From 4437e692e24ab57234321bcbf15c0da65b346aef Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 17 Jan 2021 13:00:40 +0100 Subject: [PATCH] Replace remnants of corrupted elements --- data/language/en-GB.txt | 1 - src/openrct2-ui/input/KeyboardShortcuts.h | 171 ++++++++++++++++++++++ src/openrct2-ui/input/Shortcuts.cpp | 1 - src/openrct2/interface/Window.h | 2 +- src/openrct2/localisation/StringIds.h | 3 +- src/openrct2/scripting/ScTile.hpp | 4 +- src/openrct2/world/TileElement.h | 10 -- 7 files changed, 174 insertions(+), 18 deletions(-) create mode 100644 src/openrct2-ui/input/KeyboardShortcuts.h diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 0f76a1a77f..4300ab4904 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3575,7 +3575,6 @@ STR_6331 :Create ducks STR_6332 :Remove ducks STR_6333 :Increase scale factor STR_6334 :Decrease scale factor -STR_6335 :Tile Inspector: Insert corrupt element STR_6336 :Tile Inspector: Copy element STR_6337 :Tile Inspector: Paste element STR_6338 :Tile Inspector: Delete element diff --git a/src/openrct2-ui/input/KeyboardShortcuts.h b/src/openrct2-ui/input/KeyboardShortcuts.h new file mode 100644 index 0000000000..ce53a6f30f --- /dev/null +++ b/src/openrct2-ui/input/KeyboardShortcuts.h @@ -0,0 +1,171 @@ +/***************************************************************************** + * 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/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index e666ca290e..68950bd29b 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -839,7 +839,6 @@ 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::WindowTileInspectorInsertCorrupt, STR_SHORTCUT_INSERT_CORRPUT_ELEMENT, []() { TileInspectorMouseUp(WC_TILE_INSPECTOR__WIDX_BUTTON_CORRUPT); }); 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); }); diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index ed9b1f2f3f..08038d3884 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -554,7 +554,7 @@ enum #define WC_EDITOR_OBJECT_SELECTION__WIDX_TAB_1 21 #define WC_STAFF__WIDX_PICKUP 9 #define WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE 14 -#define WC_TILE_INSPECTOR__WIDX_BUTTON_CORRUPT 10 +#define WC_TILE_INSPECTOR__WIDX_BUTTON_TOGGLE_INVISIBILITY 10 #define WC_TILE_INSPECTOR__WIDX_BUTTON_COPY 17 #define WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE 16 #define WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE 11 diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index bcc6bcc860..fb6c03b27f 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -3334,7 +3334,6 @@ enum STR_TILE_INSPECTOR_GROUPBOX_WALL_INFO = 5929, STR_TILE_INSPECTOR_GROUPBOX_LARGE_SCENERY_INFO = 5930, STR_TILE_INSPECTOR_GROUPBOX_BANNER_INFO = 5931, - STR_TILE_INSPECTOR_GROUPBOX_CORRUPT_INFO = 5932, STR_TILE_INSPECTOR_GROUPBOX_PROPERTIES = 5933, STR_TILE_INSPECTOR_SURFACE_TERAIN = 5934, STR_TILE_INSPECTOR_SURFACE_EDGE = 5935, @@ -3799,7 +3798,6 @@ enum STR_SHORTCUT_SCALE_UP = 6333, STR_SHORTCUT_SCALE_DOWN = 6334, - STR_SHORTCUT_INSERT_CORRPUT_ELEMENT = 6335, STR_SHORTCUT_COPY_ELEMENT = 6336, STR_SHORTCUT_PASTE_ELEMENT = 6337, STR_SHORTCUT_REMOVE_ELEMENT = 6338, @@ -3902,6 +3900,7 @@ enum STR_INSTALL_INNOEXTRACT = 6408, STR_NOT_THE_GOG_INSTALLER = 6409, +<<<<<<< HEAD STR_ZOOM_BUTTON_ON_TOOLBAR = 6410, STR_ZOOM_BUTTON_ON_TOOLBAR_TIP = 6411, diff --git a/src/openrct2/scripting/ScTile.hpp b/src/openrct2/scripting/ScTile.hpp index b6a1c62f00..7b2f658efe 100644 --- a/src/openrct2/scripting/ScTile.hpp +++ b/src/openrct2/scripting/ScTile.hpp @@ -90,9 +90,7 @@ namespace OpenRCT2::Scripting type = TILE_ELEMENT_TYPE_BANNER; else { - if (value == "openrct2_corrupt_deprecated") - std::puts( - "Creation of new corrupt elements is deprecated. To hide elements, use the 'hidden' property instead."); + std::puts("Element type not recognised!"); return; } diff --git a/src/openrct2/world/TileElement.h b/src/openrct2/world/TileElement.h index e5a8102997..fce4d94ae5 100644 --- a/src/openrct2/world/TileElement.h +++ b/src/openrct2/world/TileElement.h @@ -51,7 +51,6 @@ enum class TileElementType : uint8_t Wall = (5 << 2), LargeScenery = (6 << 2), Banner = (7 << 2), - Corrupt = (8 << 2), }; struct TileElement; @@ -63,7 +62,6 @@ struct LargeSceneryElement; struct WallElement; struct EntranceElement; struct BannerElement; -struct CorruptElement; struct TileElementBase { @@ -617,14 +615,6 @@ public: }; assert_struct_size(BannerElement, 16); -struct CorruptElement : TileElementBase -{ - static constexpr TileElementType ElementType = TileElementType::Corrupt; - - uint8_t pad[3]; - uint8_t pad_08[8]; -}; -assert_struct_size(CorruptElement, 16); #pragma pack(pop) class QuarterTile