- added new smalltux
authorIngo Ruhnke <grumbel@gmx.de>
Fri, 9 Apr 2004 02:20:51 +0000 (02:20 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Fri, 9 Apr 2004 02:20:51 +0000 (02:20 +0000)
SVN-Revision: 438

data/images/shared/smalltux-jump-left.png [new file with mode: 0644]
data/images/shared/smalltux-jump-right.png [new file with mode: 0644]
src/gameloop.cpp
src/menu.cpp
src/player.cpp
src/player.h

diff --git a/data/images/shared/smalltux-jump-left.png b/data/images/shared/smalltux-jump-left.png
new file mode 100644 (file)
index 0000000..209ea17
Binary files /dev/null and b/data/images/shared/smalltux-jump-left.png differ
diff --git a/data/images/shared/smalltux-jump-right.png b/data/images/shared/smalltux-jump-right.png
new file mode 100644 (file)
index 0000000..3ff316e
Binary files /dev/null and b/data/images/shared/smalltux-jump-right.png differ
index 6718c13..b4b4c81 100644 (file)
@@ -822,13 +822,31 @@ void loadshared(void)
   int i;
 
   /* Tuxes: */
-  texture_load(&tux_right[0], datadir + "/images/shared/tux-right-0.png", USE_ALPHA);
-  texture_load(&tux_right[1], datadir + "/images/shared/tux-right-1.png", USE_ALPHA);
-  texture_load(&tux_right[2], datadir + "/images/shared/tux-right-2.png", USE_ALPHA);
-
-  texture_load(&tux_left[0], datadir + "/images/shared/tux-left-0.png", USE_ALPHA);
-  texture_load(&tux_left[1], datadir + "/images/shared/tux-left-1.png", USE_ALPHA);
-  texture_load(&tux_left[2], datadir + "/images/shared/tux-left-2.png", USE_ALPHA);
+  texture_load(&smalltux_stand_left, datadir + "/images/shared/smalltux-left-6.png", USE_ALPHA);
+  texture_load(&smalltux_stand_right, datadir + "/images/shared/smalltux-right-6.png", USE_ALPHA);
+
+  texture_load(&smalltux_jump_left, datadir + "/images/shared/smalltux-jump-left.png", USE_ALPHA);
+  texture_load(&smalltux_jump_right, datadir + "/images/shared/smalltux-jump-right.png", USE_ALPHA);
+
+  tux_right.resize(8);
+  texture_load(&tux_right[0], datadir + "/images/shared/smalltux-right-1.png", USE_ALPHA);
+  texture_load(&tux_right[1], datadir + "/images/shared/smalltux-right-2.png", USE_ALPHA);
+  texture_load(&tux_right[2], datadir + "/images/shared/smalltux-right-3.png", USE_ALPHA);
+  texture_load(&tux_right[3], datadir + "/images/shared/smalltux-right-4.png", USE_ALPHA);
+  texture_load(&tux_right[4], datadir + "/images/shared/smalltux-right-5.png", USE_ALPHA);
+  texture_load(&tux_right[5], datadir + "/images/shared/smalltux-right-6.png", USE_ALPHA);
+  texture_load(&tux_right[6], datadir + "/images/shared/smalltux-right-7.png", USE_ALPHA);
+  texture_load(&tux_right[7], datadir + "/images/shared/smalltux-right-8.png", USE_ALPHA);
+
+  tux_left.resize(8);
+  texture_load(&tux_left[0], datadir + "/images/shared/smalltux-left-1.png", USE_ALPHA);
+  texture_load(&tux_left[1], datadir + "/images/shared/smalltux-left-2.png", USE_ALPHA);
+  texture_load(&tux_left[2], datadir + "/images/shared/smalltux-left-3.png", USE_ALPHA);
+  texture_load(&tux_left[3], datadir + "/images/shared/smalltux-left-4.png", USE_ALPHA);
+  texture_load(&tux_left[4], datadir + "/images/shared/smalltux-left-5.png", USE_ALPHA);
+  texture_load(&tux_left[5], datadir + "/images/shared/smalltux-left-6.png", USE_ALPHA);
+  texture_load(&tux_left[6], datadir + "/images/shared/smalltux-left-7.png", USE_ALPHA);
+  texture_load(&tux_left[7], datadir + "/images/shared/smalltux-left-8.png", USE_ALPHA);
 
   texture_load(&firetux_right[0], datadir + "/images/shared/firetux-right-0.png", USE_ALPHA);
   texture_load(&firetux_right[1], datadir + "/images/shared/firetux-right-1.png", USE_ALPHA);
index 35f602d..893962d 100644 (file)
@@ -31,7 +31,7 @@
 #include "high_scores.h"
 
 /* (global) menu variables */
-MenuAction menuaction;
+MenuAction menuaction = MENU_ACTION_NONE;
 bool show_menu;
 bool menu_change;
 texture_type checkbox, checkbox_checked, back, arrow_left, arrow_right;
@@ -192,6 +192,7 @@ Menu::action()
                 item[active_item].list->active_item = item[active_item].list->num_items-1;
             }
           break;
