* Added a boolean "disable-physics" property to powerups. We can't afford losing...
[supertux.git] / src / object / player.hpp
index 451ed05..1ec6397 100644 (file)
@@ -29,6 +29,7 @@
 #include "sprite/sprite.hpp"
 #include "physic.hpp"
 #include "control/controller.hpp"
+#include "scripting/player.hpp"
 #include "player_status.hpp"
 
 class BadGuy;
@@ -38,9 +39,6 @@ class Portable;
 static const float TUX_SAFE_TIME = 1.8;
 static const float TUX_INVINCIBLE_TIME = 10.0;
 static const float TUX_INVINCIBLE_TIME_WARNING = 2.0;
-static const float TUX_FLAPPING_TIME = 1; /* How long Tux can flap his wings to gain additional jump height */
-static const float TUX_FLAPPING_STRENGTH = 100; /* How much Y velocity Tux gains when flapping */
-static const float TUX_FLAPPING_LEAST_X = 30; /* How much X velocity Tux gains when flapping from vertical jump */
 static const float GROWING_TIME = 1.0;
 static const int GROWING_FRAMES = 7;
 
@@ -78,7 +76,7 @@ extern TuxBodyParts* big_tux;
 extern TuxBodyParts* fire_tux;
 extern TuxBodyParts* ice_tux;
 
-class Player : public MovingObject
+class Player : public MovingObject, public Scripting::Player
 {
 public:
   enum HurtMode { KILL, SHRINK };
@@ -91,6 +89,8 @@ public:
 
 private:
   bool dying;
+  bool backflipping;
+  int  backflip_direction;
 public:
 
   Direction dir;
@@ -101,23 +101,9 @@ public:
 
   bool on_ground_flag;
   bool jumping;
-  bool flapping;
   bool can_jump;
-  bool can_flap;
-  bool falling_from_flap;
-  bool enable_hover;
   bool butt_jump;
   
-  float flapping_velocity;
-
-  // Ricardo's flapping
-  int flaps_nb;
-
-  // temporary to help player's choosing a flapping
-  // TODO: remove this after agreeing on flapstyle!
-  enum { MAREK_FLAP, RICARDO_FLAP, RYAN_FLAP, NO_FLAP };
-  int flapping_mode;
-
   Timer invincible_timer;
   Timer skidding_timer;
   Timer safe_timer;
@@ -126,7 +112,7 @@ public:
   Timer dying_timer;
   Timer growing_timer;
   Timer idle_timer;
-  Timer flapping_timer;
+  Timer backflip_timer;
   Physic physic;
   
 public:
@@ -167,12 +153,17 @@ public:
 private:
   void handle_input();
   bool on_ground();
+  bool deactivated;
   
   void init();
   
   void handle_horizontal_input();
   void handle_vertical_input();
 
+  void activate();
+  void deactivate();
+  void walk(float speed);
+
   Portable* grabbed_object;
 
   Sprite* smalltux_gameover;