From: Ingo Ruhnke Date: Fri, 9 Apr 2004 02:20:51 +0000 (+0000) Subject: - added new smalltux X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=ae7e8f04e6a19855f6f89233bbd36bf0855ccc03;p=supertux.git - added new smalltux SVN-Revision: 438 --- diff --git a/data/images/shared/smalltux-jump-left.png b/data/images/shared/smalltux-jump-left.png new file mode 100644 index 000000000..209ea173d 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 index 000000000..3ff316e05 Binary files /dev/null and b/data/images/shared/smalltux-jump-right.png differ diff --git a/src/gameloop.cpp b/src/gameloop.cpp index 6718c1348..b4b4c8170 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -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); diff --git a/src/menu.cpp b/src/menu.cpp index 35f602d2c..893962d94 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -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) diff --git a/src/player.cpp b/src/player.cpp index f23dc6be8..6052cc4c9 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -20,8 +20,13 @@ #include "screen.h" texture_type tux_life; -texture_type tux_right[3]; -texture_type tux_left[3]; +std::vector tux_right; +std::vector 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 diff --git a/src/player.h b/src/player.h index 7f481b9d7..89f9a92e6 100644 --- a/src/player.h +++ b/src/player.h @@ -37,6 +37,8 @@ #define SCORE_BRICK 5 #define SCORE_DISTRO 25 +#include + 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 tux_right; +extern std::vector 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;