+
         case MENU_ACTION_RIGHT:
           if(item[active_item].kind == MN_STRINGSELECT
               && item[active_item].list->num_items != 0)
index f23dc6b..6052cc4 100644 (file)
 #include "screen.h"
 
 texture_type tux_life;
-texture_type tux_right[3];
-texture_type tux_left[3];
+std::vector<texture_type> tux_right;
+std::vector<texture_type> tux_left;
+texture_type smalltux_jump_left;
+texture_type smalltux_jump_right;
+texture_type smalltux_stand_left;
+texture_type smalltux_stand_right;
+
 texture_type bigtux_right[3];
 texture_type bigtux_left[3];
 texture_type bigtux_right_jump;
@@ -597,13 +602,31 @@ Player::draw()
 
           if (!got_coffee)
             {
-              if (dir == RIGHT)
+              if (physic.get_velocity_y() > 0)
                 {
-                  texture_draw(&tux_right[frame_], base.x- scroll_x, base.y);
+                  if (dir == RIGHT)
+                    texture_draw(&smalltux_jump_right, base.x - scroll_x, base.y - 10);
+                  else
+                    texture_draw(&smalltux_jump_left, base.x - scroll_x, base.y - 10);                   
                 }
               else
                 {
-                  texture_draw(&tux_left[frame_], base.x- scroll_x, base.y);
+                  if (fabsf(physic.get_velocity_x()) < 1.0f) // standing
+                    {
+                      if (dir == RIGHT)
+                        texture_draw(&smalltux_stand_right, base.x - scroll_x, base.y - 9);
+                      else
+                        texture_draw(&smalltux_stand_left, base.x - scroll_x, base.y - 9);
+                    }
+                  else // moving
+                    {
+                      if (dir == RIGHT)
+                        texture_draw(&tux_right[(global_frame_counter/2) % tux_right.size()], 
+                                     base.x - scroll_x, base.y - 9);
+                      else
+                        texture_draw(&tux_left[(global_frame_counter/2) % tux_left.size()], 
+                                     base.x - scroll_x, base.y - 9);
+                    }
                 }
             }
           else
index 7f481b9..89f9a92 100644 (file)
@@ -37,6 +37,8 @@
 #define SCORE_BRICK 5
 #define SCORE_DISTRO 25
 
+#include <vector>
+
 struct player_keymap_type
 {
   int jump;
@@ -59,8 +61,12 @@ struct player_input_type
 void player_input_init(player_input_type* pplayer_input);
 
 extern texture_type tux_life;
-extern texture_type tux_right[3];
-extern texture_type tux_left[3];
+extern std::vector<texture_type> tux_right;
+extern std::vector<texture_type> tux_left;
+extern texture_type smalltux_jump_left;
+extern texture_type smalltux_jump_right;
+extern texture_type smalltux_stand_left;
+extern texture_type smalltux_stand_right;
 extern texture_type bigtux_right[3];
 extern texture_type bigtux_left[3];
 extern texture_type bigtux_right_jump;