<MatzeB> my patch fixes another leak in the levelsubset code and cleans that up a...
[supertux.git] / src / badguy.h
index aba346a..1511e6b 100644 (file)
 #include "collision.h"
 #include "sprite.h"
 
-extern Sprite* img_bsod_left;
-extern Sprite* img_bsod_right;
-extern Sprite* img_laptop_left;
-
 /* Bad guy kinds: */
 enum BadGuyKind {
-  BAD_BSOD,
-  BAD_LAPTOP,
-  BAD_MONEY,
+  BAD_MRICEBLOCK,
+  BAD_JUMPY,
   BAD_MRBOMB,
   BAD_BOMB,
   BAD_STALACTITE,
@@ -69,7 +64,7 @@ struct BadGuyData
     : kind(kind_), x(x_), y(y_), stay_on_platform(stay_on_platform_) {}
 
   BadGuyData()
-    : kind(BAD_BSOD), x(0), y(0), stay_on_platform(false) {}
+    : kind(BAD_SNOWBALL), x(0), y(0), stay_on_platform(false) {}
 };
 
 class Player;
@@ -85,7 +80,7 @@ public:
     KICK,
     HELD,
 
-    MONEY_JUMP,
+    JUMPY_JUMP,
 
     BOMB_TICKING,
     BOMB_EXPLODE,
@@ -112,7 +107,9 @@ public:
   Direction dir;
 
 private:
+  bool removable;
   bool seen;
+  int squishcount; /// number of times this enemy was squiched
   base_type old_base;
   Timer timer;
   Physic physic;
@@ -121,11 +118,9 @@ private:
   Sprite*   sprite_right;
 
   int animation_offset;
-  size_t animation_length;
-  float animation_speed;
 
 public:
-  void init(float x, float y, BadGuyKind kind, bool stay_on_platform);
+  BadGuy(float x, float y, BadGuyKind kind, bool stay_on_platform);
 
   void action(float frame_ratio);
   void draw();
@@ -136,12 +131,18 @@ public:
   /** this functions tries to kill the badguy and lets him fall off the
    * screen. Some badguys like the flame might ignore this.
    */
-  void kill_me();
-  
+  void kill_me(int score);
+
+  /** remove ourself from the list of badguys. WARNING! This function will
+   * invalidate all members. So don't do anything else with member after calling
+   * this.
+   */
+  void remove_me();  
+  bool is_removable() const { return removable; }
 private:
-  void action_bsod(float frame_ratio);
-  void action_laptop(float frame_ratio);
-  void action_money(float frame_ratio); 
+  void action_mriceblock(float frame_ratio);
+  void action_jumpy(float frame_ratio); 
   void action_bomb(float frame_ratio);
   void action_mrbomb(float frame_ratio);
   void action_stalactite(float frame_ratio);
@@ -155,13 +156,10 @@ private:
   /** handles falling down. disables gravity calculation when we're back on
    * ground */
   void fall();
-  /** remove ourself from the list of badguys. WARNING! This function will
-   * invalidate all members. So don't do anything else with member after calling
-   * this.
-   */
-  void remove_me();  
+
   /** let the player jump a bit (used when you hit a badguy) */
   void make_player_jump(Player* player);
+
   /** check if we're running left or right in a wall and eventually change
    * direction
    */
@@ -173,8 +171,7 @@ private:
   /** squish ourself, give player score and set dying to DYING_SQICHED */
   void squish_me(Player* player);
   /** set image of the badguy */
-  void set_sprite(Sprite* left, Sprite* right,
-                  int animlength = 1, float animspeed = 1);
+  void set_sprite(Sprite* left, Sprite* right);
 };
 
 #endif /*SUPERTUX_BADGUY_H*/