rnd-20060226-1-src
[rocksndiamonds.git] / src / screens.c
index 90b987f3bfa4884ba1ab9e94388407326414550e..4a9e2ffbc97cb9a9a0d534f3ff57d0e2fe5d0bc0 100644 (file)
@@ -826,12 +826,15 @@ void DrawInfoScreen_HelpAnim(int start, int max_anims, boolean init)
     action = helpanim_info[j].action;
     direction = helpanim_info[j].direction;
 
+    if (element < 0)
+      element = EL_UNKNOWN;
+
     if (action != -1 && direction != -1)
       graphic = el_act_dir2img(element, action, direction);
     else if (action != -1)
       graphic = el_act2img(element, action);
     else if (direction != -1)
-      graphic = el_act2img(element, direction);
+      graphic = el_dir2img(element, direction);
     else
       graphic = el2img(element);
 
@@ -1000,7 +1003,7 @@ void HandleInfoScreen_Elements(int button)
   }
   else
   {
-    if (DelayReached(&info_delay, GAME_FRAME_DELAY))
+    if (DelayReached(&info_delay, GameFrameDelay))
       if (page < num_pages)
        DrawInfoScreen_HelpAnim(page * anims_per_page, num_anims, FALSE);
 
@@ -2044,6 +2047,7 @@ static struct TokenInfo setup_info_game[] =
   { TYPE_SWITCH,       &setup.skip_levels,     "Skip Levels:"          },
   { TYPE_SWITCH,       &setup.time_limit,      "Timelimit:"            },
   { TYPE_SWITCH,       &setup.autorecord,      "Auto-Record:"          },
+  { TYPE_SWITCH,       &setup.quick_switch,    "Quick Switch:"         },
   { TYPE_EMPTY,                NULL,                   ""                      },
   { TYPE_LEAVE_MENU,   execSetupMain,          "Back"                  },
 
@@ -3085,16 +3089,36 @@ void HandleGameActions()
     byte tape_action[MAX_PLAYERS];
     int i;
 
+#if 1
     if (level.native_em_level->lev->home == 0) /* all players at home */
     {
+      local_player->LevelSolved = TRUE;
+      AllPlayersGone = TRUE;
+
+      level.native_em_level->lev->home = -1;
+    }
+
+    if (local_player->LevelSolved)
       GameWon();
 
-      if (!TAPE_IS_STOPPED(tape))
+    if (AllPlayersGone && !TAPE_IS_STOPPED(tape))
+      TapeStop();
+
+    if (game_status != GAME_MODE_PLAYING)
+      return;
+#else
+    if (level.native_em_level->lev->home == 0) /* all players at home */
+    {
+      if (local_player->LevelSolved)
+       GameWon();
+
+      if (AllPlayersGone && !TAPE_IS_STOPPED(tape))
        TapeStop();
 
       if (game_status != GAME_MODE_PLAYING)
        return;
     }
+#endif
 
     if (level.native_em_level->ply[0]->alive == 0 &&
        level.native_em_level->ply[1]->alive == 0 &&
@@ -3160,6 +3184,27 @@ void HandleGameActions()
       for (i = 0; i < MAX_PLAYERS; i++)
        effective_action[i] = stored_player[i].effective_action;
 
+
+#if 0
+      printf("::: %s: ",
+            tape.playing ? "PLAYING" :
+            tape.recording ? "RECORDING" :
+            "STOPPED");
+
+      for (i = 1; i < MAX_PLAYERS; i++)
+       if ((recorded_player_action && recorded_player_action[i] != 0) ||
+           tape_action[i] != 0 ||
+           effective_action[i] != 0)
+         printf("::: -----------------> WARNING!\n");
+
+      printf("::: %08d: %08x [%08x] [%08x]\n",
+            FrameCounter,
+            (recorded_player_action ? recorded_player_action[0] : -1),
+            tape_action[0],
+            effective_action[0]);
+#endif
+
+
       GameActions_EM(effective_action);
     }
 #else
@@ -3225,8 +3270,15 @@ void HandleGameActions()
 void StartGameActions(boolean init_network_game, boolean record_tape,
                      long random_seed)
 {
+#if 1
+  unsigned long new_random_seed = InitRND(random_seed);
+
+  if (record_tape)
+    TapeStartRecording(new_random_seed);
+#else
   if (record_tape)
     TapeStartRecording(random_seed);
+#endif
 
 #if defined(NETWORK_AVALIABLE)
   if (init_network_game)
@@ -3241,7 +3293,9 @@ void StartGameActions(boolean init_network_game, boolean record_tape,
 
   game_status = GAME_MODE_PLAYING;
 
+#if 0
   InitRND(random_seed);
+#endif
 
   InitGame();
 }