- made shrink behaviour more mariobros3 like, ie. firetux will go to largetux to...
authorIngo Ruhnke <grumbel@gmx.de>
Thu, 22 Apr 2004 20:14:49 +0000 (20:14 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Thu, 22 Apr 2004 20:14:49 +0000 (20:14 +0000)
SVN-Revision: 651

src/defines.h
src/gameloop.cpp
src/player.cpp
src/player.h
src/special.cpp

index aec1e3b..e2cb949 100644 (file)
@@ -48,11 +48,6 @@ enum DyingType {
   DYING_FALLING = 2
 };
 
-/* Hurt modes: */
-
-#define KILL 0
-#define SHRINK 1
-
 /* Sizes: */
 
 #define SMALL 0
index b43a0a9..dd6da60 100644 (file)
@@ -555,7 +555,7 @@ GameSession::run()
 
       /* Handle time: */
       if (!time_left.check() && world->get_tux()->dying == DYING_NOT)
-        world->get_tux()->kill(KILL);
+        world->get_tux()->kill(Player::KILL);
 
       /* Handle music: */
       if(world->get_tux()->invincible_timer.check())
index 7a387a2..031fe04 100644 (file)
@@ -527,55 +527,39 @@ Player::draw()
                     cape_left[global_frame_counter % 2]->draw(base.x- scroll_x, base.y);
                 }
 
-              if (!got_coffee)
+              if (!skidding_timer.started())
                 {
-                  if (!skidding_timer.started())
+                  if (physic.get_velocity_y() != 0)
                     {
-                      if (physic.get_velocity_y() != 0)
+                      if (dir == RIGHT)
+                        smalltux_jump_right->draw( base.x - scroll_x, base.y - 10);
+                      else
+                        smalltux_jump_left->draw( base.x - scroll_x, base.y - 10);                   
+                    }
+                  else
+                    {
+                      if (fabsf(physic.get_velocity_x()) < 1.0f) // standing
                         {
                           if (dir == RIGHT)
-                            smalltux_jump_right->draw( base.x - scroll_x, base.y - 10);
+                            smalltux_stand_right->draw( base.x - scroll_x, base.y - 9);
                           else
-                            smalltux_jump_left->draw( base.x - scroll_x, base.y - 10);                   
+                            smalltux_stand_left->draw( base.x - scroll_x, base.y - 9);
                         }
-                      else
+                      else // moving
                         {
-                          if (fabsf(physic.get_velocity_x()) < 1.0f) // standing
-                            {
-                              if (dir == RIGHT)
-                                smalltux_stand_right->draw( base.x - scroll_x, base.y - 9);
-                              else
-                                smalltux_stand_left->draw( base.x - scroll_x, base.y - 9);
-                            }
-                          else // moving
-                            {
-                              if (dir == RIGHT)
-                                tux_right[(global_frame_counter/2) % tux_right.size()]->draw(base.x - scroll_x, base.y - 9);
-                              else
-                                tux_left[(global_frame_counter/2) % tux_left.size()]->draw(base.x - scroll_x, base.y - 9);
-                            }
+                          if (dir == RIGHT)
+                            tux_right[(global_frame_counter/2) % tux_right.size()]->draw(base.x - scroll_x, base.y - 9);
+                          else
+                            tux_left[(global_frame_counter/2) % tux_left.size()]->draw(base.x - scroll_x, base.y - 9);
                         }
                     }
-                  else
-                    {
-                      if (dir == RIGHT)
-                        smalltux_skid_right->draw(base.x - scroll_x, base.y);
-                      else
-                        smalltux_skid_left->draw(base.x - scroll_x, base.y); 
-                    }
                 }
               else
                 {
-                  /* Tux got coffee! */
-
                   if (dir == RIGHT)
-                    {
-                      firetux_right[frame_]->draw( base.x- scroll_x, base.y);
-                    }
+                    smalltux_skid_right->draw(base.x - scroll_x, base.y);
                   else
-                    {
-                      firetux_left[frame_]->draw( base.x- scroll_x, base.y);
-                    }
+                    smalltux_skid_left->draw(base.x - scroll_x, base.y); 
                 }
             }
           else // Large Tux
@@ -749,7 +733,7 @@ Player::collision(void* p_c_object, int c_object)
 /* Kill Player! */
 
 void
-Player::kill(int mode)
+Player::kill(HurtMode mode)
 {
   play_sound(sounds[SND_HURT], SOUND_CENTER_SPEAKER);
 
@@ -758,12 +742,15 @@ Player::kill(int mode)
   if (mode == SHRINK && size == BIG)
     {
       if (got_coffee)
-        got_coffee = false;
-
-      size = SMALL;
-      base.height = 32;
-      duck = false;
-
+        {
+          got_coffee = false;
+        }
+      else
+        {
+          size = SMALL;
+          base.height = 32;
+          duck = false;
+        }
       safe_timer.start(TUX_SAFE_TIME);
     }
   else
index db73d8e..2a055bb 100644 (file)
@@ -112,6 +112,8 @@ extern Surface* bigcape_left[2];
 class Player
 {
 public:
+  enum HurtMode { KILL, SHRINK };
+
   player_input_type  input;
   bool got_coffee;
   int size;
@@ -142,7 +144,7 @@ public:
   void grabdistros();
   void draw();
   void collision(void* p_c_object, int c_object);
-  void kill(int mode);
+  void kill(HurtMode mode);
   void is_dying();
   bool is_dead();
   void player_remove_powerups();
index 33878cf..ee7dacc 100644 (file)
@@ -306,6 +306,15 @@ Upgrade::collision(void* p_c_object, int c_object)
         {
           play_sound(sounds[SND_COFFEE], SOUND_CENTER_SPEAKER);
           pplayer->got_coffee = true;
+          pplayer->size = BIG;
+          pplayer->base.height = 64;
+         pplayer->base.y -= 32;
+         if(collision_object_map(pplayer->base))
+            {
+              pplayer->base.height = 32;
+              pplayer->base.y += 32;
+              pplayer->duck = true;
+            }
         }
       else if (kind == UPGRADE_HERRING)
         {