From: Ingo Ruhnke Date: Sat, 24 Apr 2004 12:11:11 +0000 (+0000) Subject: - fixed bug in Menu::check() X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=bd7ba9109959cd12e5558af05ed51be1a06272c3;p=supertux.git - fixed bug in Menu::check() - added grab/kick tux to resources - added flag to use endsequence or not SVN-Revision: 678 --- diff --git a/src/level.cpp b/src/level.cpp index bbd09158a..19ecc4980 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -241,6 +241,7 @@ Level::init_defaults() bkgd_bottom.green = 255; bkgd_bottom.blue = 255; endpos = 0; + use_endsequence = false; for(int i = 0; i < 15; ++i) { @@ -305,6 +306,7 @@ Level::load(const std::string& filename) { LispReader reader(lisp_cdr(root_obj)); reader.read_int("version", &version); + reader.read_bool("use-endsequence", &use_endsequence); reader.read_int("width", &width); if (!reader.read_int("start_pos_x", &start_pos_x)) start_pos_x = 100; if (!reader.read_int("start_pos_y", &start_pos_y)) start_pos_y = 170; @@ -493,7 +495,10 @@ Level::load(const std::string& filename) // Mark the end position of this level! // FIXME: -10 is a rather random value, we still need some kind of // real levelend gola - endpos = 32*(width-20); + if (use_endsequence) + endpos = 32*(width-20); + else + endpos = 32*(width-15); fclose(fi); return 0; diff --git a/src/level.h b/src/level.h index 9be4fd9af..6dcebc56f 100644 --- a/src/level.h +++ b/src/level.h @@ -87,6 +87,7 @@ class Level int start_pos_x; int start_pos_y; int endpos; + bool use_endsequence; float gravity; std::vector badguy_data; diff --git a/src/menu.cpp b/src/menu.cpp index 1a76b18a9..9eec207b3 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -223,7 +223,6 @@ Menu::Menu() pos_x = screen->w/2; pos_y = screen->h/2; has_backitem = false; - last_id = 0; arrange_left = 0; active_item = 0; effect.init(false); @@ -241,12 +240,9 @@ Menu::additem(MenuItemKind kind_, const std::string& text_, int toggle_, Menu* m if(kind_ == MN_BACK) has_backitem = true; - if(id == -1 && item.size() == (unsigned)last_id) - { - id = last_id; - last_id++; - } - + if(id == -1) + id = int(item.size()); + additem(MenuItem::create(kind_, text_.c_str(), toggle_, menu_, id, int_p)); } @@ -404,30 +400,10 @@ Menu::action() int Menu::check() { - return item[hit_item].id; - /* - if (item.size() != 0) - { - if((item[active_item].kind == MN_ACTION - || item[active_item].kind == MN_TEXTFIELD - || item[active_item].kind == MN_NUMFIELD) - && item[active_item].toggled) - { - item[active_item].toggled = false; - Menu::set_current(0); - return active_item; - } - else if(item[active_item].kind == MN_TOGGLE - || item[active_item].kind == MN_GOTO) - { - return active_item; - } - else - return -1; - } + if (hit_item != -1) + return item[hit_item].id; else return -1; - */ } void diff --git a/src/menu.h b/src/menu.h index 280a459c6..cd2023be8 100644 --- a/src/menu.h +++ b/src/menu.h @@ -138,7 +138,6 @@ private: int pos_x; int pos_y; bool has_backitem; - int last_id; /** input event for the menu (up, down, left, right, etc.) */ MenuAction menuaction; diff --git a/src/player.cpp b/src/player.cpp index 031fe0470..389c6b334 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -38,6 +38,17 @@ Surface* smalltux_stand_right; Sprite* smalltux_gameover; Sprite* smalltux_skid_left; Sprite* smalltux_skid_right; + +Sprite* smalltux_kick_left; +Sprite* smalltux_kick_right; +Sprite* smalltux_grab_left; +Sprite* smalltux_grab_right; + +Sprite* largetux_kick_left; +Sprite* largetux_kick_right; +Sprite* largetux_grab_left; +Sprite* largetux_grab_right; + Sprite* largetux_stand_left; Sprite* largetux_stand_right; diff --git a/src/player.h b/src/player.h index 2a055bb74..0dcca5fda 100644 --- a/src/player.h +++ b/src/player.h @@ -86,6 +86,17 @@ extern Sprite* smalltux_skid_right; extern Sprite* smalltux_gameover; extern Sprite* largetux_stand_left; extern Sprite* largetux_stand_right; + +extern Sprite* smalltux_kick_left; +extern Sprite* smalltux_kick_right; +extern Sprite* smalltux_grab_left; +extern Sprite* smalltux_grab_right; + +extern Sprite* largetux_kick_left; +extern Sprite* largetux_kick_right; +extern Sprite* largetux_grab_left; +extern Sprite* largetux_grab_right; + extern Sprite* bigtux_right; extern Sprite* bigtux_left; extern Sprite* bigtux_right_jump; diff --git a/src/resources.cpp b/src/resources.cpp index 5da2c82ff..8dce0ad5b 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -46,6 +46,16 @@ void loadshared() sprite_manager = new SpriteManager(datadir + "/supertux.strf"); /* Tuxes: */ + smalltux_kick_left = sprite_manager->load("smalltux-kick-left"); + smalltux_kick_right = sprite_manager->load("smalltux-kick-right"); + smalltux_grab_left = sprite_manager->load("smalltux-grab-left"); + smalltux_grab_right = sprite_manager->load("smalltux-grab-right"); + + largetux_kick_left = sprite_manager->load("largetux-kick-left"); + largetux_kick_right = sprite_manager->load("largetux-kick-right"); + largetux_grab_left = sprite_manager->load("largetux-grab-left"); + largetux_grab_right = sprite_manager->load("largetux-grab-right"); + largetux_stand_left = sprite_manager->load("largetux-stand-left"); largetux_stand_right = sprite_manager->load("largetux-stand-right");