Merge pull request #1828 from Gymnasiast/fix-menu-saving

Fix file menu for editor, restore menu order, add shortcut for quick saving
This commit is contained in:
Ted John 2015-08-20 18:19:00 +01:00
commit 32a46e699d
7 changed files with 38 additions and 18 deletions

View File

@ -3851,3 +3851,4 @@ STR_5509 :{SMALLFONT}{BLACK}Allows loading scenarios and saves that have an i
STR_5510 :Default sound device
STR_5511 :(UNKNOWN)
STR_5512 :Save Game As
STR_5513 :(Quick) save game

View File

@ -974,6 +974,7 @@ static const uint16 _defaultShortcutKeys[SHORTCUT_COUNT] = {
SDL_SCANCODE_DOWN, // SHORTCUT_SCROLL_MAP_DOWN
SDL_SCANCODE_RIGHT, // SHORTCUT_SCROLL_MAP_RIGHT
SDL_SCANCODE_C, // SHORTCUT_OPEN_CHAT_WINDOW
CTRL | SDL_SCANCODE_F10, // SHORTCUT_QUICK_SAVE_GAME
};
#define SHORTCUT_FILE_VERSION 1

View File

@ -77,6 +77,7 @@ enum {
SHORTCUT_SCROLL_MAP_DOWN,
SHORTCUT_SCROLL_MAP_RIGHT,
SHORTCUT_OPEN_CHAT_WINDOW,
SHORTCUT_QUICK_SAVE_GAME,
SHORTCUT_COUNT
};

View File

@ -500,6 +500,19 @@ static void shortcut_open_chat_window()
chat_toggle();
}
static void shortcut_quick_save_game()
{
// Do a quick save in playing mode and a regular save in Scenario Editor mode. In other cases, don't do anything.
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) == SCREEN_FLAGS_PLAYING) {
tool_cancel();
save_game();
}
else if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) {
rct_s6_info *s6Info = (rct_s6_info*)0x0141F570;
window_loadsave_open(LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE, s6Info->name);
}
}
static const shortcut_action shortcut_table[SHORTCUT_COUNT] = {
shortcut_close_top_most_window,
shortcut_close_all_floating_windows,
@ -545,6 +558,7 @@ static const shortcut_action shortcut_table[SHORTCUT_COUNT] = {
NULL,
NULL,
shortcut_open_chat_window,
shortcut_quick_save_game,
};
#pragma endregion

View File

@ -114,7 +114,6 @@ enum {
STR_CANT_RAISE_LAND_HERE = 880,
STR_LOAD_GAME = 882,
STR_SAVE_GAME_AS = 5512,
STR_SAVE_GAME = 883,
STR_LOAD_LANDSCAPE = 884,
STR_SAVE_LANDSCAPE = 885,
@ -2059,6 +2058,9 @@ enum {
STR_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM = 5508,
STR_ALLOW_LOADING_WITH_INCORRECT_CHECKSUM_TIP = 5509,
STR_SAVE_GAME_AS = 5512,
STR_SHORTCUT_QUICK_SAVE_GAME = 5513,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768
};

View File

@ -131,6 +131,7 @@ const rct_string_id ShortcutStringIds[] = {
STR_SHORTCUT_SCROLL_MAP_DOWN,
STR_SHORTCUT_SCROLL_MAP_RIGHT,
STR_SEND_MESSAGE,
STR_SHORTCUT_QUICK_SAVE_GAME,
};
/**
@ -262,4 +263,4 @@ static void window_shortcut_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, i
RCT2_GLOBAL(0x13CE956, uint16) = templateStringId;
gfx_draw_string_left(dpi, format, (void*)0x13CE952, 0, 0, y - 1);
}
}
}

View File

@ -72,9 +72,9 @@ enum {
};
typedef enum {
DDIDX_SAVE_GAME = 0,
DDIDX_SAVE_GAME_AS = 1,
DDIDX_LOAD_GAME = 2,
DDIDX_LOAD_GAME = 0,
DDIDX_SAVE_GAME = 1,
DDIDX_SAVE_GAME_AS = 2,
// separator
DDIDX_ABOUT = 4,
DDIDX_OPTIONS = 5,
@ -378,9 +378,9 @@ static void window_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widg
gDropdownItemsFormat[9] = STR_EXIT_OPENRCT2;
numItems = 10;
} else {
gDropdownItemsFormat[0] = STR_SAVE_GAME;
gDropdownItemsFormat[1] = STR_SAVE_GAME_AS;
gDropdownItemsFormat[2] = STR_LOAD_GAME;
gDropdownItemsFormat[0] = STR_LOAD_GAME;
gDropdownItemsFormat[1] = STR_SAVE_GAME;
gDropdownItemsFormat[2] = STR_SAVE_GAME_AS;
gDropdownItemsFormat[3] = 0;
gDropdownItemsFormat[4] = STR_ABOUT;
gDropdownItemsFormat[5] = STR_OPTIONS;
@ -487,6 +487,12 @@ static void window_top_toolbar_dropdown(rct_window *w, int widgetIndex, int drop
{
switch (widgetIndex) {
case WIDX_FILE_MENU:
// Quicksave is only available in the normal game. Skip one position to avoid incorrect mappings in the menus of the other modes.
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR) && dropdownIndex > DDIDX_LOAD_GAME)
dropdownIndex += 1;
// Track designer and track designs manager start with About, not Load/save
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))
dropdownIndex += DDIDX_ABOUT;
@ -494,6 +500,10 @@ static void window_top_toolbar_dropdown(rct_window *w, int widgetIndex, int drop
case DDIDX_LOAD_GAME:
game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);
break;
case DDIDX_SAVE_GAME:
tool_cancel();
save_game();
break;
case DDIDX_SAVE_GAME_AS:
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) {
rct_s6_info *s6Info = (rct_s6_info*)0x0141F570;
@ -504,16 +514,6 @@ static void window_top_toolbar_dropdown(rct_window *w, int widgetIndex, int drop
save_game_as();
}
break;
case DDIDX_SAVE_GAME:
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) {
rct_s6_info *s6Info = (rct_s6_info*)0x0141F570;
window_loadsave_open(LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE, s6Info->name);
}
else {
tool_cancel();
save_game();
}
break;
case DDIDX_ABOUT:
window_about_open();
break;