From 9a0db38cbbfffbcdd8fee130925c4956ba117527 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sat, 27 Mar 2021 16:46:27 +0100 Subject: [PATCH] Fix rebase errors and re-add invisibility toggle --- src/openrct2-ui/input/KeyboardShortcuts.h | 171 ---------------------- src/openrct2-ui/input/ShortcutIds.h | 2 +- src/openrct2-ui/input/ShortcutManager.cpp | 2 +- src/openrct2-ui/input/Shortcuts.cpp | 1 + 4 files changed, 3 insertions(+), 173 deletions(-) delete mode 100644 src/openrct2-ui/input/KeyboardShortcuts.h diff --git a/src/openrct2-ui/input/KeyboardShortcuts.h b/src/openrct2-ui/input/KeyboardShortcuts.h deleted file mode 100644 index ce53a6f30f..0000000000 --- a/src/openrct2-ui/input/KeyboardShortcuts.h +++ /dev/null @@ -1,171 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014-2020 OpenRCT2 developers - * - * For a complete list of all authors, please refer to contributors.md - * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 - * - * OpenRCT2 is licensed under the GNU General Public License version 3. - *****************************************************************************/ - -#pragma once - -#include -#include - -#define SHIFT 0x100 -#define CTRL 0x200 -#define ALT 0x400 -#define CMD 0x800 -#ifdef __MACOSX__ -# define PLATFORM_MODIFIER CMD -#else -# define PLATFORM_MODIFIER CTRL -#endif - -struct ScreenCoordsXY; - -#include - -namespace OpenRCT2 -{ - struct IPlatformEnvironment; - - namespace Input - { - enum class Shortcut : size_t - { - CloseTopMostWindow, - CloseAllFloatingWindows, - CancelConstructionMode, - PauseGame, - ZoomViewOut, - ZoomViewIn, - RotateViewClockwise, - RotateViewAnticlockwise, - RotateConstructionObject, - UndergroundViewToggle, - RemoveBaseLandToggle, - RemoveVerticalLandToggle, - SeeThroughRidesToggle, - SeeThroughSceneryToggle, - InvisibleSupportsToggle, - InvisiblePeopleToggle, - HeightMarksOnLandToggle, - HeightMarksOnRideTracksToggle, - HeightMarksOnPathsToggle, - AdjustLand, - AdjustWater, - BuildScenery, - BuildPaths, - BuildNewRide, - ShowFinancialInformation, - ShowResearchInformation, - ShowRidesList, - ShowParkInformation, - ShowGuestList, - ShowStaffList, - ShowRecentMessages, - ShowMap, - Screenshot, - - // New - ReduceGameSpeed, - IncreaseGameSpeed, - OpenCheatWindow, - RemoveTopBottomToolbarToggle, - ScrollMapUp, - ScrollMapLeft, - ScrollMapDown, - ScrollMapRight, - OpenChatWindow, - QuickSaveGame, - ShowOptions, - MuteSound, - WindowedModeToggle, - ShowMultiplayer, - PaintOriginalToggle, - DebugPaintToggle, - SeeThroughPathsToggle, - RideConstructionTurnLeft, - RideConstructionTurnRight, - RideConstructionUseTrackDefault, - RideConstructionSlopeDown, - RideConstructionSlopeUp, - RideConstructionChainLiftToggle, - RideConstructionBankLeft, - RideConstructionBankRight, - RideConstructionPreviousTrack, - RideConstructionNextTrack, - RideConstructionBuildCurrent, - RideConstructionDemolishCurrent, - LoadGame, - ClearScenery, - GridlinesDisplayToggle, - ViewClipping, - HighlightPathIssuesToggle, - TileInspector, - AdvanceToNextTick, - SceneryPicker, - ScaleUp, - ScaleDown, - ToggleInvisibility, - CopyElement, - PasteElement, - RemoveElement, - MoveElementUp, - MoveElementDown, - IncreaseXCoord, - DecreaseXCoord, - IncreaseYCoord, - DecreaseYCoord, - IncreaseElementHeight, - DecreaseElementHeight, - ToggleClearanceChecks, - - Count, - - Undefined = 0xFFFF, - }; - constexpr size_t ShortcutsCount = static_cast(Shortcut::Count); - - class KeyboardShortcuts - { - private: - constexpr static int32_t CURRENT_FILE_VERSION = 1; - static const uint16_t DefaultKeys[ShortcutsCount]; - - std::shared_ptr const _env; - uint16_t _keys[ShortcutsCount]; - - public: - KeyboardShortcuts(const std::shared_ptr& env); - ~KeyboardShortcuts(); - - void Reset(); - bool Load(); - bool Save(); - - std::string GetShortcutString(int32_t shortcut) const; - - void Set(int32_t key); - Shortcut GetFromKey(int32_t key); - ScreenCoordsXY GetKeyboardMapScroll(const uint8_t* keysState) const; - }; - const uint16_t ScanCodeUndefined = 0xFFFF; - } // namespace Input -} // namespace OpenRCT2 - -// The current shortcut being changed. -extern OpenRCT2::Input::Shortcut gKeyboardShortcutChangeId; - -void KeyboardShortcutsReset(); -bool KeyboardShortcutsLoad(); -bool KeyboardShortcutsSave(); -void KeyboardShortcutsSet(int32_t key); -OpenRCT2::Input::Shortcut KeyboardShortcutsGetFromKey(int32_t key); -void KeyboardShortcutsFormatString(char* buffer, size_t bufferSize, int32_t shortcut); - -void KeyboardShortcutHandle(int32_t key); -void KeyboardShortcutHandleCommand(OpenRCT2::Input::Shortcut shortcut); - -ScreenCoordsXY GetKeyboardMapScroll(const uint8_t* keysState); diff --git a/src/openrct2-ui/input/ShortcutIds.h b/src/openrct2-ui/input/ShortcutIds.h index 6220a7338a..1cba3a2616 100644 --- a/src/openrct2-ui/input/ShortcutIds.h +++ b/src/openrct2-ui/input/ShortcutIds.h @@ -98,7 +98,7 @@ namespace OpenRCT2::Ui::ShortcutId constexpr std::string_view WindowRideConstructionDemolish = "window.rideconstruction.demolish"; // Window / tile inspector - constexpr std::string_view WindowTileInspectorInsertCorrupt = "window.tileinspector.insert_corrupt"; + constexpr std::string_view WindowTileInspectorToggleInvisibility = "window.tileinspector.toggle_invisibility"; constexpr std::string_view WindowTileInspectorCopy = "window.tileinspector.copy"; constexpr std::string_view WindowTileInspectorPaste = "window.tileinspector.paste"; constexpr std::string_view WindowTileInspectorRemove = "window.tileinspector.remove"; diff --git a/src/openrct2-ui/input/ShortcutManager.cpp b/src/openrct2-ui/input/ShortcutManager.cpp index d729ea8b30..6b53a5d39d 100644 --- a/src/openrct2-ui/input/ShortcutManager.cpp +++ b/src/openrct2-ui/input/ShortcutManager.cpp @@ -429,7 +429,7 @@ std::string_view ShortcutManager::GetLegacyShortcutId(size_t index) ShortcutId::InterfaceSceneryPicker, ShortcutId::InterfaceScaleIncrease, ShortcutId::InterfaceScaleDecrease, - ShortcutId::WindowTileInspectorInsertCorrupt, + ShortcutId::WindowTileInspectorToggleInvisibility, ShortcutId::WindowTileInspectorCopy, ShortcutId::WindowTileInspectorPaste, ShortcutId::WindowTileInspectorRemove, diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index 68950bd29b..febba86917 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -839,6 +839,7 @@ void ShortcutManager::RegisterDefaultShortcuts() RegisterShortcut(ShortcutId::WindowRideConstructionBuild, STR_SHORTCUT_CONSTRUCTION_BUILD_CURRENT, "NUMPAD 0", []() { ShortcutConstructionBuildCurrent(); }); RegisterShortcut(ShortcutId::WindowRideConstructionDemolish, STR_SHORTCUT_CONSTRUCTION_DEMOLISH_CURRENT, "NUMPAD -", []() { ShortcutConstructionDemolishCurrent(); }); + RegisterShortcut(ShortcutId::WindowTileInspectorToggleInvisibility, STR_SHORTCUT_TOGGLE_INVISIBILITY, []() { TileInspectorMouseUp(WC_TILE_INSPECTOR__WIDX_BUTTON_TOGGLE_INVISIBILITY); }); RegisterShortcut(ShortcutId::WindowTileInspectorCopy, STR_SHORTCUT_COPY_ELEMENT, []() { TileInspectorMouseUp(WC_TILE_INSPECTOR__WIDX_BUTTON_COPY); }); RegisterShortcut(ShortcutId::WindowTileInspectorPaste, STR_SHORTCUT_PASTE_ELEMENT, []() { TileInspectorMouseUp(WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE); }); RegisterShortcut(ShortcutId::WindowTileInspectorRemove, STR_SHORTCUT_REMOVE_ELEMENT, []() { TileInspectorMouseUp(WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE); });