From 7927e26b1ec2ef8b787a35d7867bdc40249cd2ee Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 31 May 2015 02:14:50 +0200 Subject: [PATCH] added setup option to enable/disable (now optional) snapshot buttons --- src/conf_gfx.c | 15 ++++++++++++--- src/files.c | 31 +++++++++++++++++-------------- src/game.c | 39 +++++++++++++++++++++++++++------------ src/game.h | 1 + src/libgame/system.h | 1 + src/screens.c | 1 + src/tape.c | 4 +++- 7 files changed, 62 insertions(+), 30 deletions(-) diff --git a/src/conf_gfx.c b/src/conf_gfx.c index b63cb940..44eafc75 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -4741,6 +4741,13 @@ struct ConfigInfo image_config[] = { "game.button.gfx.save.width", "30" }, { "game.button.gfx.save.height", "30" }, { "game.button.gfx.save.pressed_xoffset", "-100" }, + { "game.button.gfx.pause2", "RocksDoor2.png" }, + { "game.button.gfx.pause2.x", "135" }, + { "game.button.gfx.pause2.y", "50" }, + { "game.button.gfx.pause2.width", "30" }, + { "game.button.gfx.pause2.height", "30" }, + { "game.button.gfx.pause2.pressed_xoffset", "-100" }, + { "game.button.gfx.pause2.active_yoffset", "-30" }, { "game.button.gfx.load", "RocksDoor2.png" }, { "game.button.gfx.load.x", "165" }, { "game.button.gfx.load.y", "50" }, @@ -7367,11 +7374,11 @@ struct ConfigInfo image_config[] = { "game.panel.level_author.draw_masked", "true" }, { "game.panel.level_author.draw_order", "0" }, - { "game.button.stop.x", "-1" }, - { "game.button.stop.y", "-1" }, + { "game.button.stop.x", "5" }, + { "game.button.stop.y", "215" }, { "game.button.pause.x", "35" }, { "game.button.pause.y", "215" }, - { "game.button.play.x", "35" }, + { "game.button.play.x", "65" }, { "game.button.play.y", "215" }, { "game.button.undo.x", "5" }, { "game.button.undo.y", "215" }, @@ -7379,6 +7386,8 @@ struct ConfigInfo image_config[] = { "game.button.redo.y", "215" }, { "game.button.save.x", "5" }, { "game.button.save.y", "215" }, + { "game.button.pause2.x", "35" }, + { "game.button.pause2.y", "215" }, { "game.button.load.x", "65" }, { "game.button.load.y", "215" }, { "game.button.sound_music.x", "5" }, diff --git a/src/files.c b/src/files.c index 184fbb0f..47e26ffa 100644 --- a/src/files.c +++ b/src/files.c @@ -7913,20 +7913,21 @@ void SaveScore(int nr) #define SETUP_TOKEN_GAME_FRAME_DELAY 26 #define SETUP_TOKEN_SP_SHOW_BORDER_ELEMENTS 27 #define SETUP_TOKEN_SMALL_GAME_GRAPHICS 28 -#define SETUP_TOKEN_GRAPHICS_SET 29 -#define SETUP_TOKEN_SOUNDS_SET 30 -#define SETUP_TOKEN_MUSIC_SET 31 -#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 32 -#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 33 -#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 34 -#define SETUP_TOKEN_VOLUME_SIMPLE 35 -#define SETUP_TOKEN_VOLUME_LOOPS 36 -#define SETUP_TOKEN_VOLUME_MUSIC 37 -#define SETUP_TOKEN_TOUCH_CONTROL_TYPE 38 -#define SETUP_TOKEN_TOUCH_MOVE_DISTANCE 39 -#define SETUP_TOKEN_TOUCH_DROP_DISTANCE 40 - -#define NUM_GLOBAL_SETUP_TOKENS 41 +#define SETUP_TOKEN_SHOW_SNAPSHOT_BUTTONS 29 +#define SETUP_TOKEN_GRAPHICS_SET 30 +#define SETUP_TOKEN_SOUNDS_SET 31 +#define SETUP_TOKEN_MUSIC_SET 32 +#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 33 +#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 34 +#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 35 +#define SETUP_TOKEN_VOLUME_SIMPLE 36 +#define SETUP_TOKEN_VOLUME_LOOPS 37 +#define SETUP_TOKEN_VOLUME_MUSIC 38 +#define SETUP_TOKEN_TOUCH_CONTROL_TYPE 39 +#define SETUP_TOKEN_TOUCH_MOVE_DISTANCE 40 +#define SETUP_TOKEN_TOUCH_DROP_DISTANCE 41 + +#define NUM_GLOBAL_SETUP_TOKENS 42 /* editor setup */ #define SETUP_TOKEN_EDITOR_EL_BOULDERDASH 0 @@ -8085,6 +8086,7 @@ static struct TokenInfo global_setup_tokens[] = { TYPE_INTEGER,&si.game_frame_delay, "game_frame_delay" }, { TYPE_SWITCH, &si.sp_show_border_elements, "sp_show_border_elements" }, { TYPE_SWITCH, &si.small_game_graphics, "small_game_graphics" }, + { TYPE_SWITCH, &si.show_snapshot_buttons, "show_snapshot_buttons" }, { TYPE_STRING, &si.graphics_set, "graphics_set" }, { TYPE_STRING, &si.sounds_set, "sounds_set" }, { TYPE_STRING, &si.music_set, "music_set" }, @@ -8264,6 +8266,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->game_frame_delay = GAME_FRAME_DELAY; si->sp_show_border_elements = FALSE; si->small_game_graphics = FALSE; + si->show_snapshot_buttons = FALSE; si->graphics_set = getStringCopy(GFX_CLASSIC_SUBDIR); si->sounds_set = getStringCopy(SND_CLASSIC_SUBDIR); diff --git a/src/game.c b/src/game.c index 6a896768..c02e590f 100644 --- a/src/game.c +++ b/src/game.c @@ -974,12 +974,13 @@ static struct GamePanelControlInfo game_panel_controls[] = #define GAME_CTRL_ID_UNDO 3 #define GAME_CTRL_ID_REDO 4 #define GAME_CTRL_ID_SAVE 5 -#define GAME_CTRL_ID_LOAD 6 -#define SOUND_CTRL_ID_MUSIC 7 -#define SOUND_CTRL_ID_LOOPS 8 -#define SOUND_CTRL_ID_SIMPLE 9 +#define GAME_CTRL_ID_PAUSE2 6 +#define GAME_CTRL_ID_LOAD 7 +#define SOUND_CTRL_ID_MUSIC 8 +#define SOUND_CTRL_ID_LOOPS 9 +#define SOUND_CTRL_ID_SIMPLE 10 -#define NUM_GAME_BUTTONS 10 +#define NUM_GAME_BUTTONS 11 /* forward declaration for internal use */ @@ -14866,6 +14867,10 @@ static struct IMG_GAME_BUTTON_GFX_SAVE, &game.button.save, GAME_CTRL_ID_SAVE, "save game" }, + { + IMG_GAME_BUTTON_GFX_PAUSE2, &game.button.pause2, + GAME_CTRL_ID_PAUSE2, "pause game" + }, { IMG_GAME_BUTTON_GFX_LOAD, &game.button.load, GAME_CTRL_ID_LOAD, "load game" @@ -14916,7 +14921,6 @@ void CreateGameButtons() } if (id == GAME_CTRL_ID_STOP || - id == GAME_CTRL_ID_PAUSE || id == GAME_CTRL_ID_PLAY || id == GAME_CTRL_ID_SAVE || id == GAME_CTRL_ID_LOAD) @@ -15001,22 +15005,18 @@ void MapUndoRedoButtons() { UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_UNDO); UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_REDO); - UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_PLAY); MapGadget(game_gadget[GAME_CTRL_ID_UNDO]); MapGadget(game_gadget[GAME_CTRL_ID_REDO]); - MapGadget(game_gadget[GAME_CTRL_ID_PLAY]); } void UnmapUndoRedoButtons() { UnmapGadget(game_gadget[GAME_CTRL_ID_UNDO]); UnmapGadget(game_gadget[GAME_CTRL_ID_REDO]); - UnmapGadget(game_gadget[GAME_CTRL_ID_PLAY]); MapGameButtonsAtSamePosition(GAME_CTRL_ID_UNDO); MapGameButtonsAtSamePosition(GAME_CTRL_ID_REDO); - MapGameButtonsAtSamePosition(GAME_CTRL_ID_PLAY); } void MapGameButtons() @@ -15025,9 +15025,23 @@ void MapGameButtons() for (i = 0; i < NUM_GAME_BUTTONS; i++) if (i != GAME_CTRL_ID_UNDO && - i != GAME_CTRL_ID_REDO && - i != GAME_CTRL_ID_PLAY) + i != GAME_CTRL_ID_REDO) MapGadget(game_gadget[i]); + + if (setup.show_snapshot_buttons) + { + UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_SAVE); + UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_PAUSE2); + UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_LOAD); + } + else + { + UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_STOP); + UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_PAUSE); + UnmapGameButtonsAtSamePosition(GAME_CTRL_ID_PLAY); + } + + RedrawGameButtons(); } void UnmapGameButtons() @@ -15111,6 +15125,7 @@ static void HandleGameButtonsExt(int id, int button) break; case GAME_CTRL_ID_PAUSE: + case GAME_CTRL_ID_PAUSE2: if (options.network && game_status == GAME_MODE_PLAYING) { #if defined(NETWORK_AVALIABLE) diff --git a/src/game.h b/src/game.h index a962abd7..b801932c 100644 --- a/src/game.h +++ b/src/game.h @@ -105,6 +105,7 @@ struct GameButtonInfo struct XY redo; struct XY save; + struct XY pause2; struct XY load; struct XY sound_music; diff --git a/src/libgame/system.h b/src/libgame/system.h index 9a42c147..df223fe7 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -982,6 +982,7 @@ struct SetupInfo int game_frame_delay; boolean sp_show_border_elements; boolean small_game_graphics; + boolean show_snapshot_buttons; char *graphics_set; char *sounds_set; diff --git a/src/screens.c b/src/screens.c index deb4da87..d1b80e26 100644 --- a/src/screens.c +++ b/src/screens.c @@ -5286,6 +5286,7 @@ static struct TokenInfo setup_info_game[] = #endif { TYPE_ENTER_LIST, execSetupChooseSnapshotMode,"Game Engine Snapshot Mode:" }, { TYPE_STRING, &snapshot_mode_text, "" }, + { TYPE_SWITCH, &setup.show_snapshot_buttons,"Show Snapshot Buttons:" }, { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execSetupMain, "Back" }, diff --git a/src/tape.c b/src/tape.c index 7a896e80..4ff0c968 100644 --- a/src/tape.c +++ b/src/tape.c @@ -747,7 +747,9 @@ void TapeTogglePause(boolean toggle_manual) } } - if (game_status == GAME_MODE_PLAYING && CheckEngineSnapshotList()) + if (setup.show_snapshot_buttons && + game_status == GAME_MODE_PLAYING && + CheckEngineSnapshotList()) { if (tape.pausing) MapUndoRedoButtons(); -- 2.34.1