- introduced new function wait_for_event
[supertux.git] / src / badguy.h
1 //
2 // Interface: badguy
3 //
4 // Description:
5 //
6 //
7 // Author: Tobias Glaesser <tobi.web@gmx.de> (C) 2003
8 //
9 // Copyright: See COPYING file that comes with this distribution
10 //
11 //
12
13 #ifndef SUPERTUX_BADGUY_H
14 #define SUPERTUX_BADGUY_H
15
16 #include "SDL.h"
17 #include "bitmask.h"
18 #include "type.h"
19 #include "timer.h"
20 #include "texture.h"
21 #include "physic.h"
22 #include "collision.h"
23
24 extern texture_type img_bsod_left[4];
25 extern texture_type img_bsod_right[4];
26 extern texture_type img_laptop_left[3];
27 extern texture_type img_money_left[2];
28
29 /* Enemy modes: */
30 enum {
31     NORMAL=0,
32     FLAT,
33     KICK,
34     HELD,
35
36     MONEY_JUMP,
37
38     BOMB_TICKING,
39     BOMB_EXPLODE,
40
41     STALACTITE_SHAKING,
42     STALACTITE_FALL
43 };
44
45 /* Bad guy kinds: */
46 enum BadGuyKind {
47   BAD_BSOD,
48   BAD_LAPTOP,
49   BAD_MONEY,
50   BAD_MRBOMB,
51   BAD_BOMB,
52   BAD_STALACTITE,
53   BAD_FLAME
54 };
55
56 BadGuyKind  badguykind_from_string(const std::string& str);
57 std::string badguykind_to_string(BadGuyKind kind);
58 void load_badguy_gfx();
59 void free_badguy_gfx();
60
61 struct BadGuyData
62 {
63   BadGuyKind kind;
64   int x;
65   int y;
66
67   BadGuyData(BadGuyKind kind_, int x_, int y_) 
68     : kind(kind_), x(x_), y(y_) {}
69
70   BadGuyData()
71     : kind(BAD_BSOD), x(0), y(0) {}
72 };
73
74 class Player;
75
76 /* Badguy type: */
77 class BadGuy
78 {
79  public:
80   int mode;
81   DyingType dying;
82   BadGuyKind kind;
83   bool seen;
84   int dir;
85   base_type base;
86   base_type old_base;
87   timer_type timer;
88   physic_type physic;
89
90  public:
91   void init(float x, float y, BadGuyKind kind);
92
93   void action();
94   void draw();
95
96   void collision(void* p_c_object, int c_object,
97           CollisionType type = COLLISION_NORMAL);
98   
99  private:
100   void fall(bool dojump=false);
101   void remove_me();
102
103   void action_bsod();
104   void draw_bsod();
105
106   void action_laptop();
107   void draw_laptop();
108    
109   void action_money(); 
110   void draw_money();
111
112   void action_bomb();
113   void draw_bomb();
114
115   void action_mrbomb();
116   void draw_mrbomb();
117
118   void action_stalactite();
119   void draw_stalactite();
120
121   void action_flame();
122   void draw_flame();
123
124   void make_player_jump(Player* player);
125   void check_horizontal_bump(bool checkcliff = false);
126   void bump();
127   void squich(Player* player);
128 };
129
130 #endif /*SUPERTUX_BADGUY_H*/
131
132