added setup option to show/hide classic elements in the editor palette
[rocksndiamonds.git] / src / tape.c
index 540341fbc19d6bbb097909ac70ad57d168fbedc7..8c1e059b15f7d49416749c66cfc5615715aa800b 100644 (file)
@@ -401,8 +401,7 @@ void DrawCompleteVideoDisplay()
             gfx.vxsize, gfx.vysize, gfx.vx, gfx.vy);
 
   /* draw tape buttons (forced) */
-  UnmapTapeButtons();
-  MapTapeButtons();
+  RedrawOrRemapTapeButtons();
 
   DrawVideoDisplay(VIDEO_ALL_OFF, 0);
 
@@ -711,6 +710,9 @@ void TapeTogglePause(boolean toggle_mode)
 
     // restart step/move snapshots after quick loading tape
     SaveEngineSnapshotToListInitial();
+
+    // do not map undo/redo buttons after quick loading tape
+    return;
   }
 
   if (setup.show_snapshot_buttons &&
@@ -1110,7 +1112,7 @@ void AutoPlayTape()
     Print("Level %03d: ", level_nr);
 
     LoadLevel(level_nr);
-    if (level.no_valid_file)
+    if (level.no_level_file || level.no_valid_file)
     {
       Print("(no level)\n");
       continue;
@@ -1122,7 +1124,10 @@ void AutoPlayTape()
     continue;
 #endif
 
-    LoadSolutionTape(level_nr);
+    if (options.mytapes)
+      LoadTape(level_nr);
+    else
+      LoadSolutionTape(level_nr);
 
     if (tape.no_valid_file)
     {
@@ -1287,6 +1292,34 @@ void UnmapTapeButtons()
     UnmapGameButtons();
 }
 
+void RedrawTapeButtons()
+{
+  int i;
+
+  for (i = 0; i < NUM_TAPE_BUTTONS; i++)
+    RedrawGadget(tape_gadget[i]);
+
+  if (tape.show_game_buttons)
+    RedrawGameButtons();
+
+  // RedrawGadget() may have set REDRAW_ALL if buttons are defined off-area
+  redraw_mask &= ~REDRAW_ALL;
+}
+
+void RedrawOrRemapTapeButtons()
+{
+  if (tape_gadget[TAPE_CTRL_ID_PLAY]->mapped)
+  {
+    // tape buttons already mapped
+    RedrawTapeButtons();
+  }
+  else
+  {
+    UnmapTapeButtons();
+    MapTapeButtons();
+  }
+}
+
 static void HandleTapeButtonsExt(int id)
 {
   if (game_status != GAME_MODE_MAIN && game_status != GAME_MODE_PLAYING)