replaced stop/play buttons in game panel with save/load buttons
authorHolger Schemel <info@artsoft.org>
Mon, 30 Mar 2015 21:47:02 +0000 (23:47 +0200)
committerHolger Schemel <info@artsoft.org>
Mon, 30 Mar 2015 21:49:42 +0000 (23:49 +0200)
ChangeLog
graphics/gfx_classic/RocksDoor2.ilbm
src/conf_gfx.c
src/game.c
src/game.h
src/tape.c

index ab81b63..0a7168d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2015-03-30
+       * replaced stop/play buttons in game panel with save/load buttons
+
 2015-03-24
        * added step-based engine snapshots to undo/redo single steps in game
 
index 0f169db..ef9d5f5 100644 (file)
Binary files a/graphics/gfx_classic/RocksDoor2.ilbm and b/graphics/gfx_classic/RocksDoor2.ilbm differ
index 1dc1c1b..bbf92ef 100644 (file)
@@ -4735,8 +4735,18 @@ struct ConfigInfo image_config[] =
   { "game.button.gfx.redo.height",             "30"                    },
   { "game.button.gfx.redo.pressed_xoffset",    "-100"                  },
 
-  { "game.button.gfx.save",                    UNDEFINED_FILENAME      },
-  { "game.button.gfx.load",                    UNDEFINED_FILENAME      },
+  { "game.button.gfx.save",                    "RocksDoor2.png"        },
+  { "game.button.gfx.save.x",                  "105"                   },
+  { "game.button.gfx.save.y",                  "50"                    },
+  { "game.button.gfx.save.width",              "30"                    },
+  { "game.button.gfx.save.height",             "30"                    },
+  { "game.button.gfx.save.pressed_xoffset",    "-100"                  },
+  { "game.button.gfx.load",                    "RocksDoor2.png"        },
+  { "game.button.gfx.load.x",                  "165"                   },
+  { "game.button.gfx.load.y",                  "50"                    },
+  { "game.button.gfx.load.width",              "30"                    },
+  { "game.button.gfx.load.height",             "30"                    },
+  { "game.button.gfx.load.pressed_xoffset",    "-100"                  },
 
   { "game.button.gfx.sound_music",             "RocksDoor.png"         },
   { "game.button.gfx.sound_music.x",           "305"                   },
@@ -7356,20 +7366,20 @@ struct ConfigInfo image_config[] =
   { "game.panel.level_author.draw_masked",     "true"                  },
   { "game.panel.level_author.draw_order",      "0"                     },
 
-  { "game.button.stop.x",                      "5"                     },
-  { "game.button.stop.y",                      "215"                   },
+  { "game.button.stop.x",                      "-1"                    },
+  { "game.button.stop.y",                      "-1"                    },
   { "game.button.pause.x",                     "35"                    },
   { "game.button.pause.y",                     "215"                   },
-  { "game.button.play.x",                      "65"                    },
-  { "game.button.play.y",                      "215"                   },
+  { "game.button.play.x",                      "-1"                    },
+  { "game.button.play.y",                      "-1"                    },
   { "game.button.undo.x",                      "5"                     },
   { "game.button.undo.y",                      "215"                   },
   { "game.button.redo.x",                      "65"                    },
   { "game.button.redo.y",                      "215"                   },
-  { "game.button.save.x",                      "-1"                    },
-  { "game.button.save.y",                      "-1"                    },
-  { "game.button.load.x",                      "-1"                    },
-  { "game.button.load.y",                      "-1"                    },
+  { "game.button.save.x",                      "5"                     },
+  { "game.button.save.y",                      "215"                   },
+  { "game.button.load.x",                      "65"                    },
+  { "game.button.load.y",                      "215"                   },
   { "game.button.sound_music.x",               "5"                     },
   { "game.button.sound_music.y",               "245"                   },
   { "game.button.sound_loops.x",               "35"                    },
index 82931d3..ee52b55 100644 (file)
@@ -3044,8 +3044,6 @@ static void InitGameEngine()
      SNAPSHOT_MODE_EVERY_STEP :
      strEqual(setup.engine_snapshot_mode, STR_SNAPSHOT_MODE_EVERY_MOVE) ?
      SNAPSHOT_MODE_EVERY_MOVE : SNAPSHOT_MODE_OFF);
-
-  FreeEngineSnapshotList();
 }
 
 int get_num_special_action(int element, int action_first, int action_last)
@@ -4007,7 +4005,7 @@ void InitGame()
 
   game.restart_level = FALSE;
 
-  SaveEngineSnapshotToList();
+  SaveEngineSnapshotToListInitial();
 }
 
 void UpdateEngineValues(int actual_scroll_x, int actual_scroll_y)
@@ -14722,11 +14720,6 @@ ListNode *SaveEngineSnapshotBuffers()
   SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(scroll_x));
   SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(scroll_y));
 
-  /* save level identification information */
-
-  setString(&snapshot_level_identifier, leveldir_current->identifier);
-  snapshot_level_nr = level_nr;
-
 #if 0
   ListNode *node = engine_snapshot_list_rnd;
   int num_bytes = 0;
@@ -14750,19 +14743,25 @@ void SaveEngineSnapshotSingle()
 
   /* finally save all snapshot buffers to single snapshot */
   SaveSnapshotSingle(buffers);
