From 45edbd7477e4684132ff96fa737336539ecc6f4c Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 10 Jul 2021 12:40:32 +0200 Subject: [PATCH] added setup option for showing (only) undo/redo game buttons --- src/files.c | 5 +++++ src/game.c | 12 +++++++++--- src/libgame/system.h | 1 + src/screens.c | 1 + src/tape.c | 4 +++- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/files.c b/src/files.c index 0d4eb7fe..1200be3a 100644 --- a/src/files.c +++ b/src/files.c @@ -9681,6 +9681,10 @@ static struct TokenInfo global_setup_tokens[] = TYPE_SWITCH, &setup.show_snapshot_buttons, "show_snapshot_buttons" }, + { + TYPE_SWITCH, + &setup.show_undo_redo_buttons, "show_undo_redo_buttons" + }, { TYPE_SWITCH, &setup.only_show_local_scores, "only_show_local_scores" @@ -10361,6 +10365,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->sp_show_border_elements = FALSE; si->small_game_graphics = FALSE; si->show_snapshot_buttons = FALSE; + si->show_undo_redo_buttons = FALSE; si->only_show_local_scores = FALSE; si->graphics_set = getStringCopy(GFX_CLASSIC_SUBDIR); diff --git a/src/game.c b/src/game.c index a3cc0704..932b8c9e 100644 --- a/src/game.c +++ b/src/game.c @@ -16168,6 +16168,12 @@ static void UnmapGameButtonsAtSamePosition_All(void) UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_PAUSE2); UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_LOAD); } + else if (setup.show_undo_redo_buttons) + { + UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_UNDO); + UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_PAUSE2); + UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_REDO); + } else { UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_STOP); @@ -16232,9 +16238,7 @@ static void MapGameButtonsExt(boolean on_tape) int i; for (i = 0; i < NUM_GAME_BUTTONS; i++) - if ((!on_tape || gamebutton_info[i].allowed_on_tape) && - i != GAME_CTRL_ID_UNDO && - i != GAME_CTRL_ID_REDO) + if (!on_tape || gamebutton_info[i].allowed_on_tape) MapGadget(game_gadget[i]); UnmapGameButtonsAtSamePosition_All(); @@ -16326,6 +16330,8 @@ static void GameUndoRedoExt(void) DrawVideoDisplay(VIDEO_STATE_FRAME_ON, FrameCounter); DrawVideoDisplay(VIDEO_STATE_1STEP(tape.single_step), 0); + ModifyPauseButtons(); + BackToFront(); } diff --git a/src/libgame/system.h b/src/libgame/system.h index bd3f4b8f..24696031 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1475,6 +1475,7 @@ struct SetupInfo boolean sp_show_border_elements; boolean small_game_graphics; boolean show_snapshot_buttons; + boolean show_undo_redo_buttons; boolean only_show_local_scores; char *graphics_set; diff --git a/src/screens.c b/src/screens.c index a63aa333..b7678d09 100644 --- a/src/screens.c +++ b/src/screens.c @@ -6795,6 +6795,7 @@ static struct TokenInfo setup_info_game[] = { TYPE_ENTER_LIST, execSetupChooseSnapshotMode,"Game Engine Snapshot Mode:" }, { TYPE_STRING, &snapshot_mode_text, "" }, { TYPE_SWITCH, &setup.show_snapshot_buttons,"Show Snapshot Buttons:" }, + { TYPE_SWITCH, &setup.show_undo_redo_buttons,"Show Undo/Redo Buttons:" }, { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execSetupMain, "Back" }, diff --git a/src/tape.c b/src/tape.c index 1c691867..aa2f84a5 100644 --- a/src/tape.c +++ b/src/tape.c @@ -828,7 +828,9 @@ void TapeTogglePause(boolean toggle_mode) if (game_status == GAME_MODE_PLAYING) { - if (setup.show_snapshot_buttons && CheckEngineSnapshotList()) + if (setup.show_snapshot_buttons && + setup.show_undo_redo_buttons && + CheckEngineSnapshotList()) { if (tape.pausing) MapUndoRedoButtons(); -- 2.34.1