rnd-20050122-1-src
[rocksndiamonds.git] / src / screens.c
index 1ba452fbc249bf0c60b915decf32aa82b22fe6ac..d6c84d81a4495eb03e19eedd99ae849bfc2c4cf2 100644 (file)
@@ -1957,6 +1957,7 @@ static struct TokenInfo setup_info_editor[] =
 #endif
   { TYPE_SWITCH,       &setup.editor.el_boulderdash,   "BoulderDash:"  },
   { TYPE_SWITCH,       &setup.editor.el_emerald_mine,  "Emerald Mine:" },
+  { TYPE_SWITCH,       &setup.editor.el_emerald_mine_club,"E.M. Club:" },
   { TYPE_SWITCH,       &setup.editor.el_more,          "More:"         },
   { TYPE_SWITCH,       &setup.editor.el_sokoban,       "Sokoban:"      },
   { TYPE_SWITCH,       &setup.editor.el_supaplex,      "Supaplex:"     },
@@ -2952,11 +2953,44 @@ void HandleGameActions()
     byte tape_action[MAX_PLAYERS];
     int i;
 
+    if (level.native_em_level->lev->home == 0) /* all players at home */
+    {
+      GameWon();
+
+      if (!TAPE_IS_STOPPED(tape))
+       TapeStop();
+
+      if (game_status != GAME_MODE_PLAYING)
+       return;
+    }
+
+    if (level.native_em_level->ply1->alive == 0 &&
+       level.native_em_level->ply2->alive == 0)        /* all dead */
+      AllPlayersGone = TRUE;
+
+    if (AllPlayersGone && !TAPE_IS_STOPPED(tape))
+      TapeStop();
+
+    /* --- game actions --- */
+
     if (tape.pausing)
+    {
+      /* don't use 100% CPU while in pause mode -- this should better be solved
+        like in the R'n'D game engine! */
+
+      Delay(10);
+
       return;
+    }
 
     recorded_player_action = (tape.playing ? TapePlayAction() : NULL);
 
+#if 1
+    /* !!! CHECK THIS (tape.pausing is always FALSE here!) !!! */
+    if (recorded_player_action == NULL && tape.pausing)
+      return;
+#endif
+
     for (i = 0; i < MAX_PLAYERS; i++)
     {
       summarized_player_action |= stored_player[i].action;
@@ -2985,11 +3019,7 @@ void HandleGameActions()
     if (tape.recording)
       TapeRecordAction(tape_action);
 
-    if (em_main_handle_game(local_player->effective_action) != 0)
-    {
-      game_status = GAME_MODE_MAIN;
-      DrawMainMenu();
-    }
+    GameActions_EM(local_player->effective_action);
 
     if (TimeFrames >= FRAMES_PER_SECOND)
     {
@@ -3000,6 +3030,7 @@ void HandleGameActions()
        DrawVideoDisplay(VIDEO_STATE_TIME_ON, TapeTime);
     }
 
+    FrameCounter++;
     TimeFrames++;
 
     BackToFront();