+
+  /* save level identification information */
+  setString(&snapshot_level_identifier, leveldir_current->identifier);
+  snapshot_level_nr = level_nr;
 }
 
-boolean SaveEngineSnapshotToList()
+static boolean SaveEngineSnapshotToListExt(boolean initial_snapshot)
 {
   boolean save_snapshot =
-    (FrameCounter == 0 ||
+    (initial_snapshot ||
      (game.snapshot.mode == SNAPSHOT_MODE_EVERY_STEP) ||
      (game.snapshot.mode == SNAPSHOT_MODE_EVERY_MOVE &&
       game.snapshot.changed_action));
 
   game.snapshot.changed_action = FALSE;
 
-  if (game.snapshot.mode == SNAPSHOT_MODE_OFF || !save_snapshot)
+  if (game.snapshot.mode == SNAPSHOT_MODE_OFF ||
+      tape.quick_resume ||
+      !save_snapshot)
     return FALSE;
 
   ListNode *buffers = SaveEngineSnapshotBuffers();
@@ -14773,6 +14772,18 @@ boolean SaveEngineSnapshotToList()
   return TRUE;
 }
 
+boolean SaveEngineSnapshotToList()
+{
+  return SaveEngineSnapshotToListExt(FALSE);
+}
+
+void SaveEngineSnapshotToListInitial()
+{
+  FreeEngineSnapshotList();
+
+  SaveEngineSnapshotToListExt(TRUE);
+}
+
 void LoadEngineSnapshotValues()
 {
   /* restore special values from snapshot structure */
@@ -14961,24 +14972,46 @@ void FreeGameButtons()
     FreeGadget(game_gadget[i]);
 }
 
-void MapStopPlayButtons()
+static void MapGameButtonsAtSamePosition(int id)
 {
-  UnmapGadget(game_gadget[GAME_CTRL_ID_UNDO]);
-  UnmapGadget(game_gadget[GAME_CTRL_ID_REDO]);
+  int i;
 
-  MapGadget(game_gadget[GAME_CTRL_ID_STOP]);
-  MapGadget(game_gadget[GAME_CTRL_ID_PLAY]);
+  for (i = 0; i < NUM_GAME_BUTTONS; i++)
+    if (i != id &&
+       gamebutton_info[i].pos->x == gamebutton_info[id].pos->x &&
+       gamebutton_info[i].pos->y == gamebutton_info[id].pos->y)
+      MapGadget(game_gadget[i]);
+}
+
+static void UnmapGameButtonsAtSamePosition(int id)
+{
+  int i;
+
+  for (i = 0; i < NUM_GAME_BUTTONS; i++)
+    if (i != id &&
+       gamebutton_info[i].pos->x == gamebutton_info[id].pos->x &&
+       gamebutton_info[i].pos->y == gamebutton_info[id].pos->y)
+      UnmapGadget(game_gadget[i]);
 }
 
 void MapUndoRedoButtons()
 {
-  UnmapGadget(game_gadget[GAME_CTRL_ID_STOP]);
-  UnmapGadget(game_gadget[GAME_CTRL_ID_PLAY]);
+  UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_UNDO);
+  UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_REDO);
 
   MapGadget(game_gadget[GAME_CTRL_ID_UNDO]);
   MapGadget(game_gadget[GAME_CTRL_ID_REDO]);
 }
 
+void UnmapUndoRedoButtons()
+{
+  UnmapGadget(game_gadget[GAME_CTRL_ID_UNDO]);
+  UnmapGadget(game_gadget[GAME_CTRL_ID_REDO]);
+
+  MapGameButtonsAtSamePosition(GAME_CTRL_ID_UNDO);
+  MapGameButtonsAtSamePosition(GAME_CTRL_ID_REDO);
+}
+
 void MapGameButtons()
 {
   int i;
index e334dcc..3e62cf4 100644 (file)
@@ -376,12 +376,14 @@ void FreeEngineSnapshotList();
 void LoadEngineSnapshotSingle();
 void SaveEngineSnapshotSingle();
 boolean SaveEngineSnapshotToList();
+void SaveEngineSnapshotToListInitial();
 boolean CheckEngineSnapshotSingle();
+boolean CheckEngineSnapshotList();
 
 void CreateGameButtons();
 void FreeGameButtons();
-void MapStopPlayButtons();
 void MapUndoRedoButtons();
+void UnmapUndoRedoButtons();
 void MapGameButtons();
 void UnmapGameButtons();
 void RedrawGameButtons();
index 896a872..efc8bcb 100644 (file)
@@ -741,6 +741,9 @@ void TapeTogglePause(boolean toggle_manual)
 
       if (!CheckEngineSnapshotSingle())
        SaveEngineSnapshotSingle();
+
+      // restart step/move snapshots after quick loading tape
+      SaveEngineSnapshotToListInitial();
     }
   }
 
@@ -749,7 +752,7 @@ void TapeTogglePause(boolean toggle_manual)
     if (tape.pausing)
       MapUndoRedoButtons();
     else if (!tape.single_step)
-      MapStopPlayButtons();
+      UnmapUndoRedoButtons();
   }
 }
 
@@ -1049,6 +1052,9 @@ void TapeQuickLoad()
     TapeStopWarpForward();
     TapeAppendRecording();
 
+    // restart step/move snapshots after quick loading tape
+    SaveEngineSnapshotToListInitial();
+
     if (FrameCounter > 0)
       return;
   }