- memleak fix and menu fix from MatzeB
[supertux.git] / src / badguy.h
index 8ea7f2e..c7b03cc 100644 (file)
@@ -24,6 +24,7 @@
 #define SUPERTUX_BADGUY_H
 
 #include "SDL.h"
+#include "defines.h"
 #include "bitmask.h"
 #include "type.h"
 #include "timer.h"
@@ -111,6 +112,7 @@ public:
   Direction dir;
 
 private:
+  bool removable;
   bool seen;
   base_type old_base;
   Timer timer;
@@ -120,11 +122,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,7 +136,14 @@ public:
    * screen. Some badguys like the flame might ignore this.
    */
   void kill_me();
-  
+
+  /** 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);
@@ -154,13 +161,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
    */
@@ -172,8 +176,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*/