3d55f4e43be20466c6fcf30b876f345235f0a4b7
[supertux.git] / src / badguy / yeti.hpp
1 //  $Id$
2 //
3 //  SuperTux - Boss "Yeti"
4 //  Copyright (C) 2005 Matthias Braun <matze@braunis.de>
5 //  Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
6 //
7 //  This program is free software; you can redistribute it and/or
8 //  modify it under the terms of the GNU General Public License
9 //  as published by the Free Software Foundation; either version 2
10 //  of the License, or (at your option) any later version.
11 //
12 //  This program is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 //  GNU General Public License for more details.
16 //
17 //  You should have received a copy of the GNU General Public License
18 //  along with this program; if not, write to the Free Software
19 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
21 #ifndef __YETI_H__
22 #define __YETI_H__
23
24 #include "badguy.hpp"
25
26 #include <memory>
27
28 class Yeti : public BadGuy
29 {
30 public:
31   Yeti(const lisp::Lisp& lisp);
32   ~Yeti();
33
34   void draw(DrawingContext& context);
35   void write(lisp::Writer& writer);
36   void initialize();
37   void active_update(float elapsed_time);
38   void collision_solid(const CollisionHit& hit);
39   bool collision_squished(GameObject& object);
40   void kill_squished(GameObject& object);
41   void kill_fall();
42
43   virtual Yeti* clone() const { return new Yeti((Yeti&)*this); }
44
45 private:
46   void run();
47   void jump_up();
48   void be_angry();
49   void drop_stalactite();
50   void summon_snowball();
51   void jump_down();
52
53   void draw_hit_points(DrawingContext& context);
54
55   void take_hit(Player& player);
56
57   enum YetiState {
58     JUMP_DOWN,
59     RUN,
60     JUMP_UP,
61     BE_ANGRY,
62     SQUISHED
63   };
64   YetiState state;
65   Timer state_timer;
66   Timer safe_timer;
67   int stomp_count;
68   int hit_points;
69   std::auto_ptr<Surface> hud_head;
70 };
71
72 #endif