[Super-tux-commit] supertux/src gameloop.cpp,1.128,1.129 worldmap.cpp,1.72,1.73
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-05-16 12:31:42
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17160/src Modified Files: gameloop.cpp worldmap.cpp Log Message: Game end screen is drawn by the world map now. This is just a step to make a dialog like the SM3 one when the player's lost all lives. (In case there isn't any worldmap, we should draw it anyway...) Also, don't allow the player to open the menu when he is dying. Avoids cheating. Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.72 retrieving revision 1.73 diff -u -d -r1.72 -r1.73 --- worldmap.cpp 15 May 2004 11:29:47 -0000 1.72 +++ worldmap.cpp 16 May 2004 12:31:31 -0000 1.73 @@ -706,6 +706,27 @@ // is to hard) break; case GameSession::ES_GAME_OVER: + /* draw an end screen */ + /* in the future, this should make a dialog a la SuperMario, asking + if the player wants to restart the world map with no score and from + level 1 */ + char str[80]; + + drawgradient(Color (0, 255, 0), Color (255, 0, 255)); + + blue_text->drawf("GAMEOVER", 0, 200, A_HMIDDLE, A_TOP, 1); + + sprintf(str, "SCORE: %d", player_status.score); + gold_text->drawf(str, 0, 224, A_HMIDDLE, A_TOP, 1); + + sprintf(str, "COINS: %d", player_status.distros); + gold_text->drawf(str, 0, screen->w - gold_text->w*2, A_HMIDDLE, A_TOP, 1); + + flipscreen(); + + SDL_Event event; + wait_for_event(event,2000,5000,true); + quit = true; player_status.reset(); break; Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.128 retrieving revision 1.129 diff -u -d -r1.128 -r1.129 --- gameloop.cpp 14 May 2004 22:47:35 -0000 1.128 +++ gameloop.cpp 16 May 2004 12:31:31 -0000 1.129 @@ -178,6 +178,8 @@ void GameSession::on_escape_press() { + if(world->get_tux()->dying) + return; // don't let the player open the menu, when he is dying if(game_pause) return; @@ -466,9 +468,6 @@ if (player_status.lives < 0) { // No more lives!? - if(st_gl_mode != ST_GL_TEST) - drawendscreen(); - exit_status = ES_GAME_OVER; } else @@ -716,30 +715,6 @@ } void -GameSession::drawendscreen() -{ - char str[80]; - - if (get_level()->img_bkgd) - get_level()->draw_bg(); - else - drawgradient(get_level()->bkgd_top, get_level()->bkgd_bottom); - - blue_text->drawf("GAMEOVER", 0, 200, A_HMIDDLE, A_TOP, 1); - - sprintf(str, "SCORE: %d", player_status.score); - gold_text->drawf(str, 0, 224, A_HMIDDLE, A_TOP, 1); - - sprintf(str, "COINS: %d", player_status.distros); - gold_text->drawf(str, 0, screen->w - gold_text->w*2, A_HMIDDLE, A_TOP, 1); - - flipscreen(); - - SDL_Event event; - wait_for_event(event,2000,5000,true); -} - -void GameSession::drawresultscreen(void) { char str[80]; |