[Super-tux-commit] supertux/src defines.h,1.13,1.14 gameloop.cpp,1.77,1.78 gameloop.h,1.40,1.41 setu
Brought to you by:
wkendrick
From: Ingo R. <gr...@us...> - 2004-04-19 13:23:42
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9182 Modified Files: defines.h gameloop.cpp gameloop.h setup.cpp worldmap.cpp Log Message: - fixed bug in live counting - added save menu to the worldmap - removed load/save from the game menu Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- gameloop.h 17 Apr 2004 13:56:47 -0000 1.40 +++ gameloop.h 19 Apr 2004 13:23:33 -0000 1.41 @@ -51,9 +51,12 @@ // FIXME: Hack for restarting the level std::string subset; + public: enum ExitStatus { NONE, LEVEL_FINISHED, GAME_OVER, LEVEL_ABORT }; + private: ExitStatus exit_status; public: + Timer time_left; GameSession(const std::string& subset, int levelnb, int mode); Index: defines.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/defines.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- defines.h 12 Apr 2004 13:16:07 -0000 1.13 +++ defines.h 19 Apr 2004 13:23:33 -0000 1.14 @@ -68,7 +68,7 @@ #define MAX_RUN_XM 3.2 #define MAX_YM 20.0 #define MAX_JUMP_TIME 375 -#define MAX_LIVES 4.0 +#define MAX_LIVES 99 #define WALK_SPEED 1.0 #define RUN_SPEED 1.5 Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- worldmap.cpp 18 Apr 2004 12:03:07 -0000 1.32 +++ worldmap.cpp 19 Apr 2004 13:23:33 -0000 1.33 @@ -499,19 +499,39 @@ { if (enter_level && !tux->is_moving()) { - for(Levels::iterator i = levels.begin(); i != levels.end(); ++i) + Level* level = at_level(); + if (level) { - if (i->x == tux->get_tile_pos().x && - i->y == tux->get_tile_pos().y) + if (level->x == tux->get_tile_pos().x && + level->y == tux->get_tile_pos().y) { - std::cout << "Enter the current level: " << i->name << std::endl;; + std::cout << "Enter the current level: " << level->name << std::endl;; halt_music(); - GameSession session(datadir + "levels/" + i->name, + + GameSession session(datadir + "levels/" + level->name, 1, ST_GL_LOAD_LEVEL_FILE); - session.run(); - if (1) // FIXME: insert exit status checker here - i->solved = true; + switch (session.run()) + { + case GameSession::LEVEL_FINISHED: + level->solved = true; + break; + case GameSession::LEVEL_ABORT: + // Reseting the player_status might be a worthy + // consideration, but I don't think we need it + // 'cause only the bad players will use it to + // 'cheat' a few items and that isn't necesarry a + // bad thing (ie. better they continue that way, + // then stop playing the game all together since it + // is to hard) + break; + case GameSession::GAME_OVER: + quit = true; + break; + case GameSession::NONE: + // Should never be reached + break; + } play_music(song, 1); show_menu = 0; @@ -521,8 +541,11 @@ return; } } - std::cout << "Nothing to enter at: " - << tux->get_tile_pos().x << ", " << tux->get_tile_pos().y << std::endl; + else + { + std::cout << "Nothing to enter at: " + << tux->get_tile_pos().x << ", " << tux->get_tile_pos().y << std::endl; + } } else { @@ -539,7 +562,12 @@ case 2: // Return to game menu_reset(); break; - case 5: // Quit Worldmap + case 3: + if (!savegame_file.empty()) + savegame(savegame_file); + break; + + case 6: // Quit Worldmap quit = true; break; } @@ -674,6 +702,7 @@ SDL_Delay(20); } + halt_music(); free_music(song); } @@ -733,6 +762,9 @@ reader.read_int("score", &player_status.score); reader.read_int("distros", &player_status.distros); + if (player_status.lives < 0) + player_status.lives = 3; + lisp_object_t* tux_cur = 0; if (reader.read_lisp("tux", &tux_cur)) { @@ -782,4 +814,7 @@ } // namespace WorldMapNS -/* EOF */ +/* Local Variables: */ +/* mode:c++ */ +/* End: */ + Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.77 retrieving revision 1.78 diff -u -d -r1.77 -r1.78 --- gameloop.cpp 18 Apr 2004 20:36:00 -0000 1.77 +++ gameloop.cpp 19 Apr 2004 13:23:33 -0000 1.78 @@ -319,7 +319,8 @@ // Check End conditions if (tux->is_dead()) { - + player_status.lives -= 1; + if (player_status.lives < 0) { // No more lives!? if(st_gl_mode != ST_GL_TEST) @@ -327,8 +328,10 @@ if(st_gl_mode != ST_GL_TEST) { - if (player_status.score > hs_score) - save_hs(player_status.score); + // FIXME: highscore soving doesn't make sense in its + // current form + //if (player_status.score > hs_score) + //save_hs(player_status.score); } exit_status = GAME_OVER; @@ -436,14 +439,7 @@ case 2: st_pause_ticks_stop(); break; - case 3: - // FIXME: - //update_load_save_game_menu(save_game_menu); - break; - case 4: - update_load_save_game_menu(load_game_menu); - break; - case 7: + case 5: st_pause_ticks_stop(); exit_status = LEVEL_ABORT; break; Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- setup.cpp 17 Apr 2004 00:49:54 -0000 1.40 +++ setup.cpp 19 Apr 2004 13:23:33 -0000 1.41 @@ -422,18 +422,17 @@ save_game_menu->additem(MN_HL,"",0,0); save_game_menu->additem(MN_BACK,"Back",0,0); - game_menu->additem(MN_LABEL,"InGame Menu",0,0); + game_menu->additem(MN_LABEL,"Pause",0,0); game_menu->additem(MN_HL,"",0,0); - game_menu->additem(MN_ACTION,"Return To Game",0,0); - game_menu->additem(MN_GOTO,"Save Game",0,save_game_menu); - game_menu->additem(MN_GOTO,"Load Game",0,load_game_menu); + game_menu->additem(MN_ACTION,"Continue",0,0); game_menu->additem(MN_GOTO,"Options",0,options_menu); game_menu->additem(MN_HL,"",0,0); - game_menu->additem(MN_ACTION,"Quit Game",0,0); + game_menu->additem(MN_ACTION,"Abort Level",0,0); - worldmap_menu->additem(MN_LABEL,"Worldmap Menu",0,0); + worldmap_menu->additem(MN_LABEL,"Pause",0,0); worldmap_menu->additem(MN_HL,"",0,0); - worldmap_menu->additem(MN_ACTION,"Return To Game",0,0); + worldmap_menu->additem(MN_ACTION,"Continue",0,0); + worldmap_menu->additem(MN_ACTION,"Save",0,0); worldmap_menu->additem(MN_GOTO,"Options",0,options_menu); worldmap_menu->additem(MN_HL,"",0,0); worldmap_menu->additem(MN_ACTION,"Quit Game",0,0); @@ -463,7 +462,8 @@ char slotfile[1024]; snprintf(slotfile, 1024, "%s/slot%d.stsg", st_save_dir, slot-1); - + + // Load the game or at least set the savegame_file variable worldmap.loadgame(slotfile); worldmap.display(); |