OpenRCT2/src/openrct2-ui/input/Shortcuts.cpp

921 lines
36 KiB
C++
Raw Normal View History

/*****************************************************************************
* Copyright (c) 2014-2024 OpenRCT2 developers
2015-10-20 20:16:30 +02:00
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
2015-10-20 20:16:30 +02:00
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
2021-01-16 18:39:34 +01:00
#include "ShortcutIds.h"
2020-07-14 00:12:49 +02:00
#include "ShortcutManager.h"
2018-06-22 23:20:31 +02:00
#include <functional>
2020-12-15 00:12:19 +01:00
#include <openrct2-ui/UiContext.h>
#include <openrct2-ui/interface/InGameConsole.h>
2018-06-22 23:20:31 +02:00
#include <openrct2-ui/interface/Viewport.h>
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/interface/Window.h>
#include <openrct2-ui/windows/Window.h>
2017-10-10 10:52:48 +02:00
#include <openrct2/Context.h>
#include <openrct2/Editor.h>
2018-06-22 23:20:31 +02:00
#include <openrct2/Game.h>
#include <openrct2/GameState.h>
2018-06-22 23:20:31 +02:00
#include <openrct2/Input.h>
2017-10-10 10:52:48 +02:00
#include <openrct2/OpenRCT2.h>
#include <openrct2/actions/CheatSetAction.h>
Split actions hpp files into separate h and cpp files (#13548) * Split up SmallSceneryPlace/Remove Added undo function for Remove Scenery * Refactor: Balloon and Banner actions hpp=>h/cpp * Refactor: rename all action *.hpp files to *.cpp This is preparation for separation in later commits. Note that without the complete set of commits in this branch, the code will not build. * Refactor Clear, Climate, Custom, and Footpath actions hpp=>h/cpp * VSCode: add src subdirectories to includePath * Refactor Guest actions hpp=>h/cpp * Refactor Land actions hpp=>h/cpp * Refactor LargeScenery actions hpp=>h/cpp * Refactor Load, Maze, Network actions hpp=>h/cpp * Refactor Park actions hpp=>h/cpp * Refactor/style: move private function declarations in actions *.h Previous action .h files included private function declarations with private member variables, before public function declarations. This commit re-orders the header files to the following order: - public member variables - private member variables - public functions - private functions * Refactor Pause action hpp=>h/cpp * Refactor Peep, Place, Player actions hpp=>h/cpp * Refactor Ride actions hpp=>h/cpp * Refactor Scenario, Set*, Sign* actions hpp=>h/cpp * Refactor SmallScenerySetColourAction hpp=>h/cpp * Refactor Staff actions hpp=>h/cpp * Refactor Surface, Tile, Track* actions hpp=>h/cpp * Refactor Wall and Water actions hpp=>h/cpp * Fix various includes and other compile errors Update includes for tests. Move static function declarations to .h files Add explicit includes to various files that were previously implicit (the required header was a nested include in an action hpp file, and the action .h file does not include that header) Move RideSetStatus string enum to the cpp file to avoid unused imports * Xcode: modify project file for actions refactor * Cleanup whitespace and end-of-file newlines Co-authored-by: duncanspumpkin <duncans_pumpkin@hotmail.co.uk>
2020-12-10 07:39:10 +01:00
#include <openrct2/actions/LoadOrQuitAction.h>
#include <openrct2/actions/PauseToggleAction.h>
#include <openrct2/actions/TileModifyAction.h>
#include <openrct2/audio/audio.h>
#include <openrct2/config/Config.h>
2018-01-06 00:00:39 +01:00
#include <openrct2/interface/Chat.h>
2018-06-22 23:20:31 +02:00
#include <openrct2/interface/Screenshot.h>
2018-01-06 18:32:25 +01:00
#include <openrct2/localisation/Localisation.h>
#include <openrct2/network/network.h>
#include <openrct2/object/WallSceneryEntry.h>
#include <openrct2/platform/Platform.h>
2017-10-17 13:51:47 +02:00
#include <openrct2/ride/Track.h>
2018-01-10 00:00:09 +01:00
#include <openrct2/ride/TrackPaint.h>
2018-03-19 23:28:40 +01:00
#include <openrct2/scenario/Scenario.h>
#include <openrct2/title/TitleScreen.h>
2017-12-13 13:02:24 +01:00
#include <openrct2/util/Util.h>
#include <openrct2/windows/Intent.h>
#include <openrct2/windows/TileInspectorGlobals.h>
2018-03-19 23:28:40 +01:00
#include <openrct2/world/Park.h>
2019-03-24 22:45:42 +01:00
#include <openrct2/world/Scenery.h>
#include <openrct2/world/TileInspector.h>
using namespace OpenRCT2;
2020-12-15 00:12:19 +01:00
using namespace OpenRCT2::Ui;
using namespace OpenRCT2::Ui::Windows;
#pragma region Shortcut Commands
static void OpenWindow(WindowClass wc)
{
2020-12-13 15:29:10 +01:00
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
2017-10-10 10:52:48 +02:00
{
2022-11-06 21:49:07 +01:00
ContextOpenWindow(wc);
}
}
2020-12-13 15:29:10 +01:00
static void RotateCamera(int32_t direction)
{
2020-12-13 15:29:10 +01:00
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
{
ViewportRotateAll(direction);
2020-12-13 15:29:10 +01:00
}
}
2020-12-13 15:29:10 +01:00
static void ToggleViewFlag(int32_t viewportFlag)
{
2020-12-13 15:29:10 +01:00
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
2017-10-10 10:52:48 +02:00
{
auto window = WindowGetMain();
2018-01-04 06:58:44 +01:00
if (window != nullptr)
2017-10-10 10:52:48 +02:00
{
2020-12-13 15:29:10 +01:00
window->viewport->flags ^= viewportFlag;
window->Invalidate();
}
}
}
static void ShortcutRotateConstructionObject()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
// Rotate scenery
WindowBase* w = WindowFindByClass(WindowClass::Scenery);
if (w != nullptr && !WidgetIsDisabled(*w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON)
&& w->widgets[WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type != WindowWidgetType::Empty)
2017-10-10 10:52:48 +02:00
{
w->OnMouseUp(WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON);
return;
}
// Rotate construction track piece
w = WindowFindByClass(WindowClass::RideConstruction);
if (w != nullptr && !WidgetIsDisabled(*w, WC_RIDE_CONSTRUCTION__WIDX_ROTATE)
&& w->widgets[WC_RIDE_CONSTRUCTION__WIDX_ROTATE].type != WindowWidgetType::Empty)
2017-10-10 10:52:48 +02:00
{
// Check if building a maze...
2017-10-10 10:52:48 +02:00
if (w->widgets[WC_RIDE_CONSTRUCTION__WIDX_ROTATE].tooltip != STR_RIDE_CONSTRUCTION_BUILD_MAZE_IN_THIS_DIRECTION_TIP)
{
w->OnMouseUp(WC_RIDE_CONSTRUCTION__WIDX_ROTATE);
return;
}
}
// Rotate track design preview
w = WindowFindByClass(WindowClass::TrackDesignList);
if (w != nullptr && !WidgetIsDisabled(*w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE)
&& w->widgets[WC_TRACK_DESIGN_LIST__WIDX_ROTATE].type != WindowWidgetType::Empty)
2017-10-10 10:52:48 +02:00
{
w->OnMouseUp(WC_TRACK_DESIGN_LIST__WIDX_ROTATE);
return;
}
// Rotate track design placement
w = WindowFindByClass(WindowClass::TrackDesignPlace);
if (w != nullptr && !WidgetIsDisabled(*w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE)
&& w->widgets[WC_TRACK_DESIGN_PLACE__WIDX_ROTATE].type != WindowWidgetType::Empty)
2017-10-10 10:52:48 +02:00
{
w->OnMouseUp(WC_TRACK_DESIGN_PLACE__WIDX_ROTATE);
return;
}
// Rotate park entrance
w = WindowFindByClass(WindowClass::Map);
if (w != nullptr && !WidgetIsDisabled(*w, WC_MAP__WIDX_ROTATE_90)
&& w->widgets[WC_MAP__WIDX_ROTATE_90].type != WindowWidgetType::Empty)
2017-10-10 10:52:48 +02:00
{
w->OnMouseUp(WC_MAP__WIDX_ROTATE_90);
return;
}
// Rotate selected element in tile inspector
w = WindowFindByClass(WindowClass::TileInspector);
if (w != nullptr && !WidgetIsDisabled(*w, WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE)
&& w->widgets[WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE].type != WindowWidgetType::Empty)
{
w->OnMouseUp(WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE);
return;
}
}
static void ShortcutRemoveTopBottomToolbarToggle()
2015-06-26 17:01:50 +02:00
{
2017-10-10 10:52:48 +02:00
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
{
if (WindowFindByClass(WindowClass::TitleLogo) != nullptr)
2017-10-10 10:52:48 +02:00
{
WindowCloseByClass(WindowClass::TitleLogo);
WindowCloseByClass(WindowClass::TitleOptions);
WindowCloseByClass(WindowClass::TitleMenu);
WindowCloseByClass(WindowClass::TitleExit);
TitleSetHideVersionInfo(true);
2017-10-10 10:52:48 +02:00
}
else
{
TitleCreateWindows();
}
2017-10-10 10:52:48 +02:00
}
else
{
if (WindowFindByClass(WindowClass::TopToolbar) != nullptr)
2017-10-10 10:52:48 +02:00
{
WindowCloseByClass(WindowClass::Dropdown);
WindowCloseByClass(WindowClass::TopToolbar);
WindowCloseByClass(WindowClass::BottomToolbar);
2017-10-10 10:52:48 +02:00
}
else
{
if (gScreenFlags == 0)
{
2022-11-06 21:49:07 +01:00
ContextOpenWindow(WindowClass::TopToolbar);
ContextOpenWindow(WindowClass::BottomToolbar);
2017-10-10 10:52:48 +02:00
}
else
{
2022-11-06 21:49:07 +01:00
ContextOpenWindow(WindowClass::TopToolbar);
ContextOpenWindowView(WV_EDITOR_BOTTOM_TOOLBAR);
}
}
}
GfxInvalidateScreen();
2015-06-26 17:01:50 +02:00
}
static void ShortcutAdjustLand()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().EditorStep == EditorStep::LandscapeEditor)
2017-10-10 10:52:48 +02:00
{
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
{
WindowBase* window = WindowFindByClass(WindowClass::TopToolbar);
2018-01-04 06:58:44 +01:00
if (window != nullptr)
2017-10-10 10:52:48 +02:00
{
window->Invalidate();
window->OnMouseUp(WC_TOP_TOOLBAR__WIDX_LAND);
}
}
}
}
static void ShortcutAdjustWater()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().EditorStep == EditorStep::LandscapeEditor)
2017-10-10 10:52:48 +02:00
{
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
{
WindowBase* window = WindowFindByClass(WindowClass::TopToolbar);
2018-01-04 06:58:44 +01:00
if (window != nullptr)
2017-10-10 10:52:48 +02:00
{
window->Invalidate();
window->OnMouseUp(WC_TOP_TOOLBAR__WIDX_WATER);
}
}
}
}
static void ShortcutBuildScenery()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().EditorStep == EditorStep::LandscapeEditor)
2017-10-10 10:52:48 +02:00
{
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
{
WindowBase* window = WindowFindByClass(WindowClass::TopToolbar);
2018-01-04 06:58:44 +01:00
if (window != nullptr)
2017-10-10 10:52:48 +02:00
{
window->Invalidate();
window->OnMouseUp(WC_TOP_TOOLBAR__WIDX_SCENERY);
}
}
}
}
static void ShortcutBuildPaths()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().EditorStep == EditorStep::LandscapeEditor)
2017-10-10 10:52:48 +02:00
{
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
{
ContextOpenWindow(WindowClass::Footpath);
}
}
}
static void ShortcutBuildNewRide()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
2017-10-10 10:52:48 +02:00
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR))
{
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
{
2022-11-06 21:49:07 +01:00
ContextOpenWindow(WindowClass::ConstructRide);
}
}
}
static void ShortcutShowFinancialInformation()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
2022-11-06 21:49:07 +01:00
ContextOpenWindow(WindowClass::Finances);
}
static void ShortcutShowResearchInformation()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR))
2017-10-10 10:52:48 +02:00
{
2022-11-06 21:49:07 +01:00
ContextOpenWindowView(WV_RIDE_RESEARCH);
}
}
static void ShortcutShowRidesList()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR))
2017-10-10 10:52:48 +02:00
{
2022-11-06 21:49:07 +01:00
ContextOpenWindow(WindowClass::RideList);
}
}
static void ShortcutShowParkInformation()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR))
2017-10-10 10:52:48 +02:00
{
2022-11-06 21:49:07 +01:00
ContextOpenWindow(WindowClass::ParkInformation);
}
}
static void ShortcutShowGuestList()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR))
2017-10-10 10:52:48 +02:00
{
2022-11-06 21:49:07 +01:00
ContextOpenWindow(WindowClass::GuestList);
}
}
static void ShortcutShowStaffList()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR))
2017-10-10 10:52:48 +02:00
{
2022-11-06 21:49:07 +01:00
ContextOpenWindow(WindowClass::StaffList);
}
}
static void ShortcutShowRecentMessages()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR))
2022-11-06 21:49:07 +01:00
ContextOpenWindow(WindowClass::RecentNews);
}
static void ShortcutShowMap()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().EditorStep == EditorStep::LandscapeEditor)
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
2022-11-06 21:49:07 +01:00
ContextOpenWindow(WindowClass::Map);
}
static void ShortcutReduceGameSpeed()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
if (NetworkGetMode() == NETWORK_MODE_NONE)
GameReduceGameSpeed();
}
static void ShortcutIncreaseGameSpeed()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
if (NetworkGetMode() == NETWORK_MODE_NONE)
GameIncreaseGameSpeed();
}
static void ShortcutOpenCheatWindow()
{
if (gScreenFlags != SCREEN_FLAGS_PLAYING)
return;
// Check if window is already open
WindowBase* window = WindowFindByClass(WindowClass::Cheats);
2018-01-04 06:58:44 +01:00
if (window != nullptr)
2017-10-10 10:52:48 +02:00
{
WindowClose(*window);
return;
}
2022-11-06 21:49:07 +01:00
ContextOpenWindow(WindowClass::Cheats);
}
static void ShortcutOpenKeyboardShortcutsWindow()
{
ShortcutKeysOpen();
}
static void ShortcutOpenTransparencyWindow()
{
if (gScreenFlags != SCREEN_FLAGS_PLAYING)
return;
2022-11-06 21:49:07 +01:00
ContextOpenWindow(WindowClass::Transparency);
}
static void ShortcutClearScenery()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
2017-10-10 10:52:48 +02:00
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().EditorStep == EditorStep::LandscapeEditor)
2017-10-10 10:52:48 +02:00
{
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
{
WindowBase* window = WindowFindByClass(WindowClass::TopToolbar);
2018-01-04 06:58:44 +01:00
if (window != nullptr)
2017-10-10 10:52:48 +02:00
{
window->Invalidate();
window->OnMouseUp(WC_TOP_TOOLBAR__WIDX_CLEAR_SCENERY);
}
}
}
}
static void ShortcutQuickSaveGame()
{
// Do a quick save in playing mode and a regular save in Scenario Editor mode. In other cases, don't do anything.
2017-10-10 10:52:48 +02:00
if (gScreenFlags == SCREEN_FLAGS_PLAYING)
{
ToolCancel();
SaveGame();
}
2017-10-10 10:52:48 +02:00
else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
{
auto intent = Intent(WindowClass::Loadsave);
intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE);
intent.PutExtra(INTENT_EXTRA_PATH, GetGameState().ScenarioName);
2022-11-06 21:49:07 +01:00
ContextOpenIntent(&intent);
}
}
static void ShortcutLoadGame()
2017-06-18 19:32:12 +02:00
{
2017-10-10 10:52:48 +02:00
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
{
2019-02-21 10:34:30 +01:00
auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::OpenSavePrompt);
GameActions::Execute(&loadOrQuitAction);
2017-06-18 19:32:12 +02:00
}
}
static void ShortcutOpenSceneryPicker()
2019-03-24 22:45:42 +01:00
{
if ((gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))
|| (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && GetGameState().EditorStep != EditorStep::LandscapeEditor))
2019-03-24 22:45:42 +01:00
return;
WindowBase* window_scenery = WindowFindByClass(WindowClass::Scenery);
2019-03-24 22:45:42 +01:00
if (window_scenery == nullptr)
{
WindowBase* window_toolbar = WindowFindByClass(WindowClass::TopToolbar);
2019-03-24 22:45:42 +01:00
if (window_toolbar != nullptr)
{
window_toolbar->Invalidate();
window_toolbar->OnMouseUp(WC_TOP_TOOLBAR__WIDX_SCENERY);
2019-03-24 22:45:42 +01:00
}
}
window_scenery = WindowFindByClass(WindowClass::Scenery);
if (window_scenery != nullptr && !WidgetIsDisabled(*window_scenery, WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON)
2019-03-24 22:45:42 +01:00
&& !gWindowSceneryEyedropperEnabled)
{
window_scenery->OnMouseUp(WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON);
2019-03-24 22:45:42 +01:00
return;
}
}
static void ShortcutScaleUp()
{
gConfigGeneral.WindowScale += 0.25f;
ConfigSaveDefault();
GfxInvalidateScreen();
2022-11-06 21:49:07 +01:00
ContextTriggerResize();
ContextUpdateCursorScale();
}
static void ShortcutScaleDown()
{
gConfigGeneral.WindowScale -= 0.25f;
gConfigGeneral.WindowScale = std::max(0.5f, gConfigGeneral.WindowScale);
ConfigSaveDefault();
GfxInvalidateScreen();
2022-11-06 21:49:07 +01:00
ContextTriggerResize();
ContextUpdateCursorScale();
}
// Tile inspector shortcuts
2022-08-21 18:49:23 +02:00
static void TileInspectorMouseUp(WidgetIndex widgetIndex)
{
auto w = WindowFindByClass(WindowClass::TileInspector);
if (w != nullptr && !WidgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WindowWidgetType::Empty)
{
w->OnMouseUp(widgetIndex);
}
}
2022-08-21 18:49:23 +02:00
static void TileInspectorMouseDown(WidgetIndex widgetIndex)
{
auto w = WindowFindByClass(WindowClass::TileInspector);
if (w != nullptr && !WidgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WindowWidgetType::Empty)
{
w->OnMouseDown(widgetIndex);
}
}
static void ShortcutToggleWallSlope()
{
WindowBase* window = WindowFindByClass(WindowClass::TileInspector);
if (window == nullptr)
{
return;
}
const TileElement* tileElement = OpenRCT2::TileInspector::GetSelectedElement();
// Ensure an element is selected and it's a wall
if (tileElement == nullptr || tileElement->GetType() != TileElementType::Wall)
{
return;
}
// Ensure a wall can be built on a slope
if (tileElement->AsWall()->GetEntry()->flags & WALL_SCENERY_CANT_BUILD_ON_SLOPE)
{
return;
}
int32_t currSlopeValue = tileElement->AsWall()->GetSlope();
int32_t newSlopeValue = (currSlopeValue + 1) % 3;
extern TileCoordsXY windowTileInspectorTile;
auto modifyTile = TileModifyAction(
windowTileInspectorTile.ToCoordsXY(), TileModifyType::WallSetSlope, windowTileInspectorSelectedIndex, newSlopeValue);
GameActions::Execute(&modifyTile);
}
static void ShortcutIncreaseElementHeight()
{
WindowBase* w = WindowFindByClass(WindowClass::TileInspector);
if (w != nullptr)
{
int action = -1;
switch (EnumValue(w->tileInspectorPage))
{
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_SURFACE:
action = WC_TILE_INSPECTOR__WIDX_SURFACE_SPINNER_HEIGHT_INCREASE;
break;
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_PATH:
action = WC_TILE_INSPECTOR__WIDX_PATH_SPINNER_HEIGHT_INCREASE;
break;
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_TRACK:
action = WC_TILE_INSPECTOR__WIDX_TRACK_SPINNER_HEIGHT_INCREASE;
break;
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_SCENERY:
action = WC_TILE_INSPECTOR__WIDX_SCENERY_SPINNER_HEIGHT_INCREASE;
break;
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_ENTRANCE:
action = WC_TILE_INSPECTOR__WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE;
break;
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_WALL:
action = WC_TILE_INSPECTOR__WIDX_WALL_SPINNER_HEIGHT_INCREASE;
break;
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_LARGE_SCENERY:
action = WC_TILE_INSPECTOR__WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE;
break;
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_BANNER:
action = WC_TILE_INSPECTOR__WIDX_BANNER_SPINNER_HEIGHT_INCREASE;
break;
}
if (action != -1 && !WidgetIsDisabled(*w, action) && w->widgets[action].type != WindowWidgetType::Empty)
w->OnMouseDown(action);
return;
}
}
static void ShortcutDecreaseElementHeight()
{
WindowBase* w = WindowFindByClass(WindowClass::TileInspector);
if (w != nullptr)
{
int action = -1;
switch (EnumValue(w->tileInspectorPage))
{
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_SURFACE:
action = WC_TILE_INSPECTOR__WIDX_SURFACE_SPINNER_HEIGHT_DECREASE;
break;
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_PATH:
action = WC_TILE_INSPECTOR__WIDX_PATH_SPINNER_HEIGHT_DECREASE;
break;
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_TRACK:
action = WC_TILE_INSPECTOR__WIDX_TRACK_SPINNER_HEIGHT_DECREASE;
break;
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_SCENERY:
action = WC_TILE_INSPECTOR__WIDX_SCENERY_SPINNER_HEIGHT_DECREASE;
break;
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_ENTRANCE:
action = WC_TILE_INSPECTOR__WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE;
break;
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_WALL:
action = WC_TILE_INSPECTOR__WIDX_WALL_SPINNER_HEIGHT_DECREASE;
break;
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_LARGE_SCENERY:
action = WC_TILE_INSPECTOR__WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE;
break;
case WC_TILE_INSPECTOR__TILE_INSPECTOR_PAGE_BANNER:
action = WC_TILE_INSPECTOR__WIDX_BANNER_SPINNER_HEIGHT_DECREASE;
break;
}
if (action != -1 && !WidgetIsDisabled(*w, action) && w->widgets[action].type != WindowWidgetType::Empty)
w->OnMouseDown(action);
return;
}
}
static void ShortcutToggleClearanceChecks()
{
2024-03-03 22:44:15 +01:00
auto cheatSetAction = CheatSetAction(
CheatType::DisableClearanceChecks, GetGameState().Cheats.DisableClearanceChecks ? 0 : 1);
GameActions::Execute(&cheatSetAction);
}
2020-12-15 00:12:19 +01:00
static void ShortcutToggleConsole()
{
auto& console = GetInGameConsole();
if (console.IsOpen())
{
console.Toggle();
}
2022-11-06 21:49:07 +01:00
else if (gConfigGeneral.DebuggingTools && !ContextIsInputActive())
2020-12-15 00:12:19 +01:00
{
WindowCancelTextbox();
2020-12-15 00:12:19 +01:00
console.Toggle();
}
}
static void ShortcutConstructionTurnLeft()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
WindowBase* window = WindowFindByClass(WindowClass::Footpath);
if (window != nullptr)
{
WindowFootpathKeyboardShortcutTurnLeft();
}
else
{
WindowRideConstructionKeyboardShortcutTurnLeft();
}
}
static void ShortcutConstructionTurnRight()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
WindowBase* window = WindowFindByClass(WindowClass::Footpath);
if (window != nullptr)
{
WindowFootpathKeyboardShortcutTurnRight();
}
else
{
WindowRideConstructionKeyboardShortcutTurnRight();
}
}
static void ShortcutConstructionSlopeUp()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
WindowBase* window = WindowFindByClass(WindowClass::Footpath);
if (window != nullptr)
{
WindowFootpathKeyboardShortcutSlopeUp();
}
else
{
WindowRideConstructionKeyboardShortcutSlopeUp();
}
}
static void ShortcutConstructionBuildCurrent()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
WindowBase* window = WindowFindByClass(WindowClass::Footpath);
if (window != nullptr)
{
WindowFootpathKeyboardShortcutBuildCurrent();
}
else
{
WindowRideConstructionKeyboardShortcutBuildCurrent();
}
}
static void ShortcutConstructionSlopeDown()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
WindowBase* window = WindowFindByClass(WindowClass::Footpath);
if (window != nullptr)
{
WindowFootpathKeyboardShortcutSlopeDown();
}
else
{
WindowRideConstructionKeyboardShortcutSlopeDown();
}
}
static void ShortcutConstructionDemolishCurrent()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
WindowBase* window = WindowFindByClass(WindowClass::Footpath);
if (window != nullptr)
{
WindowFootpathKeyboardShortcutDemolishCurrent();
}
else
{
WindowRideConstructionKeyboardShortcutDemolishCurrent();
}
}
2021-05-24 16:54:30 +02:00
static void ShortcutToggleTransparentWater()
{
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
return;
gConfigGeneral.TransparentWater ^= 1;
ConfigSaveDefault();
GfxInvalidateScreen();
2021-05-24 16:54:30 +02:00
}
#pragma endregion
2020-07-14 00:12:49 +02:00
2020-07-15 01:40:29 +02:00
using namespace OpenRCT2::Ui;
2020-07-14 00:12:49 +02:00
void ShortcutManager::RegisterDefaultShortcuts()
{
// clang-format off
2021-02-16 21:48:05 +01:00
// Interface
RegisterShortcut(ShortcutId::InterfaceCloseTop, STR_SHORTCUT_CLOSE_TOP_MOST_WINDOW, "BACKSPACE", WindowCloseTop);
RegisterShortcut(ShortcutId::InterfaceCloseAll, STR_SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS, "SHIFT+BACKSPACE", []() {
2020-07-14 00:12:49 +02:00
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR))
2020-12-13 15:29:10 +01:00
{
WindowCloseAll();
2020-12-13 15:29:10 +01:00
}
else if (GetGameState().EditorStep == EditorStep::LandscapeEditor)
2020-12-13 15:29:10 +01:00
{
WindowCloseTop();
2020-12-13 15:29:10 +01:00
}
});
RegisterShortcut(ShortcutId::InterfaceRotateConstruction, STR_SHORTCUT_ROTATE_CONSTRUCTION_OBJECT, "Z", ShortcutRotateConstructionObject);
RegisterShortcut(ShortcutId::InterfaceCancelConstruction, STR_SHORTCUT_CANCEL_CONSTRUCTION_MODE, "ESCAPE", []() {
2020-12-13 15:29:10 +01:00
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
{
auto window = WindowFindByClass(WindowClass::Error);
2020-12-13 15:29:10 +01:00
if (window != nullptr)
{
WindowClose(*window);
2020-12-13 15:29:10 +01:00
}
else if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))
2020-12-13 15:29:10 +01:00
{
ToolCancel();
2020-12-13 15:29:10 +01:00
}
}
});
RegisterShortcut(ShortcutId::InterfacePause, STR_SHORTCUT_PAUSE_GAME, "PAUSE", []() {
if (!(gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_MANAGER)))
{
auto pauseToggleAction = PauseToggleAction();
GameActions::Execute(&pauseToggleAction);
}
2021-02-16 21:48:05 +01:00
});
RegisterShortcut(ShortcutId::InterfaceDecreaseSpeed, STR_SHORTCUT_REDUCE_GAME_SPEED, "-", ShortcutReduceGameSpeed);
RegisterShortcut(ShortcutId::InterfaceIncreaseSpeed, STR_SHORTCUT_INCREASE_GAME_SPEED, "=", ShortcutIncreaseGameSpeed);
RegisterShortcut(ShortcutId::InterfaceToggleToolbars, STR_SHORTCUT_TOGGLE_VISIBILITY_OF_TOOLBARS, "T", ShortcutRemoveTopBottomToolbarToggle);
RegisterShortcut(ShortcutId::InterfaceScreenshot, STR_SHORTCUT_SCREENSHOT, "CTRL+S", []() { gScreenshotCountdown = 2; });
RegisterShortcut(ShortcutId::InterfaceGiantScreenshot, STR_SHORTCUT_GIANT_SCREENSHOT, "CTRL+SHIFT+S", ScreenshotGiant);
RegisterShortcut(ShortcutId::InterfaceLoadGame, STR_LOAD_GAME, "CTRL+L", ShortcutLoadGame);
RegisterShortcut(ShortcutId::InterfaceSaveGame, STR_SAVE_GAME, "CTRL+F10", ShortcutQuickSaveGame);
RegisterShortcut(ShortcutId::InterfaceMute, STR_SHORTCUT_MUTE_SOUND, OpenRCT2::Audio::ToggleAllSounds);
RegisterShortcut(ShortcutId::InterfaceSceneryPicker, STR_SHORTCUT_OPEN_SCENERY_PICKER, ShortcutOpenSceneryPicker);
RegisterShortcut(
ShortcutId::InterfaceDisableClearance, STR_SHORTCUT_TOGGLE_CLEARANCE_CHECKS, ShortcutToggleClearanceChecks);
RegisterShortcut(ShortcutId::InterfaceMultiplayerChat, STR_SEND_MESSAGE, "C", []() {
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) && ChatAvailable())
2021-02-16 21:48:05 +01:00
{
ChatToggle();
2021-02-16 21:48:05 +01:00
}
});
RegisterShortcut(ShortcutId::InterfaceScaleToggleWindowMode, STR_SHORTCUT_WINDOWED_MODE_TOGGLE, "ALT+RETURN", ToggleWindowedMode);
RegisterShortcut(ShortcutId::InterfaceScaleIncrease, STR_SHORTCUT_SCALE_UP, ShortcutScaleUp);
RegisterShortcut(ShortcutId::InterfaceScaleDecrease, STR_SHORTCUT_SCALE_DOWN, ShortcutScaleDown);
RegisterShortcut(ShortcutId::InterfaceOpenLand, STR_SHORTCUT_ADJUST_LAND, "F1", ShortcutAdjustLand);
RegisterShortcut(ShortcutId::InterfaceOpenWater, STR_SHORTCUT_ADJUST_WATER, "F2", ShortcutAdjustWater);
RegisterShortcut(ShortcutId::InterfaceClearScenery, STR_SHORTCUT_CLEAR_SCENERY, "B", ShortcutClearScenery);
RegisterShortcut(ShortcutId::InterfaceOpenScenery, STR_SHORTCUT_BUILD_SCENERY, "F3", ShortcutBuildScenery);
RegisterShortcut(ShortcutId::InterfaceOpenFootpaths, STR_SHORTCUT_BUILD_PATHS, "F4", ShortcutBuildPaths);
RegisterShortcut(ShortcutId::InterfaceOpenNewRide, STR_SHORTCUT_BUILD_NEW_RIDE, "F5", ShortcutBuildNewRide);
RegisterShortcut(ShortcutId::InterfaceOpenFinances, STR_SHORTCUT_SHOW_FINANCIAL_INFORMATION, "F", ShortcutShowFinancialInformation);
RegisterShortcut(ShortcutId::InterfaceOpenResearch, STR_SHORTCUT_SHOW_RESEARCH_INFORMATION, "D", ShortcutShowResearchInformation);
RegisterShortcut(ShortcutId::InterfaceOpenRides, STR_SHORTCUT_SHOW_RIDES_LIST, "R", ShortcutShowRidesList);
RegisterShortcut(ShortcutId::InterfaceOpenPark, STR_SHORTCUT_SHOW_PARK_INFORMATION, "P", ShortcutShowParkInformation);
RegisterShortcut(ShortcutId::InterfaceOpenGuests, STR_SHORTCUT_SHOW_GUEST_LIST, "G", ShortcutShowGuestList);
RegisterShortcut(ShortcutId::InterfaceOpenStaff, STR_SHORTCUT_SHOW_STAFF_LIST, "S", ShortcutShowStaffList);
RegisterShortcut(ShortcutId::InterfaceOpenMessages, STR_SHORTCUT_SHOW_RECENT_MESSAGES, "M", ShortcutShowRecentMessages);
RegisterShortcut(ShortcutId::InterfaceOpenMap, STR_SHORTCUT_SHOW_MAP, "TAB", ShortcutShowMap);
RegisterShortcut(ShortcutId::InterfaceShowOptions, STR_SHORTCUT_SHOW_OPTIONS, std::bind(ContextOpenWindow, WindowClass::Options));
RegisterShortcut(ShortcutId::InterfaceOpenKeyboardShortcuts, STR_SHORTCUT_OPEN_KEYBOARD_SHORTCUTS_WINDOW, "SHIFT+/", ShortcutOpenKeyboardShortcutsWindow);
RegisterShortcut(ShortcutId::InterfaceOpenTransparencyOptions, STR_SHORTCUT_OPEN_TRANSPARENCY_OPTIONS, "CTRL+T", ShortcutOpenTransparencyWindow);
RegisterShortcut(ShortcutId::InterfaceOpenCheats, STR_SHORTCUT_OPEN_CHEATS_WINDOW, "CTRL+ALT+C", ShortcutOpenCheatWindow);
2021-02-16 21:48:05 +01:00
RegisterShortcut(ShortcutId::InterfaceOpenTileInspector, STR_SHORTCUT_OPEN_TILE_INSPECTOR, []() {
if (gConfigInterface.ToolbarShowCheats)
{
OpenWindow(WindowClass::TileInspector);
}
2022-05-27 01:18:13 +02:00
});
RegisterShortcut(ShortcutId::InterfaceMultiplayerShow, STR_SHORTCUT_SHOW_MULTIPLAYER, []() {
if (NetworkGetMode() != NETWORK_MODE_NONE)
{
OpenWindow(WindowClass::Multiplayer);
}
2020-12-13 15:29:10 +01:00
});
2020-12-13 15:29:10 +01:00
// View
RegisterShortcut(ShortcutId::ViewGeneralZoomOut, STR_SHORTCUT_ZOOM_VIEW_OUT, "PAGEUP", std::bind(MainWindowZoom, false, false));
RegisterShortcut(ShortcutId::ViewGeneralZoomIn, STR_SHORTCUT_ZOOM_VIEW_IN, "PAGEDOWN", std::bind(MainWindowZoom, true, false));
RegisterShortcut(ShortcutId::ViewGeneralRotateClockwise, STR_SHORTCUT_ROTATE_VIEW_CLOCKWISE, "RETURN", "MOUSE 6", std::bind(RotateCamera, 1));
RegisterShortcut(ShortcutId::ViewGeneralRotateAnticlockwise, STR_SHORTCUT_ROTATE_VIEW_ANTICLOCKWISE, "SHIFT+RETURN", "MOUSE 5", std::bind(RotateCamera, -1));
2022-05-27 01:18:13 +02:00
RegisterShortcut(ShortcutId::ViewScrollUp, STR_SHORTCUT_SCROLL_MAP_UP, "UP", []() {});
RegisterShortcut(ShortcutId::ViewScrollLeft, STR_SHORTCUT_SCROLL_MAP_LEFT, "LEFT", []() {});
RegisterShortcut(ShortcutId::ViewScrollRight, STR_SHORTCUT_SCROLL_MAP_RIGHT, "RIGHT", []() {});
RegisterShortcut(ShortcutId::ViewScrollDown, STR_SHORTCUT_SCROLL_MAP_DOWN, "DOWN", []() {});
RegisterShortcut(ShortcutId::ViewToggleUnderground, STR_SHORTCUT_UNDERGROUND_VIEW_TOGGLE, "1", std::bind(ToggleViewFlag, VIEWPORT_FLAG_UNDERGROUND_INSIDE));
RegisterShortcut(ShortcutId::ViewToggleTransparentWater, STR_VIEWPORT_TRANSPARENT_WATER, "2", ShortcutToggleTransparentWater);
RegisterShortcut(ShortcutId::ViewToggleBaseLand, STR_SHORTCUT_REMOVE_BASE_LAND_TOGGLE, "H", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_BASE));
RegisterShortcut(ShortcutId::ViewToggleVerticalLand, STR_SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE, "V", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_VERTICAL));
RegisterShortcut(ShortcutId::ViewToggleRides, STR_SHORTCUT_SEE_THROUGH_RIDES_TOGGLE, "3", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_RIDES));
RegisterShortcut(ShortcutId::ViewToggleVehicles, STR_SHORTCUT_SEE_THROUGH_VEHICLES_TOGGLE, std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_VEHICLES));
RegisterShortcut(ShortcutId::ViewToggleVegetation, STR_SHORTCUT_SEE_THROUGH_VEGETATION_TOGGLE, std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_VEGETATION));
RegisterShortcut(ShortcutId::ViewToggleScenery, STR_SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE, "4", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_SCENERY));
RegisterShortcut(ShortcutId::ViewToggleFootpaths, STR_SHORTCUT_SEE_THROUGH_PATHS_TOGGLE, std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_PATHS));
RegisterShortcut(ShortcutId::ViewToggleSupports, STR_SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE, "5", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_SUPPORTS));
RegisterShortcut(ShortcutId::ViewToggleGuests, STR_SHORTCUT_SEE_THROUGH_GUESTS_TOGGLE, "6", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_GUESTS));
RegisterShortcut(ShortcutId::ViewToggleStaff, STR_SHORTCUT_SEE_THROUGH_STAFF_TOGGLE, std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_STAFF));
RegisterShortcut(ShortcutId::ViewToggleLandHeightMarkers, STR_SHORTCUT_HEIGHT_MARKS_ON_LAND_TOGGLE, "8", std::bind(ToggleViewFlag, VIEWPORT_FLAG_LAND_HEIGHTS));
RegisterShortcut(ShortcutId::ViewToggleTrackHeightMarkers, STR_SHORTCUT_HEIGHT_MARKS_ON_RIDE_TRACKS_TOGGLE, "9", std::bind(ToggleViewFlag, VIEWPORT_FLAG_TRACK_HEIGHTS));
RegisterShortcut(ShortcutId::ViewToggleFootpathHeightMarkers, STR_SHORTCUT_HEIGHT_MARKS_ON_PATHS_TOGGLE, "0", std::bind(ToggleViewFlag, VIEWPORT_FLAG_PATH_HEIGHTS));
RegisterShortcut(ShortcutId::ViewToggleGridlines, STR_SHORTCUT_GRIDLINES_DISPLAY_TOGGLE, "7", std::bind(ToggleViewFlag, VIEWPORT_FLAG_GRIDLINES));
RegisterShortcut(ShortcutId::ViewToggleCutAway, STR_SHORTCUT_VIEW_CLIPPING, std::bind(OpenWindow, WindowClass::ViewClipping));
RegisterShortcut(ShortcutId::ViewToogleFootpathIssues, STR_SHORTCUT_HIGHLIGHT_PATH_ISSUES_TOGGLE, "I", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES));
2020-12-13 15:29:10 +01:00
2021-02-16 21:48:05 +01:00
// Window
RegisterShortcut(ShortcutId::WindowRideConstructionTurnLeft, STR_SHORTCUT_CONSTRUCTION_TURN_LEFT, "NUMPAD 4", ShortcutConstructionTurnLeft);
RegisterShortcut(ShortcutId::WindowRideConstructionTurnRight, STR_SHORTCUT_CONSTRUCTION_TURN_RIGHT, "NUMPAD 6", ShortcutConstructionTurnRight);
RegisterShortcut(ShortcutId::WindowRideConstructionDefault, STR_SHORTCUT_CONSTRUCTION_USE_TRACK_DEFAULT, "NUMPAD 5", WindowRideConstructionKeyboardShortcutUseTrackDefault);
RegisterShortcut(ShortcutId::WindowRideConstructionSlopeDown, STR_SHORTCUT_CONSTRUCTION_SLOPE_DOWN, "NUMPAD 2", ShortcutConstructionSlopeDown);
RegisterShortcut(ShortcutId::WindowRideConstructionSlopeUp, STR_SHORTCUT_CONSTRUCTION_SLOPE_UP, "NUMPAD 8", ShortcutConstructionSlopeUp);
RegisterShortcut(ShortcutId::WindowRideConstructionChainLift, STR_SHORTCUT_CONSTRUCTION_CHAIN_LIFT_TOGGLE, "NUMPAD +", WindowRideConstructionKeyboardShortcutChainLiftToggle);
RegisterShortcut(ShortcutId::WindowRideConstructionBankLeft, STR_SHORTCUT_CONSTRUCTION_BANK_LEFT, "NUMPAD 1", WindowRideConstructionKeyboardShortcutBankLeft);
RegisterShortcut(ShortcutId::WindowRideConstructionBankRight, STR_SHORTCUT_CONSTRUCTION_BANK_RIGHT, "NUMPAD 3", WindowRideConstructionKeyboardShortcutBankRight);
RegisterShortcut(ShortcutId::WindowRideConstructionPrevious, STR_SHORTCUT_CONSTRUCTION_PREVIOUS_TRACK, "NUMPAD 7", WindowRideConstructionKeyboardShortcutPreviousTrack);
RegisterShortcut(ShortcutId::WindowRideConstructionNext, STR_SHORTCUT_CONSTRUCTION_NEXT_TRACK, "NUMPAD 9", WindowRideConstructionKeyboardShortcutNextTrack);
RegisterShortcut(ShortcutId::WindowRideConstructionBuild, STR_SHORTCUT_CONSTRUCTION_BUILD_CURRENT, "NUMPAD 0", ShortcutConstructionBuildCurrent);
RegisterShortcut(ShortcutId::WindowRideConstructionDemolish, STR_SHORTCUT_CONSTRUCTION_DEMOLISH_CURRENT, "NUMPAD -", ShortcutConstructionDemolishCurrent);
2023-10-07 16:36:47 +02:00
RegisterShortcut(ShortcutId::WindowTileInspectorToggleInvisibility, STR_SHORTCUT_TOGGLE_INVISIBILITY, WindowTileInspectorKeyboardShortcutToggleInvisibility);
RegisterShortcut(ShortcutId::WindowTileInspectorCopy, STR_SHORTCUT_COPY_ELEMENT, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_COPY));
RegisterShortcut(ShortcutId::WindowTileInspectorPaste, STR_SHORTCUT_PASTE_ELEMENT, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE));
RegisterShortcut(ShortcutId::WindowTileInspectorSort, STR_SHORTCUT_SORT_ELEMENTS, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_SORT));
RegisterShortcut(ShortcutId::WindowTileInspectorRemove, STR_SHORTCUT_REMOVE_ELEMENT, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE));
RegisterShortcut(ShortcutId::WindowTileInspectorMoveUp, STR_SHORTCUT_MOVE_ELEMENT_UP, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP));
RegisterShortcut(ShortcutId::WindowTileInspectorMoveDown, STR_SHORTCUT_MOVE_ELEMENT_DOWN, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN));
RegisterShortcut(ShortcutId::WindowTileInspectorIncreaseX, STR_SHORTCUT_INCREASE_X_COORD, std::bind(TileInspectorMouseDown, WC_TILE_INSPECTOR__WIDX_SPINNER_X_INCREASE));
RegisterShortcut(ShortcutId::WindowTileInspectorDecreaseX, STR_SHORTCUT_DECREASE_X_COORD, std::bind(TileInspectorMouseDown, WC_TILE_INSPECTOR__WIDX_SPINNER_X_DECREASE));
RegisterShortcut(ShortcutId::WindowTileInspectorIncreaseY, STR_SHORTCUT_INCREASE_Y_COORD, std::bind(TileInspectorMouseDown, WC_TILE_INSPECTOR__WIDX_SPINNER_Y_INCREASE));
RegisterShortcut(ShortcutId::WindowTileInspectorDecreaseY, STR_SHORTCUT_DECREASE_Y_COORD, std::bind(TileInspectorMouseDown, WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE));
RegisterShortcut(ShortcutId::WindowTileInspectorIncreaseHeight, STR_SHORTCUT_INCREASE_ELEM_HEIGHT, ShortcutIncreaseElementHeight);
RegisterShortcut(ShortcutId::WindowTileInspectorDecreaseHeight, STR_SHORTCUT_DECREASE_ELEM_HEIGHT, ShortcutDecreaseElementHeight);
RegisterShortcut(ShortcutId::WindowTileInspectorChangeWallSlope, STR_SHORTCUT_TOGGLE_WALL_SLOPE, ShortcutToggleWallSlope);
2020-12-13 15:29:10 +01:00
// Debug
RegisterShortcut(ShortcutId::DebugToggleConsole, STR_CONSOLE, "`", ShortcutToggleConsole);
RegisterShortcut(ShortcutId::DebugAdvanceTick, STR_ADVANCE_TO_NEXT_TICK, []() {
2020-12-13 15:29:10 +01:00
if (!(gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_MANAGER)))
{
gDoSingleUpdate = true;
}
});
RegisterShortcut(ShortcutId::DebugTogglePaintDebugWindow, STR_SHORTCUT_DEBUG_PAINT_TOGGLE, []() {
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
{
auto window = WindowFindByClass(WindowClass::DebugPaint);
if (window != nullptr)
{
WindowClose(*window);
}
else
2020-12-13 15:29:10 +01:00
{
ContextOpenWindow(WindowClass::DebugPaint);
2020-12-13 15:29:10 +01:00
}
}
2020-12-13 15:29:10 +01:00
});
// clang-format on
2020-07-14 00:12:49 +02:00
}