+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
{ "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" },
{ "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" },
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)
game.restart_level = FALSE;
- SaveEngineSnapshotToList();
+ SaveEngineSnapshotToListInitial();
}
void UpdateEngineValues(int actual_scroll_x, int actual_scroll_y)
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;
/* 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();
return TRUE;
}
+boolean SaveEngineSnapshotToList()
+{
+ return SaveEngineSnapshotToListExt(FALSE);
+}
+
+void SaveEngineSnapshotToListInitial()
+{
+ FreeEngineSnapshotList();
+
+ SaveEngineSnapshotToListExt(TRUE);
+}
+
void LoadEngineSnapshotValues()
{
/* restore special values from snapshot structure */
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;
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();
if (!CheckEngineSnapshotSingle())
SaveEngineSnapshotSingle();
+
+ // restart step/move snapshots after quick loading tape
+ SaveEngineSnapshotToListInitial();
}
}
if (tape.pausing)
MapUndoRedoButtons();
else if (!tape.single_step)
- MapStopPlayButtons();
+ UnmapUndoRedoButtons();
}
}
TapeStopWarpForward();
TapeAppendRecording();
+ // restart step/move snapshots after quick loading tape
+ SaveEngineSnapshotToListInitial();
+
if (FrameCounter > 0)
return;
}