2017-06-01 21:55:10 +02:00
|
|
|
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
|
2014-11-05 19:50:51 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2016-05-04 19:24:41 +02:00
|
|
|
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
|
|
|
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2014-11-05 19:50:51 +01:00
|
|
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2016-05-04 19:24:41 +02:00
|
|
|
*
|
|
|
|
* A full copy of the GNU General Public License can be found in licence.txt
|
2014-11-05 19:50:51 +01:00
|
|
|
*****************************************************************************/
|
2016-05-04 19:24:41 +02:00
|
|
|
#pragma endregion
|
2014-11-05 19:50:51 +01:00
|
|
|
|
2017-06-11 13:30:00 +02:00
|
|
|
#include <openrct2/audio/audio.h>
|
|
|
|
#include <openrct2/config/Config.h>
|
|
|
|
#include <openrct2/editor.h>
|
|
|
|
#include <openrct2/game.h>
|
|
|
|
#include <openrct2/input.h>
|
|
|
|
#include <openrct2/interface/chat.h>
|
|
|
|
#include <openrct2/interface/Screenshot.h>
|
|
|
|
#include <openrct2/localisation/localisation.h>
|
|
|
|
#include <openrct2/network/network.h>
|
|
|
|
#include <openrct2/platform/platform.h>
|
|
|
|
#include <openrct2/ride/track.h>
|
|
|
|
#include <openrct2/ride/track_paint.h>
|
|
|
|
#include <openrct2/title/TitleScreen.h>
|
|
|
|
#include <openrct2/util/util.h>
|
|
|
|
#include <openrct2/interface/viewport.h>
|
|
|
|
#include <openrct2/interface/widget.h>
|
|
|
|
#include <openrct2/interface/window.h>
|
|
|
|
#include "KeyboardShortcuts.h"
|
2014-11-05 19:50:51 +01:00
|
|
|
|
2016-09-05 22:04:22 +02:00
|
|
|
uint8 gKeyboardShortcutChangeId;
|
|
|
|
|
2014-11-05 19:50:51 +01:00
|
|
|
typedef void (*shortcut_action)();
|
|
|
|
|
|
|
|
static const shortcut_action shortcut_table[SHORTCUT_COUNT];
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2014-11-05 19:50:51 +01:00
|
|
|
* rct2: 0x006E3E68
|
|
|
|
*/
|
2017-01-04 22:17:08 +01:00
|
|
|
void keyboard_shortcut_handle(sint32 key)
|
2014-11-05 19:50:51 +01:00
|
|
|
{
|
2017-06-11 13:30:00 +02:00
|
|
|
sint32 shortcut = keyboard_shortcuts_get_from_key(key);
|
2017-06-06 23:24:18 +02:00
|
|
|
if (shortcut != -1) {
|
|
|
|
keyboard_shortcut_handle_command(shortcut);
|
|
|
|
}
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
2017-01-04 22:17:08 +01:00
|
|
|
void keyboard_shortcut_handle_command(sint32 shortcutIndex)
|
2014-11-05 19:50:51 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (shortcutIndex >= 0 && shortcutIndex < countof(shortcut_table)) {
|
|
|
|
shortcut_action action = shortcut_table[shortcutIndex];
|
|
|
|
if (action != NULL) {
|
|
|
|
action();
|
|
|
|
}
|
|
|
|
}
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#pragma region Shortcut Commands
|
|
|
|
|
2017-01-04 22:17:08 +01:00
|
|
|
static void toggle_view_flag(sint32 viewportFlag)
|
2014-11-05 19:50:51 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window *window;
|
2014-11-05 19:50:51 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window = window_get_main();
|
|
|
|
if (window != NULL) {
|
|
|
|
window->viewport->flags ^= viewportFlag;
|
|
|
|
window_invalidate(window);
|
|
|
|
}
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_close_top_most_window()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_close_top();
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_close_all_floating_windows()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR))
|
|
|
|
window_close_all();
|
|
|
|
else if (gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR)
|
|
|
|
window_close_top();
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_cancel_construction_mode()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2014-11-05 19:50:51 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window *window = window_find_by_class(WC_ERROR);
|
|
|
|
if (window != NULL)
|
|
|
|
window_close(window);
|
|
|
|
else if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE))
|
|
|
|
tool_cancel();
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_pause_game()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_MANAGER))) {
|
|
|
|
rct_window *window = window_find_by_class(WC_TOP_TOOLBAR);
|
|
|
|
if (window != NULL) {
|
|
|
|
window_invalidate(window);
|
|
|
|
window_event_mouse_up_call(window, WC_TOP_TOOLBAR__WIDX_PAUSE);
|
|
|
|
}
|
|
|
|
}
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_zoom_view_out()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
main_window_zoom(false, false);
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_zoom_view_in()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
main_window_zoom(true, false);
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
2015-07-09 14:50:33 +02:00
|
|
|
static void shortcut_rotate_view_clockwise()
|
2014-11-05 19:50:51 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window* w = window_get_main();
|
|
|
|
window_rotate_camera(w, 1);
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
2015-07-09 14:50:33 +02:00
|
|
|
static void shortcut_rotate_view_anticlockwise()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window* w = window_get_main();
|
|
|
|
window_rotate_camera(w, -1);
|
2015-07-09 14:50:33 +02:00
|
|
|
}
|
|
|
|
|
2014-11-05 19:50:51 +01:00
|
|
|
static void shortcut_rotate_construction_object()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Rotate scenery
|
|
|
|
rct_window *w = window_find_by_class(WC_SCENERY);
|
|
|
|
if (w != NULL && !widget_is_disabled(w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON) && w->widgets[WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type != WWT_EMPTY) {
|
|
|
|
window_event_mouse_up_call(w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Rotate construction track piece
|
|
|
|
w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
|
|
|
if (w != NULL && !widget_is_disabled(w, WC_RIDE_CONSTRUCTION__WIDX_ROTATE) && w->widgets[WC_RIDE_CONSTRUCTION__WIDX_ROTATE].type != WWT_EMPTY) {
|
|
|
|
// Check if building a maze...
|
|
|
|
if (w->widgets[WC_RIDE_CONSTRUCTION__WIDX_ROTATE].tooltip != STR_RIDE_CONSTRUCTION_BUILD_MAZE_IN_THIS_DIRECTION_TIP) {
|
|
|
|
window_event_mouse_up_call(w, WC_RIDE_CONSTRUCTION__WIDX_ROTATE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Rotate track design preview
|
|
|
|
w = window_find_by_class(WC_TRACK_DESIGN_LIST);
|
|
|
|
if (w != NULL && !widget_is_disabled(w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE) && w->widgets[WC_TRACK_DESIGN_LIST__WIDX_ROTATE].type != WWT_EMPTY) {
|
|
|
|
window_event_mouse_up_call(w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Rotate track design placement
|
|
|
|
w = window_find_by_class(WC_TRACK_DESIGN_PLACE);
|
|
|
|
if (w != NULL && !widget_is_disabled(w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE) && w->widgets[WC_TRACK_DESIGN_PLACE__WIDX_ROTATE].type != WWT_EMPTY) {
|
|
|
|
window_event_mouse_up_call(w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Rotate park entrance
|
|
|
|
w = window_find_by_class(WC_MAP);
|
|
|
|
if (w != NULL && !widget_is_disabled(w, WC_MAP__WIDX_ROTATE_90) && w->widgets[WC_MAP__WIDX_ROTATE_90].type != WWT_EMPTY) {
|
|
|
|
window_event_mouse_up_call(w, WC_MAP__WIDX_ROTATE_90);
|
|
|
|
return;
|
|
|
|
}
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_underground_view_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
toggle_view_flag(VIEWPORT_FLAG_UNDERGROUND_INSIDE);
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_remove_base_land_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
toggle_view_flag(VIEWPORT_FLAG_HIDE_BASE);
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_remove_vertical_land_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
toggle_view_flag(VIEWPORT_FLAG_HIDE_VERTICAL);
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
2015-06-26 17:01:50 +02:00
|
|
|
static void shortcut_remove_top_bottom_toolbar_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) {
|
|
|
|
if (window_find_by_class(WC_TITLE_LOGO) != NULL) {
|
|
|
|
window_close(window_find_by_class(WC_TITLE_LOGO));
|
|
|
|
window_close(window_find_by_class(WC_TITLE_OPTIONS));
|
|
|
|
window_close(window_find_by_class(WC_TITLE_MENU));
|
|
|
|
window_close(window_find_by_class(WC_TITLE_EXIT));
|
|
|
|
gTitleHideVersionInfo = true;
|
|
|
|
} else {
|
|
|
|
title_create_windows();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (window_find_by_class(WC_TOP_TOOLBAR) != NULL) {
|
|
|
|
window_close(window_find_by_class(WC_DROPDOWN));
|
|
|
|
window_close(window_find_by_class(WC_TOP_TOOLBAR));
|
|
|
|
window_close(window_find_by_class(WC_BOTTOM_TOOLBAR));
|
|
|
|
} else {
|
|
|
|
if (gScreenFlags == 0) {
|
|
|
|
window_top_toolbar_open();
|
|
|
|
window_game_bottom_toolbar_open();
|
|
|
|
} else {
|
|
|
|
window_top_toolbar_open();
|
|
|
|
window_editor_bottom_toolbar_open();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gfx_invalidate_screen();
|
2015-06-26 17:01:50 +02:00
|
|
|
}
|
|
|
|
|
2014-11-05 19:50:51 +01:00
|
|
|
static void shortcut_see_through_rides_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
toggle_view_flag(VIEWPORT_FLAG_SEETHROUGH_RIDES);
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_see_through_scenery_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
toggle_view_flag(VIEWPORT_FLAG_SEETHROUGH_SCENERY);
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
2016-08-15 06:25:02 +02:00
|
|
|
static void shortcut_see_through_paths_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
toggle_view_flag(VIEWPORT_FLAG_SEETHROUGH_PATHS);
|
2016-08-15 06:25:02 +02:00
|
|
|
}
|
|
|
|
|
2014-11-05 19:50:51 +01:00
|
|
|
static void shortcut_invisible_supports_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
toggle_view_flag(VIEWPORT_FLAG_INVISIBLE_SUPPORTS);
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_invisible_people_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
toggle_view_flag(VIEWPORT_FLAG_INVISIBLE_PEEPS);
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_height_marks_on_land_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
toggle_view_flag(VIEWPORT_FLAG_LAND_HEIGHTS);
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_height_marks_on_ride_tracks_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
toggle_view_flag(VIEWPORT_FLAG_TRACK_HEIGHTS);
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_height_marks_on_paths_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
toggle_view_flag(VIEWPORT_FLAG_PATH_HEIGHTS);
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_adjust_land()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2014-11-05 19:50:51 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) {
|
|
|
|
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
|
|
|
rct_window *window = window_find_by_class(WC_TOP_TOOLBAR);
|
|
|
|
if (window != NULL) {
|
|
|
|
window_invalidate(window);
|
|
|
|
window_event_mouse_up_call(window, WC_TOP_TOOLBAR__WIDX_LAND);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_adjust_water()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2014-11-05 19:50:51 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) {
|
|
|
|
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
|
|
|
rct_window *window = window_find_by_class(WC_TOP_TOOLBAR);
|
|
|
|
if (window != NULL) {
|
|
|
|
window_invalidate(window);
|
|
|
|
window_event_mouse_up_call(window, WC_TOP_TOOLBAR__WIDX_WATER);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_build_scenery()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2014-11-05 19:50:51 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) {
|
|
|
|
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
|
|
|
rct_window *window = window_find_by_class(WC_TOP_TOOLBAR);
|
|
|
|
if (window != NULL) {
|
|
|
|
window_invalidate(window);
|
|
|
|
window_event_mouse_up_call(window, WC_TOP_TOOLBAR__WIDX_SCENERY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_build_paths()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2014-11-05 19:50:51 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) {
|
|
|
|
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
|
|
|
rct_window *window = window_find_by_class(WC_TOP_TOOLBAR);
|
|
|
|
if (window != NULL) {
|
|
|
|
window_invalidate(window);
|
|
|
|
window_event_mouse_up_call(window, WC_TOP_TOOLBAR__WIDX_PATH);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_build_new_ride()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2014-11-05 19:50:51 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)) {
|
|
|
|
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
|
|
|
window_new_ride_open();
|
|
|
|
}
|
|
|
|
}
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_show_financial_information()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
|
|
|
|
if (!(gParkFlags & PARK_FLAGS_NO_MONEY))
|
|
|
|
window_finances_open();
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_show_research_information()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
|
|
|
if (gConfigInterface.toolbar_show_research)
|
|
|
|
window_research_open();
|
|
|
|
else
|
|
|
|
window_new_ride_open_research();
|
|
|
|
}
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_show_rides_list()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2014-11-05 19:50:51 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
|
|
|
window_ride_list_open();
|
|
|
|
}
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_show_park_information()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2014-11-05 19:50:51 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
|
|
|
window_park_entrance_open();
|
|
|
|
}
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_show_guest_list()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2014-11-05 19:50:51 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
|
|
|
window_guest_list_open();
|
|
|
|
}
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_show_staff_list()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2014-11-05 19:50:51 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
|
|
|
window_staff_list_open();
|
|
|
|
}
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_show_recent_messages()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
|
|
|
|
window_news_open();
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_show_map()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR)
|
|
|
|
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
|
|
|
|
window_map_open();
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_screenshot()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gScreenshotCountdown = 2;
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_reduce_game_speed()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (network_get_mode() == NETWORK_MODE_NONE)
|
|
|
|
game_reduce_game_speed();
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_increase_game_speed()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (network_get_mode() == NETWORK_MODE_NONE)
|
|
|
|
game_increase_game_speed();
|
2014-11-05 19:50:51 +01:00
|
|
|
}
|
|
|
|
|
2014-11-24 17:38:19 +01:00
|
|
|
static void shortcut_open_cheat_window()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags != SCREEN_FLAGS_PLAYING)
|
|
|
|
return;
|
2014-12-09 20:55:17 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
// Check if window is already open
|
|
|
|
rct_window *window = window_find_by_class(WC_CHEATS);
|
|
|
|
if (window != NULL) {
|
|
|
|
window_close(window);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
window_cheats_open();
|
2014-11-24 17:38:19 +01:00
|
|
|
}
|
|
|
|
|
2015-02-12 17:23:49 +01:00
|
|
|
static void shortcut_open_chat_window()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2016-09-25 01:09:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
chat_toggle();
|
2015-02-12 17:23:49 +01:00
|
|
|
}
|
|
|
|
|
2015-08-20 12:13:08 +02:00
|
|
|
static void shortcut_quick_save_game()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
// Do a quick save in playing mode and a regular save in Scenario Editor mode. In other cases, don't do anything.
|
|
|
|
if (gScreenFlags == SCREEN_FLAGS_PLAYING) {
|
|
|
|
tool_cancel();
|
|
|
|
save_game();
|
|
|
|
}
|
|
|
|
else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) {
|
|
|
|
window_loadsave_open(LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE, gS6Info.name);
|
|
|
|
}
|
2015-08-20 12:13:08 +02:00
|
|
|
}
|
|
|
|
|
2016-01-23 15:15:48 +01:00
|
|
|
static void shortcut_show_options()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_options_open();
|
2016-01-23 15:15:48 +01:00
|
|
|
}
|
|
|
|
|
2016-03-05 00:43:38 +01:00
|
|
|
static void shortcut_mute_sound()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
audio_toggle_all_sounds();
|
2016-03-05 00:43:38 +01:00
|
|
|
}
|
|
|
|
|
2016-05-03 21:07:33 +02:00
|
|
|
static void shortcut_windowed_mode_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
platform_toggle_windowed_mode();
|
2016-05-03 21:07:33 +02:00
|
|
|
}
|
|
|
|
|
2016-05-06 22:14:49 +02:00
|
|
|
static void shortcut_show_multiplayer()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (network_get_mode() != NETWORK_MODE_NONE)
|
|
|
|
window_multiplayer_open();
|
2016-05-06 22:14:49 +02:00
|
|
|
}
|
|
|
|
|
2016-05-24 20:59:37 +02:00
|
|
|
static void shortcut_orginal_painting_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gUseOriginalRidePaint = !gUseOriginalRidePaint;
|
|
|
|
window_invalidate_by_class(WC_DEBUG_PAINT);
|
|
|
|
gfx_invalidate_screen();
|
2016-05-24 20:59:37 +02:00
|
|
|
}
|
|
|
|
|
2016-07-25 23:49:39 +02:00
|
|
|
static void shortcut_debug_paint_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window * window = window_find_by_class(WC_DEBUG_PAINT);
|
|
|
|
if (window != NULL) {
|
|
|
|
window_close(window);
|
|
|
|
} else {
|
|
|
|
window_debug_paint_open();
|
|
|
|
}
|
2016-07-25 23:49:39 +02:00
|
|
|
}
|
|
|
|
|
2017-03-03 09:35:42 +01:00
|
|
|
static void shortcut_ride_construction_turn_left()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2017-03-03 09:35:42 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_ride_construction_keyboard_shortcut_turn_left();
|
2017-03-03 09:35:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_ride_construction_turn_right()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2017-03-03 09:35:42 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_ride_construction_keyboard_shortcut_turn_right();
|
2017-03-03 09:35:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_ride_construction_use_track_default()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2017-03-03 09:35:42 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_ride_construction_keyboard_shortcut_use_track_default();
|
2017-03-03 09:35:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_ride_construction_slope_down()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2017-03-03 09:35:42 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_ride_construction_keyboard_shortcut_slope_down();
|
2017-03-03 09:35:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_ride_construction_slope_up()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2017-03-03 09:35:42 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_ride_construction_keyboard_shortcut_slope_up();
|
2017-03-03 09:35:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_ride_construction_chain_lift_toggle()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2017-03-03 09:35:42 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_ride_construction_keyboard_shortcut_chain_lift_toggle();
|
2017-03-03 09:35:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_ride_construction_bank_left()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2017-03-03 09:35:42 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_ride_construction_keyboard_shortcut_bank_left();
|
2017-03-03 09:35:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_ride_construction_bank_right()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2017-03-03 09:35:42 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_ride_construction_keyboard_shortcut_bank_right();
|
2017-03-03 09:35:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_ride_construction_previous_track()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2017-03-03 09:35:42 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_ride_construction_keyboard_shortcut_previous_track();
|
2017-03-03 09:35:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_ride_construction_next_track()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2017-03-03 09:35:42 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_ride_construction_keyboard_shortcut_next_track();
|
2017-03-03 09:35:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_ride_construction_build_current()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2017-03-03 09:35:42 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_ride_construction_keyboard_shortcut_build_current();
|
2017-03-03 09:35:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void shortcut_ride_construction_demolish_current()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
return;
|
2017-03-03 09:35:42 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_ride_construction_keyboard_shortcut_demolish_current();
|
2017-03-03 09:35:42 +01:00
|
|
|
}
|
|
|
|
|
2017-06-18 19:32:12 +02:00
|
|
|
static void shortcut_load_game()
|
|
|
|
{
|
|
|
|
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
|
|
|
game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-05 19:50:51 +01:00
|
|
|
static const shortcut_action shortcut_table[SHORTCUT_COUNT] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
shortcut_close_top_most_window,
|
|
|
|
shortcut_close_all_floating_windows,
|
|
|
|
shortcut_cancel_construction_mode,
|
|
|
|
shortcut_pause_game,
|
|
|
|
shortcut_zoom_view_out,
|
|
|
|
shortcut_zoom_view_in,
|
|
|
|
shortcut_rotate_view_clockwise,
|
|
|
|
shortcut_rotate_view_anticlockwise,
|
|
|
|
shortcut_rotate_construction_object,
|
|
|
|
shortcut_underground_view_toggle,
|
|
|
|
shortcut_remove_base_land_toggle,
|
|
|
|
shortcut_remove_vertical_land_toggle,
|
|
|
|
shortcut_see_through_rides_toggle,
|
|
|
|
shortcut_see_through_scenery_toggle,
|
|
|
|
shortcut_invisible_supports_toggle,
|
|
|
|
shortcut_invisible_people_toggle,
|
|
|
|
shortcut_height_marks_on_land_toggle,
|
|
|
|
shortcut_height_marks_on_ride_tracks_toggle,
|
|
|
|
shortcut_height_marks_on_paths_toggle,
|
|
|
|
shortcut_adjust_land,
|
|
|
|
shortcut_adjust_water,
|
|
|
|
shortcut_build_scenery,
|
|
|
|
shortcut_build_paths,
|
|
|
|
shortcut_build_new_ride,
|
|
|
|
shortcut_show_financial_information,
|
|
|
|
shortcut_show_research_information,
|
|
|
|
shortcut_show_rides_list,
|
|
|
|
shortcut_show_park_information,
|
|
|
|
shortcut_show_guest_list,
|
|
|
|
shortcut_show_staff_list,
|
|
|
|
shortcut_show_recent_messages,
|
|
|
|
shortcut_show_map,
|
|
|
|
shortcut_screenshot,
|
|
|
|
|
|
|
|
//new
|
|
|
|
shortcut_reduce_game_speed,
|
|
|
|
shortcut_increase_game_speed,
|
|
|
|
shortcut_open_cheat_window,
|
|
|
|
shortcut_remove_top_bottom_toolbar_toggle,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
shortcut_open_chat_window,
|
|
|
|
shortcut_quick_save_game,
|
|
|
|
shortcut_show_options,
|
|
|
|
shortcut_mute_sound,
|
|
|
|
shortcut_windowed_mode_toggle,
|
|
|
|
shortcut_show_multiplayer,
|
|
|
|
shortcut_orginal_painting_toggle,
|
|
|
|
shortcut_debug_paint_toggle,
|
|
|
|
shortcut_see_through_paths_toggle,
|
|
|
|
shortcut_ride_construction_turn_left,
|
|
|
|
shortcut_ride_construction_turn_right,
|
|
|
|
shortcut_ride_construction_use_track_default,
|
|
|
|
shortcut_ride_construction_slope_down,
|
|
|
|
shortcut_ride_construction_slope_up,
|
|
|
|
shortcut_ride_construction_chain_lift_toggle,
|
|
|
|
shortcut_ride_construction_bank_left,
|
|
|
|
shortcut_ride_construction_bank_right,
|
|
|
|
shortcut_ride_construction_previous_track,
|
|
|
|
shortcut_ride_construction_next_track,
|
|
|
|
shortcut_ride_construction_build_current,
|
|
|
|
shortcut_ride_construction_demolish_current,
|
2017-06-18 19:32:12 +02:00
|
|
|
shortcut_load_game,
|
2014-11-05 19:50:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#pragma endregion
|