2015-06-01 02:33:56 +01:00
/*****************************************************************************
2024-12-31 20:30:04 +01:00
* Copyright (c) 2014-2025 OpenRCT2 developers
2016-05-04 19:24:41 +02:00
*
2018-06-15 14:07:34 +02:00
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
2016-05-04 19:24:41 +02:00
*
2018-06-15 14:07:34 +02:00
* OpenRCT2 is licensed under the GNU General Public License version 3.
2016-05-04 19:24:41 +02:00
*****************************************************************************/
2015-06-01 02:33:56 +01:00
2018-11-21 23:16:04 +01:00
#include <iterator>
2024-08-14 16:36:05 +02:00
#include <openrct2-ui/UiContext.h>
#include <openrct2-ui/UiStringIds.h>
#include <openrct2-ui/input/InputManager.h>
2018-06-22 23:21:44 +02:00
#include <openrct2-ui/interface/Dropdown.h>
2024-08-14 16:36:05 +02:00
#include <openrct2-ui/interface/Viewport.h>
2018-06-22 23:21:44 +02:00
#include <openrct2-ui/interface/Widget.h>
2025-01-19 15:50:54 +01:00
#include <openrct2-ui/windows/Windows.h>
2018-06-22 23:21:44 +02:00
#include <openrct2/Game.h>
2025-09-08 16:21:29 +02:00
#include <openrct2/GameState.h>
2018-06-22 23:21:44 +02:00
#include <openrct2/Input.h>
2025-02-13 10:51:46 -05:00
#include <openrct2/SpriteIds.h>
2020-12-09 23:39:10 -07:00
#include <openrct2/actions/TileModifyAction.h>
2017-11-23 00:42:12 +01:00
#include <openrct2/core/Guard.hpp>
2025-10-23 18:44:45 +02:00
#include <openrct2/drawing/Rectangle.h>
2021-12-11 18:06:06 -05:00
#include <openrct2/localisation/Formatter.h>
2021-10-27 14:21:14 +02:00
#include <openrct2/object/FootpathObject.h>
#include <openrct2/object/FootpathRailingsObject.h>
#include <openrct2/object/FootpathSurfaceObject.h>
2023-01-26 18:44:42 +00:00
#include <openrct2/object/LargeSceneryEntry.h>
2023-02-15 21:35:16 +00:00
#include <openrct2/object/ObjectEntryManager.h>
2023-05-09 21:08:25 +02:00
#include <openrct2/object/PathAdditionEntry.h>
2023-01-25 19:25:33 +00:00
#include <openrct2/object/SmallSceneryEntry.h>
2020-07-28 22:37:52 +02:00
#include <openrct2/object/TerrainEdgeObject.h>
#include <openrct2/object/TerrainSurfaceObject.h>
2023-01-25 19:56:29 +00:00
#include <openrct2/object/WallSceneryEntry.h>
2018-01-10 00:00:09 +01:00
#include <openrct2/ride/RideData.h>
2017-11-23 00:42:12 +01:00
#include <openrct2/ride/Track.h>
2025-01-08 21:12:11 +01:00
#include <openrct2/ui/WindowManager.h>
2023-01-17 20:46:55 +01:00
#include <openrct2/windows/TileInspectorGlobals.h>
2018-06-22 23:21:44 +02:00
#include <openrct2/world/Banner.h>
2024-03-26 21:35:55 +01:00
#include <openrct2/world/Entrance.h>
2018-01-11 10:59:26 +01:00
#include <openrct2/world/Footpath.h>
2025-09-04 21:57:41 +02:00
#include <openrct2/world/Map.h>
2025-09-04 21:18:12 +02:00
#include <openrct2/world/MapSelection.h>
2018-06-22 23:21:44 +02:00
#include <openrct2/world/Park.h>
2018-01-11 10:59:26 +01:00
#include <openrct2/world/Scenery.h>
2021-08-01 23:13:12 +03:00
#include <openrct2/world/TileInspector.h>
2024-10-14 14:26:10 +02:00
#include <openrct2/world/tile_element/BannerElement.h>
2024-10-03 12:42:53 +02:00
#include <openrct2/world/tile_element/EntranceElement.h>
2024-10-15 22:02:31 +02:00
#include <openrct2/world/tile_element/LargeSceneryElement.h>
#include <openrct2/world/tile_element/PathElement.h>
2024-05-02 23:31:01 +02:00
#include <openrct2/world/tile_element/Slope.h>
2024-10-15 22:02:31 +02:00
#include <openrct2/world/tile_element/SmallSceneryElement.h>
#include <openrct2/world/tile_element/SurfaceElement.h>
2024-10-14 14:26:10 +02:00
#include <openrct2/world/tile_element/TrackElement.h>
2024-10-03 21:09:30 +01:00
#include <openrct2/world/tile_element/WallElement.h>
2015-06-01 02:33:56 +01:00
2025-10-21 12:20:00 +02:00
using namespace OpenRCT2 :: Drawing ;
2024-03-10 13:52:35 +00:00
namespace OpenRCT2 :: Ui :: Windows
2021-10-17 15:31:56 +02:00
{
2024-03-10 13:52:35 +00:00
static constexpr StringId EntranceTypeStringIds [] = {
STR_TILE_INSPECTOR_ENTRANCE_TYPE_RIDE_ENTRANCE ,
STR_TILE_INSPECTOR_ENTRANCE_TYPE_RIDE_EXIT ,
STR_TILE_INSPECTOR_ENTRANCE_TYPE_PARK_ENTRANC ,
};
2016-05-29 16:12:53 +02:00
2024-03-10 13:52:35 +00:00
static constexpr StringId ParkEntrancePartStringIds [] = {
STR_TILE_INSPECTOR_ENTRANCE_MIDDLE ,
STR_TILE_INSPECTOR_ENTRANCE_LEFT ,
STR_TILE_INSPECTOR_ENTRANCE_RIGHT ,
};
2016-05-29 16:12:53 +02:00
2024-03-10 13:52:35 +00:00
static constexpr StringId WallSlopeStringIds [] = {
STR_TILE_INSPECTOR_WALL_FLAT ,
STR_TILE_INSPECTOR_WALL_SLOPED_LEFT ,
STR_TILE_INSPECTOR_WALL_SLOPED_RIGHT ,
STR_TILE_INSPECTOR_WALL_ANIMATION_FRAME ,
};
2016-05-29 16:12:53 +02:00
2024-03-10 13:52:35 +00:00
enum WindowTileInspectorWidgetIdx
{
WIDX_BACKGROUND ,
WIDX_TITLE ,
WIDX_CLOSE ,
WIDX_LIST ,
2025-01-10 15:39:32 +01:00
WIDX_SPINNER_X_LABEL ,
2024-03-10 13:52:35 +00:00
WIDX_SPINNER_X ,
WIDX_SPINNER_X_INCREASE ,
WIDX_SPINNER_X_DECREASE ,
2025-01-10 15:39:32 +01:00
WIDX_SPINNER_Y_LABEL ,
2024-03-10 13:52:35 +00:00
WIDX_SPINNER_Y ,
WIDX_SPINNER_Y_INCREASE ,
WIDX_SPINNER_Y_DECREASE ,
WIDX_BUTTON_REMOVE ,
WIDX_BUTTON_MOVE_UP ,
WIDX_BUTTON_MOVE_DOWN ,
WIDX_BUTTON_ROTATE ,
WIDX_BUTTON_SORT ,
WIDX_BUTTON_PASTE ,
WIDX_BUTTON_COPY ,
WIDX_COLUMN_INVISIBLE ,
WIDX_COLUMN_TYPE ,
WIDX_COLUMN_BASEHEIGHT ,
WIDX_COLUMN_CLEARANCEHEIGHT ,
WIDX_COLUMN_DIRECTION ,
WIDX_COLUMN_GHOSTFLAG ,
WIDX_COLUMN_LASTFLAG ,
WIDX_GROUPBOX_DETAILS ,
WIDX_GROUPBOX_PROPERTIES ,
2016-05-29 16:12:53 +02:00
2024-03-10 13:52:35 +00:00
PAGE_WIDGETS ,
2016-05-29 16:12:53 +02:00
2024-03-10 13:52:35 +00:00
// Surface
WIDX_SURFACE_SPINNER_HEIGHT = PAGE_WIDGETS ,
WIDX_SURFACE_SPINNER_HEIGHT_INCREASE ,
WIDX_SURFACE_SPINNER_HEIGHT_DECREASE ,
WIDX_SURFACE_BUTTON_REMOVE_FENCES ,
WIDX_SURFACE_BUTTON_RESTORE_FENCES ,
WIDX_SURFACE_CHECK_CORNER_N ,
WIDX_SURFACE_CHECK_CORNER_E ,
WIDX_SURFACE_CHECK_CORNER_S ,
WIDX_SURFACE_CHECK_CORNER_W ,
WIDX_SURFACE_CHECK_DIAGONAL ,
2016-05-29 16:12:53 +02:00
2024-03-10 13:52:35 +00:00
// Path
WIDX_PATH_SPINNER_HEIGHT = PAGE_WIDGETS ,
WIDX_PATH_SPINNER_HEIGHT_INCREASE ,
WIDX_PATH_SPINNER_HEIGHT_DECREASE ,
WIDX_PATH_CHECK_BROKEN ,
WIDX_PATH_CHECK_SLOPED ,
WIDX_PATH_CHECK_JUNCTION_RAILINGS ,
WIDX_PATH_CHECK_EDGE_NE , // Note: This is NOT named after the world orientation, but after the way
WIDX_PATH_CHECK_EDGE_E , // it looks in the window (top corner is north). Their order is important,
WIDX_PATH_CHECK_EDGE_SE , // as this is the same order paths use for their corners / edges.
WIDX_PATH_CHECK_EDGE_S , // N
WIDX_PATH_CHECK_EDGE_SW , // NW-------NE
WIDX_PATH_CHECK_EDGE_W , // W ------------- E
WIDX_PATH_CHECK_EDGE_NW , // SW-------SE
WIDX_PATH_CHECK_EDGE_N , // S
2016-05-29 16:12:53 +02:00
2024-03-10 13:52:35 +00:00
// Track
WIDX_TRACK_CHECK_APPLY_TO_ALL = PAGE_WIDGETS ,
WIDX_TRACK_SPINNER_HEIGHT ,
WIDX_TRACK_SPINNER_HEIGHT_INCREASE ,
WIDX_TRACK_SPINNER_HEIGHT_DECREASE ,
WIDX_TRACK_CHECK_CHAIN_LIFT ,
WIDX_TRACK_CHECK_BRAKE_CLOSED ,
WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE ,
2016-05-29 16:12:53 +02:00
2024-03-10 13:52:35 +00:00
// Scenery
WIDX_SCENERY_SPINNER_HEIGHT = PAGE_WIDGETS ,
WIDX_SCENERY_SPINNER_HEIGHT_INCREASE ,
WIDX_SCENERY_SPINNER_HEIGHT_DECREASE ,
WIDX_SCENERY_CHECK_QUARTER_N ,
WIDX_SCENERY_CHECK_QUARTER_E ,
WIDX_SCENERY_CHECK_QUARTER_S ,
WIDX_SCENERY_CHECK_QUARTER_W ,
WIDX_SCENERY_CHECK_COLLISION_N ,
WIDX_SCENERY_CHECK_COLLISION_E ,
WIDX_SCENERY_CHECK_COLLISION_S ,
WIDX_SCENERY_CHECK_COLLISION_W ,
2016-05-29 16:12:53 +02:00
2024-03-10 13:52:35 +00:00
// Entrance
WIDX_ENTRANCE_SPINNER_HEIGHT = PAGE_WIDGETS ,
WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE ,
WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE ,
WIDX_ENTRANCE_BUTTON_MAKE_USABLE ,
2015-06-01 02:33:56 +01:00
2024-03-10 13:52:35 +00:00
// Wall
WIDX_WALL_SPINNER_HEIGHT = PAGE_WIDGETS ,
WIDX_WALL_SPINNER_HEIGHT_INCREASE ,
WIDX_WALL_SPINNER_HEIGHT_DECREASE ,
WIDX_WALL_DROPDOWN_SLOPE ,
WIDX_WALL_DROPDOWN_SLOPE_BUTTON ,
WIDX_WALL_SPINNER_ANIMATION_FRAME ,
WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE ,
WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE ,
2024-04-12 20:08:34 +02:00
WIDX_WALL_ANIMATION_IS_BACKWARDS ,
2024-03-10 13:52:35 +00:00
// Large
WIDX_LARGE_SCENERY_SPINNER_HEIGHT = PAGE_WIDGETS ,
WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE ,
WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE ,
// Banner
WIDX_BANNER_SPINNER_HEIGHT = PAGE_WIDGETS ,
WIDX_BANNER_SPINNER_HEIGHT_INCREASE ,
WIDX_BANNER_SPINNER_HEIGHT_DECREASE ,
WIDX_BANNER_CHECK_BLOCK_NE ,
WIDX_BANNER_CHECK_BLOCK_SE ,
WIDX_BANNER_CHECK_BLOCK_SW ,
WIDX_BANNER_CHECK_BLOCK_NW ,
};
static_assert ( WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE == WIDX_BUTTON_ROTATE );
static_assert ( WC_TILE_INSPECTOR__WIDX_BUTTON_COPY == WIDX_BUTTON_COPY );
static_assert ( WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE == WIDX_BUTTON_PASTE );
2024-03-22 10:24:10 -04:00
static_assert ( WC_TILE_INSPECTOR__WIDX_BUTTON_SORT == WIDX_BUTTON_SORT );
2024-03-10 13:52:35 +00:00
static_assert ( WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE == WIDX_BUTTON_REMOVE );
static_assert ( WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP == WIDX_BUTTON_MOVE_UP );
static_assert ( WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN == WIDX_BUTTON_MOVE_DOWN );
static_assert ( WC_TILE_INSPECTOR__WIDX_SPINNER_X_INCREASE == WIDX_SPINNER_X_INCREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_SPINNER_X_DECREASE == WIDX_SPINNER_X_DECREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_SPINNER_Y_INCREASE == WIDX_SPINNER_Y_INCREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE == WIDX_SPINNER_Y_DECREASE );
2025-01-13 18:09:21 -05:00
static_assert ( WC_TILE_INSPECTOR__WIDX_SURFACE_SPINNER_HEIGHT_INCREASE == WIDX_SURFACE_SPINNER_HEIGHT_INCREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_SURFACE_SPINNER_HEIGHT_DECREASE == WIDX_SURFACE_SPINNER_HEIGHT_DECREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_PATH_SPINNER_HEIGHT_INCREASE == WIDX_PATH_SPINNER_HEIGHT_INCREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_PATH_SPINNER_HEIGHT_DECREASE == WIDX_PATH_SPINNER_HEIGHT_DECREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_TRACK_SPINNER_HEIGHT_INCREASE == WIDX_TRACK_SPINNER_HEIGHT_INCREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_TRACK_SPINNER_HEIGHT_DECREASE == WIDX_TRACK_SPINNER_HEIGHT_DECREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_SCENERY_SPINNER_HEIGHT_INCREASE == WIDX_SCENERY_SPINNER_HEIGHT_INCREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_SCENERY_SPINNER_HEIGHT_DECREASE == WIDX_SCENERY_SPINNER_HEIGHT_DECREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE == WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE == WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_WALL_SPINNER_HEIGHT_INCREASE == WIDX_WALL_SPINNER_HEIGHT_INCREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_WALL_SPINNER_HEIGHT_DECREASE == WIDX_WALL_SPINNER_HEIGHT_DECREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE == WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE == WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_BANNER_SPINNER_HEIGHT_INCREASE == WIDX_BANNER_SPINNER_HEIGHT_INCREASE );
static_assert ( WC_TILE_INSPECTOR__WIDX_BANNER_SPINNER_HEIGHT_DECREASE == WIDX_BANNER_SPINNER_HEIGHT_DECREASE );
2021-12-03 00:28:43 +01:00
2022-03-23 22:01:23 -04:00
#pragma region MEASUREMENTS
2019-10-18 22:02:31 -04:00
2025-06-16 23:10:47 +02:00
static constexpr StringId kWindowTitle = STR_TILE_INSPECTOR_TITLE ;
2024-09-04 21:11:26 +02:00
2024-03-10 13:52:35 +00:00
// Window sizes
2025-06-16 23:10:47 +02:00
static constexpr ScreenSize kWindowSize = { 400 , 170 };
static constexpr ScreenSize kMinimumWindowSize = { 400 , 130 };
static constexpr ScreenSize kMaximumWindowSize = { 400 , 800 };
2015-06-01 02:33:56 +01:00
2024-03-10 13:52:35 +00:00
// Button space for top buttons
2025-06-16 23:10:47 +02:00
constexpr auto kToolbarButtonAnchor = ScreenCoordsXY { kWindowSize . width - 27 , 17 };
constexpr auto kToolbarButtonSize = ScreenSize { 24 , 24 };
constexpr auto kToolbarButtonHalfSize = ScreenSize { 24 , 12 };
constexpr auto kToolbarButtonOffsetX = ScreenSize { - 24 , 0 };
2015-12-28 23:11:36 +01:00
2024-03-10 13:52:35 +00:00
// List's column offsets
2025-06-16 23:10:47 +02:00
constexpr auto kInvisibleFlagColumnXY = ScreenCoordsXY { 3 , 42 };
constexpr auto kInvisibleFlagColumnSize = ScreenSize { 20 , 14 };
constexpr auto kTypeColumnXY = kInvisibleFlagColumnXY + ScreenSize { kInvisibleFlagColumnSize . width , 0 };
constexpr auto kTypeColumnSize = ScreenSize { 252 , 14 };
constexpr auto kBaseHeightColumnXY = kTypeColumnXY + ScreenSize { kTypeColumnSize . width , 0 };
constexpr auto kBaseHeightColumnSize = ScreenSize { 30 , 14 };
constexpr auto kClearanceHeightColumnXY = kBaseHeightColumnXY + ScreenCoordsXY { kBaseHeightColumnSize . width , 0 };
constexpr auto kClearanceHeightColumnSize = ScreenSize { 30 , 14 };
constexpr auto kDirectionColumnXY = kClearanceHeightColumnXY + ScreenCoordsXY { kClearanceHeightColumnSize . width , 0 };
constexpr auto kDirectionColumnSize = ScreenSize { 15 , 14 };
constexpr auto kGhostFlagColumnXY = kDirectionColumnXY + ScreenCoordsXY { kDirectionColumnSize . width , 0 };
constexpr auto kGhostFlagColumnSize = ScreenSize { 15 , 14 };
constexpr auto kLastFlagColumnXY = kGhostFlagColumnXY + ScreenCoordsXY { kGhostFlagColumnSize . width , 0 };
constexpr auto kLastFlagColumnSize = ScreenSize { 32 , 14 };
2015-12-29 23:19:01 +01:00
2025-06-16 23:10:47 +02:00
constexpr int32_t kBottomPadding = 15 ;
constexpr int32_t kGroupboxPadding = 6 ;
constexpr int32_t kHorizontalGroupboxPadding = 5 ;
constexpr int32_t kVerticalGroupboxPadding = 4 ;
constexpr auto kPropertyButtonSize = ScreenSize { 130 , 18 };
constexpr auto kPropertyFullWidth = ScreenSize { 370 , 18 };
2024-09-04 21:11:26 +02:00
2022-03-23 22:01:23 -04:00
#pragma endregion
2021-10-31 22:44:42 +01:00
2024-09-04 21:11:26 +02:00
// clang-format off
2024-03-10 13:52:35 +00:00
constexpr ScreenCoordsXY PropertyRowCol ( ScreenCoordsXY anchor , int32_t row , int32_t column )
{
2025-06-16 23:10:47 +02:00
return anchor + ScreenCoordsXY { column * ( kPropertyButtonSize . width + kHorizontalGroupboxPadding ),
row * ( kPropertyButtonSize . height + kVerticalGroupboxPadding ) };
2024-03-10 13:52:35 +00:00
}
2016-10-01 23:23:47 +02:00
2024-03-10 13:52:35 +00:00
constexpr ScreenCoordsXY CheckboxGroupOffset (
ScreenCoordsXY anchorPoint , int16_t horizontalMultiplier , int16_t verticalMultiplier )
{
return anchorPoint + ScreenCoordsXY { 14 * horizontalMultiplier , 7 * verticalMultiplier };
}
2016-10-01 23:23:47 +02:00
2024-09-04 21:11:26 +02:00
// Macros for easily obtaining the top and bottom of a widget inside a properties group box
2025-06-16 23:10:47 +02:00
#define GBBT(GROUPTOP, row) ((GROUPTOP) + 14 + row * (kPropertyButtonSize.height + kVerticalGroupboxPadding))
#define GBBB(GROUPTOP, row) (GBBT((GROUPTOP), row) + kPropertyButtonSize.height)
2016-10-01 23:23:47 +02:00
2025-06-07 23:02:14 +02:00
static constexpr auto kMainTileInspectorWidgets = makeWidgets (
2025-06-16 23:10:47 +02:00
makeWindowShim ( kWindowTitle , kWindowSize ),
makeWidget ({ 3 , 57 }, { kWindowSize . width - 6 , kWindowSize . height - kBottomPadding - 58 }, WidgetType :: scroll , WindowColour :: secondary , SCROLL_VERTICAL ), /* Element list */
2025-06-07 23:02:14 +02:00
/* X and Y spinners */
2025-06-10 19:55:12 +02:00
makeWidget ({ 4 , 24 }, { 38 , 14 }, WidgetType :: label , WindowColour :: secondary , STR_TILE_INSPECTOR_X_LABEL ),
makeSpinnerWidgets ({ 20 , 23 }, { 51 , 12 }, WidgetType :: spinner , WindowColour :: secondary ), /* Spinner X (3 widgets) */
makeWidget ({ 74 , 24 }, { 38 , 14 }, WidgetType :: label , WindowColour :: secondary , STR_TILE_INSPECTOR_Y_LABEL ),
makeSpinnerWidgets ({ 90 , 23 }, { 51 , 12 }, WidgetType :: spinner , WindowColour :: secondary ), /* Spinner Y (3 widgets) */
2025-06-07 23:02:14 +02:00
/* Top buttons */
2025-06-16 23:10:47 +02:00
makeWidget ( kToolbarButtonAnchor + kToolbarButtonOffsetX * 0 , kToolbarButtonSize , WidgetType :: flatBtn , WindowColour :: secondary , ImageId ( SPR_DEMOLISH ), STR_REMOVE_SELECTED_ELEMENT_TIP ), /* Remove button */
makeWidget ( kToolbarButtonAnchor + kToolbarButtonOffsetX * 1 , kToolbarButtonHalfSize , WidgetType :: button , WindowColour :: secondary , STR_UP , STR_MOVE_SELECTED_ELEMENT_UP_TIP ), /* Move up */
makeWidget ( kToolbarButtonAnchor + kToolbarButtonOffsetX * 1 + ScreenSize { 0 , 12 }, kToolbarButtonHalfSize , WidgetType :: button , WindowColour :: secondary , STR_DOWN , STR_MOVE_SELECTED_ELEMENT_DOWN_TIP ), /* Move down */
makeWidget ( kToolbarButtonAnchor + kToolbarButtonOffsetX * 2 , kToolbarButtonSize , WidgetType :: flatBtn , WindowColour :: secondary , ImageId ( SPR_ROTATE_ARROW ), STR_ROTATE_SELECTED_ELEMENT_TIP ), /* Rotate button */
makeWidget ( kToolbarButtonAnchor + kToolbarButtonOffsetX * 3 , kToolbarButtonSize , WidgetType :: flatBtn , WindowColour :: secondary , ImageId ( SPR_G2_SORT ), STR_TILE_INSPECTOR_SORT_TIP ), /* Sort button */
makeWidget ( kToolbarButtonAnchor + kToolbarButtonOffsetX * 4 , kToolbarButtonSize , WidgetType :: flatBtn , WindowColour :: secondary , ImageId ( SPR_G2_PASTE ), STR_TILE_INSPECTOR_PASTE_TIP ), /* Paste button */
makeWidget ( kToolbarButtonAnchor + kToolbarButtonOffsetX * 5 , kToolbarButtonSize , WidgetType :: flatBtn , WindowColour :: secondary , ImageId ( SPR_G2_COPY ), STR_TILE_INSPECTOR_COPY_TIP ), /* Copy button */
2025-06-07 23:02:14 +02:00
/* Column headers */
2025-06-16 23:10:47 +02:00
makeWidget ( kInvisibleFlagColumnXY , kInvisibleFlagColumnSize , WidgetType :: tableHeader , WindowColour :: secondary , STR_TILE_INSPECTOR_INVISIBLE_SHORT , STR_TILE_INSPECTOR_FLAG_INVISIBLE ), /* Invisible flag */
makeWidget ( kTypeColumnXY , kTypeColumnSize , WidgetType :: tableHeader , WindowColour :: secondary , STR_TILE_INSPECTOR_ELEMENT_TYPE ), /* Type */
makeWidget ( kBaseHeightColumnXY , kBaseHeightColumnSize , WidgetType :: tableHeader , WindowColour :: secondary , STR_TILE_INSPECTOR_BASE_HEIGHT_SHORT , STR_TILE_INSPECTOR_BASE_HEIGHT ), /* Base height */
makeWidget ( kClearanceHeightColumnXY , kClearanceHeightColumnSize , WidgetType :: tableHeader , WindowColour :: secondary , STR_TILE_INSPECTOR_CLEARANGE_HEIGHT_SHORT , STR_TILE_INSPECTOR_CLEARANCE_HEIGHT ), /* Clearance height */
makeWidget ( kDirectionColumnXY , kDirectionColumnSize , WidgetType :: tableHeader , WindowColour :: secondary , STR_TILE_INSPECTOR_DIRECTION_SHORT , STR_TILE_INSPECTOR_DIRECTION ), /* Direction */
makeWidget ( kGhostFlagColumnXY , kGhostFlagColumnSize , WidgetType :: tableHeader , WindowColour :: secondary , STR_TILE_INSPECTOR_FLAG_GHOST_SHORT , STR_TILE_INSPECTOR_FLAG_GHOST ), /* Ghost flag */
makeWidget ( kLastFlagColumnXY , kLastFlagColumnSize , WidgetType :: tableHeader , WindowColour :: secondary , STR_TILE_INSPECTOR_FLAG_LAST_SHORT , STR_TILE_INSPECTOR_FLAG_LAST ), /* Last of tile flag */
2025-06-07 23:02:14 +02:00
/* Group boxes */
2025-06-16 23:10:47 +02:00
makeWidget ({ 6 , 0 }, { kWindowSize . width - 12 , 0 }, WidgetType :: groupbox , WindowColour :: secondary , kStringIdNone , kStringIdNone ), /* Details group box */
makeWidget ({ 6 , 0 }, { kWindowSize . width - 12 , 0 }, WidgetType :: groupbox , WindowColour :: secondary , STR_TILE_INSPECTOR_GROUPBOX_PROPERTIES , kStringIdNone ) /* Properties group box */
2025-06-07 23:02:14 +02:00
);
2016-05-29 16:12:53 +02:00
2025-06-07 23:02:14 +02:00
static constexpr auto DefaultWidgets = makeWidgets (
kMainTileInspectorWidgets
);
2015-12-28 23:11:36 +01:00
2024-09-04 21:11:26 +02:00
constexpr int32_t NumSurfaceProperties = 4 ;
constexpr int32_t NumSurfaceDetails = 4 ;
constexpr int32_t SurfacePropertiesHeight = 16 + NumSurfaceProperties * 21 ;
constexpr int32_t SurfaceDetailsHeight = 20 + NumSurfaceDetails * 11 ;
2025-06-07 23:02:14 +02:00
static constexpr auto SurfaceWidgets = makeWidgets (
kMainTileInspectorWidgets ,
2025-06-16 23:10:47 +02:00
makeSpinnerWidgets ( PropertyRowCol ({ 12 , 0 }, 0 , 1 ), kPropertyButtonSize , WidgetType :: spinner , WindowColour :: secondary ), // WIDX_SURFACE_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
makeWidget ( PropertyRowCol ({ 12 , 0 }, 1 , 0 ), kPropertyButtonSize , WidgetType :: button , WindowColour :: secondary , STR_TILE_INSPECTOR_SURFACE_REMOVE_FENCES ), // WIDX_SURFACE_BUTTON_REMOVE_FENCES
makeWidget ( PropertyRowCol ({ 12 , 0 }, 1 , 1 ), kPropertyButtonSize , WidgetType :: button , WindowColour :: secondary , STR_TILE_INSPECTOR_SURFACE_RESTORE_FENCES ), // WIDX_SURFACE_BUTTON_RESTORE_FENCES
2025-06-10 19:55:12 +02:00
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 3 , 1 ), 1 , 0 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_SURFACE_CHECK_CORNER_N
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 3 , 1 ), 2 , 1 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_SURFACE_CHECK_CORNER_E
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 3 , 1 ), 1 , 2 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_SURFACE_CHECK_CORNER_S
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 3 , 1 ), 0 , 1 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_SURFACE_CHECK_CORNER_W
2025-06-16 23:10:47 +02:00
makeWidget ( PropertyRowCol ({ 12 , 0 }, 4 , 0 ), kPropertyFullWidth , WidgetType :: checkbox , WindowColour :: secondary , STR_TILE_INSPECTOR_SURFACE_DIAGONAL ) // WIDX_SURFACE_CHECK_DIAGONAL
2025-06-07 23:02:14 +02:00
);
2015-06-01 02:33:56 +01:00
2024-09-04 21:11:26 +02:00
constexpr int32_t NumPathProperties = 6 ;
constexpr int32_t NumPathDetails = 3 ;
constexpr int32_t PathPropertiesHeight = 16 + NumPathProperties * 21 ;
constexpr int32_t PathDetailsHeight = 20 + NumPathDetails * 11 ;
2025-06-07 23:02:14 +02:00
static constexpr auto PathWidgets = makeWidgets (
kMainTileInspectorWidgets ,
2025-06-16 23:10:47 +02:00
makeSpinnerWidgets ( PropertyRowCol ({ 12 , 0 }, 0 , 1 ), kPropertyButtonSize , WidgetType :: spinner , WindowColour :: secondary ), // WIDX_PATH_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
makeWidget ( PropertyRowCol ({ 12 , 0 }, 1 , 0 ), kPropertyFullWidth , WidgetType :: checkbox , WindowColour :: secondary , STR_TILE_INSPECTOR_PATH_BROKEN ), // WIDX_PATH_CHECK_BROKEN
makeWidget ( PropertyRowCol ({ 12 , 0 }, 2 , 0 ), kPropertyFullWidth , WidgetType :: checkbox , WindowColour :: secondary , STR_TILE_INSPECTOR_PATH_SLOPED ), // WIDX_PATH_CHECK_SLOPED
makeWidget ( PropertyRowCol ({ 12 , 0 }, 3 , 0 ), kPropertyFullWidth , WidgetType :: checkbox , WindowColour :: secondary , STR_TILE_INSPECTOR_PATH_JUNCTION_RAILINGS ), // WIDX_PATH_CHECK_JUNCTION_RAILINGS
2025-06-10 19:55:12 +02:00
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 4 , 1 ), 3 , 1 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_PATH_CHECK_EDGE_NE
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 4 , 1 ), 4 , 2 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_PATH_CHECK_EDGE_E
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 4 , 1 ), 3 , 3 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_PATH_CHECK_EDGE_SE
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 4 , 1 ), 2 , 4 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_PATH_CHECK_EDGE_S
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 4 , 1 ), 1 , 3 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_PATH_CHECK_EDGE_SW
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 4 , 1 ), 0 , 2 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_PATH_CHECK_EDGE_W
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 4 , 1 ), 1 , 1 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_PATH_CHECK_EDGE_NW
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 4 , 1 ), 2 , 0 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ) // WIDX_PATH_CHECK_EDGE_N
2025-06-07 23:02:14 +02:00
);
2016-05-29 16:12:53 +02:00
2024-09-04 21:11:26 +02:00
constexpr int32_t NumTrackProperties = 5 ;
constexpr int32_t NumTrackDetails = 7 ;
constexpr int32_t TrackPropertiesHeight = 16 + NumTrackProperties * 21 ;
constexpr int32_t TrackDetailsHeight = 20 + NumTrackDetails * 11 ;
2025-06-07 23:02:14 +02:00
static constexpr auto TrackWidgets = makeWidgets (
kMainTileInspectorWidgets ,
2025-06-16 23:10:47 +02:00
makeWidget ( PropertyRowCol ({ 12 , 0 }, 0 , 0 ), kPropertyFullWidth , WidgetType :: checkbox , WindowColour :: secondary , STR_TILE_INSPECTOR_TRACK_ENTIRE_TRACK_PIECE ), // WIDX_TRACK_CHECK_APPLY_TO_ALL
makeSpinnerWidgets ( PropertyRowCol ({ 12 , 0 }, 1 , 1 ), kPropertyButtonSize , WidgetType :: spinner , WindowColour :: secondary ), // WIDX_TRACK_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
makeWidget ( PropertyRowCol ({ 12 , 0 }, 2 , 0 ), kPropertyFullWidth , WidgetType :: checkbox , WindowColour :: secondary , STR_TILE_INSPECTOR_TRACK_CHAIN_LIFT ), // WIDX_TRACK_CHECK_CHAIN_LIFT
makeWidget ( PropertyRowCol ({ 12 , 0 }, 3 , 0 ), kPropertyFullWidth , WidgetType :: checkbox , WindowColour :: secondary , STR_TILE_INSPECTOR_TRACK_BRAKE_CLOSED ), // WIDX_TRACK_CHECK_BRAKE_CLOSED
makeWidget ( PropertyRowCol ({ 12 , 0 }, 4 , 0 ), kPropertyFullWidth , WidgetType :: checkbox , WindowColour :: secondary , STR_TILE_INSPECTOR_TRACK_IS_INDESTRUCTIBLE ) // WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE
2025-06-07 23:02:14 +02:00
);
2016-05-29 16:12:53 +02:00
2024-09-04 21:11:26 +02:00
constexpr int32_t NumSceneryProperties = 4 ; // The checkbox groups both count for 2 rows
constexpr int32_t NumSceneryDetails = 3 ;
constexpr int32_t SceneryPropertiesHeight = 16 + NumSceneryProperties * 21 ;
constexpr int32_t SceneryDetailsHeight = 20 + NumSceneryDetails * 11 ;
2025-06-07 23:02:14 +02:00
static constexpr auto SceneryWidgets = makeWidgets (
kMainTileInspectorWidgets ,
2025-06-16 23:10:47 +02:00
makeSpinnerWidgets ( PropertyRowCol ({ 12 , 0 }, 0 , 1 ), kPropertyButtonSize , WidgetType :: spinner , WindowColour :: secondary ), // WIDX_SCENERY_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
2025-06-10 19:55:12 +02:00
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 1 , 1 ), 1 , 0 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_SCENERY_CHECK_QUARTER_N
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 1 , 1 ), 2 , 1 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_SCENERY_CHECK_QUARTER_E
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 1 , 1 ), 1 , 2 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_SCENERY_CHECK_QUARTER_S
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 1 , 1 ), 0 , 1 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_SCENERY_CHECK_QUARTER_W
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 2 , 1 ), 1 , 0 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_SCENERY_CHECK_COLLISION_N
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 2 , 1 ), 2 , 1 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_SCENERY_CHECK_COLLISION_E
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 2 , 1 ), 1 , 2 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_SCENERY_CHECK_COLLISION_S
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 2 , 1 ), 0 , 1 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ) // WIDX_SCENERY_CHECK_COLLISION_W
2025-06-07 23:02:14 +02:00
);
2016-05-29 16:12:53 +02:00
2024-09-04 21:11:26 +02:00
constexpr int32_t NumEntranceProperties = 2 ;
constexpr int32_t NumEntranceDetails = 4 ;
constexpr int32_t EntrancePropertiesHeight = 16 + NumEntranceProperties * 21 ;
constexpr int32_t EntranceDetailsHeight = 20 + NumEntranceDetails * 11 ;
2025-06-07 23:02:14 +02:00
static constexpr auto EntranceWidgets = makeWidgets (
kMainTileInspectorWidgets ,
2025-06-16 23:10:47 +02:00
makeSpinnerWidgets ( PropertyRowCol ({ 12 , 0 }, 0 , 1 ), kPropertyButtonSize , WidgetType :: spinner , WindowColour :: secondary ), // WIDX_ENTRANCE_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
makeWidget ( PropertyRowCol ({ 12 , 0 }, 1 , 0 ), kPropertyButtonSize , WidgetType :: button , WindowColour :: secondary , STR_TILE_INSPECTOR_ENTRANCE_MAKE_USABLE , STR_TILE_INSPECTOR_ENTRANCE_MAKE_USABLE_TIP ) // WIDX_ENTRANCE_BUTTON_MAKE_USABLE
2025-06-07 23:02:14 +02:00
);
2016-05-29 16:12:53 +02:00
2024-09-04 21:11:26 +02:00
constexpr int32_t NumWallProperties = 4 ;
constexpr int32_t NumWallDetails = 2 ;
constexpr int32_t WallPropertiesHeight = 16 + NumWallProperties * 21 ;
constexpr int32_t WallDetailsHeight = 20 + NumWallDetails * 11 ;
2025-06-07 23:02:14 +02:00
static constexpr auto WallWidgets = makeWidgets (
kMainTileInspectorWidgets ,
2025-06-16 23:10:47 +02:00
makeSpinnerWidgets ( PropertyRowCol ({ 12 , 0 }, 0 , 1 ), kPropertyButtonSize , WidgetType :: spinner , WindowColour :: secondary ), // WIDX_WALL_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
makeWidget ( PropertyRowCol ({ 12 , 0 }, 1 , 1 ), kPropertyButtonSize , WidgetType :: dropdownMenu , WindowColour :: secondary ), // WIDX_WALL_DROPDOWN_SLOPE
makeWidget ( PropertyRowCol ({ 12 + kPropertyButtonSize . width - 12 , 0 }, 1 , 1 ), { 11 , 12 }, WidgetType :: button , WindowColour :: secondary , STR_DROPDOWN_GLYPH ), // WIDX_WALL_DROPDOWN_SLOPE_BUTTON
makeSpinnerWidgets ( PropertyRowCol ({ 12 , 0 }, 2 , 1 ), kPropertyButtonSize , WidgetType :: spinner , WindowColour :: secondary ), // WIDX_WALL_SPINNER_ANIMATION_FRAME{,_INCREASE,_DECREASE}
makeWidget ( PropertyRowCol ({ 12 , 0 }, 3 , 0 ), kPropertyFullWidth , WidgetType :: checkbox , WindowColour :: secondary , STR_TILE_INSPECTOR_WALL_ANIMATION_IS_BACKWARDS ) // WIDX_WALL_ANIMATION_IS_BACKWARDS
2025-06-07 23:02:14 +02:00
);
2016-05-29 16:12:53 +02:00
2024-09-04 21:11:26 +02:00
constexpr int32_t NumLargeSceneryProperties = 1 ;
constexpr int32_t NumLargeSceneryDetails = 3 ;
constexpr int32_t LargeSceneryPropertiesHeight = 16 + NumLargeSceneryProperties * 21 ;
constexpr int32_t LargeSceneryDetailsHeight = 20 + NumLargeSceneryDetails * 11 ;
2025-06-07 23:02:14 +02:00
static constexpr auto LargeSceneryWidgets = makeWidgets (
kMainTileInspectorWidgets ,
2025-06-16 23:10:47 +02:00
makeSpinnerWidgets ( PropertyRowCol ({ 12 , 0 }, 0 , 1 ), kPropertyButtonSize , WidgetType :: spinner , WindowColour :: secondary ) // WIDX_LARGE_SCENERY_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
2025-06-07 23:02:14 +02:00
);
2016-05-29 16:12:53 +02:00
2024-09-04 21:11:26 +02:00
constexpr int32_t NumBannerProperties = 3 ;
constexpr int32_t NumBannerDetails = 1 ;
constexpr int32_t BannerPropertiesHeight = 16 + NumBannerProperties * 21 ;
constexpr int32_t BannerDetailsHeight = 20 + NumBannerDetails * 11 ;
2025-06-07 23:02:14 +02:00
static constexpr auto BannerWidgets = makeWidgets (
kMainTileInspectorWidgets ,
2025-06-16 23:10:47 +02:00
makeSpinnerWidgets ( PropertyRowCol ({ 12 , 0 }, 0 , 1 ), kPropertyButtonSize , WidgetType :: spinner , WindowColour :: secondary ), // WIDX_BANNER_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
2025-06-10 19:55:12 +02:00
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 1 , 1 ), 3 , 1 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_BANNER_CHECK_BLOCK_NE
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 1 , 1 ), 3 , 3 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_BANNER_CHECK_BLOCK_SE
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 1 , 1 ), 1 , 3 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ), // WIDX_BANNER_CHECK_BLOCK_SW
makeWidget ( CheckboxGroupOffset ( PropertyRowCol ({ 12 , 0 }, 1 , 1 ), 1 , 1 ), { 12 , 12 }, WidgetType :: checkbox , WindowColour :: secondary ) // WIDX_BANNER_CHECK_BLOCK_NW
2025-06-07 23:02:14 +02:00
);
2016-05-29 16:12:53 +02:00
2025-01-18 14:45:17 +02:00
static constexpr std :: span < const Widget > PageWidgets [] = {
2024-09-04 21:11:26 +02:00
DefaultWidgets ,
SurfaceWidgets ,
PathWidgets ,
TrackWidgets ,
SceneryWidgets ,
EntranceWidgets ,
WallWidgets ,
LargeSceneryWidgets ,
BannerWidgets ,
};
2024-03-10 13:52:35 +00:00
// clang-format on
2016-05-29 16:12:53 +02:00
2024-03-10 13:52:35 +00:00
struct TileInspectorGroupboxSettings
{
// Offsets from the bottom of the window
int16_t details_top_offset , details_bottom_offset ;
int16_t properties_top_offset , properties_bottom_offset ;
// String to be displayed in the details groupbox
StringId string_id ;
};
2021-10-31 22:44:42 +01:00
2024-03-10 13:52:35 +00:00
static constexpr TileInspectorGroupboxSettings MakeGroupboxSettings (
int16_t detailsHeight , int16_t propertiesHeight , StringId stringId )
{
TileInspectorGroupboxSettings settings {};
decltype ( settings . properties_bottom_offset ) offsetSum = 0 ;
2025-06-16 23:10:47 +02:00
settings . properties_bottom_offset = ( offsetSum += kBottomPadding );
2024-03-10 13:52:35 +00:00
settings . properties_top_offset = ( offsetSum += propertiesHeight );
2025-06-16 23:10:47 +02:00
settings . details_bottom_offset = ( offsetSum += kGroupboxPadding );
2024-03-10 13:52:35 +00:00
settings . details_top_offset = ( offsetSum += detailsHeight );
settings . string_id = stringId ;
return settings ;
}
2021-10-31 22:44:42 +01:00
2024-03-10 13:52:35 +00:00
static constexpr TileInspectorGroupboxSettings PageGroupBoxSettings [] = {
MakeGroupboxSettings ( SurfaceDetailsHeight , SurfacePropertiesHeight , STR_TILE_INSPECTOR_GROUPBOX_SURFACE_INFO ),
MakeGroupboxSettings ( PathDetailsHeight , PathPropertiesHeight , STR_TILE_INSPECTOR_GROUPBOX_PATH_INFO ),
MakeGroupboxSettings ( TrackDetailsHeight , TrackPropertiesHeight , STR_TILE_INSPECTOR_GROUPBOX_TRACK_INFO ),
MakeGroupboxSettings ( SceneryDetailsHeight , SceneryPropertiesHeight , STR_TILE_INSPECTOR_GROUPBOX_SCENERY_INFO ),
MakeGroupboxSettings ( EntranceDetailsHeight , EntrancePropertiesHeight , STR_TILE_INSPECTOR_GROUPBOX_ENTRANCE_INFO ),
MakeGroupboxSettings ( WallDetailsHeight , WallPropertiesHeight , STR_TILE_INSPECTOR_GROUPBOX_WALL_INFO ),
MakeGroupboxSettings ( LargeSceneryDetailsHeight , LargeSceneryPropertiesHeight , STR_TILE_INSPECTOR_GROUPBOX_BANNER_INFO ),
MakeGroupboxSettings ( BannerDetailsHeight , BannerPropertiesHeight , STR_TILE_INSPECTOR_GROUPBOX_BANNER_INFO ),
};
2016-05-29 16:12:53 +02:00
2024-03-10 13:52:35 +00:00
static constexpr int32_t ViewportInteractionFlags = EnumsToFlags (
2025-09-15 23:34:29 +02:00
ViewportInteractionItem :: terrain , ViewportInteractionItem :: ride , ViewportInteractionItem :: scenery ,
ViewportInteractionItem :: footpath , ViewportInteractionItem :: pathAddition , ViewportInteractionItem :: parkEntrance ,
ViewportInteractionItem :: wall , ViewportInteractionItem :: largeScenery , ViewportInteractionItem :: banner );
2024-03-10 13:52:35 +00:00
// clang-format off
2018-06-10 18:55:44 +02:00
2018-06-20 17:28:51 +02:00
static uint64_t PageHoldDownWidgets [] = {
2022-10-17 19:21:18 +02:00
( 1uLL << WIDX_SPINNER_X_INCREASE ) | ( 1uLL << WIDX_SPINNER_X_DECREASE ) | ( 1uLL << WIDX_SPINNER_Y_INCREASE ) | ( 1uLL << WIDX_SPINNER_Y_DECREASE ),
( 1uLL << WIDX_SPINNER_X_INCREASE ) | ( 1uLL << WIDX_SPINNER_X_DECREASE ) | ( 1uLL << WIDX_SPINNER_Y_INCREASE ) | ( 1uLL << WIDX_SPINNER_Y_DECREASE ) | ( 1uLL << WIDX_SURFACE_SPINNER_HEIGHT_INCREASE ) | ( 1uLL << WIDX_SURFACE_SPINNER_HEIGHT_DECREASE ),
( 1uLL << WIDX_SPINNER_X_INCREASE ) | ( 1uLL << WIDX_SPINNER_X_DECREASE ) | ( 1uLL << WIDX_SPINNER_Y_INCREASE ) | ( 1uLL << WIDX_SPINNER_Y_DECREASE ) | ( 1uLL << WIDX_PATH_SPINNER_HEIGHT_INCREASE ) | ( 1uLL << WIDX_PATH_SPINNER_HEIGHT_DECREASE ),
( 1uLL << WIDX_SPINNER_X_INCREASE ) | ( 1uLL << WIDX_SPINNER_X_DECREASE ) | ( 1uLL << WIDX_SPINNER_Y_INCREASE ) | ( 1uLL << WIDX_SPINNER_Y_DECREASE ) | ( 1uLL << WIDX_TRACK_SPINNER_HEIGHT_INCREASE ) | ( 1uLL << WIDX_TRACK_SPINNER_HEIGHT_DECREASE ),
( 1uLL << WIDX_SPINNER_X_INCREASE ) | ( 1uLL << WIDX_SPINNER_X_DECREASE ) | ( 1uLL << WIDX_SPINNER_Y_INCREASE ) | ( 1uLL << WIDX_SPINNER_Y_DECREASE ) | ( 1uLL << WIDX_SCENERY_SPINNER_HEIGHT_INCREASE ) | ( 1uLL << WIDX_SCENERY_SPINNER_HEIGHT_DECREASE ),
( 1uLL << WIDX_SPINNER_X_INCREASE ) | ( 1uLL << WIDX_SPINNER_X_DECREASE ) | ( 1uLL << WIDX_SPINNER_Y_INCREASE ) | ( 1uLL << WIDX_SPINNER_Y_DECREASE ) | ( 1uLL << WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE ) | ( 1uLL << WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE ),
( 1uLL << WIDX_SPINNER_X_INCREASE ) | ( 1uLL << WIDX_SPINNER_X_DECREASE ) | ( 1uLL << WIDX_SPINNER_Y_INCREASE ) | ( 1uLL << WIDX_SPINNER_Y_DECREASE ) | ( 1uLL << WIDX_WALL_SPINNER_HEIGHT_INCREASE ) | ( 1uLL << WIDX_WALL_SPINNER_HEIGHT_DECREASE ) | ( 1uLL << WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE ) | ( 1uLL << WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE ),
( 1uLL << WIDX_SPINNER_X_INCREASE ) | ( 1uLL << WIDX_SPINNER_X_DECREASE ) | ( 1uLL << WIDX_SPINNER_Y_INCREASE ) | ( 1uLL << WIDX_SPINNER_Y_DECREASE ) | ( 1uLL << WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE ) | ( 1uLL << WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE ),
( 1uLL << WIDX_SPINNER_X_INCREASE ) | ( 1uLL << WIDX_SPINNER_X_DECREASE ) | ( 1uLL << WIDX_SPINNER_Y_INCREASE ) | ( 1uLL << WIDX_SPINNER_Y_DECREASE ) | ( 1uLL << WIDX_BANNER_SPINNER_HEIGHT_INCREASE ) | ( 1uLL << WIDX_BANNER_SPINNER_HEIGHT_DECREASE ),
2016-05-29 16:12:53 +02:00
};
2018-06-20 17:28:51 +02:00
static uint64_t PageDisabledWidgets [] = {
2022-10-17 19:21:18 +02:00
( 1uLL << WIDX_BUTTON_MOVE_UP ) | ( 1uLL << WIDX_BUTTON_MOVE_DOWN ) | ( 1uLL << WIDX_BUTTON_REMOVE ) | ( 1uLL << WIDX_BUTTON_ROTATE ) | ( 1uLL << WIDX_BUTTON_COPY ),
2017-06-06 23:24:18 +02:00
0 ,
0 ,
0 ,
0 ,
0 ,
0 ,
2022-10-17 19:21:18 +02:00
( 1uLL << WIDX_BUTTON_ROTATE ),
2017-06-06 23:24:18 +02:00
0 ,
2016-05-29 16:12:53 +02:00
};
2024-03-10 13:52:35 +00:00
// clang-format on
2016-05-29 16:12:53 +02:00
2024-03-10 13:52:35 +00:00
class TileInspector final : public Window
2018-05-21 19:11:14 +02:00
{
2024-03-10 13:52:35 +00:00
private :
int16_t _highlightedIndex = - 1 ;
bool _tileSelected = false ;
int32_t _toolMouseX = 0 ;
int32_t _toolMouseY = 0 ;
bool _toolCtrlDown = false ;
CoordsXY _toolMap = {};
bool _applyToAll = false ;
bool _elementCopied = false ;
TileElement _copiedElement ;
Banner _copiedBanner ;
2022-03-23 22:01:23 -04:00
2024-03-10 13:52:35 +00:00
public :
2025-09-17 20:10:06 +02:00
void onOpen () override
2018-05-21 22:34:42 +02:00
{
2025-06-16 23:10:47 +02:00
WindowSetResize ( * this , kMinimumWindowSize , kMaximumWindowSize );
2024-03-10 13:52:35 +00:00
windowTileInspectorSelectedIndex = - 1 ;
2025-09-17 20:10:06 +02:00
setPage ( TileInspectorPage :: Default );
2024-03-10 13:52:35 +00:00
WindowInitScrollWidgets ( * this );
_tileSelected = false ;
2025-03-01 15:56:36 +01:00
ToolSet ( * this , WIDX_BACKGROUND , Tool :: crosshair );
2018-05-21 22:34:42 +02:00
}
2025-09-17 20:10:06 +02:00
void onUpdate () override
2018-06-22 23:21:44 +02:00
{
2024-03-10 13:52:35 +00:00
// Check if the mouse is hovering over the list
2025-06-10 21:57:53 +02:00
if ( ! widgetIsHighlighted ( * this , WIDX_LIST ))
2024-03-10 13:52:35 +00:00
{
if ( _highlightedIndex != - 1 )
2025-09-17 20:10:06 +02:00
invalidateWidget ( WIDX_LIST );
2024-03-10 13:52:35 +00:00
_highlightedIndex = - 1 ;
}
2024-08-05 10:47:36 +02:00
2025-09-17 23:18:52 +02:00
if ( ! isToolActive ( WindowClass :: tileInspector ))
2025-09-17 20:10:06 +02:00
close ();
2024-03-10 13:52:35 +00:00
}
2025-09-17 20:10:06 +02:00
void onMouseUp ( WidgetIndex widgetIndex ) override
2024-03-10 13:52:35 +00:00
{
switch ( widgetIndex )
{
case WIDX_CLOSE :
2025-09-17 20:10:06 +02:00
close ();
2024-03-10 13:52:35 +00:00
return ;
case WIDX_BUTTON_REMOVE :
{
RemoveElement ( windowTileInspectorSelectedIndex );
break ;
}
case WIDX_BUTTON_ROTATE :
RotateElement ( windowTileInspectorSelectedIndex );
break ;
case WIDX_BUTTON_SORT :
SortElements ();
break ;
case WIDX_BUTTON_COPY :
CopyElement ();
break ;
case WIDX_BUTTON_PASTE :
PasteElement ();
break ;
case WIDX_BUTTON_MOVE_UP :
SwapElements ( windowTileInspectorSelectedIndex , windowTileInspectorSelectedIndex + 1 );
break ;
case WIDX_BUTTON_MOVE_DOWN :
SwapElements ( windowTileInspectorSelectedIndex - 1 , windowTileInspectorSelectedIndex );
break ;
}
2025-09-17 20:10:06 +02:00
// only element-specific widgets from now on
2024-03-10 13:52:35 +00:00
if ( tileInspectorPage == TileInspectorPage :: Default || windowTileInspectorSelectedIndex == - 1 )
2022-03-23 22:01:23 -04:00
return ;
2016-05-29 16:12:53 +02:00
2023-07-22 23:32:53 +02:00
const TileElement * const tileElement = OpenRCT2 :: TileInspector :: GetSelectedElement ();
2024-03-10 13:52:35 +00:00
if ( tileElement == nullptr )
return ;
// Page widgets
switch ( tileElement -> GetType ())
{
case TileElementType :: Surface :
switch ( widgetIndex )
{
case WIDX_SURFACE_BUTTON_REMOVE_FENCES :
SurfaceShowParkFences ( false );
break ;
case WIDX_SURFACE_BUTTON_RESTORE_FENCES :
SurfaceShowParkFences ( true );
break ;
case WIDX_SURFACE_CHECK_CORNER_N :
case WIDX_SURFACE_CHECK_CORNER_E :
case WIDX_SURFACE_CHECK_CORNER_S :
case WIDX_SURFACE_CHECK_CORNER_W :
SurfaceToggleCorner ((( widgetIndex - WIDX_SURFACE_CHECK_CORNER_N ) + 2 - GetCurrentRotation ()) & 3 );
break ;
case WIDX_SURFACE_CHECK_DIAGONAL :
SurfaceToggleDiagonal ();
break ;
} // switch widgetindex
break ;
case TileElementType :: Path :
switch ( widgetIndex )
{
case WIDX_PATH_CHECK_SLOPED :
PathSetSloped ( windowTileInspectorSelectedIndex , ! tileElement -> AsPath () -> IsSloped ());
break ;
case WIDX_PATH_CHECK_JUNCTION_RAILINGS :
PathSetJunctionRailings (
windowTileInspectorSelectedIndex , ! tileElement -> AsPath () -> HasJunctionRailings ());
break ;
case WIDX_PATH_CHECK_BROKEN :
PathSetBroken ( windowTileInspectorSelectedIndex , ! tileElement -> AsPath () -> IsBroken ());
break ;
case WIDX_PATH_CHECK_EDGE_E :
case WIDX_PATH_CHECK_EDGE_S :
case WIDX_PATH_CHECK_EDGE_W :
case WIDX_PATH_CHECK_EDGE_N :
{
// 0 = east/right, 1 = south/bottom, 2 = west/left, 3 = north/top
const int32_t eswn = ( widgetIndex - WIDX_PATH_CHECK_EDGE_E ) / 2 ;
// Transform to world orientation
const int32_t index = ( eswn - GetCurrentRotation ()) & 3 ;
PathToggleEdge (
windowTileInspectorSelectedIndex ,
index + 4 ); // The corners are stored in the 4 most significant bits, hence the + 4
break ;
}
case WIDX_PATH_CHECK_EDGE_NE :
case WIDX_PATH_CHECK_EDGE_SE :
case WIDX_PATH_CHECK_EDGE_SW :
case WIDX_PATH_CHECK_EDGE_NW :
{
// 0 = NE, 1 = SE, 2 = SW, 3 = NW
const int32_t neseswnw = ( widgetIndex - WIDX_PATH_CHECK_EDGE_NE ) / 2 ;
// Transform to world orientation
const int32_t index = ( neseswnw - GetCurrentRotation ()) & 3 ;
PathToggleEdge ( windowTileInspectorSelectedIndex , index );
break ;
}
} // switch widget index
break ;
case TileElementType :: Track :
switch ( widgetIndex )
{
case WIDX_TRACK_CHECK_APPLY_TO_ALL :
_applyToAll ^= 1 ;
2025-09-17 20:10:06 +02:00
invalidateWidget ( widgetIndex );
2024-03-10 13:52:35 +00:00
break ;
case WIDX_TRACK_CHECK_CHAIN_LIFT :
{
2025-09-17 20:10:06 +02:00
bool entireTrackBlock = isWidgetPressed ( WIDX_TRACK_CHECK_APPLY_TO_ALL );
2024-03-10 13:52:35 +00:00
bool newLift = ! tileElement -> AsTrack () -> HasChain ();
TrackBlockSetLift ( windowTileInspectorSelectedIndex , entireTrackBlock , newLift );
break ;
}
case WIDX_TRACK_CHECK_BRAKE_CLOSED :
TrackSetBrakeClosed ( windowTileInspectorSelectedIndex , ! tileElement -> AsTrack () -> IsBrakeClosed ());
break ;
case WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE :
TrackSetIndestructible (
windowTileInspectorSelectedIndex , ! tileElement -> AsTrack () -> IsIndestructible ());
break ;
} // switch widget index
break ;
case TileElementType :: SmallScenery :
switch ( widgetIndex )
{
case WIDX_SCENERY_CHECK_QUARTER_N :
case WIDX_SCENERY_CHECK_QUARTER_E :
case WIDX_SCENERY_CHECK_QUARTER_S :
case WIDX_SCENERY_CHECK_QUARTER_W :
QuarterTileSet ( windowTileInspectorSelectedIndex , widgetIndex - WIDX_SCENERY_CHECK_QUARTER_N );
break ;
case WIDX_SCENERY_CHECK_COLLISION_N :
case WIDX_SCENERY_CHECK_COLLISION_E :
case WIDX_SCENERY_CHECK_COLLISION_S :
case WIDX_SCENERY_CHECK_COLLISION_W :
ToggleQuadrantCollosion (
windowTileInspectorSelectedIndex , widgetIndex - WIDX_SCENERY_CHECK_COLLISION_N );
break ;
} // switch widget index
break ;
case TileElementType :: Entrance :
switch ( widgetIndex )
{
case WIDX_ENTRANCE_BUTTON_MAKE_USABLE :
EntranceMakeUsable ( windowTileInspectorSelectedIndex );
break ;
} // switch widget index
break ;
case TileElementType :: Banner :
switch ( widgetIndex )
{
case WIDX_BANNER_CHECK_BLOCK_NE :
case WIDX_BANNER_CHECK_BLOCK_SE :
case WIDX_BANNER_CHECK_BLOCK_SW :
case WIDX_BANNER_CHECK_BLOCK_NW :
BannerToggleBlock ( windowTileInspectorSelectedIndex , widgetIndex - WIDX_BANNER_CHECK_BLOCK_NE );
break ;
} // switch widget index
break ;
case TileElementType :: LargeScenery :
case TileElementType :: Wall :
2024-04-12 20:08:34 +02:00
switch ( widgetIndex )
{
case WIDX_WALL_ANIMATION_IS_BACKWARDS :
WallSetAnimationIsBackwards (
windowTileInspectorSelectedIndex , ! tileElement -> AsWall () -> AnimationIsBackwards ());
break ;
}
2025-05-23 18:29:03 +03:00
break ;
2024-03-10 13:52:35 +00:00
default :
break ;
}
}
2025-09-17 20:10:06 +02:00
void onClose () override
2024-03-10 13:52:35 +00:00
{
2025-09-17 23:18:52 +02:00
if ( isToolActive ( WindowClass :: tileInspector ))
2024-07-20 23:14:37 +10:00
ToolCancel ();
2024-08-05 10:47:36 +02:00
2024-03-10 13:52:35 +00:00
TileElement * const elem = OpenRCT2 :: TileInspector :: GetSelectedElement ();
if ( elem != nullptr )
{
MapInvalidateElement ( _toolMap , elem );
}
windowTileInspectorSelectedIndex = - 1 ;
}
2025-09-17 20:10:06 +02:00
void onResize () override
2024-03-10 13:52:35 +00:00
{
2025-09-17 19:03:29 +02:00
if ( width < minWidth )
2024-03-10 13:52:35 +00:00
{
2025-09-17 20:10:06 +02:00
invalidate ();
2025-09-17 19:03:29 +02:00
width = minWidth ;
2024-03-10 13:52:35 +00:00
}
2025-09-17 19:03:29 +02:00
if ( height < minHeight )
2024-03-10 13:52:35 +00:00
{
2025-09-17 20:10:06 +02:00
invalidate ();
2025-09-17 19:03:29 +02:00
height = minHeight ;
2024-03-10 13:52:35 +00:00
}
}
2025-09-17 20:10:06 +02:00
void onMouseDown ( WidgetIndex widgetIndex ) override
2024-03-10 13:52:35 +00:00
{
switch ( widgetIndex )
{
case WIDX_SPINNER_X_INCREASE :
2024-03-25 16:56:04 +01:00
windowTileInspectorTile . x = std :: min < int32_t > ( windowTileInspectorTile . x + 1 , kMaximumMapSizeTechnical - 1 );
2025-01-22 17:16:55 +01:00
_toolMap . x = std :: min < int32_t > ( _toolMap . x + 32 , kMaximumTileStartXY );
2024-03-10 13:52:35 +00:00
LoadTile ( nullptr );
break ;
case WIDX_SPINNER_X_DECREASE :
windowTileInspectorTile . x = std :: max < int32_t > ( windowTileInspectorTile . x - 1 , 0 );
_toolMap . x = std :: max < int32_t > ( _toolMap . x - 32 , 0 );
LoadTile ( nullptr );
break ;
case WIDX_SPINNER_Y_INCREASE :
2024-03-25 16:56:04 +01:00
windowTileInspectorTile . y = std :: min < int32_t > ( windowTileInspectorTile . y + 1 , kMaximumMapSizeTechnical - 1 );
2025-01-22 17:16:55 +01:00
_toolMap . y = std :: min < int32_t > ( _toolMap . y + 32 , kMaximumTileStartXY );
2024-03-10 13:52:35 +00:00
LoadTile ( nullptr );
break ;
case WIDX_SPINNER_Y_DECREASE :
windowTileInspectorTile . y = std :: max < int32_t > ( windowTileInspectorTile . y - 1 , 0 );
_toolMap . y = std :: max < int32_t > ( _toolMap . y - 32 , 0 );
LoadTile ( nullptr );
break ;
} // switch widget index
2025-09-17 20:10:06 +02:00
// only element-specific widgets from now on
2024-03-10 13:52:35 +00:00
if ( tileInspectorPage == TileInspectorPage :: Default || windowTileInspectorSelectedIndex == - 1 )
return ;
const TileElement * tileElement = OpenRCT2 :: TileInspector :: GetSelectedElement ();
2022-03-23 22:01:23 -04:00
if ( tileElement == nullptr )
return ;
switch ( tileElement -> GetType ())
{
case TileElementType :: Surface :
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
{
case WIDX_SURFACE_SPINNER_HEIGHT_INCREASE :
BaseHeightOffset ( windowTileInspectorSelectedIndex , 1 );
break ;
2022-03-23 22:01:23 -04:00
2024-03-10 13:52:35 +00:00
case WIDX_SURFACE_SPINNER_HEIGHT_DECREASE :
BaseHeightOffset ( windowTileInspectorSelectedIndex , - 1 );
break ;
} // switch widget index
2022-03-23 22:01:23 -04:00
break ;
2024-03-10 13:52:35 +00:00
2022-03-23 22:01:23 -04:00
case TileElementType :: Path :
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
2022-03-23 22:01:23 -04:00
{
2024-03-10 13:52:35 +00:00
case WIDX_PATH_SPINNER_HEIGHT_INCREASE :
BaseHeightOffset ( windowTileInspectorSelectedIndex , 1 );
break ;
2022-03-23 22:01:23 -04:00
2024-03-10 13:52:35 +00:00
case WIDX_PATH_SPINNER_HEIGHT_DECREASE :
BaseHeightOffset ( windowTileInspectorSelectedIndex , - 1 );
break ;
} // switch widget index
2022-03-23 22:01:23 -04:00
break ;
2018-06-22 23:21:44 +02:00
2022-03-23 22:01:23 -04:00
case TileElementType :: Track :
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
2022-03-23 22:01:23 -04:00
{
2024-03-10 13:52:35 +00:00
case WIDX_TRACK_SPINNER_HEIGHT_INCREASE :
2025-09-17 20:10:06 +02:00
if ( isWidgetPressed ( WIDX_TRACK_CHECK_APPLY_TO_ALL ))
2024-03-10 13:52:35 +00:00
TrackBlockHeightOffset ( windowTileInspectorSelectedIndex , 1 );
else
BaseHeightOffset ( windowTileInspectorSelectedIndex , 1 );
break ;
2022-03-23 22:01:23 -04:00
2024-03-10 13:52:35 +00:00
case WIDX_TRACK_SPINNER_HEIGHT_DECREASE :
2025-09-17 20:10:06 +02:00
if ( isWidgetPressed ( WIDX_TRACK_CHECK_APPLY_TO_ALL ))
2024-03-10 13:52:35 +00:00
TrackBlockHeightOffset ( windowTileInspectorSelectedIndex , - 1 );
else
BaseHeightOffset ( windowTileInspectorSelectedIndex , - 1 );
break ;
} // switch widget index
2022-03-23 22:01:23 -04:00
break ;
2018-06-22 23:21:44 +02:00
2022-03-23 22:01:23 -04:00
case TileElementType :: SmallScenery :
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
2022-03-23 22:01:23 -04:00
{
2024-03-10 13:52:35 +00:00
case WIDX_SCENERY_SPINNER_HEIGHT_INCREASE :
BaseHeightOffset ( windowTileInspectorSelectedIndex , 1 );
break ;
2022-03-23 22:01:23 -04:00
2024-03-10 13:52:35 +00:00
case WIDX_SCENERY_SPINNER_HEIGHT_DECREASE :
BaseHeightOffset ( windowTileInspectorSelectedIndex , - 1 );
break ;
} // switch widget index
2022-03-23 22:01:23 -04:00
break ;
2016-10-02 22:15:54 +02:00
2022-03-23 22:01:23 -04:00
case TileElementType :: Entrance :
2024-03-10 13:52:35 +00:00
switch ( widgetIndex )
{
case WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE :
BaseHeightOffset ( windowTileInspectorSelectedIndex , 1 );
break ;
2022-03-23 22:01:23 -04:00
2024-03-10 13:52:35 +00:00
case WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE :
BaseHeightOffset ( windowTileInspectorSelectedIndex , - 1 );
break ;
case WIDX_ENTRANCE_BUTTON_MAKE_USABLE :
EntranceMakeUsable ( windowTileInspectorSelectedIndex );
break ;
} // switch widget index
break ;
case TileElementType :: Wall :
switch ( widgetIndex )
2022-03-23 22:01:23 -04:00
{
2024-03-10 13:52:35 +00:00
case WIDX_WALL_SPINNER_HEIGHT_INCREASE :
BaseHeightOffset ( windowTileInspectorSelectedIndex , 1 );
break ;
case WIDX_WALL_SPINNER_HEIGHT_DECREASE :
BaseHeightOffset ( windowTileInspectorSelectedIndex , - 1 );
break ;
case WIDX_WALL_DROPDOWN_SLOPE_BUTTON :
2022-03-23 22:01:23 -04:00
{
2024-03-10 13:52:35 +00:00
Widget * widget = & widgets [ widgetIndex ];
// Use dropdown instead of dropdown button
widget -- ;
// Fill dropdown list
2025-08-23 16:06:48 +02:00
gDropdown . items [ 0 ] = Dropdown :: MenuLabel ( STR_TILE_INSPECTOR_WALL_FLAT );
gDropdown . items [ 1 ] = Dropdown :: MenuLabel ( STR_TILE_INSPECTOR_WALL_SLOPED_LEFT );
gDropdown . items [ 2 ] = Dropdown :: MenuLabel ( STR_TILE_INSPECTOR_WALL_SLOPED_RIGHT );
2024-03-10 13:52:35 +00:00
WindowDropdownShowTextCustomWidth (
{ windowPos . x + widget -> left , windowPos . y + widget -> top }, widget -> height () + 1 , colours [ 1 ], 0 ,
Dropdown :: Flag :: StayOpen , 3 , widget -> width () - 3 );
// Set current value as checked
2025-08-23 14:09:40 +02:00
gDropdown . items [ tileElement -> AsWall () -> GetSlope ()]. setChecked ( true );
2024-03-10 13:52:35 +00:00
break ;
}
case WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE :
WallAnimationFrameOffset ( windowTileInspectorSelectedIndex , 1 );
break ;
case WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE :
WallAnimationFrameOffset ( windowTileInspectorSelectedIndex , - 1 );
break ;
} // switch widget index
break ;
case TileElementType :: LargeScenery :
switch ( widgetIndex )
{
case WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE :
BaseHeightOffset ( windowTileInspectorSelectedIndex , 1 );
break ;
case WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE :
BaseHeightOffset ( windowTileInspectorSelectedIndex , - 1 );
break ;
} // switch widget index
break ;
case TileElementType :: Banner :
switch ( widgetIndex )
{
case WIDX_BANNER_SPINNER_HEIGHT_INCREASE :
BaseHeightOffset ( windowTileInspectorSelectedIndex , 1 );
break ;
case WIDX_BANNER_SPINNER_HEIGHT_DECREASE :
BaseHeightOffset ( windowTileInspectorSelectedIndex , - 1 );
break ;
} // switch widget index
break ;
default :
break ;
}
}
2025-09-17 20:10:06 +02:00
void onDropdown ( WidgetIndex widgetIndex , int32_t dropdownIndex ) override
2024-03-10 13:52:35 +00:00
{
if ( dropdownIndex == - 1 )
return ;
// Get selected element
const TileElement * const tileElement = OpenRCT2 :: TileInspector :: GetSelectedElement ();
if ( tileInspectorPage == TileInspectorPage :: Wall )
{
Guard :: Assert ( tileElement -> GetType () == TileElementType :: Wall , "Element is not a wall" );
if ( widgetIndex == WIDX_WALL_DROPDOWN_SLOPE_BUTTON )
WallSetSlope ( windowTileInspectorSelectedIndex , dropdownIndex );
}
}
2025-09-17 20:10:06 +02:00
void onToolUpdate ( WidgetIndex widgetIndex , const ScreenCoordsXY & screenCoords ) override
2024-03-10 13:52:35 +00:00
{
MapInvalidateSelectionRect ();
2025-09-10 23:23:51 +02:00
gMapSelectFlags . set ( MapSelectFlag :: enable );
2024-03-10 13:52:35 +00:00
CoordsXY mapCoords ;
TileElement * clickedElement = nullptr ;
bool mouseOnViewport = false ;
2025-09-30 22:35:02 +02:00
if ( GetInputManager (). isModifierKeyPressed ( ModifierKey :: ctrl ))
2024-03-10 13:52:35 +00:00
{
auto info = GetMapCoordinatesFromPos ( screenCoords , ViewportInteractionFlags );
clickedElement = info . Element ;
mapCoords = info . Loc ;
}
// Even if Ctrl was pressed, fall back to normal selection when there was nothing under the cursor
if ( clickedElement == nullptr )
{
auto mouseCoords = ScreenPosToMapPos ( screenCoords , nullptr );
if ( mouseCoords . has_value ())
{
mouseOnViewport = true ;
mapCoords = mouseCoords . value ();
}
}
if ( mouseOnViewport )
gMapSelectPositionA = gMapSelectPositionB = mapCoords ;
else if ( _tileSelected )
gMapSelectPositionA = gMapSelectPositionB = _toolMap ;
else
2025-09-10 23:23:51 +02:00
gMapSelectFlags . unset ( MapSelectFlag :: enable );
2024-03-10 13:52:35 +00:00
2025-09-10 23:47:41 +02:00
gMapSelectType = MapSelectType :: full ;
2024-03-10 13:52:35 +00:00
MapInvalidateSelectionRect ();
}
2025-09-17 20:10:06 +02:00
void onToolDown ( WidgetIndex widgetIndex , const ScreenCoordsXY & screenCoords ) override
2024-03-10 13:52:35 +00:00
{
UpdateSelectedTile ( screenCoords );
}
2025-09-17 20:10:06 +02:00
void onToolDrag ( WidgetIndex widgetIndex , const ScreenCoordsXY & screenCoords ) override
2024-03-10 13:52:35 +00:00
{
UpdateSelectedTile ( screenCoords );
}
2025-09-17 20:10:06 +02:00
ScreenSize onScrollGetSize ( int32_t scrollIndex ) override
2024-03-10 13:52:35 +00:00
{
2025-06-16 23:10:47 +02:00
return ScreenSize ( kWindowSize . width - 30 , windowTileInspectorElementCount * kScrollableRowHeight );
2024-03-10 13:52:35 +00:00
}
2025-09-17 20:10:06 +02:00
void onScrollMouseDown ( int32_t scrollIndex , const ScreenCoordsXY & screenCoords ) override
2024-03-10 13:52:35 +00:00
{
// There is nothing to interact with when no tile is selected
if ( ! _tileSelected )
return ;
// Because the list items are displayed in reverse order, subtract the calculated index from the amount of elements
2024-05-09 13:59:03 +02:00
const int16_t index = windowTileInspectorElementCount - ( screenCoords . y - 1 ) / kScrollableRowHeight - 1 ;
2024-03-10 13:52:35 +00:00
const ScreenRect checkboxColumnRect { { 2 , 0 }, { 15 , screenCoords . y } };
if ( index >= 0 && checkboxColumnRect . Contains ( screenCoords ))
{ // Checkbox was clicked
ToggleInvisibility ( index );
}
else
{
SelectElementFromList ( index );
}
}
2025-09-17 20:10:06 +02:00
void onScrollMouseOver ( int32_t scrollIndex , const ScreenCoordsXY & screenCoords ) override
2024-03-10 13:52:35 +00:00
{
2024-05-09 13:59:03 +02:00
int16_t index = windowTileInspectorElementCount - ( screenCoords . y - 1 ) / kScrollableRowHeight - 1 ;
2024-03-10 13:52:35 +00:00
if ( index < 0 || index >= windowTileInspectorElementCount )
_highlightedIndex = - 1 ;
else
_highlightedIndex = index ;
2025-09-17 20:10:06 +02:00
invalidateWidget ( WIDX_LIST );
2024-03-10 13:52:35 +00:00
}
2025-09-17 20:10:06 +02:00
void onDraw ( RenderTarget & rt ) override
2024-03-10 13:52:35 +00:00
{
2025-09-17 20:10:06 +02:00
drawWidgets ( rt );
2024-03-10 13:52:35 +00:00
ScreenCoordsXY screenCoords ( windowPos . x , windowPos . y );
// Draw coordinates
2025-01-10 15:39:32 +01:00
auto yOffset = widgets [ WIDX_SPINNER_X_LABEL ]. top ;
2024-03-10 13:52:35 +00:00
if ( _tileSelected )
{
auto tileCoords = TileCoordsXY { _toolMap };
auto ft = Formatter ();
ft . Add < int32_t > ( tileCoords . x );
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 43 , yOffset }, STR_FORMAT_INTEGER , ft ,
2025-10-16 20:06:18 +02:00
{ colours [ 1 ], TextAlignment :: right });
2024-03-10 13:52:35 +00:00
ft = Formatter ();
ft . Add < int32_t > ( tileCoords . y );
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 113 , yOffset }, STR_FORMAT_INTEGER , ft ,
2025-10-16 20:06:18 +02:00
{ colours [ 1 ], TextAlignment :: right });
2024-03-10 13:52:35 +00:00
}
else
{
2025-05-05 01:06:46 +03:00
DrawText ( rt , screenCoords + ScreenCoordsXY ( 43 - 7 , yOffset ), { colours [ 1 ] }, "-" );
DrawText ( rt , screenCoords + ScreenCoordsXY ( 113 - 7 , yOffset ), { colours [ 1 ] }, "-" );
2024-03-10 13:52:35 +00:00
}
if ( windowTileInspectorSelectedIndex != - 1 )
{
// X and Y of first element in detail box
screenCoords = windowPos
+ ScreenCoordsXY { widgets [ WIDX_GROUPBOX_DETAILS ]. left + 7 , widgets [ WIDX_GROUPBOX_DETAILS ]. top + 14 };
// Get map element
const TileElement * const tileElement = OpenRCT2 :: TileInspector :: GetSelectedElement ();
if ( tileElement == nullptr )
return ;
switch ( tileElement -> GetType ())
{
case TileElementType :: Surface :
{
// Details
// Terrain texture name
2025-01-19 16:59:45 +01:00
StringId terrainNameId = kStringIdEmpty ;
2024-03-10 13:52:35 +00:00
auto surfaceStyle = tileElement -> AsSurface () -> GetSurfaceObject ();
if ( surfaceStyle != nullptr )
terrainNameId = surfaceStyle -> NameStringId ;
auto ft = Formatter ();
ft . Add < StringId > ( terrainNameId );
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_SURFACE_TERAIN , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Edge texture name
2025-01-19 16:59:45 +01:00
StringId terrainEdgeNameId = kStringIdEmpty ;
2024-03-10 13:52:35 +00:00
auto edgeStyle = tileElement -> AsSurface () -> GetEdgeObject ();
if ( edgeStyle != nullptr )
terrainEdgeNameId = edgeStyle -> NameStringId ;
ft = Formatter ();
ft . Add < StringId > ( terrainEdgeNameId );
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 11 }, STR_TILE_INSPECTOR_SURFACE_EDGE , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Land ownership
StringId landOwnership ;
if ( tileElement -> AsSurface () -> GetOwnership () & OWNERSHIP_OWNED )
landOwnership = STR_LAND_OWNED ;
else if ( tileElement -> AsSurface () -> GetOwnership () & OWNERSHIP_AVAILABLE )
landOwnership = STR_LAND_SALE ;
else if ( tileElement -> AsSurface () -> GetOwnership () & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED )
landOwnership = STR_CONSTRUCTION_RIGHTS_OWNED ;
else if ( tileElement -> AsSurface () -> GetOwnership () & OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE )
landOwnership = STR_CONSTRUCTION_RIGHTS_SALE ;
else
landOwnership = STR_TILE_INSPECTOR_LAND_NOT_OWNED_AND_NOT_AVAILABLE ;
ft = Formatter ();
ft . Add < StringId > ( landOwnership );
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 22 }, STR_TILE_INSPECTOR_SURFACE_OWNERSHIP , ft ,
2024-03-10 13:52:35 +00:00
{ colours [ 1 ] });
// Water level
ft = Formatter ();
ft . Add < uint32_t > ( tileElement -> AsSurface () -> GetWaterHeight ());
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 33 }, STR_TILE_INSPECTOR_SURFACE_WATER_LEVEL , ft ,
2024-03-10 13:52:35 +00:00
{ colours [ 1 ] });
// Properties
// Raise / lower label
screenCoords = windowPos
+ ScreenCoordsXY { widgets [ WIDX_GROUPBOX_DETAILS ]. left + 7 ,
widgets [ WIDX_SURFACE_SPINNER_HEIGHT ]. top };
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_BASE_HEIGHT_FULL , {}, { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Current base height
screenCoords . x = windowPos . x + widgets [ WIDX_SURFACE_SPINNER_HEIGHT ]. left + 3 ;
ft = Formatter ();
ft . Add < int32_t > ( tileElement -> BaseHeight );
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_FORMAT_INTEGER , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Raised corners
screenCoords = windowPos
+ ScreenCoordsXY { widgets [ WIDX_GROUPBOX_DETAILS ]. left + 7 ,
widgets [ WIDX_SURFACE_CHECK_CORNER_E ]. top };
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_SURFACE_CORNERS , {}, { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
break ;
}
case TileElementType :: Path :
{
// Details
auto pathEl = tileElement -> AsPath ();
auto footpathObj = pathEl -> GetLegacyPathEntry ();
if ( footpathObj == nullptr )
{
// Surface name
auto surfaceObj = pathEl -> GetSurfaceEntry ();
if ( surfaceObj != nullptr )
{
auto ft = Formatter ();
ft . Add < StringId > ( surfaceObj -> NameStringId );
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_FOOTPATH_SURFACE_NAME , ft , { COLOUR_WHITE });
2024-03-10 13:52:35 +00:00
}
// Railings name
auto railingsObj = pathEl -> GetRailingsEntry ();
if ( railingsObj != nullptr )
{
auto ft = Formatter ();
ft . Add < StringId > ( railingsObj -> NameStringId );
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 11 }, STR_TILE_INSPECTOR_FOOTPATH_RAILINGS_NAME , ft ,
2024-03-10 13:52:35 +00:00
{ COLOUR_WHITE });
}
}
else
{
// Legacy path name
auto footpathEntry = reinterpret_cast < const FootpathEntry *> ( footpathObj -> GetLegacyData ());
auto ft = Formatter ();
ft . Add < StringId > ( footpathEntry -> string_idx );
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_PATH_NAME , ft , { COLOUR_WHITE });
2024-03-10 13:52:35 +00:00
}
// Path addition
if ( tileElement -> AsPath () -> HasAddition ())
{
const auto pathAdditionEntry = tileElement -> AsPath () -> GetAdditionEntry ();
StringId additionNameId = pathAdditionEntry != nullptr
? pathAdditionEntry -> name
: static_cast < StringId > ( STR_UNKNOWN_OBJECT_TYPE );
auto ft = Formatter ();
ft . Add < StringId > ( additionNameId );
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 2 * 11 }, STR_TILE_INSPECTOR_PATH_ADDITIONS , ft ,
2024-03-10 13:52:35 +00:00
{ COLOUR_WHITE });
}
else
{
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 2 * 11 }, STR_TILE_INSPECTOR_PATH_ADDITIONS_NONE , {},
2024-03-10 13:52:35 +00:00
{ COLOUR_WHITE });
}
// Properties
// Raise / lower label
screenCoords = windowPos
+ ScreenCoordsXY { widgets [ WIDX_GROUPBOX_DETAILS ]. left + 7 , widgets [ WIDX_PATH_SPINNER_HEIGHT ]. top };
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_BASE_HEIGHT_FULL , {}, { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Current base height
screenCoords . x = windowPos . x + widgets [ WIDX_PATH_SPINNER_HEIGHT ]. left + 3 ;
auto ft = Formatter ();
ft . Add < int32_t > ( tileElement -> BaseHeight );
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_FORMAT_INTEGER , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Path connections
screenCoords = windowPos
+ ScreenCoordsXY { widgets [ WIDX_GROUPBOX_DETAILS ]. left + 7 , widgets [ WIDX_PATH_CHECK_EDGE_W ]. top };
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_PATH_CONNECTED_EDGES , {}, { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
break ;
}
case TileElementType :: Track :
{
auto trackElement = tileElement -> AsTrack ();
RideId id = trackElement -> GetRideIndex ();
auto rideTile = GetRide ( id );
// Ride ID
auto ft = Formatter ();
ft . Add < int16_t > ( id );
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_TRACK_RIDE_ID , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Ride name
if ( rideTile != nullptr )
{
ft = Formatter ();
2025-03-09 00:26:25 +01:00
rideTile -> formatNameTo ( ft );
2024-03-10 13:52:35 +00:00
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 11 }, STR_TILE_INSPECTOR_TRACK_RIDE_NAME , ft ,
2024-03-10 13:52:35 +00:00
{ colours [ 1 ] });
}
// Ride type. Individual pieces may be of a different ride type from the ride it belongs to.
const auto & rtd = GetRideTypeDescriptor ( trackElement -> GetRideType ());
ft = Formatter ();
ft . Add < StringId > ( rtd . Naming . Name );
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 22 }, STR_TILE_INSPECTOR_TRACK_RIDE_TYPE , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Track
ft = Formatter ();
2024-10-11 15:30:27 +02:00
ft . Add < uint16_t > ( trackElement -> GetTrackType ());
2024-03-10 13:52:35 +00:00
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 33 }, STR_TILE_INSPECTOR_TRACK_PIECE_ID , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
ft = Formatter ();
2024-10-11 15:30:27 +02:00
ft . Add < uint16_t > ( trackElement -> GetSequenceIndex ());
2024-03-10 13:52:35 +00:00
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 44 }, STR_TILE_INSPECTOR_TRACK_SEQUENCE , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
if ( trackElement -> IsStation ())
{
auto stationIndex = trackElement -> GetStationIndex ();
ft = Formatter ();
ft . Add < StringId > ( STR_COMMA16 );
ft . Add < int16_t > ( stationIndex . ToUnderlying ());
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 55 }, STR_TILE_INSPECTOR_STATION_INDEX , ft ,
2024-03-10 13:52:35 +00:00
{ colours [ 1 ] });
}
else
{
const char * stationNone = "-" ;
ft = Formatter ();
ft . Add < StringId > ( STR_STRING );
ft . Add < char *> ( stationNone );
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 55 }, STR_TILE_INSPECTOR_STATION_INDEX , ft ,
2024-03-10 13:52:35 +00:00
{ colours [ 1 ] });
}
ft = Formatter ();
ft . Add < StringId > ( ColourSchemeNames [ trackElement -> GetColourScheme ()]);
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 66 }, STR_TILE_INSPECTOR_COLOUR_SCHEME , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Properties
// Raise / lower label
screenCoords . y = windowPos . y + widgets [ WIDX_TRACK_SPINNER_HEIGHT ]. top ;
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_BASE_HEIGHT_FULL , {}, { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Current base height
screenCoords . x = windowPos . x + widgets [ WIDX_TRACK_SPINNER_HEIGHT ]. left + 3 ;
ft = Formatter ();
ft . Add < int32_t > ( tileElement -> BaseHeight );
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_FORMAT_INTEGER , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
break ;
}
case TileElementType :: SmallScenery :
{
// Details
// Age
auto ft = Formatter ();
ft . Add < int16_t > ( tileElement -> AsSmallScenery () -> GetAge ());
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_SCENERY_AGE , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Quadrant value
const auto * sceneryEntry = tileElement -> AsSmallScenery () -> GetEntry ();
if ( sceneryEntry != nullptr && ! ( sceneryEntry -> HasFlag ( SMALL_SCENERY_FLAG_FULL_TILE )))
{
int16_t quadrant = tileElement -> AsSmallScenery () -> GetSceneryQuadrant ();
static constexpr StringId _quadrantStringIdx [] = {
STR_TILE_INSPECTOR_SCENERY_QUADRANT_SW ,
STR_TILE_INSPECTOR_SCENERY_QUADRANT_NW ,
STR_TILE_INSPECTOR_SCENERY_QUADRANT_NE ,
STR_TILE_INSPECTOR_SCENERY_QUADRANT_SE ,
};
ft = Formatter ();
ft . Add < StringId > ( _quadrantStringIdx [ quadrant ]);
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 11 }, STR_TILE_INSPECTOR_SCENERY_QUADRANT , ft ,
2024-03-10 13:52:35 +00:00
{ colours [ 1 ] });
}
// Scenery ID
ft = Formatter ();
ft . Add < ObjectEntryIndex > ( tileElement -> AsSmallScenery () -> GetEntryIndex ());
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 22 }, STR_TILE_INSPECTOR_SCENERY_ENTRY_IDX , ft ,
2024-03-10 13:52:35 +00:00
{ colours [ 1 ] });
// Properties
// Raise / Lower
screenCoords . y = windowPos . y + widgets [ WIDX_SCENERY_SPINNER_HEIGHT ]. top ;
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_BASE_HEIGHT_FULL , {}, { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Current base height
screenCoords . x = windowPos . x + widgets [ WIDX_SCENERY_SPINNER_HEIGHT ]. left + 3 ;
ft = Formatter ();
ft . Add < int32_t > ( tileElement -> BaseHeight );
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_FORMAT_INTEGER , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Quarter tile
screenCoords = windowPos
+ ScreenCoordsXY { widgets [ WIDX_GROUPBOX_DETAILS ]. left + 7 ,
widgets [ WIDX_SCENERY_CHECK_QUARTER_E ]. top };
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_SCENERY_QUADRANT_LABEL , {}, { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Collision
screenCoords . y = windowPos . y + widgets [ WIDX_SCENERY_CHECK_COLLISION_E ]. top ;
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_COLLISSION , {}, { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
break ;
}
case TileElementType :: Entrance :
{
// Details
// Entrance type
auto ft = Formatter ();
ft . Add < StringId > ( EntranceTypeStringIds [ tileElement -> AsEntrance () -> GetEntranceType ()]);
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_ENTRANCE_TYPE , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
if ( tileElement -> AsEntrance () -> GetEntranceType () == ENTRANCE_TYPE_PARK_ENTRANCE )
{
// TODO: Make this work with Left/Right park entrance parts
ft = Formatter ();
ft . Add < StringId > ( ParkEntranceGetIndex ({ _toolMap , tileElement -> GetBaseZ () }));
2022-03-23 22:01:23 -04:00
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 11 }, STR_TILE_INSPECTOR_ENTRANCE_ENTRANCE_ID , ft ,
2022-03-23 22:01:23 -04:00
{ colours [ 1 ] });
}
else
{
2024-03-10 13:52:35 +00:00
ft = Formatter ();
ft . Add < int16_t > ( tileElement -> AsEntrance () -> GetStationIndex (). ToUnderlying ());
if ( tileElement -> AsEntrance () -> GetEntranceType () == ENTRANCE_TYPE_RIDE_ENTRANCE )
{
// Ride entrance ID
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 11 }, STR_TILE_INSPECTOR_ENTRANCE_ENTRANCE_ID , ft ,
2024-03-10 13:52:35 +00:00
{ colours [ 1 ] });
}
else
{
// Ride exit ID
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 11 }, STR_TILE_INSPECTOR_ENTRANCE_EXIT_ID , ft ,
2024-03-10 13:52:35 +00:00
{ colours [ 1 ] });
}
}
if ( tileElement -> AsEntrance () -> GetEntranceType () == ENTRANCE_TYPE_PARK_ENTRANCE )
{
// Entrance part
ft = Formatter ();
ft . Add < StringId > ( ParkEntrancePartStringIds [ tileElement -> AsEntrance () -> GetSequenceIndex ()]);
2022-03-23 22:01:23 -04:00
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 22 }, STR_TILE_INSPECTOR_ENTRANCE_PART , ft ,
2024-03-10 13:52:35 +00:00
{ colours [ 1 ] });
}
else
{
// Ride ID
ft = Formatter ();
ft . Add < RideId > ( tileElement -> AsEntrance () -> GetRideIndex ());
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 22 }, STR_TILE_INSPECTOR_ENTRANCE_RIDE_ID , ft ,
2024-03-10 13:52:35 +00:00
{ colours [ 1 ] });
// Station index
auto stationIndex = tileElement -> AsEntrance () -> GetStationIndex ();
ft = Formatter ();
ft . Add < StringId > ( STR_COMMA16 );
ft . Add < int16_t > ( stationIndex . ToUnderlying ());
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 33 }, STR_TILE_INSPECTOR_STATION_INDEX , ft ,
2022-03-23 22:01:23 -04:00
{ colours [ 1 ] });
}
2024-03-10 13:52:35 +00:00
// Properties
// Raise / Lower
screenCoords . y = windowPos . y + widgets [ WIDX_ENTRANCE_SPINNER_HEIGHT ]. top ;
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_BASE_HEIGHT_FULL , {}, { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Current base height
screenCoords . x = windowPos . x + widgets [ WIDX_ENTRANCE_SPINNER_HEIGHT ]. left + 3 ;
2022-03-23 22:01:23 -04:00
ft = Formatter ();
2024-03-10 13:52:35 +00:00
ft . Add < int32_t > ( tileElement -> BaseHeight );
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_FORMAT_INTEGER , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
break ;
2022-03-23 22:01:23 -04:00
}
2024-03-10 13:52:35 +00:00
case TileElementType :: Wall :
2019-07-25 17:51:22 +01:00
{
2024-03-10 13:52:35 +00:00
// Details
// Type
auto ft = Formatter ();
ft . Add < ObjectEntryIndex > ( tileElement -> AsWall () -> GetEntryIndex ());
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_WALL_TYPE , ft , { colours [ 1 ] });
2022-03-23 22:01:23 -04:00
2024-03-10 13:52:35 +00:00
// Banner info
auto banner = tileElement -> AsWall () -> GetBanner ();
2022-03-23 22:01:23 -04:00
if ( banner != nullptr )
{
ft = Formatter ();
2025-05-20 23:47:45 +02:00
banner -> formatTextTo ( ft );
2022-03-23 22:01:23 -04:00
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 11 }, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT , ft ,
2022-03-23 22:01:23 -04:00
{ colours [ 1 ] });
}
2024-03-10 13:52:35 +00:00
else
{
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 11 }, STR_TILE_INSPECTOR_ENTRY_BANNER_NONE , {},
2024-03-10 13:52:35 +00:00
{ colours [ 1 ] });
}
// Properties
// Raise / lower label
screenCoords . y = windowPos . y + widgets [ WIDX_WALL_SPINNER_HEIGHT ]. top ;
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_BASE_HEIGHT_FULL , {}, { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Current base height
screenCoords . x = windowPos . x + widgets [ WIDX_WALL_SPINNER_HEIGHT ]. left + 3 ;
ft = Formatter ();
ft . Add < int32_t > ( tileElement -> BaseHeight );
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_FORMAT_INTEGER , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Slope label
screenCoords = windowPos
+ ScreenCoordsXY { widgets [ WIDX_GROUPBOX_DETAILS ]. left + 7 , widgets [ WIDX_WALL_DROPDOWN_SLOPE ]. top };
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_WALL_SLOPE , {}, { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Animation frame label
screenCoords . y = windowPos . y + widgets [ WIDX_WALL_SPINNER_ANIMATION_FRAME ]. top ;
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_WALL_ANIMATION_FRAME , {}, { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Current animation frame
2024-05-09 02:45:07 +02:00
auto colour = colours [ 1 ];
2025-09-17 20:10:06 +02:00
if ( isWidgetDisabled ( WIDX_WALL_SPINNER_ANIMATION_FRAME ))
2024-03-10 13:52:35 +00:00
{
2024-05-09 02:45:07 +02:00
colour = colours [ 0 ]. withFlag ( ColourFlag :: inset , true );
2024-03-10 13:52:35 +00:00
}
screenCoords . x = windowPos . x + widgets [ WIDX_WALL_SPINNER_ANIMATION_FRAME ]. left + 3 ;
ft = Formatter ();
ft . Add < int32_t > ( tileElement -> AsWall () -> GetAnimationFrame ());
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_FORMAT_INTEGER , ft , { colour });
2024-03-10 13:52:35 +00:00
break ;
2022-03-23 22:01:23 -04:00
}
2024-03-10 13:52:35 +00:00
case TileElementType :: LargeScenery :
2022-03-23 22:01:23 -04:00
{
2024-03-10 13:52:35 +00:00
// Details
// Type
auto sceneryElement = tileElement -> AsLargeScenery ();
ObjectEntryIndex largeSceneryType = sceneryElement -> GetEntryIndex ();
auto ft = Formatter ();
ft . Add < ObjectEntryIndex > ( largeSceneryType );
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_LARGE_SCENERY_TYPE , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Part ID
ft = Formatter ();
ft . Add < int16_t > ( sceneryElement -> GetSequenceIndex ());
2022-03-23 22:01:23 -04:00
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 11 }, STR_TILE_INSPECTOR_LARGE_SCENERY_PIECE_ID , ft ,
2022-03-23 22:01:23 -04:00
{ colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Banner info
auto * largeSceneryEntry = OpenRCT2 :: ObjectManager :: GetObjectEntry < LargeSceneryEntry > ( largeSceneryType );
2025-05-20 22:57:59 +02:00
if ( largeSceneryEntry != nullptr && largeSceneryEntry -> scrolling_mode != kScrollingModeNone )
2024-03-10 13:52:35 +00:00
{
auto banner = sceneryElement -> GetBanner ();
if ( banner != nullptr )
{
ft = Formatter ();
2025-05-20 23:47:45 +02:00
banner -> formatTextTo ( ft );
2024-03-10 13:52:35 +00:00
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 22 }, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT , ft ,
2024-03-10 13:52:35 +00:00
{ colours [ 1 ] });
}
}
else
{
DrawTextBasic (
2025-05-05 01:06:46 +03:00
rt , screenCoords + ScreenCoordsXY { 0 , 22 }, STR_TILE_INSPECTOR_ENTRY_BANNER_NONE , {},
2024-03-10 13:52:35 +00:00
{ colours [ 1 ] });
}
// Properties
// Raise / lower label
screenCoords . y = windowPos . y + widgets [ WIDX_LARGE_SCENERY_SPINNER_HEIGHT ]. top ;
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_BASE_HEIGHT_FULL , {}, { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Current base height
screenCoords . x = windowPos . x + widgets [ WIDX_LARGE_SCENERY_SPINNER_HEIGHT ]. left + 3 ;
ft = Formatter ();
ft . Add < int32_t > ( tileElement -> BaseHeight );
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_FORMAT_INTEGER , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
break ;
2022-03-23 22:01:23 -04:00
}
2024-03-10 13:52:35 +00:00
case TileElementType :: Banner :
2022-03-23 22:01:23 -04:00
{
2024-03-10 13:52:35 +00:00
// Details
// Banner info
auto banner = tileElement -> AsBanner () -> GetBanner ();
if ( banner != nullptr )
{
Formatter ft ;
2025-05-20 23:47:45 +02:00
banner -> formatTextTo ( ft );
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
}
// Properties
// Raise / lower label
screenCoords . y = windowPos . y + widgets [ WIDX_BANNER_SPINNER_HEIGHT ]. top ;
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_BASE_HEIGHT_FULL , {}, { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Current base height
screenCoords . x = windowPos . x + widgets [ WIDX_BANNER_SPINNER_HEIGHT ]. left + 3 ;
auto ft = Formatter ();
ft . Add < int32_t > ( tileElement -> BaseHeight );
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_FORMAT_INTEGER , ft , { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
// Blocked paths
screenCoords . y += 28 ;
screenCoords . x = windowPos . x + widgets [ WIDX_GROUPBOX_DETAILS ]. left + 7 ;
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords , STR_TILE_INSPECTOR_BANNER_BLOCKED_PATHS , {}, { colours [ 1 ] });
2024-03-10 13:52:35 +00:00
break ;
2022-03-23 22:01:23 -04:00
}
2024-03-10 13:52:35 +00:00
default :
break ;
2018-06-22 23:21:44 +02:00
}
2021-01-03 14:30:59 +01:00
}
2021-03-03 22:06:07 +01:00
}
2015-06-01 02:33:56 +01:00
2025-09-17 20:10:06 +02:00
void onScrollDraw ( int32_t scrollIndex , RenderTarget & rt ) override
2018-05-21 13:46:55 +02:00
{
2024-03-10 13:52:35 +00:00
const int32_t listWidth = widgets [ WIDX_LIST ]. width ();
2025-10-23 18:44:45 +02:00
Rectangle :: fill (
2025-05-05 01:06:46 +03:00
rt , { { rt . x , rt . y }, { rt . x + rt . width - 1 , rt . y + rt . height - 1 } }, ColourMapA [ colours [ 1 ]. colour ]. mid_light );
2022-03-23 22:01:23 -04:00
2024-03-10 13:52:35 +00:00
// Show usage hint when nothing is selected
if ( ! _tileSelected )
2022-03-23 22:01:23 -04:00
{
2024-03-10 13:52:35 +00:00
auto & listWidget = widgets [ WIDX_LIST ];
auto centrePos = ScreenCoordsXY { listWidget . width () / 2 ,
2025-10-16 20:20:46 +02:00
( listWidget . height () - FontGetLineHeight ( FontStyle :: medium )) / 2 };
2024-03-10 13:52:35 +00:00
auto ft = Formatter {};
2025-10-16 20:06:18 +02:00
auto textPaint = TextPaint { colours [ 1 ], TextAlignment :: centre };
2025-05-05 01:06:46 +03:00
DrawTextWrapped ( rt , centrePos , listWidth , STR_TILE_INSPECTOR_SELECT_TILE_HINT , ft , textPaint );
2024-03-10 13:52:35 +00:00
return ;
2022-03-23 22:01:23 -04:00
}
2024-03-10 13:52:35 +00:00
ScreenCoordsXY screenCoords {};
2024-05-09 13:59:03 +02:00
screenCoords . y = kScrollableRowHeight * ( windowTileInspectorElementCount - 1 );
2024-03-10 13:52:35 +00:00
int32_t i = 0 ;
char buffer [ 256 ];
const TileElement * tileElement = MapGetFirstElementAt ( _toolMap );
do
2022-03-23 22:01:23 -04:00
{
2024-03-10 13:52:35 +00:00
if ( tileElement == nullptr )
2022-03-23 22:01:23 -04:00
break ;
2024-03-10 13:52:35 +00:00
const bool selectedRow = i == windowTileInspectorSelectedIndex ;
const bool hoveredRow = i == _highlightedIndex ;
const char * typeName = "" ;
2022-03-23 22:01:23 -04:00
2024-03-10 13:52:35 +00:00
// Draw row background colour
auto fillRectangle = ScreenRect { { 0 , screenCoords . y },
2024-05-09 13:59:03 +02:00
{ listWidth , screenCoords . y + kScrollableRowHeight - 1 } };
2024-03-10 13:52:35 +00:00
if ( selectedRow )
2025-10-23 18:44:45 +02:00
Rectangle :: fill ( rt , fillRectangle , ColourMapA [ colours [ 1 ]. colour ]. mid_dark );
2024-03-10 13:52:35 +00:00
else if ( hoveredRow )
2025-10-23 18:44:45 +02:00
Rectangle :: fill ( rt , fillRectangle , ColourMapA [ colours [ 1 ]. colour ]. mid_dark | 0x1000000 );
2024-03-10 13:52:35 +00:00
// Zebra stripes
else if ((( windowTileInspectorElementCount - i ) & 1 ) == 0 )
2025-10-23 18:44:45 +02:00
Rectangle :: fill ( rt , fillRectangle , ColourMapA [ colours [ 1 ]. colour ]. light | 0x1000000 );
2022-03-23 22:01:23 -04:00
2024-05-11 11:24:01 +02:00
StringId stringFormat = STR_WINDOW_COLOUR_2_STRINGID ;
if ( selectedRow || hoveredRow )
stringFormat = STR_WHITE_STRING ;
2024-03-10 13:52:35 +00:00
auto checkboxFormatter = Formatter ();
checkboxFormatter . Add < StringId > ( STR_STRING );
2024-07-12 20:47:56 +02:00
checkboxFormatter . Add < char *> ( kCheckMarkString );
2024-03-10 13:52:35 +00:00
// Draw checkbox and check if visible
2025-10-23 18:44:45 +02:00
Rectangle :: fillInset (
rt , { { 2 , screenCoords . y }, { 15 , screenCoords . y + 11 } }, colours [ 1 ], Rectangle :: BorderStyle :: inset ,
Rectangle :: FillBrightness :: dark , Rectangle :: FillMode :: dontLightenWhenInset );
2024-03-10 13:52:35 +00:00
if ( ! tileElement -> IsInvisible ())
2022-03-23 22:01:23 -04:00
{
2024-03-10 13:52:35 +00:00
auto eyeFormatter = Formatter ();
eyeFormatter . Add < StringId > ( STR_STRING );
2024-07-12 20:47:56 +02:00
eyeFormatter . Add < char *> ( kEyeString );
2025-05-05 01:06:46 +03:00
DrawTextBasic ( rt , screenCoords + ScreenCoordsXY { 2 , 1 }, stringFormat , eyeFormatter );
2022-03-23 22:01:23 -04:00
}
2024-03-10 13:52:35 +00:00
const auto type = tileElement -> GetType ();
switch ( type )
2022-03-23 22:01:23 -04:00
{
2024-03-10 13:52:35 +00:00
case TileElementType :: Surface :
typeName = LanguageGetString ( STR_TILE_INSPECTOR_SURFACE );
break ;
case TileElementType :: Path :
typeName = tileElement -> AsPath () -> IsQueue () ? LanguageGetString ( STR_QUEUE_LINE_MAP_TIP )
: LanguageGetString ( STR_FOOTPATH_MAP_TIP );
break ;
case TileElementType :: Track :
typeName = LanguageGetString ( STR_RIDE_COMPONENT_TRACK_CAPITALISED );
break ;
case TileElementType :: SmallScenery :
{
const auto * sceneryEntry = tileElement -> AsSmallScenery () -> GetEntry ();
snprintf (
buffer , sizeof ( buffer ), "%s (%s)" , LanguageGetString ( STR_OBJECT_SELECTION_SMALL_SCENERY ),
sceneryEntry != nullptr ? LanguageGetString ( sceneryEntry -> name ) : "" );
typeName = buffer ;
break ;
}
case TileElementType :: Entrance :
typeName = LanguageGetString ( STR_RIDE_CONSTRUCTION_ENTRANCE );
break ;
case TileElementType :: Wall :
{
const auto * entry = tileElement -> AsWall () -> GetEntry ();
snprintf (
buffer , sizeof ( buffer ), "%s (%s)" , LanguageGetString ( STR_TILE_INSPECTOR_WALL ),
entry != nullptr ? LanguageGetString ( entry -> name ) : "" );
typeName = buffer ;
break ;
}
case TileElementType :: LargeScenery :
typeName = LanguageGetString ( STR_OBJECT_SELECTION_LARGE_SCENERY );
break ;
case TileElementType :: Banner :
snprintf (
buffer , sizeof ( buffer ), "%s (%u)" , LanguageGetString ( STR_BANNER_WINDOW_TITLE ),
tileElement -> AsBanner () -> GetIndex (). ToUnderlying ());
typeName = buffer ;
break ;
default :
snprintf (
buffer , sizeof ( buffer ), "%s (%d)" , LanguageGetString ( STR_UNKNOWN_OBJECT_TYPE ), EnumValue ( type ));
typeName = buffer ;
2022-03-23 22:01:23 -04:00
}
2024-03-10 13:52:35 +00:00
const int32_t clearanceHeight = tileElement -> ClearanceHeight ;
const bool ghost = tileElement -> IsGhost ();
const bool last = tileElement -> IsLastForTile ();
2022-03-23 22:01:23 -04:00
2024-03-10 13:52:35 +00:00
// Element name
auto ft = Formatter ();
ft . Add < StringId > ( STR_STRING );
ft . Add < char *> ( typeName );
DrawTextEllipsised (
2025-06-16 23:10:47 +02:00
rt , screenCoords + ScreenCoordsXY { kTypeColumnXY . x , 0 }, kTypeColumnSize . width , stringFormat , ft );
2022-03-23 22:01:23 -04:00
2024-03-10 13:52:35 +00:00
// Base height
ft = Formatter ();
ft . Add < StringId > ( STR_FORMAT_INTEGER );
ft . Add < int32_t > ( tileElement -> BaseHeight );
2025-06-16 23:10:47 +02:00
DrawTextBasic ( rt , screenCoords + ScreenCoordsXY { kBaseHeightColumnXY . x , 0 }, stringFormat , ft );
2024-03-10 13:52:35 +00:00
// Clearance height
ft = Formatter ();
ft . Add < StringId > ( STR_FORMAT_INTEGER );
ft . Add < int32_t > ( clearanceHeight );
2025-06-16 23:10:47 +02:00
DrawTextBasic ( rt , screenCoords + ScreenCoordsXY { kClearanceHeightColumnXY . x , 0 }, stringFormat , ft );
2024-03-10 13:52:35 +00:00
// Direction
ft = Formatter ();
ft . Add < StringId > ( STR_FORMAT_INTEGER );
ft . Add < int32_t > ( tileElement -> GetDirection ());
2025-06-16 23:10:47 +02:00
DrawTextBasic ( rt , screenCoords + ScreenCoordsXY { kDirectionColumnXY . x , 0 }, stringFormat , ft );
2024-03-10 13:52:35 +00:00
// Checkmarks for ghost and last for tile
if ( ghost )
2025-06-16 23:10:47 +02:00
DrawTextBasic (
rt , screenCoords + ScreenCoordsXY { kGhostFlagColumnXY . x , 0 }, stringFormat , checkboxFormatter );
2024-03-10 13:52:35 +00:00
if ( last )
2025-06-16 23:10:47 +02:00
DrawTextBasic ( rt , screenCoords + ScreenCoordsXY { kLastFlagColumnXY . x , 0 }, stringFormat , checkboxFormatter );
2024-03-10 13:52:35 +00:00
2024-05-09 13:59:03 +02:00
screenCoords . y -= kScrollableRowHeight ;
2024-03-10 13:52:35 +00:00
i ++ ;
} while ( ! ( tileElement ++ ) -> IsLastForTile ());
}
void ClearClipboard ()
{
_elementCopied = false ;
}
void ToggleInvisibility ()
{
if ( windowTileInspectorSelectedIndex >= 0 && windowTileInspectorSelectedIndex < windowTileInspectorElementCount )
{
ToggleInvisibility ( windowTileInspectorSelectedIndex );
2022-03-23 22:01:23 -04:00
}
2021-11-25 23:52:24 +01:00
}
2024-03-10 13:52:35 +00:00
private :
2025-09-17 20:10:06 +02:00
void setPage ( const TileInspectorPage p )
2022-03-23 22:01:23 -04:00
{
2025-03-12 19:50:19 +01:00
// Skip setting page if we're already on this page, unless we're initialising the window
if ( tileInspectorPage == p && ! widgets . empty ())
return ;
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
// subtract current page height, then add new page height
if ( tileInspectorPage != TileInspectorPage :: Default )
{
auto index = EnumValue ( tileInspectorPage ) - 1 ;
2025-06-16 23:10:47 +02:00
height -= PageGroupBoxSettings [ index ]. details_top_offset - kGroupboxPadding - 3 ;
2025-09-17 19:03:29 +02:00
minHeight -= PageGroupBoxSettings [ index ]. details_top_offset - kGroupboxPadding - 3 ;
2024-03-10 13:52:35 +00:00
}
if ( p != TileInspectorPage :: Default )
{
auto index = EnumValue ( p ) - 1 ;
2025-06-16 23:10:47 +02:00
height += PageGroupBoxSettings [ index ]. details_top_offset - kGroupboxPadding - 3 ;
2025-09-17 19:03:29 +02:00
minHeight += PageGroupBoxSettings [ index ]. details_top_offset - kGroupboxPadding - 3 ;
2024-03-10 13:52:35 +00:00
}
tileInspectorPage = p ;
auto pageIndex = EnumValue ( p );
2025-09-17 20:10:06 +02:00
setWidgets ( PageWidgets [ pageIndex ]);
2025-09-17 19:03:29 +02:00
holdDownWidgets = PageHoldDownWidgets [ pageIndex ];
disabledWidgets = PageDisabledWidgets [ pageIndex ];
pressedWidgets = 0 ;
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
}
void UpdateSelectedTile ( const ScreenCoordsXY & screenCoords )
{
2025-09-30 22:35:02 +02:00
const bool ctrlIsHeldDown = GetInputManager (). isModifierKeyPressed ( ModifierKey :: ctrl );
2024-03-10 13:52:35 +00:00
// Mouse hasn't moved
if ( screenCoords . x == _toolMouseX && screenCoords . y == _toolMouseY && _toolCtrlDown == ctrlIsHeldDown )
2022-03-23 22:01:23 -04:00
return ;
2024-03-10 13:52:35 +00:00
_toolMouseX = screenCoords . x ;
_toolMouseY = screenCoords . y ;
_toolCtrlDown = ctrlIsHeldDown ;
CoordsXY mapCoords {};
TileElement * clickedElement = nullptr ;
if ( ctrlIsHeldDown )
{
auto info = GetMapCoordinatesFromPos ( screenCoords , ViewportInteractionFlags );
clickedElement = info . Element ;
mapCoords = info . Loc ;
}
// Even if Ctrl was pressed, fall back to normal selection when there was nothing under the cursor
if ( clickedElement == nullptr )
{
auto mouseCoords = ScreenPosToMapPos ( screenCoords , nullptr );
if ( ! mouseCoords . has_value ())
return ;
mapCoords = mouseCoords . value ();
// Tile is already selected
if ( _tileSelected && mapCoords . x == _toolMap . x && mapCoords . y == _toolMap . y )
return ;
}
// Invalidate the previous selection
if ( auto * elem = OpenRCT2 :: TileInspector :: GetSelectedElement (); elem != nullptr )
{
MapInvalidateElement ( windowTileInspectorTile . ToCoordsXY (), elem );
}
_tileSelected = true ;
_toolMap = mapCoords ;
windowTileInspectorTile = TileCoordsXY ( mapCoords );
LoadTile ( clickedElement );
2022-03-23 22:01:23 -04:00
}
2024-03-10 13:52:35 +00:00
void SelectElementFromList ( int32_t index )
2023-07-23 00:08:13 +02:00
{
2024-03-10 13:52:35 +00:00
if ( index < 0 || index >= windowTileInspectorElementCount )
{
windowTileInspectorSelectedIndex = - 1 ;
}
else
{
windowTileInspectorSelectedIndex = index ;
}
2025-09-17 20:10:06 +02:00
invalidate ();
2023-07-23 00:08:13 +02:00
}
2024-03-10 13:52:35 +00:00
void LoadTile ( TileElement * elementToSelect )
2022-03-23 22:01:23 -04:00
{
windowTileInspectorSelectedIndex = - 1 ;
2024-08-11 16:21:53 +02:00
scrolls [ 0 ]. contentOffsetY = 0 ;
2024-03-10 13:52:35 +00:00
TileElement * element = MapGetFirstElementAt ( _toolMap );
int16_t numItems = 0 ;
do
{
if ( element == nullptr )
break ;
if ( element == elementToSelect )
windowTileInspectorSelectedIndex = numItems ;
numItems ++ ;
} while ( ! ( element ++ ) -> IsLastForTile ());
windowTileInspectorElementCount = numItems ;
2025-09-17 20:10:06 +02:00
invalidate ();
2022-03-23 22:01:23 -04:00
}
2024-03-10 13:52:35 +00:00
void RemoveElement ( int32_t elementIndex )
2022-03-23 22:01:23 -04:00
{
2024-03-10 13:52:35 +00:00
Guard :: Assert ( elementIndex >= 0 && elementIndex < windowTileInspectorElementCount , "elementIndex out of range" );
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction ( _toolMap , GameActions :: TileModifyType :: AnyRemove , elementIndex );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2022-03-23 22:01:23 -04:00
}
2024-03-10 13:52:35 +00:00
void RotateElement ( int32_t elementIndex )
2022-03-23 22:01:23 -04:00
{
2024-03-10 13:52:35 +00:00
Guard :: Assert ( elementIndex >= 0 && elementIndex < windowTileInspectorElementCount , "elementIndex out of range" );
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction ( _toolMap , GameActions :: TileModifyType :: AnyRotate , elementIndex );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2023-05-30 16:40:04 +02:00
}
2022-03-23 22:01:23 -04:00
2024-03-10 13:52:35 +00:00
// Swap element with its parent
void SwapElements ( int16_t first , int16_t second )
2022-03-23 22:01:23 -04:00
{
2024-03-10 13:52:35 +00:00
bool firstInRange = first >= 0 && first < windowTileInspectorElementCount ;
bool secondInRange = second >= 0 && second < windowTileInspectorElementCount ;
// This might happen if two people are modifying the same tile.
if ( ! firstInRange || ! secondInRange )
return ;
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction ( _toolMap , GameActions :: TileModifyType :: AnySwap , first , second );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void SortElements ()
{
Guard :: Assert ( _tileSelected , "No tile selected" );
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction ( _toolMap , GameActions :: TileModifyType :: AnySort );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void CopyElement ()
{
const TileElement * const tileElement = OpenRCT2 :: TileInspector :: GetSelectedElement ();
Guard :: Assert ( tileElement != nullptr , "Invalid tile element" );
// Copy value, in case the element gets moved
_copiedElement = * tileElement ;
_copiedBanner = {};
auto bannerIndex = _copiedElement . GetBannerIndex ();
if ( bannerIndex != BannerIndex :: GetNull ())
{
auto banner = GetBanner ( bannerIndex );
if ( banner != nullptr )
_copiedBanner = * banner ;
}
_elementCopied = true ;
2025-09-17 20:10:06 +02:00
invalidate ();
2024-03-10 13:52:35 +00:00
}
void PasteElement ()
{
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: AnyPaste , 0 , 0 , _copiedElement , _copiedBanner );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void BaseHeightOffset ( int16_t elementIndex , int8_t heightOffset )
{
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: AnyBaseHeightOffset , elementIndex , heightOffset );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void SurfaceShowParkFences ( bool showFences )
{
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: SurfaceShowParkFences , showFences );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void SurfaceToggleCorner ( int32_t cornerIndex )
{
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: SurfaceToggleCorner , cornerIndex );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void SurfaceToggleDiagonal ()
{
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction ( _toolMap , GameActions :: TileModifyType :: SurfaceToggleDiagonal );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void PathSetSloped ( int32_t elementIndex , bool sloped )
{
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: PathSetSlope , elementIndex , sloped );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void PathSetJunctionRailings ( int32_t elementIndex , bool hasJunctionRailings )
{
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: PathSetJunctionRailings , elementIndex , hasJunctionRailings );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void PathSetBroken ( int32_t elementIndex , bool broken )
{
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: PathSetBroken , elementIndex , broken );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void PathToggleEdge ( int32_t elementIndex , int32_t cornerIndex )
{
Guard :: Assert ( elementIndex >= 0 && elementIndex < windowTileInspectorElementCount , "elementIndex out of range" );
Guard :: Assert ( cornerIndex >= 0 && cornerIndex < 8 , "cornerIndex out of range" );
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: PathToggleEdge , elementIndex , cornerIndex );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void EntranceMakeUsable ( int32_t elementIndex )
{
Guard :: ArgumentInRange ( elementIndex , 0 , windowTileInspectorElementCount - 1 );
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: EntranceMakeUsable , elementIndex );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void WallSetSlope ( int32_t elementIndex , int32_t slopeValue )
{
// Make sure only the correct bits are set
Guard :: Assert (( slopeValue & 3 ) == slopeValue , "slopeValue doesn't match its mask" );
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: WallSetSlope , elementIndex , slopeValue );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void WallAnimationFrameOffset ( int16_t elementIndex , int8_t animationFrameOffset )
{
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: WallSetAnimationFrame , elementIndex , animationFrameOffset );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void TrackBlockHeightOffset ( int32_t elementIndex , int8_t heightOffset )
{
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: TrackBaseHeightOffset , elementIndex , heightOffset );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void TrackBlockSetLift ( int32_t elementIndex , bool entireTrackBlock , bool chain )
{
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap ,
entireTrackBlock ? GameActions :: TileModifyType :: TrackSetChainBlock : GameActions :: TileModifyType :: TrackSetChain ,
elementIndex , chain );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void TrackSetBrakeClosed ( int32_t elementIndex , bool isClosed )
{
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: TrackSetBrake , elementIndex , isClosed );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void TrackSetIndestructible ( int32_t elementIndex , bool isIndestructible )
{
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: TrackSetIndestructible , elementIndex , isIndestructible );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void QuarterTileSet ( int32_t elementIndex , const int32_t quarterIndex )
{
// quarterIndex is widget index relative to WIDX_SCENERY_CHECK_QUARTER_N, so a value from 0-3
Guard :: Assert ( quarterIndex >= 0 && quarterIndex < 4 , "quarterIndex out of range" );
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: ScenerySetQuarterLocation , elementIndex ,
( quarterIndex - GetCurrentRotation ()) & 3 );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
// ToggleQuadrantCollision?
void ToggleQuadrantCollosion ( int32_t elementIndex , const int32_t quadrantIndex )
{
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: ScenerySetQuarterCollision , elementIndex ,
2024-03-10 13:52:35 +00:00
( quadrantIndex + 2 - GetCurrentRotation ()) & 3 );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void BannerToggleBlock ( int32_t elementIndex , int32_t edgeIndex )
{
Guard :: Assert ( edgeIndex >= 0 && edgeIndex < 4 , "edgeIndex out of range" );
2024-07-09 15:17:07 +02:00
// Make edgeIndex = 0
2024-03-10 13:52:35 +00:00
edgeIndex = ( edgeIndex - GetCurrentRotation ()) & 3 ;
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: BannerToggleBlockingEdge , elementIndex , edgeIndex );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
void ToggleInvisibility ( int32_t elementIndex )
{
Guard :: Assert ( elementIndex >= 0 && elementIndex < windowTileInspectorElementCount , "elementIndex out of range" );
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: AnyToggleInvisilibity , elementIndex );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-03-10 13:52:35 +00:00
}
2024-04-12 20:08:34 +02:00
void WallSetAnimationIsBackwards ( int32_t elementIndex , bool backwards )
{
2025-08-26 21:39:29 +02:00
auto modifyTile = GameActions :: TileModifyAction (
_toolMap , GameActions :: TileModifyType :: WallSetAnimationIsBackwards , elementIndex , backwards );
2025-09-08 16:21:29 +02:00
GameActions :: Execute ( & modifyTile , getGameState ());
2024-04-12 20:08:34 +02:00
}
2025-09-17 20:10:06 +02:00
void onPrepareDraw () override
2024-03-10 13:52:35 +00:00
{
const TileElement * const tileElement = OpenRCT2 :: TileInspector :: GetSelectedElement ();
// Set the correct page automatically
TileInspectorPage p = TileInspectorPage :: Default ;
if ( tileElement != nullptr )
{
switch ( tileElement -> GetType ())
{
case TileElementType :: Surface :
p = TileInspectorPage :: Surface ;
break ;
case TileElementType :: Path :
p = TileInspectorPage :: Path ;
break ;
case TileElementType :: Track :
p = TileInspectorPage :: Track ;
break ;
case TileElementType :: SmallScenery :
p = TileInspectorPage :: Scenery ;
break ;
case TileElementType :: Entrance :
p = TileInspectorPage :: Entrance ;
break ;
case TileElementType :: Wall :
p = TileInspectorPage :: Wall ;
break ;
case TileElementType :: LargeScenery :
p = TileInspectorPage :: LargeScenery ;
break ;
case TileElementType :: Banner :
p = TileInspectorPage :: Banner ;
break ;
}
}
if ( tileInspectorPage != p )
{
2025-09-17 20:10:06 +02:00
setPage ( p );
invalidate ();
2024-03-10 13:52:35 +00:00
}
// X and Y spinners
2025-09-17 20:10:06 +02:00
setWidgetDisabledAndInvalidate (
2024-03-17 14:41:36 +01:00
WIDX_SPINNER_X_INCREASE , ! ( _tileSelected && (( _toolMap . x / 32 ) < kMaximumMapSizeTechnical - 1 )));
2025-09-17 20:10:06 +02:00
setWidgetDisabledAndInvalidate ( WIDX_SPINNER_X_DECREASE , ! ( _tileSelected && (( _toolMap . x / 32 ) > 0 )));
setWidgetDisabledAndInvalidate (
2024-03-17 14:41:36 +01:00
WIDX_SPINNER_Y_INCREASE , ! ( _tileSelected && (( _toolMap . y / 32 ) < kMaximumMapSizeTechnical - 1 )));
2025-09-17 20:10:06 +02:00
setWidgetDisabledAndInvalidate ( WIDX_SPINNER_Y_DECREASE , ! ( _tileSelected && (( _toolMap . y / 32 ) > 0 )));
2024-03-10 13:52:35 +00:00
// Sort buttons
2025-09-17 20:10:06 +02:00
setWidgetDisabledAndInvalidate ( WIDX_BUTTON_SORT , ! ( _tileSelected && windowTileInspectorElementCount > 1 ));
2024-03-10 13:52:35 +00:00
// Move Up button
2025-09-17 20:10:06 +02:00
setWidgetDisabledAndInvalidate (
2024-03-10 13:52:35 +00:00
WIDX_BUTTON_MOVE_UP ,
! ( windowTileInspectorSelectedIndex != - 1
&& windowTileInspectorSelectedIndex < windowTileInspectorElementCount - 1 ));
// Move Down button
2025-09-17 20:10:06 +02:00
setWidgetDisabledAndInvalidate ( WIDX_BUTTON_MOVE_DOWN , ! ( windowTileInspectorSelectedIndex > 0 ));
2024-03-10 13:52:35 +00:00
// Copy button
2025-09-17 20:10:06 +02:00
setWidgetDisabledAndInvalidate ( WIDX_BUTTON_COPY , ! ( windowTileInspectorSelectedIndex >= 0 ));
2024-03-10 13:52:35 +00:00
// Paste button
2025-09-17 20:10:06 +02:00
setWidgetDisabledAndInvalidate ( WIDX_BUTTON_PASTE , ! ( _tileSelected && _elementCopied ));
2024-03-10 13:52:35 +00:00
widgets [ WIDX_BACKGROUND ]. bottom = height - 1 ;
if ( tileInspectorPage == TileInspectorPage :: Default )
{
2025-06-10 19:55:12 +02:00
widgets [ WIDX_GROUPBOX_DETAILS ]. type = WidgetType :: empty ;
widgets [ WIDX_GROUPBOX_PROPERTIES ]. type = WidgetType :: empty ;
2025-06-16 23:10:47 +02:00
widgets [ WIDX_LIST ]. bottom = height - kBottomPadding ;
2024-03-10 13:52:35 +00:00
}
else
{
2025-06-10 19:55:12 +02:00
widgets [ WIDX_GROUPBOX_DETAILS ]. type = WidgetType :: groupbox ;
widgets [ WIDX_GROUPBOX_PROPERTIES ]. type = WidgetType :: groupbox ;
2024-03-10 13:52:35 +00:00
auto pageIndex = EnumValue ( tileInspectorPage ) - 1 ;
widgets [ WIDX_GROUPBOX_DETAILS ]. text = PageGroupBoxSettings [ pageIndex ]. string_id ;
widgets [ WIDX_GROUPBOX_DETAILS ]. top = height - PageGroupBoxSettings [ pageIndex ]. details_top_offset ;
widgets [ WIDX_GROUPBOX_DETAILS ]. bottom = height - PageGroupBoxSettings [ pageIndex ]. details_bottom_offset ;
widgets [ WIDX_GROUPBOX_PROPERTIES ]. top = height - PageGroupBoxSettings [ pageIndex ]. properties_top_offset ;
widgets [ WIDX_GROUPBOX_PROPERTIES ]. bottom = height - PageGroupBoxSettings [ pageIndex ]. properties_bottom_offset ;
2025-06-16 23:10:47 +02:00
widgets [ WIDX_LIST ]. bottom = widgets [ WIDX_GROUPBOX_DETAILS ]. top - kGroupboxPadding ;
2024-03-10 13:52:35 +00:00
}
// The default page doesn't need further invalidation
if ( tileInspectorPage == TileInspectorPage :: Default )
return ;
// Using a switch, because I don't think giving each page their own callbacks is
// needed here, as only the mouseup and invalidate functions are different.
const int32_t propertiesAnchor = widgets [ WIDX_GROUPBOX_PROPERTIES ]. top ;
2023-06-26 16:11:49 +02:00
switch ( tileElement -> GetType ())
2022-03-23 22:01:23 -04:00
{
case TileElementType :: Surface :
2024-03-10 13:52:35 +00:00
widgets [ WIDX_SURFACE_SPINNER_HEIGHT ]. top = GBBT ( propertiesAnchor , 0 ) + 3 ;
widgets [ WIDX_SURFACE_SPINNER_HEIGHT ]. bottom = GBBB ( propertiesAnchor , 0 ) - 3 ;
widgets [ WIDX_SURFACE_SPINNER_HEIGHT_INCREASE ]. top = GBBT ( propertiesAnchor , 0 ) + 4 ;
widgets [ WIDX_SURFACE_SPINNER_HEIGHT_INCREASE ]. bottom = GBBB ( propertiesAnchor , 0 ) - 4 ;
widgets [ WIDX_SURFACE_SPINNER_HEIGHT_DECREASE ]. top = GBBT ( propertiesAnchor , 0 ) + 4 ;
widgets [ WIDX_SURFACE_SPINNER_HEIGHT_DECREASE ]. bottom = GBBB ( propertiesAnchor , 0 ) - 4 ;
widgets [ WIDX_SURFACE_BUTTON_REMOVE_FENCES ]. top = GBBT ( propertiesAnchor , 1 );
widgets [ WIDX_SURFACE_BUTTON_REMOVE_FENCES ]. bottom = GBBB ( propertiesAnchor , 1 );
widgets [ WIDX_SURFACE_BUTTON_RESTORE_FENCES ]. top = GBBT ( propertiesAnchor , 1 );
widgets [ WIDX_SURFACE_BUTTON_RESTORE_FENCES ]. bottom = GBBB ( propertiesAnchor , 1 );
widgets [ WIDX_SURFACE_CHECK_CORNER_N ]. top = GBBT ( propertiesAnchor , 2 ) + 7 * 0 ;
widgets [ WIDX_SURFACE_CHECK_CORNER_N ]. bottom = widgets [ WIDX_SURFACE_CHECK_CORNER_N ]. top + 13 ;
widgets [ WIDX_SURFACE_CHECK_CORNER_E ]. top = GBBT ( propertiesAnchor , 2 ) + 7 * 1 ;
widgets [ WIDX_SURFACE_CHECK_CORNER_E ]. bottom = widgets [ WIDX_SURFACE_CHECK_CORNER_E ]. top + 13 ;
widgets [ WIDX_SURFACE_CHECK_CORNER_S ]. top = GBBT ( propertiesAnchor , 2 ) + 7 * 2 ;
widgets [ WIDX_SURFACE_CHECK_CORNER_S ]. bottom = widgets [ WIDX_SURFACE_CHECK_CORNER_S ]. top + 13 ;
widgets [ WIDX_SURFACE_CHECK_CORNER_W ]. top = GBBT ( propertiesAnchor , 2 ) + 7 * 1 ;
widgets [ WIDX_SURFACE_CHECK_CORNER_W ]. bottom = widgets [ WIDX_SURFACE_CHECK_CORNER_W ]. top + 13 ;
widgets [ WIDX_SURFACE_CHECK_DIAGONAL ]. top = GBBT ( propertiesAnchor , 3 ) + 7 * 1 ;
widgets [ WIDX_SURFACE_CHECK_DIAGONAL ]. bottom = widgets [ WIDX_SURFACE_CHECK_DIAGONAL ]. top + 13 ;
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_SURFACE_CHECK_CORNER_N ,
tileElement -> AsSurface () -> GetSlope () & ( 1 << (( 2 - GetCurrentRotation ()) & 3 )));
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_SURFACE_CHECK_CORNER_E ,
tileElement -> AsSurface () -> GetSlope () & ( 1 << (( 3 - GetCurrentRotation ()) & 3 )));
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_SURFACE_CHECK_CORNER_S ,
tileElement -> AsSurface () -> GetSlope () & ( 1 << (( 0 - GetCurrentRotation ()) & 3 )));
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_SURFACE_CHECK_CORNER_W ,
tileElement -> AsSurface () -> GetSlope () & ( 1 << (( 1 - GetCurrentRotation ()) & 3 )));
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-05-02 23:31:01 +02:00
WIDX_SURFACE_CHECK_DIAGONAL , tileElement -> AsSurface () -> GetSlope () & kTileSlopeDiagonalFlag );
2022-03-23 22:01:23 -04:00
break ;
case TileElementType :: Path :
2024-03-10 13:52:35 +00:00
widgets [ WIDX_PATH_SPINNER_HEIGHT ]. top = GBBT ( propertiesAnchor , 0 ) + 3 ;
widgets [ WIDX_PATH_SPINNER_HEIGHT ]. bottom = GBBB ( propertiesAnchor , 0 ) - 3 ;
widgets [ WIDX_PATH_SPINNER_HEIGHT_INCREASE ]. top = GBBT ( propertiesAnchor , 0 ) + 4 ;
widgets [ WIDX_PATH_SPINNER_HEIGHT_INCREASE ]. bottom = GBBB ( propertiesAnchor , 0 ) - 4 ;
widgets [ WIDX_PATH_SPINNER_HEIGHT_DECREASE ]. top = GBBT ( propertiesAnchor , 0 ) + 4 ;
widgets [ WIDX_PATH_SPINNER_HEIGHT_DECREASE ]. bottom = GBBB ( propertiesAnchor , 0 ) - 4 ;
widgets [ WIDX_PATH_CHECK_BROKEN ]. top = GBBT ( propertiesAnchor , 1 );
widgets [ WIDX_PATH_CHECK_BROKEN ]. bottom = GBBB ( propertiesAnchor , 1 );
widgets [ WIDX_PATH_CHECK_SLOPED ]. top = GBBT ( propertiesAnchor , 2 );
widgets [ WIDX_PATH_CHECK_SLOPED ]. bottom = GBBB ( propertiesAnchor , 2 );
widgets [ WIDX_PATH_CHECK_JUNCTION_RAILINGS ]. top = GBBT ( propertiesAnchor , 3 );
widgets [ WIDX_PATH_CHECK_JUNCTION_RAILINGS ]. bottom = GBBB ( propertiesAnchor , 3 );
widgets [ WIDX_PATH_CHECK_EDGE_N ]. top = GBBT ( propertiesAnchor , 4 ) + 7 * 0 ;
widgets [ WIDX_PATH_CHECK_EDGE_N ]. bottom = widgets [ WIDX_PATH_CHECK_EDGE_N ]. top + 13 ;
widgets [ WIDX_PATH_CHECK_EDGE_NE ]. top = GBBT ( propertiesAnchor , 4 ) + 7 * 1 ;
widgets [ WIDX_PATH_CHECK_EDGE_NE ]. bottom = widgets [ WIDX_PATH_CHECK_EDGE_NE ]. top + 13 ;
widgets [ WIDX_PATH_CHECK_EDGE_E ]. top = GBBT ( propertiesAnchor , 4 ) + 7 * 2 ;
widgets [ WIDX_PATH_CHECK_EDGE_E ]. bottom = widgets [ WIDX_PATH_CHECK_EDGE_E ]. top + 13 ;
widgets [ WIDX_PATH_CHECK_EDGE_SE ]. top = GBBT ( propertiesAnchor , 4 ) + 7 * 3 ;
widgets [ WIDX_PATH_CHECK_EDGE_SE ]. bottom = widgets [ WIDX_PATH_CHECK_EDGE_SE ]. top + 13 ;
widgets [ WIDX_PATH_CHECK_EDGE_S ]. top = GBBT ( propertiesAnchor , 4 ) + 7 * 4 ;
widgets [ WIDX_PATH_CHECK_EDGE_S ]. bottom = widgets [ WIDX_PATH_CHECK_EDGE_S ]. top + 13 ;
widgets [ WIDX_PATH_CHECK_EDGE_SW ]. top = GBBT ( propertiesAnchor , 4 ) + 7 * 3 ;
widgets [ WIDX_PATH_CHECK_EDGE_SW ]. bottom = widgets [ WIDX_PATH_CHECK_EDGE_SW ]. top + 13 ;
widgets [ WIDX_PATH_CHECK_EDGE_W ]. top = GBBT ( propertiesAnchor , 4 ) + 7 * 2 ;
widgets [ WIDX_PATH_CHECK_EDGE_W ]. bottom = widgets [ WIDX_PATH_CHECK_EDGE_W ]. top + 13 ;
widgets [ WIDX_PATH_CHECK_EDGE_NW ]. top = GBBT ( propertiesAnchor , 4 ) + 7 * 1 ;
widgets [ WIDX_PATH_CHECK_EDGE_NW ]. bottom = widgets [ WIDX_PATH_CHECK_EDGE_NW ]. top + 13 ;
2025-09-17 20:10:06 +02:00
setCheckboxValue ( WIDX_PATH_CHECK_SLOPED , tileElement -> AsPath () -> IsSloped ());
setCheckboxValue ( WIDX_PATH_CHECK_JUNCTION_RAILINGS , tileElement -> AsPath () -> HasJunctionRailings ());
setCheckboxValue ( WIDX_PATH_CHECK_BROKEN , tileElement -> AsPath () -> IsBroken ());
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_PATH_CHECK_EDGE_NE , tileElement -> AsPath () -> GetEdges () & ( 1 << (( 0 - GetCurrentRotation ()) & 3 )));
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_PATH_CHECK_EDGE_SE , tileElement -> AsPath () -> GetEdges () & ( 1 << (( 1 - GetCurrentRotation ()) & 3 )));
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_PATH_CHECK_EDGE_SW , tileElement -> AsPath () -> GetEdges () & ( 1 << (( 2 - GetCurrentRotation ()) & 3 )));
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_PATH_CHECK_EDGE_NW , tileElement -> AsPath () -> GetEdges () & ( 1 << (( 3 - GetCurrentRotation ()) & 3 )));
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_PATH_CHECK_EDGE_E , tileElement -> AsPath () -> GetCorners () & ( 1 << (( 0 - GetCurrentRotation ()) & 3 )));
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_PATH_CHECK_EDGE_S , tileElement -> AsPath () -> GetCorners () & ( 1 << (( 1 - GetCurrentRotation ()) & 3 )));
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_PATH_CHECK_EDGE_W , tileElement -> AsPath () -> GetCorners () & ( 1 << (( 2 - GetCurrentRotation ()) & 3 )));
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_PATH_CHECK_EDGE_N , tileElement -> AsPath () -> GetCorners () & ( 1 << (( 3 - GetCurrentRotation ()) & 3 )));
2022-03-23 22:01:23 -04:00
break ;
case TileElementType :: Track :
2024-03-10 13:52:35 +00:00
widgets [ WIDX_TRACK_CHECK_APPLY_TO_ALL ]. top = GBBT ( propertiesAnchor , 0 );
widgets [ WIDX_TRACK_CHECK_APPLY_TO_ALL ]. bottom = GBBB ( propertiesAnchor , 0 );
widgets [ WIDX_TRACK_SPINNER_HEIGHT ]. top = GBBT ( propertiesAnchor , 1 ) + 3 ;
widgets [ WIDX_TRACK_SPINNER_HEIGHT ]. bottom = GBBB ( propertiesAnchor , 1 ) - 3 ;
widgets [ WIDX_TRACK_SPINNER_HEIGHT_INCREASE ]. top = GBBT ( propertiesAnchor , 1 ) + 4 ;
widgets [ WIDX_TRACK_SPINNER_HEIGHT_INCREASE ]. bottom = GBBB ( propertiesAnchor , 1 ) - 4 ;
widgets [ WIDX_TRACK_SPINNER_HEIGHT_DECREASE ]. top = GBBT ( propertiesAnchor , 1 ) + 4 ;
widgets [ WIDX_TRACK_SPINNER_HEIGHT_DECREASE ]. bottom = GBBB ( propertiesAnchor , 1 ) - 4 ;
widgets [ WIDX_TRACK_CHECK_CHAIN_LIFT ]. top = GBBT ( propertiesAnchor , 2 );
widgets [ WIDX_TRACK_CHECK_CHAIN_LIFT ]. bottom = GBBB ( propertiesAnchor , 2 );
widgets [ WIDX_TRACK_CHECK_BRAKE_CLOSED ]. top = GBBT ( propertiesAnchor , 3 );
widgets [ WIDX_TRACK_CHECK_BRAKE_CLOSED ]. bottom = GBBB ( propertiesAnchor , 3 );
widgets [ WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE ]. top = GBBT ( propertiesAnchor , 4 );
widgets [ WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE ]. bottom = GBBB ( propertiesAnchor , 4 );
2025-09-17 20:10:06 +02:00
setCheckboxValue ( WIDX_TRACK_CHECK_APPLY_TO_ALL , _applyToAll );
setCheckboxValue ( WIDX_TRACK_CHECK_CHAIN_LIFT , tileElement -> AsTrack () -> HasChain ());
setCheckboxValue ( WIDX_TRACK_CHECK_BRAKE_CLOSED , tileElement -> AsTrack () -> IsBrakeClosed ());
2024-03-10 13:52:35 +00:00
widgets [ WIDX_TRACK_CHECK_BRAKE_CLOSED ]. content = tileElement -> AsTrack () -> IsBlockStart ()
? STR_TILE_INSPECTOR_TRACK_BLOCK_BRAKE
: STR_TILE_INSPECTOR_TRACK_BRAKE_CLOSED ;
2025-09-17 20:10:06 +02:00
setCheckboxValue ( WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE , tileElement -> AsTrack () -> IsIndestructible ());
2022-03-23 22:01:23 -04:00
break ;
case TileElementType :: SmallScenery :
2024-03-10 13:52:35 +00:00
{
// Raise / Lower
widgets [ WIDX_SCENERY_SPINNER_HEIGHT ]. top = GBBT ( propertiesAnchor , 0 ) + 3 ;
widgets [ WIDX_SCENERY_SPINNER_HEIGHT ]. bottom = GBBB ( propertiesAnchor , 0 ) - 3 ;
widgets [ WIDX_SCENERY_SPINNER_HEIGHT_INCREASE ]. top = GBBT ( propertiesAnchor , 0 ) + 4 ;
widgets [ WIDX_SCENERY_SPINNER_HEIGHT_INCREASE ]. bottom = GBBB ( propertiesAnchor , 0 ) - 4 ;
widgets [ WIDX_SCENERY_SPINNER_HEIGHT_DECREASE ]. top = GBBT ( propertiesAnchor , 0 ) + 4 ;
widgets [ WIDX_SCENERY_SPINNER_HEIGHT_DECREASE ]. bottom = GBBB ( propertiesAnchor , 0 ) - 4 ;
// Quadrant checkboxes
widgets [ WIDX_SCENERY_CHECK_QUARTER_N ]. top = GBBT ( propertiesAnchor , 1 ) - 5 + 7 * 0 ;
widgets [ WIDX_SCENERY_CHECK_QUARTER_N ]. bottom = widgets [ WIDX_SCENERY_CHECK_QUARTER_N ]. top + 13 ;
widgets [ WIDX_SCENERY_CHECK_QUARTER_E ]. top = GBBT ( propertiesAnchor , 1 ) - 5 + 7 * 1 ;
widgets [ WIDX_SCENERY_CHECK_QUARTER_E ]. bottom = widgets [ WIDX_SCENERY_CHECK_QUARTER_E ]. top + 13 ;
widgets [ WIDX_SCENERY_CHECK_QUARTER_S ]. top = GBBT ( propertiesAnchor , 1 ) - 5 + 7 * 2 ;
widgets [ WIDX_SCENERY_CHECK_QUARTER_S ]. bottom = widgets [ WIDX_SCENERY_CHECK_QUARTER_S ]. top + 13 ;
widgets [ WIDX_SCENERY_CHECK_QUARTER_W ]. top = GBBT ( propertiesAnchor , 1 ) - 5 + 7 * 1 ;
widgets [ WIDX_SCENERY_CHECK_QUARTER_W ]. bottom = widgets [ WIDX_SCENERY_CHECK_QUARTER_W ]. top + 13 ;
// This gets the relative rotation, by subtracting the camera's rotation, and wrapping it between 0-3
// inclusive
bool N = tileElement -> AsSmallScenery () -> GetSceneryQuadrant () == (( 0 - GetCurrentRotation ()) & 3 );
bool E = tileElement -> AsSmallScenery () -> GetSceneryQuadrant () == (( 1 - GetCurrentRotation ()) & 3 );
bool S = tileElement -> AsSmallScenery () -> GetSceneryQuadrant () == (( 2 - GetCurrentRotation ()) & 3 );
bool W = tileElement -> AsSmallScenery () -> GetSceneryQuadrant () == (( 3 - GetCurrentRotation ()) & 3 );
2025-09-17 20:10:06 +02:00
setCheckboxValue ( WIDX_SCENERY_CHECK_QUARTER_N , N );
setCheckboxValue ( WIDX_SCENERY_CHECK_QUARTER_E , E );
setCheckboxValue ( WIDX_SCENERY_CHECK_QUARTER_S , S );
setCheckboxValue ( WIDX_SCENERY_CHECK_QUARTER_W , W );
2024-03-10 13:52:35 +00:00
// Collision checkboxes
widgets [ WIDX_SCENERY_CHECK_COLLISION_N ]. top = GBBT ( propertiesAnchor , 2 ) + 5 + 7 * 0 ;
widgets [ WIDX_SCENERY_CHECK_COLLISION_N ]. bottom = widgets [ WIDX_SCENERY_CHECK_COLLISION_N ]. top + 13 ;
widgets [ WIDX_SCENERY_CHECK_COLLISION_E ]. top = GBBT ( propertiesAnchor , 2 ) + 5 + 7 * 1 ;
widgets [ WIDX_SCENERY_CHECK_COLLISION_E ]. bottom = widgets [ WIDX_SCENERY_CHECK_COLLISION_E ]. top + 13 ;
widgets [ WIDX_SCENERY_CHECK_COLLISION_S ]. top = GBBT ( propertiesAnchor , 2 ) + 5 + 7 * 2 ;
widgets [ WIDX_SCENERY_CHECK_COLLISION_S ]. bottom = widgets [ WIDX_SCENERY_CHECK_COLLISION_S ]. top + 13 ;
widgets [ WIDX_SCENERY_CHECK_COLLISION_W ]. top = GBBT ( propertiesAnchor , 2 ) + 5 + 7 * 1 ;
widgets [ WIDX_SCENERY_CHECK_COLLISION_W ]. bottom = widgets [ WIDX_SCENERY_CHECK_COLLISION_W ]. top + 13 ;
auto occupiedQuadrants = tileElement -> GetOccupiedQuadrants ();
N = ( occupiedQuadrants & ( 1 << (( 2 - GetCurrentRotation ()) & 3 ))) != 0 ;
E = ( occupiedQuadrants & ( 1 << (( 3 - GetCurrentRotation ()) & 3 ))) != 0 ;
S = ( occupiedQuadrants & ( 1 << (( 0 - GetCurrentRotation ()) & 3 ))) != 0 ;
W = ( occupiedQuadrants & ( 1 << (( 1 - GetCurrentRotation ()) & 3 ))) != 0 ;
2025-09-17 20:10:06 +02:00
setCheckboxValue ( WIDX_SCENERY_CHECK_COLLISION_N , N );
setCheckboxValue ( WIDX_SCENERY_CHECK_COLLISION_E , E );
setCheckboxValue ( WIDX_SCENERY_CHECK_COLLISION_S , S );
setCheckboxValue ( WIDX_SCENERY_CHECK_COLLISION_W , W );
2022-03-23 22:01:23 -04:00
break ;
2024-03-10 13:52:35 +00:00
}
2022-03-23 22:01:23 -04:00
case TileElementType :: Entrance :
2024-03-10 13:52:35 +00:00
widgets [ WIDX_ENTRANCE_SPINNER_HEIGHT ]. top = GBBT ( propertiesAnchor , 0 ) + 3 ;
widgets [ WIDX_ENTRANCE_SPINNER_HEIGHT ]. bottom = GBBB ( propertiesAnchor , 0 ) - 3 ;
widgets [ WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE ]. top = GBBT ( propertiesAnchor , 0 ) + 4 ;
widgets [ WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE ]. bottom = GBBB ( propertiesAnchor , 0 ) - 4 ;
widgets [ WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE ]. top = GBBT ( propertiesAnchor , 0 ) + 4 ;
widgets [ WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE ]. bottom = GBBB ( propertiesAnchor , 0 ) - 4 ;
widgets [ WIDX_ENTRANCE_BUTTON_MAKE_USABLE ]. top = GBBT ( propertiesAnchor , 1 );
widgets [ WIDX_ENTRANCE_BUTTON_MAKE_USABLE ]. bottom = GBBB ( propertiesAnchor , 1 );
2025-09-17 20:10:06 +02:00
setWidgetDisabled (
2024-03-10 13:52:35 +00:00
WIDX_ENTRANCE_BUTTON_MAKE_USABLE ,
! ( tileElement -> AsEntrance () -> GetEntranceType () != ENTRANCE_TYPE_PARK_ENTRANCE ));
2022-03-23 22:01:23 -04:00
break ;
case TileElementType :: Wall :
2024-03-10 13:52:35 +00:00
{
bool canBeSloped = false ;
bool hasAnimation = false ;
const auto wallEntry = tileElement -> AsWall () -> GetEntry ();
if ( wallEntry != nullptr )
{
canBeSloped = ! ( wallEntry -> flags & WALL_SCENERY_CANT_BUILD_ON_SLOPE );
hasAnimation = wallEntry -> flags & WALL_SCENERY_IS_DOOR ;
}
widgets [ WIDX_WALL_SPINNER_HEIGHT ]. top = GBBT ( propertiesAnchor , 0 ) + 3 ;
widgets [ WIDX_WALL_SPINNER_HEIGHT ]. bottom = GBBB ( propertiesAnchor , 0 ) - 3 ;
widgets [ WIDX_WALL_SPINNER_HEIGHT_INCREASE ]. top = GBBT ( propertiesAnchor , 0 ) + 4 ;
widgets [ WIDX_WALL_SPINNER_HEIGHT_INCREASE ]. bottom = GBBB ( propertiesAnchor , 0 ) - 4 ;
widgets [ WIDX_WALL_SPINNER_HEIGHT_DECREASE ]. top = GBBT ( propertiesAnchor , 0 ) + 4 ;
widgets [ WIDX_WALL_SPINNER_HEIGHT_DECREASE ]. bottom = GBBB ( propertiesAnchor , 0 ) - 4 ;
widgets [ WIDX_WALL_DROPDOWN_SLOPE ]. top = GBBT ( propertiesAnchor , 1 ) + 3 ;
widgets [ WIDX_WALL_DROPDOWN_SLOPE ]. bottom = GBBB ( propertiesAnchor , 1 ) - 3 ;
widgets [ WIDX_WALL_DROPDOWN_SLOPE ]. text = WallSlopeStringIds [ tileElement -> AsWall () -> GetSlope ()];
widgets [ WIDX_WALL_DROPDOWN_SLOPE_BUTTON ]. top = GBBT ( propertiesAnchor , 1 ) + 4 ;
widgets [ WIDX_WALL_DROPDOWN_SLOPE_BUTTON ]. bottom = GBBB ( propertiesAnchor , 1 ) - 4 ;
widgets [ WIDX_WALL_SPINNER_ANIMATION_FRAME ]. top = GBBT ( propertiesAnchor , 2 ) + 3 ;
widgets [ WIDX_WALL_SPINNER_ANIMATION_FRAME ]. bottom = GBBB ( propertiesAnchor , 2 ) - 3 ;
widgets [ WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE ]. top = GBBT ( propertiesAnchor , 2 ) + 4 ;
widgets [ WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE ]. bottom = GBBB ( propertiesAnchor , 2 ) - 4 ;
widgets [ WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE ]. top = GBBT ( propertiesAnchor , 2 ) + 4 ;
widgets [ WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE ]. bottom = GBBB ( propertiesAnchor , 2 ) - 4 ;
2024-04-12 20:08:34 +02:00
widgets [ WIDX_WALL_ANIMATION_IS_BACKWARDS ]. top = GBBT ( propertiesAnchor , 3 );
widgets [ WIDX_WALL_ANIMATION_IS_BACKWARDS ]. bottom = GBBB ( propertiesAnchor , 3 );
2024-03-10 13:52:35 +00:00
// Wall slope dropdown
2025-09-17 20:10:06 +02:00
setWidgetDisabled ( WIDX_WALL_DROPDOWN_SLOPE , ! canBeSloped );
invalidateWidget ( WIDX_WALL_DROPDOWN_SLOPE );
setWidgetDisabled ( WIDX_WALL_DROPDOWN_SLOPE_BUTTON , ! canBeSloped );
invalidateWidget ( WIDX_WALL_DROPDOWN_SLOPE_BUTTON );
2024-03-10 13:52:35 +00:00
// Wall animation frame spinner
2025-09-17 20:10:06 +02:00
setWidgetDisabled ( WIDX_WALL_SPINNER_ANIMATION_FRAME , ! hasAnimation );
setWidgetDisabled ( WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE , ! hasAnimation );
setWidgetDisabled ( WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE , ! hasAnimation );
2024-04-12 20:08:34 +02:00
2025-09-17 20:10:06 +02:00
setCheckboxValue ( WIDX_WALL_ANIMATION_IS_BACKWARDS , tileElement -> AsWall () -> AnimationIsBackwards ());
setWidgetDisabled ( WIDX_WALL_ANIMATION_IS_BACKWARDS , ! hasAnimation );
2022-03-23 22:01:23 -04:00
break ;
2024-03-10 13:52:35 +00:00
}
2022-03-23 22:01:23 -04:00
case TileElementType :: LargeScenery :
2024-03-10 13:52:35 +00:00
widgets [ WIDX_LARGE_SCENERY_SPINNER_HEIGHT ]. top = GBBT ( propertiesAnchor , 0 ) + 3 ;
widgets [ WIDX_LARGE_SCENERY_SPINNER_HEIGHT ]. bottom = GBBB ( propertiesAnchor , 0 ) - 3 ;
widgets [ WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE ]. top = GBBT ( propertiesAnchor , 0 ) + 4 ;
widgets [ WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE ]. bottom = GBBB ( propertiesAnchor , 0 ) - 4 ;
widgets [ WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE ]. top = GBBT ( propertiesAnchor , 0 ) + 4 ;
widgets [ WIDX_LARGE_SCENERY_SPINNER_HEIGHT_DECREASE ]. bottom = GBBB ( propertiesAnchor , 0 ) - 4 ;
2022-03-23 22:01:23 -04:00
break ;
case TileElementType :: Banner :
2024-03-10 13:52:35 +00:00
widgets [ WIDX_BANNER_SPINNER_HEIGHT ]. top = GBBT ( propertiesAnchor , 0 ) + 3 ;
widgets [ WIDX_BANNER_SPINNER_HEIGHT ]. bottom = GBBB ( propertiesAnchor , 0 ) - 3 ;
widgets [ WIDX_BANNER_SPINNER_HEIGHT_INCREASE ]. top = GBBT ( propertiesAnchor , 0 ) + 4 ;
widgets [ WIDX_BANNER_SPINNER_HEIGHT_INCREASE ]. bottom = GBBB ( propertiesAnchor , 0 ) - 4 ;
widgets [ WIDX_BANNER_SPINNER_HEIGHT_DECREASE ]. top = GBBT ( propertiesAnchor , 0 ) + 4 ;
widgets [ WIDX_BANNER_SPINNER_HEIGHT_DECREASE ]. bottom = GBBB ( propertiesAnchor , 0 ) - 4 ;
widgets [ WIDX_BANNER_CHECK_BLOCK_NE ]. top = GBBT ( propertiesAnchor , 1 );
widgets [ WIDX_BANNER_CHECK_BLOCK_NE ]. bottom = GBBB ( propertiesAnchor , 1 );
widgets [ WIDX_BANNER_CHECK_BLOCK_SE ]. top = GBBT ( propertiesAnchor , 2 );
widgets [ WIDX_BANNER_CHECK_BLOCK_SE ]. bottom = GBBB ( propertiesAnchor , 2 );
widgets [ WIDX_BANNER_CHECK_BLOCK_SW ]. top = GBBT ( propertiesAnchor , 2 );
widgets [ WIDX_BANNER_CHECK_BLOCK_SW ]. bottom = GBBB ( propertiesAnchor , 2 );
widgets [ WIDX_BANNER_CHECK_BLOCK_NW ]. top = GBBT ( propertiesAnchor , 1 );
widgets [ WIDX_BANNER_CHECK_BLOCK_NW ]. bottom = GBBB ( propertiesAnchor , 1 );
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_BANNER_CHECK_BLOCK_NE ,
( tileElement -> AsBanner () -> GetAllowedEdges () & ( 1 << (( 0 - GetCurrentRotation ()) & 3 ))));
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_BANNER_CHECK_BLOCK_SE ,
( tileElement -> AsBanner () -> GetAllowedEdges () & ( 1 << (( 1 - GetCurrentRotation ()) & 3 ))));
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_BANNER_CHECK_BLOCK_SW ,
( tileElement -> AsBanner () -> GetAllowedEdges () & ( 1 << (( 2 - GetCurrentRotation ()) & 3 ))));
2025-09-17 20:10:06 +02:00
setCheckboxValue (
2024-03-10 13:52:35 +00:00
WIDX_BANNER_CHECK_BLOCK_NW ,
( tileElement -> AsBanner () -> GetAllowedEdges () & ( 1 << (( 3 - GetCurrentRotation ()) & 3 ))));
2022-03-23 22:01:23 -04:00
break ;
2024-03-10 13:52:35 +00:00
default :
break ; // Nothing.
2022-03-23 22:01:23 -04:00
}
}
2024-03-10 13:52:35 +00:00
};
2022-03-23 22:01:23 -04:00
2024-03-17 02:37:46 -04:00
WindowBase * TileInspectorOpen ()
2024-03-10 13:52:35 +00:00
{
2025-01-19 10:58:28 +01:00
auto * windowMgr = GetWindowManager ();
2025-09-17 23:18:52 +02:00
WindowBase * window = windowMgr -> BringToFrontByClass ( WindowClass :: tileInspector );
2024-03-10 13:52:35 +00:00
if ( window == nullptr )
2025-06-10 22:20:27 +02:00
window = windowMgr -> Create < TileInspector > (
2025-09-20 21:46:42 +02:00
WindowClass :: tileInspector , ScreenCoordsXY ( 0 , 29 ), kWindowSize , WindowFlag :: resizable );
2024-03-10 13:52:35 +00:00
return window ;
2022-03-23 22:01:23 -04:00
}
2015-06-01 02:33:56 +01:00
2024-03-10 13:52:35 +00:00
void WindowTileInspectorClearClipboard ()
{
2025-01-19 10:58:28 +01:00
auto * windowMgr = GetWindowManager ();
2025-09-17 23:18:52 +02:00
auto * window = windowMgr -> FindByClass ( WindowClass :: tileInspector );
2024-03-10 13:52:35 +00:00
if ( window != nullptr )
static_cast < TileInspector *> ( window ) -> ClearClipboard ();
}
2022-03-23 22:01:23 -04:00
2024-03-10 13:52:35 +00:00
void WindowTileInspectorKeyboardShortcutToggleInvisibility ()
{
2025-01-19 10:58:28 +01:00
auto * windowMgr = GetWindowManager ();
2025-09-17 23:18:52 +02:00
auto * window = windowMgr -> FindByClass ( WindowClass :: tileInspector );
2024-03-10 13:52:35 +00:00
if ( window != nullptr )
static_cast < TileInspector *> ( window ) -> ToggleInvisibility ();
}
} // namespace OpenRCT2::Ui::Windows