- renamed input/input_
authorIngo Ruhnke <grumbel@gmx.de>
Wed, 24 Mar 2004 22:10:29 +0000 (22:10 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Wed, 24 Mar 2004 22:10:29 +0000 (22:10 +0000)
SVN-Revision: 343

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

index 9b3384b..d5a63e0 100644 (file)
@@ -160,7 +160,7 @@ void BadGuy::action_laptop()
           base.y = tux.base.y + tux.base.height/1.5 - base.height;
         }
 
-      if(tux.input_.fire != DOWN) /* SHOOT! */
+      if(tux.input.fire != DOWN) /* SHOOT! */
         {
           if(dir == LEFT)
             base.x -= 24;
index 9dd970c..d5097b3 100644 (file)
@@ -236,32 +236,32 @@ void game_event(void)
             case JOY_X:
               if (event.jaxis.value < -JOYSTICK_DEAD_ZONE)
                 {
-                  tux.input_.left  = DOWN;
-                  tux.input_.right = UP;
+                  tux.input.left  = DOWN;
+                  tux.input.right = UP;
                 }
               else if (event.jaxis.value > JOYSTICK_DEAD_ZONE)
                 {
-                  tux.input_.left  = UP;
-                  tux.input_.right = DOWN;
+                  tux.input.left  = UP;
+                  tux.input.right = DOWN;
                 }
               else
                 {
-                  tux.input_.left  = DOWN;
-                  tux.input_.right = DOWN;
+                  tux.input.left  = DOWN;
+                  tux.input.right = DOWN;
                 }
               break;
             case JOY_Y:
               if (event.jaxis.value > JOYSTICK_DEAD_ZONE)
-                tux.input_.down = DOWN;
+                tux.input.down = DOWN;
               else if (event.jaxis.value < -JOYSTICK_DEAD_ZONE)
-                tux.input_.down = UP;
+                tux.input.down = UP;
               else
-                tux.input_.down = UP;
+                tux.input.down = UP;
 
               /* Handle joystick for the menu */
               if(show_menu)
                 {
-                  if(tux.input_.down == DOWN)
+                  if(tux.input.down == DOWN)
                     menuaction = MENU_ACTION_DOWN;
                   else
                     menuaction = MENU_ACTION_UP;
@@ -273,15 +273,15 @@ void game_event(void)
           break;
         case SDL_JOYBUTTONDOWN:
           if (event.jbutton.button == JOY_A)
-            tux.input_.up = DOWN;
+            tux.input.up = DOWN;
           else if (event.jbutton.button == JOY_B)
-            tux.input_.fire = DOWN;
+            tux.input.fire = DOWN;
           break;
         case SDL_JOYBUTTONUP:
           if (event.jbutton.button == JOY_A)
-            tux.input_.up = UP;
+            tux.input.up = UP;
           else if (event.jbutton.button == JOY_B)
-            tux.input_.fire = UP;
+            tux.input.fire = UP;
 
           if(show_menu)
             menuaction = MENU_ACTION_HIT;
@@ -625,7 +625,7 @@ int gameloop(const char * subset, int levelnb, int mode)
 
       /* Handle events: */
 
-      tux.input_.old_fire = tux.input_.fire;
+      tux.input.old_fire = tux.input.fire;
 
       game_event();
 
index 617daf8..b75a934 100644 (file)
@@ -79,7 +79,7 @@ Player::init()
   score = 0;
   distros = 0;
 
-  player_input_init(&input_);
+  player_input_init(&input);
 
   keymap.jump  = SDLK_UP;
   keymap.duck  = SDLK_DOWN;
@@ -100,27 +100,27 @@ Player::key_event(SDLKey key, int state)
 {
   if(key == keymap.right)
     {
-      input_.right = state;
+      input.right = state;
       return true;
     }
   else if(key == keymap.left)
     {
-      input_.left = state;
+      input.left = state;
       return true;
     }
   else if(key == keymap.jump)
     {
-      input_.up = state;
+      input.up = state;
       return true;
     }
   else if(key == keymap.duck)
     {
-      input_.down = state;
+      input.down = state;
       return true;
     }
   else if(key == keymap.fire)
     {
-      input_.fire = state;
+      input.fire = state;
       return true;
     }
   else
@@ -136,7 +136,7 @@ Player::level_begin()
   base.ym = 0;
   old_base = base;
 
-  player_input_init(&input_);
+  player_input_init(&input);
 
   timer_init(&invincible_timer,true);
   timer_init(&skidding_timer,true);
@@ -153,7 +153,7 @@ Player::action()
 
   /* --- HANDLE TUX! --- */
 
-  input();
+  handle_input();
 
   /* Move tux: */
 
@@ -387,7 +387,7 @@ Player::handle_horizontal_input(int newdir)
         {
           /* Facing the direction we're jumping?  Go full-speed: */
 
-          if (input_.fire == UP)
+          if (input.fire == UP)
             {
               base.xm = base.xm + ( newdir ? WALK_SPEED : -WALK_SPEED) * frame_ratio;
 
@@ -402,7 +402,7 @@ Player::handle_horizontal_input(int newdir)
                     base.xm = -MAX_WALK_XM;
                 }
             }
-          else if ( input_.fire == DOWN)
+          else if ( input.fire == DOWN)
             {
               base.xm = base.xm + ( newdir ? RUN_SPEED : -RUN_SPEED) * frame_ratio;
 
@@ -443,7 +443,7 @@ Player::handle_horizontal_input(int newdir)
 void
 Player::handle_vertical_input()
 {
-  if(input_.up == DOWN)
+  if(input.up == DOWN)
     {
       if (on_ground())
         {
@@ -460,7 +460,7 @@ Player::handle_vertical_input()
             }
         }
     }
-  else if(input_.up == UP && jumping)
+  else if(input.up == UP && jumping)
     {
       if (on_ground())
         {
@@ -490,17 +490,16 @@ Player::handle_vertical_input()
 }
 
 void
-Player::input()
+Player::handle_input()
 {
   /* Handle key and joystick state: */
-
   if(duck == false)
     {
-      if (input_.right == DOWN && input_.left == UP)
+      if (input.right == DOWN && input.left == UP)
         {
           handle_horizontal_input(RIGHT);
         }
-      else if (input_.left == DOWN && input_.right == UP)
+      else if (input.left == DOWN && input.right == UP)
         {
           handle_horizontal_input(LEFT);
         }
@@ -523,14 +522,14 @@ Player::input()
 
   /* Jump/jumping? */
 
-  if ( input_.up == DOWN || (input_.up == UP && jumping))
+  if ( input.up == DOWN || (input.up == UP && jumping))
     {
       handle_vertical_input();
     }
 
   /* Shoot! */
 
-  if (input_.fire == DOWN && input_.old_fire == UP && got_coffee)
+  if (input.fire == DOWN && input.old_fire == UP && got_coffee)
     {
       add_bullet(base.x, base.y, base.xm, dir);
     }
@@ -538,7 +537,7 @@ Player::input()
 
   /* Duck! */
 
-  if (input_.down == DOWN)
+  if (input.down == DOWN)
     {
       if (size == BIG && duck != true)
         {
@@ -579,14 +578,14 @@ Player::input()
   if(!timer_check(&frame_timer))
     {
       timer_start(&frame_timer,25);
-      if (input_.right == UP && input_.left == UP)
+      if (input.right == UP && input.left == UP)
         {
           frame_main = 1;
           frame_ = 1;
         }
       else
         {
-          if ((input_.fire == DOWN && (global_frame_counter % 2) == 0) ||
+          if ((input.fire == DOWN && (global_frame_counter % 2) == 0) ||
               (global_frame_counter % 4) == 0)
             frame_main = (frame_main + 1) % 4;
 
@@ -835,7 +834,7 @@ Player::collision(void* p_c_object, int c_object)
           !timer_started(&safe_timer) &&
           pbad_c->mode != HELD)
         {
-          if (pbad_c->mode == FLAT  && input_.fire != DOWN)
+          if (pbad_c->mode == FLAT  && input.fire != DOWN)
             {
               /* Kick: */
 
@@ -855,7 +854,7 @@ Player::collision(void* p_c_object, int c_object)
 
               timer_start(&pbad_c->timer,5000);
             }
-          else if (pbad_c->mode == FLAT && input_.fire == DOWN)
+          else if (pbad_c->mode == FLAT && input.fire == DOWN)
             {
               pbad_c->mode = HELD;
               pbad_c->base.y-=8;
index 0b47410..51592f1 100644 (file)
@@ -87,7 +87,7 @@ extern texture_type bigcape_left[2];
 class Player
 {
  public:
-  player_input_type  input_;
+  player_input_type  input;
   player_keymap_type keymap;
   int score;
   int distros;
@@ -115,7 +115,7 @@ class Player
   int  key_event(SDLKey key, int state);
   void level_begin();
   void action();
-  void input();
+  void handle_input();
   void grabdistros();
   void draw();
   void collision(void* p_c_object, int c_object);