applied flame badguy patch from Matze Braun
[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 /* Enemy modes: */
25 enum {
26     NORMAL=0,
27     FLAT,
28     KICK,
29     HELD,
30
31     BOMB_TICKING,
32     BOMB_EXPLODE,
33
34     STALACTITE_SHAKING,
35     STALACTITE_FALL
36 };
37
38 extern texture_type img_bsod_squished_left;
39 extern texture_type img_bsod_squished_right;
40 extern texture_type img_bsod_falling_left;
41 extern texture_type img_bsod_falling_right;
42 extern texture_type img_laptop_flat_left;
43 extern texture_type img_laptop_flat_right;
44 extern texture_type img_laptop_falling_left;
45 extern texture_type img_laptop_falling_right;
46 extern texture_type img_bsod_left[4];
47 extern texture_type img_bsod_right[4];
48 extern texture_type img_laptop_left[3];
49 extern texture_type img_laptop_right[3];
50 extern texture_type img_money_left[2];
51 extern texture_type img_money_right[2];
52 extern texture_type img_mrbomb_left[4];
53 extern texture_type img_mrbomb_right[4];
54 extern texture_type img_stalactite;
55 extern texture_type img_stalactite_broken;
56 extern texture_type img_flame[2];
57
58 /* Bad guy kinds: */
59 enum BadGuyKind {
60   BAD_BSOD,
61   BAD_LAPTOP,
62   BAD_MONEY,
63   BAD_MRBOMB,
64   BAD_BOMB,
65   BAD_STALACTITE,
66   BAD_FLAME
67 };
68
69 BadGuyKind  badguykind_from_string(const std::string& str);
70 std::string badguykind_to_string(BadGuyKind kind);
71 void load_badguy_gfx();
72 void free_badguy_gfx();
73
74 struct BadGuyData
75 {
76   BadGuyKind kind;
77   int x;
78   int y;
79
80   BadGuyData(BadGuyKind kind_, int x_, int y_) 
81     : kind(kind_), x(x_), y(y_) {}
82
83   BadGuyData()
84     : kind(BAD_BSOD), x(0), y(0) {}
85 };
86
87 class Player;
88
89 /* Badguy type: */
90 class BadGuy
91 {
92  public:
93   int mode;
94   DyingType dying;
95   BadGuyKind kind;
96   bool seen;
97   int dir;
98   base_type base;
99   base_type old_base;
100   timer_type timer;
101   physic_type physic;
102
103  public:
104   void init(float x, float y, BadGuyKind kind);
105
106   void action();
107   void draw();
108
109   void collision(void* p_c_object, int c_object,
110           CollisionType type = COLLISION_NORMAL);
111   
112  private:
113   void fall(bool dojump=false);
114   void remove_me();
115
116   void action_bsod();
117   void draw_bsod();
118
119   void action_laptop();
120   void draw_laptop();
121    
122   void action_money(); 
123   void draw_money();
124
125   void action_bomb();
126   void draw_bomb();
127
128   void action_mrbomb();
129   void draw_mrbomb();
130
131   void action_stalactite();
132   void draw_stalactite();
133
134   void action_flame();
135   void draw_flame();
136
137   void make_player_jump(Player* player);
138   void check_horizontal_bump(bool checkcliff = false);
139   void bump();
140   void squich(Player* player);
141 };
142
143 #endif /*SUPERTUX_BADGUY_H*/
144
145