Game end screen is drawn by the world map now. This is just a step to make a dialog...
authorRicardo Cruz <rick2@aeiou.pt>
Sun, 16 May 2004 12:31:31 +0000 (12:31 +0000)
committerRicardo Cruz <rick2@aeiou.pt>
Sun, 16 May 2004 12:31:31 +0000 (12:31 +0000)
(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

src/gameloop.cpp
src/worldmap.cpp

index 34d91bf..807b3e2 100644 (file)
@@ -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];
index d97d910..2e14839 100644 (file)
@@ -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;