From: Ricardo Cruz Date: Sun, 16 May 2004 12:31:31 +0000 (+0000) Subject: Game end screen is drawn by the world map now. This is just a step to make a dialog... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=6f32abba16fbc37eefe58685a68091e9624cc9f8;p=supertux.git 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. SVN-Revision: 1211 --- diff --git a/src/gameloop.cpp b/src/gameloop.cpp index 34d91bf2f..807b3e2de 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -178,6 +178,8 @@ GameSession::start_timers() 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 @@ GameSession::check_end_conditions() 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 @@ GameSession::drawstatus() } 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]; diff --git a/src/worldmap.cpp b/src/worldmap.cpp index d97d9108d..2e1483944 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -706,6 +706,27 @@ WorldMap::update(float delta) // 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;