Added my own flapping. :)
authorRicardo Cruz <rick2@aeiou.pt>
Sat, 30 Oct 2004 11:45:44 +0000 (11:45 +0000)
committerRicardo Cruz <rick2@aeiou.pt>
Sat, 30 Oct 2004 11:45:44 +0000 (11:45 +0000)
Made flapping to be configurable, just to get some feedback from players.
To try the different ones, type: 'marek', 'ricardo' and 'ryan' during game. Marek is default.

SVN-Revision: 2077

src/gameloop.cpp
src/player.cpp
src/player.h

index 7f26d69..15ebac5 100644 (file)
@@ -477,6 +477,22 @@ GameSession::process_events()
                           currentsector->camera->reset(Vector(tux.base.x, tux.base.y));
                           last_keys.clear();
                           }
+                        // temporary to help player's choosing a flapping
+                        if(compare_last(last_keys, "marek"))
+                          {
+                          tux.flapping_mode = Player::MAREK_FLAP;
+                          last_keys.clear();
+                          }
+                        if(compare_last(last_keys, "ricardo"))
+                          {
+                          tux.flapping_mode = Player::RICARDO_FLAP;
+                          last_keys.clear();
+                          }
+                        if(compare_last(last_keys, "ryan"))
+                          {
+                          tux.flapping_mode = Player::RYAN_FLAP;
+                          last_keys.clear();
+                          }
                   break;
 
                 case SDL_JOYAXISMOTION:
index e318ee9..7dd4111 100644 (file)
@@ -169,7 +169,13 @@ Player::init()
   butt_jump = false;
   
   flapping_velocity = 0;
-  
+
+  // temporary to help player's choosing a flapping
+  int flapping_mode = MAREK_FLAP;
+
+  // Ricardo's flapping
+  flaps_nb = 0;
+
   frame_main = 0;
   frame_ = 0;
 
@@ -571,6 +577,7 @@ Player::handle_vertical_input()
       flapping = false;
       can_jump = false;
       can_flap = false;
+      flaps_nb = 0; // Ricardo's flapping
       if (size == SMALL)
         SoundManager::get()->play_sound(IDToSound(SND_JUMP));
       else
@@ -590,7 +597,21 @@ Player::handle_vertical_input()
          }
     }
 
-   
+ // temporary to help player's choosing a flapping
+ if(flapping_mode == RICARDO_FLAP)
+   {
+   // Flapping, Ricardo's version
+   // similar to SM3 Fox
+   if(input.jump == DOWN && input.old_jump == UP && can_flap &&
+     flaps_nb < 3)
+     {
+       physic.set_velocity_y(3.5);
+       physic.set_velocity_x(physic.get_velocity_x() * 0.35);
+       flaps_nb++;
+     }
+   }
+  else if(flapping_mode == MAREK_FLAP)
+   {
    // Flapping, Marek's version
    if (input.jump == DOWN && can_flap)
      {
@@ -617,8 +638,10 @@ Player::handle_vertical_input()
                physic.set_velocity_y((float)flapping_timer.get_gone()/850);
             }
      }
-     
-   /* // Flapping, Ryan's version
+   }
+  else if(flapping_mode == RYAN_FLAP)
+   {
+   // Flapping, Ryan's version
    if (input.jump == DOWN && can_flap)
      {
          if (!flapping_timer.started())
@@ -658,7 +681,8 @@ Player::handle_vertical_input()
      {
         physic.set_acceleration_y(0);
      }
-   */
+   }
+
 
    // Hover
    //(disabled by default, use cheat code "hover" to toggle on/off)
index 002a6cd..e76b93b 100644 (file)
@@ -160,6 +160,13 @@ public:
   
   float flapping_velocity;
 
+  // Ricardo's flapping
+  int flaps_nb;
+
+  // temporary to help player's choosing a flapping
+  enum { MAREK_FLAP, RICARDO_FLAP, RYAN_FLAP, NONE_FLAP };
+  int flapping_mode;
+
   base_type  previous_base;
   Timer invincible_timer;
   Timer skidding_timer;