From: Holger Schemel Date: Mon, 30 Mar 2015 21:47:02 +0000 (+0200) Subject: replaced stop/play buttons in game panel with save/load buttons X-Git-Tag: 4.0.0.0-rc1~220 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=0e5aef968a447e03002cbcc120df7555df624b85 replaced stop/play buttons in game panel with save/load buttons --- diff --git a/ChangeLog b/ChangeLog index ab81b631..0a7168dc 100644 --- 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 diff --git a/graphics/gfx_classic/RocksDoor2.ilbm b/graphics/gfx_classic/RocksDoor2.ilbm index 0f169db3..ef9d5f57 100644 Binary files a/graphics/gfx_classic/RocksDoor2.ilbm and b/graphics/gfx_classic/RocksDoor2.ilbm differ diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 1dc1c1b8..bbf92ef0 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -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" }, diff --git a/src/game.c b/src/game.c index 82931d3f..ee52b55f 100644 --- a/src/game.c +++ b/src/game.c @@ -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; diff --git a/src/game.h b/src/game.h index e334dcc6..3e62cf4d 100644 --- a/src/game.h +++ b/src/game.h @@ -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(); diff --git a/src/tape.c b/src/tape.c index 896a8721..efc8bcb4 100644 --- a/src/tape.c +++ b/src/tape.c @@ -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; }