mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 03:53:07 +01:00
Apply coding style to tile inspector source files
This commit is contained in:
committed by
Michał Janiszewski
parent
22cfb3da2c
commit
2fb49013bc
@@ -15,12 +15,10 @@
|
||||
#pragma endregion
|
||||
|
||||
#include "../common.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../core/Guard.hpp"
|
||||
#include "../game.h"
|
||||
#include "../input.h"
|
||||
#include "../interface/themes.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../interface/widget.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../localisation/localisation.h"
|
||||
@@ -31,10 +29,9 @@
|
||||
#include "../world/scenery.h"
|
||||
#include "../world/tile_inspector.h"
|
||||
#include "dropdown.h"
|
||||
#include "error.h"
|
||||
#include "tile_inspector.h"
|
||||
|
||||
static const rct_string_id terrainTypeStringIds[] = {
|
||||
static const rct_string_id TerrainTypeStringIds[] = {
|
||||
STR_TILE_INSPECTOR_TERRAIN_GRASS,
|
||||
STR_TILE_INSPECTOR_TERRAIN_SAND,
|
||||
STR_TILE_INSPECTOR_TERRAIN_DIRT,
|
||||
@@ -53,7 +50,7 @@ static const rct_string_id terrainTypeStringIds[] = {
|
||||
STR_TILE_INSPECTOR_TERRAIN_UNDERGROUND_VIEW,
|
||||
};
|
||||
|
||||
static const rct_string_id terrainEdgeTypeStringIds[] = {
|
||||
static const rct_string_id TerrainEdgeTypeStringIds[] = {
|
||||
STR_TILE_INSPECTOR_TERRAIN_EDGE_ROCK,
|
||||
STR_TILE_INSPECTOR_TERRAIN_EDGE_WOOD_RED,
|
||||
STR_TILE_INSPECTOR_TERRAIN_EDGE_WOOD_BLACK,
|
||||
@@ -61,19 +58,19 @@ static const rct_string_id terrainEdgeTypeStringIds[] = {
|
||||
|
||||
};
|
||||
|
||||
static const rct_string_id entranceTypeStringIds[] = {
|
||||
static const rct_string_id EntranceTypeStringIds[] = {
|
||||
STR_TILE_INSPECTOR_ENTRANCE_TYPE_RIDE_ENTRANCE,
|
||||
STR_TILE_INSPECTOR_ENTRANCE_TYPE_RIDE_EXIT,
|
||||
STR_TILE_INSPECTOR_ENTRANCE_TYPE_PARK_ENTRANC,
|
||||
};
|
||||
|
||||
static const rct_string_id parkEntrancePartStringIds[] = {
|
||||
static const rct_string_id ParkEntrancePartStringIds[] = {
|
||||
STR_TILE_INSPECTOR_ENTRANCE_MIDDLE,
|
||||
STR_TILE_INSPECTOR_ENTRANCE_LEFT,
|
||||
STR_TILE_INSPECTOR_ENTRANCE_RIGHT
|
||||
};
|
||||
|
||||
static const rct_string_id fenceSlopeStringIds[] = {
|
||||
static const rct_string_id FenceSlopeStringIds[] = {
|
||||
STR_TILE_INSPECTOR_FENCE_FLAT,
|
||||
STR_TILE_INSPECTOR_FENCE_SLOPED_LEFT,
|
||||
STR_TILE_INSPECTOR_FENCE_SLOPED_RIGHT
|
||||
@@ -267,7 +264,7 @@ enum WINDOW_TILE_INSPECTOR_WIDGET_IDX {
|
||||
{ WWT_GROUPBOX, 1, 6, WW - 6, -1, -1, STR_NONE, STR_NONE }, /* Details group box */ \
|
||||
{ WWT_GROUPBOX, 1, 6, WW - 6, -1, -1, STR_TILE_INSPECTOR_GROUPBOX_PROPERTIES, STR_NONE } /* Properties group box */
|
||||
|
||||
static rct_widget windowTileInspectorWidgets[] = {
|
||||
static rct_widget DefaultWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
@@ -277,7 +274,7 @@ static rct_widget windowTileInspectorWidgets[] = {
|
||||
#define SUR_GBPT (SUR_GBPB + 16 + 4 * 21) // Surface group box properties top
|
||||
#define SUR_GBDB (SUR_GBPT + GROUPBOX_PADDING) // Surface group box details bottom
|
||||
#define SUR_GBDT (SUR_GBDB + 20 + 4 * 11) // Surface group box details top
|
||||
static rct_widget windowTileInspectorWidgetsSurface[] = {
|
||||
static rct_widget SurfaceWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
{ WWT_SPINNER, 1, GBS(WH - SUR_GBPT, 1, 0), STR_NONE, STR_NONE }, // WIDX_SURFACE_SPINNER_HEIGHT
|
||||
{ WWT_DROPDOWN_BUTTON, 1, GBSI(WH - SUR_GBPT, 1, 0), STR_NUMERIC_UP, STR_NONE }, // WIDX_SURFACE_SPINNER_HEIGHT_INCREASE
|
||||
@@ -296,7 +293,7 @@ static rct_widget windowTileInspectorWidgetsSurface[] = {
|
||||
#define PAT_GBPT (PAT_GBPB + 16 + 4 * 21) // Path group box properties top
|
||||
#define PAT_GBDB (PAT_GBPT + GROUPBOX_PADDING) // Path group box info bottom
|
||||
#define PAT_GBDT (PAT_GBDB + 20 + 2 * 11) // Path group box info top
|
||||
static rct_widget windowTileInspectorWidgetsPath[] = {
|
||||
static rct_widget PathWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
{ WWT_SPINNER, 1, GBS(WH - PAT_GBPT, 1, 0), STR_NONE, STR_NONE }, // WIDX_PATH_SPINNER_HEIGHT
|
||||
{ WWT_DROPDOWN_BUTTON, 1, GBSI(WH - PAT_GBPT, 1, 0), STR_NUMERIC_UP, STR_NONE }, // WIDX_PATH_SPINNER_HEIGHT_INCREASE
|
||||
@@ -317,7 +314,7 @@ static rct_widget windowTileInspectorWidgetsPath[] = {
|
||||
#define TRA_GBPT (TRA_GBPB + 16 + 3 * 21) // Track group box properties top
|
||||
#define TRA_GBDB (TRA_GBPT + GROUPBOX_PADDING) // Track group box info bottom
|
||||
#define TRA_GBDT (TRA_GBDB + 20 + 5 * 11) // Track group box info top
|
||||
static rct_widget windowTileInspectorWidgetsTrack[] = {
|
||||
static rct_widget TrackWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
{ WWT_CHECKBOX, 1, GBBF(WH - TRA_GBPT, 0, 0), STR_TILE_INSPECTOR_TRACK_ENTIRE_TRACK_PIECE, STR_NONE }, // WIDX_TRACK_CHECK_APPLY_TO_ALL
|
||||
{ WWT_SPINNER, 1, GBS(WH - TRA_GBPT, 1, 1), STR_NONE, STR_NONE }, // WIDX_TRACK_SPINNER_HEIGHT
|
||||
@@ -331,7 +328,7 @@ static rct_widget windowTileInspectorWidgetsTrack[] = {
|
||||
#define SCE_GBPT (SCE_GBPB + 16 + 4 * 21) // Scenery group box properties top
|
||||
#define SCE_GBDB (SCE_GBPT + GROUPBOX_PADDING) // Scenery group box info bottom
|
||||
#define SCE_GBDT (SCE_GBDB + 20 + 3 * 11) // Scenery group box info top
|
||||
static rct_widget windowTileInspectorWidgetsScenery[] = {
|
||||
static rct_widget SceneryWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
{ WWT_SPINNER, 1, GBS(WH - SCE_GBPT, 1, 0), STR_NONE, STR_NONE }, // WIDX_SCENERY_SPINNER_HEIGHT
|
||||
{ WWT_DROPDOWN_BUTTON, 1, GBSI(WH - SCE_GBPT, 1, 0), STR_NUMERIC_UP, STR_NONE }, // WIDX_SCENERY_SPINNER_HEIGHT_INCREASE
|
||||
@@ -351,7 +348,7 @@ static rct_widget windowTileInspectorWidgetsScenery[] = {
|
||||
#define ENT_GBPT (ENT_GBPB + 16 + 1 * 21) // Entrance group box properties top
|
||||
#define ENT_GBDB (ENT_GBPT + GROUPBOX_PADDING) // Entrance group box info bottom
|
||||
#define ENT_GBDT (ENT_GBDB + 20 + 3 * 11) // Entrance group box info top
|
||||
static rct_widget windowTileInspectorWidgetsEntrance[] = {
|
||||
static rct_widget EntranceWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
{ WWT_SPINNER, 1, GBS(WH - ENT_GBPT, 1, 0), STR_NONE, STR_NONE }, // WIDX_ENTRANCE_SPINNER_HEIGHT
|
||||
{ WWT_DROPDOWN_BUTTON, 1, GBSI(WH - ENT_GBPT, 1, 0), STR_NUMERIC_UP, STR_NONE }, // WIDX_ENTRANCE_SPINNER_HEIGHT_INCREASE
|
||||
@@ -363,7 +360,7 @@ static rct_widget windowTileInspectorWidgetsEntrance[] = {
|
||||
#define FEN_GBPT (FEN_GBPB + 16 + 2 * 21) // Fence group box properties top
|
||||
#define FEN_GBDB (FEN_GBPT + GROUPBOX_PADDING) // Fence group box info bottom
|
||||
#define FEN_GBDT (FEN_GBDB + 20 + 2 * 11) // Fence group box info top
|
||||
static rct_widget windowTileInspectorWidgetsFence[] = {
|
||||
static rct_widget FenceWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
{ WWT_SPINNER, 1, GBS(WH - FEN_GBPT, 1, 0), STR_NONE, STR_NONE }, // WIDX_FENCE_SPINNER_HEIGHT
|
||||
{ WWT_DROPDOWN_BUTTON, 1, GBSI(WH - FEN_GBPT, 1, 0), STR_NUMERIC_UP, STR_NONE }, // WIDX_FENCE_SPINNER_HEIGHT_INCREASE
|
||||
@@ -377,7 +374,7 @@ static rct_widget windowTileInspectorWidgetsFence[] = {
|
||||
#define LAR_GBPT (LAR_GBPB + 16 + 1 * 21) // Large scenery group box properties top
|
||||
#define LAR_GBDB (LAR_GBPT + GROUPBOX_PADDING) // Large scenery group box info bottom
|
||||
#define LAR_GBDT (LAR_GBDB + 20 + 3 * 11) // Large scenery group box info top
|
||||
static rct_widget windowTileInspectorWidgetsLargeScenery[] = {
|
||||
static rct_widget LargeSceneryWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
{ WWT_SPINNER, 1, GBS(WH - LAR_GBPT, 1, 0), STR_NONE, STR_NONE }, // WIDX_LARGE_SCENERY_SPINNER_HEIGHT
|
||||
{ WWT_DROPDOWN_BUTTON, 1, GBSI(WH - LAR_GBPT, 1, 0), STR_NUMERIC_UP, STR_NONE }, // WIDX_LARGE_SCENERY_SPINNER_HEIGHT_INCREASE
|
||||
@@ -389,7 +386,7 @@ static rct_widget windowTileInspectorWidgetsLargeScenery[] = {
|
||||
#define BAN_GBPT (BAN_GBPB + 16 + 3 * 21) // Banner group box properties top
|
||||
#define BAN_GBDB (BAN_GBPT + GROUPBOX_PADDING) // Banner group box info bottom
|
||||
#define BAN_GBDT (BAN_GBDB + 20 + 1 * 11) // Banner group box info top
|
||||
static rct_widget windowTileInspectorWidgetsBanner[] = {
|
||||
static rct_widget BannerWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
{ WWT_SPINNER, 1, GBS(WH - BAN_GBPT, 1, 0), STR_NONE, STR_NONE }, // WIDX_BANNER_SPINNER_HEIGHT
|
||||
{ WWT_DROPDOWN_BUTTON, 1, GBSI(WH - BAN_GBPT, 1, 0), STR_NUMERIC_UP, STR_NONE }, // WIDX_BANNER_SPINNER_HEIGHT_INCREASE
|
||||
@@ -406,7 +403,7 @@ static rct_widget windowTileInspectorWidgetsBanner[] = {
|
||||
#define COR_GBPT (COR_GBPB + 16 + 2 * 21) // Corrupt element group box properties top
|
||||
#define COR_GBDB (COR_GBPT + GROUPBOX_PADDING) // Corrupt element group box info bottom
|
||||
#define COR_GBDT (COR_GBDB + 20 + 0 * 11) // Corrupt element group box info top
|
||||
static rct_widget windowTileInspectorWidgetsCorrupt[] = {
|
||||
static rct_widget CorruptWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
{ WWT_SPINNER, 1, GBS(WH - COR_GBPT, 1, 0), STR_NONE, STR_NONE }, // WIDX_CORRUPT_SPINNER_HEIGHT
|
||||
{ WWT_DROPDOWN_BUTTON, 1, GBSI(WH - COR_GBPT, 1, 0), STR_NUMERIC_UP, STR_NONE }, // WIDX_CORRUPT_SPINNER_HEIGHT_INCREASE
|
||||
@@ -415,26 +412,26 @@ static rct_widget windowTileInspectorWidgetsCorrupt[] = {
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
static rct_widget *tileInspectorWidgets[] = {
|
||||
windowTileInspectorWidgets,
|
||||
windowTileInspectorWidgetsSurface,
|
||||
windowTileInspectorWidgetsPath,
|
||||
windowTileInspectorWidgetsTrack,
|
||||
windowTileInspectorWidgetsScenery,
|
||||
windowTileInspectorWidgetsEntrance,
|
||||
windowTileInspectorWidgetsFence,
|
||||
windowTileInspectorWidgetsLargeScenery,
|
||||
windowTileInspectorWidgetsBanner,
|
||||
windowTileInspectorWidgetsCorrupt,
|
||||
static rct_widget *PageWidgets[] = {
|
||||
DefaultWidgets,
|
||||
SurfaceWidgets,
|
||||
PathWidgets,
|
||||
TrackWidgets,
|
||||
SceneryWidgets,
|
||||
EntranceWidgets,
|
||||
FenceWidgets,
|
||||
LargeSceneryWidgets,
|
||||
BannerWidgets,
|
||||
CorruptWidgets,
|
||||
};
|
||||
|
||||
static struct {
|
||||
// Offsets from the bottom of the window
|
||||
sint16 detailsTopOffset, detailsBottomOffset;
|
||||
sint16 details_top_offset, details_bottom_offset;
|
||||
sint16 properties_top_offset, properties_bottom_offset;
|
||||
// String to be displayed in the details groupbox
|
||||
rct_string_id string_idx;
|
||||
} pageGroupBoxSettings[] = {
|
||||
rct_string_id string_id;
|
||||
} PageGroupBoxSettings[] = {
|
||||
{ SUR_GBDT, SUR_GBDB, SUR_GBPT, SUR_GBPB, STR_TILE_INSPECTOR_GROUPBOX_SURFACE_INFO },
|
||||
{ PAT_GBDT, PAT_GBDB, PAT_GBPT, PAT_GBPB, STR_TILE_INSPECTOR_GROUPBOX_PATH_INFO },
|
||||
{ TRA_GBDT, TRA_GBDB, TRA_GBPT, TRA_GBPB, STR_TILE_INSPECTOR_GROUPBOX_TRACK_INFO },
|
||||
@@ -475,7 +472,7 @@ static void window_tile_inspector_invalidate(rct_window *w);
|
||||
static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi);
|
||||
static void window_tile_inspector_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 scrollIndex);
|
||||
|
||||
static rct_window_event_list windowTileInspectorEvents = {
|
||||
static rct_window_event_list TileInspectorWindowEvents = {
|
||||
NULL,
|
||||
window_tile_inspector_mouseup,
|
||||
window_tile_inspector_resize,
|
||||
@@ -506,7 +503,7 @@ static rct_window_event_list windowTileInspectorEvents = {
|
||||
window_tile_inspector_scrollpaint
|
||||
};
|
||||
|
||||
static uint64 windowTileInspectorEnabledWidgets[] = {
|
||||
static uint64 PageEnabledWidgets[] = {
|
||||
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT),
|
||||
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE) | (1ULL << WIDX_BUTTON_COPY) | (1ULL << WIDX_SURFACE_SPINNER_HEIGHT_INCREASE) | (1ULL << WIDX_SURFACE_SPINNER_HEIGHT_DECREASE) | (1ULL << WIDX_SURFACE_BUTTON_REMOVE_FENCES) | (1ULL << WIDX_SURFACE_BUTTON_RESTORE_FENCES) | (1ULL << WIDX_SURFACE_CHECK_CORNER_N) | (1ULL << WIDX_SURFACE_CHECK_CORNER_E) | (1ULL << WIDX_SURFACE_CHECK_CORNER_S) | (1ULL << WIDX_SURFACE_CHECK_CORNER_W) | (1ULL << WIDX_SURFACE_CHECK_DIAGONAL),
|
||||
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE) | (1ULL << WIDX_BUTTON_COPY) | (1ULL << WIDX_PATH_SPINNER_HEIGHT_INCREASE) | (1ULL << WIDX_PATH_SPINNER_HEIGHT_DECREASE) | (1ULL << WIDX_PATH_CHECK_SLOPED) | (1ULL << WIDX_PATH_CHECK_EDGE_N) | (1ULL << WIDX_PATH_CHECK_EDGE_NE) | (1ULL << WIDX_PATH_CHECK_EDGE_E) | (1ULL << WIDX_PATH_CHECK_EDGE_SE) | (1ULL << WIDX_PATH_CHECK_EDGE_S) | (1ULL << WIDX_PATH_CHECK_EDGE_SW) | (1ULL << WIDX_PATH_CHECK_EDGE_W) | (1ULL << WIDX_PATH_CHECK_EDGE_NW),
|
||||
@@ -519,7 +516,7 @@ static uint64 windowTileInspectorEnabledWidgets[] = {
|
||||
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_COPY) | (1ULL << WIDX_CORRUPT_SPINNER_HEIGHT) | (1ULL << WIDX_CORRUPT_SPINNER_HEIGHT_INCREASE) | (1ULL << WIDX_CORRUPT_SPINNER_HEIGHT_DECREASE) | (1ULL << WIDX_CORRUPT_BUTTON_CLAMP),
|
||||
};
|
||||
|
||||
static uint64 windowTileInspectorDisabledWidgets[] = {
|
||||
static uint64 PageDisabledWidgets[] = {
|
||||
(1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_MOVE_UP) | (1ULL << WIDX_BUTTON_MOVE_DOWN) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE) | (1ULL << WIDX_BUTTON_COPY),
|
||||
0,
|
||||
0,
|
||||
@@ -546,7 +543,7 @@ void window_tile_inspector_open()
|
||||
29,
|
||||
WW,
|
||||
WH,
|
||||
&windowTileInspectorEvents,
|
||||
&TileInspectorWindowEvents,
|
||||
WC_TILE_INSPECTOR,
|
||||
WF_RESIZABLE
|
||||
);
|
||||
@@ -598,45 +595,45 @@ static void window_tile_inspector_load_tile(rct_window* w)
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_insert_corrupt_element(sint32 element_index)
|
||||
static void window_tile_inspector_insert_corrupt_element(sint32 elementIndex)
|
||||
{
|
||||
openrct2_assert(element_index > 0 && element_index < windowTileInspectorElementCount,
|
||||
"element_index out of range");
|
||||
openrct2_assert(elementIndex > 0 && elementIndex < windowTileInspectorElementCount,
|
||||
"elementIndex out of range");
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_ANY_INSERT_CORRUPT,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
element_index,
|
||||
elementIndex,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
0,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_remove_element(sint32 element_index)
|
||||
static void window_tile_inspector_remove_element(sint32 elementIndex)
|
||||
{
|
||||
openrct2_assert(element_index > 0 && element_index < windowTileInspectorElementCount,
|
||||
"element_index out of range");
|
||||
openrct2_assert(elementIndex > 0 && elementIndex < windowTileInspectorElementCount,
|
||||
"elementIndex out of range");
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_ANY_REMOVE,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
element_index,
|
||||
elementIndex,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
0,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_rotate_element(sint32 element_index)
|
||||
static void window_tile_inspector_rotate_element(sint32 elementIndex)
|
||||
{
|
||||
openrct2_assert(element_index > 0 && element_index < windowTileInspectorElementCount,
|
||||
"element_index out of range");
|
||||
openrct2_assert(elementIndex > 0 && elementIndex < windowTileInspectorElementCount,
|
||||
"elementIndex out of range");
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_ANY_ROTATE,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
element_index,
|
||||
elementIndex,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
0,
|
||||
0
|
||||
@@ -661,7 +658,7 @@ static void window_tile_inspector_swap_elements(sint16 first, sint16 second)
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_sort_elements(rct_window *w)
|
||||
static void window_tile_inspector_sort_elements()
|
||||
{
|
||||
openrct2_assert(windowTileInspectorTileSelected, "No tile selected");
|
||||
game_do_command(
|
||||
@@ -700,26 +697,26 @@ static void window_tile_inspector_paste_element(rct_window *w)
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_base_height_offset(sint16 element_index, sint8 height_offset)
|
||||
static void window_tile_inspector_base_height_offset(sint16 elementIndex, sint8 heightOffset)
|
||||
{
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_ANY_BASE_HEIGHT_OFFSET,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
element_index,
|
||||
elementIndex,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
height_offset,
|
||||
heightOffset,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_surface_show_park_fences(bool show_fences)
|
||||
static void window_tile_inspector_surface_show_park_fences(bool showFences)
|
||||
{
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_SURFACE_SHOW_PARK_FENCES,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
show_fences,
|
||||
showFences,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
0,
|
||||
0
|
||||
@@ -752,131 +749,131 @@ static void window_tile_inspector_surface_toggle_diagonal()
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_path_set_sloped(sint32 element_index, bool sloped)
|
||||
static void window_tile_inspector_path_set_sloped(sint32 elementIndex, bool sloped)
|
||||
{
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_PATH_SET_SLOPE,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
element_index,
|
||||
elementIndex,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
sloped,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_path_toggle_edge(sint32 element_index, sint32 corner_index)
|
||||
static void window_tile_inspector_path_toggle_edge(sint32 elementIndex, sint32 cornerIndex)
|
||||
{
|
||||
openrct2_assert(element_index > 0 && element_index < windowTileInspectorElementCount,
|
||||
"element_index out of range");
|
||||
openrct2_assert(corner_index >= 0 && corner_index < 8, "corner_index out of range");
|
||||
openrct2_assert(elementIndex > 0 && elementIndex < windowTileInspectorElementCount,
|
||||
"elementIndex out of range");
|
||||
openrct2_assert(cornerIndex >= 0 && cornerIndex < 8, "cornerIndex out of range");
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_PATH_TOGGLE_EDGE,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
element_index,
|
||||
elementIndex,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
corner_index,
|
||||
cornerIndex,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_fence_set_slope(sint32 element_index, sint32 slope_value)
|
||||
static void window_tile_inspector_fence_set_slope(sint32 elementIndex, sint32 slopeValue)
|
||||
{
|
||||
// Make sure only the correct bits are set
|
||||
openrct2_assert((slope_value & 0xC0) == slope_value, "slope_value doesn't match its mask");
|
||||
openrct2_assert((slopeValue & 0xC0) == slopeValue, "slopeValue doesn't match its mask");
|
||||
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_FENCE_SET_SLOPE,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
element_index,
|
||||
elementIndex,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
slope_value,
|
||||
slopeValue,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_track_block_height_offset(sint32 element_index, sint8 height_offset)
|
||||
static void window_tile_inspector_track_block_height_offset(sint32 elementIndex, sint8 heightOffset)
|
||||
{
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_TRACK_BASE_HEIGHT_OFFSET,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
element_index,
|
||||
elementIndex,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
height_offset,
|
||||
heightOffset,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_track_block_set_lift(sint32 element_index, bool entire_track_block, bool chain)
|
||||
static void window_tile_inspector_track_block_set_lift(sint32 elementIndex, bool entireTrackBlock, bool chain)
|
||||
{
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_TRACK_SET_CHAIN,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
element_index,
|
||||
elementIndex,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
entire_track_block,
|
||||
entireTrackBlock,
|
||||
chain
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_quarter_tile_set(sint32 element_index, const sint32 quarter_index)
|
||||
static void window_tile_inspector_quarter_tile_set(sint32 elementIndex, const sint32 quarterIndex)
|
||||
{
|
||||
// quarter_index is widget index relative to WIDX_SCENERY_CHECK_QUARTER_N, so a value from 0-3
|
||||
openrct2_assert(quarter_index >= 0 && quarter_index < 4, "quarter_index out of range");
|
||||
// quarterIndex is widget index relative to WIDX_SCENERY_CHECK_QUARTER_N, so a value from 0-3
|
||||
openrct2_assert(quarterIndex >= 0 && quarterIndex < 4, "quarterIndex out of range");
|
||||
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_SCENERY_SET_QUARTER_LOCATION,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
element_index,
|
||||
elementIndex,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
(quarter_index - get_current_rotation()) & 3,
|
||||
(quarterIndex - get_current_rotation()) & 3,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_toggle_quadrant_collosion(sint32 element_index, const sint32 quadrant_index)
|
||||
static void window_tile_inspector_toggle_quadrant_collosion(sint32 elementIndex, const sint32 quadrantIndex)
|
||||
{
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_SCENERY_SET_QUARTER_COLLISION,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
element_index,
|
||||
elementIndex,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
(quadrant_index + 2 - get_current_rotation()) & 3,
|
||||
(quadrantIndex + 2 - get_current_rotation()) & 3,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_banner_toggle_block(sint32 element_index, sint32 edge_index)
|
||||
static void window_tile_inspector_banner_toggle_block(sint32 elementIndex, sint32 edgeIndex)
|
||||
{
|
||||
openrct2_assert(edge_index >= 0 && edge_index < 4, "edge_index out of range");
|
||||
openrct2_assert(edgeIndex >= 0 && edgeIndex < 4, "edgeIndex out of range");
|
||||
|
||||
// Make edge_index abstract
|
||||
edge_index = (edge_index - get_current_rotation()) & 3;
|
||||
// Make edgeIndex abstract
|
||||
edgeIndex = (edgeIndex - get_current_rotation()) & 3;
|
||||
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_BANNER_TOGGLE_BLOCKING_EDGE,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
element_index,
|
||||
elementIndex,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
edge_index,
|
||||
edgeIndex,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_clamp_corrupt(sint32 element_index)
|
||||
static void window_tile_inspector_clamp_corrupt(sint32 elementIndex)
|
||||
{
|
||||
game_do_command(
|
||||
TILE_INSPECTOR_CORRUPT_CLAMP,
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
windowTileInspectorTileX | (windowTileInspectorTileY << 8),
|
||||
element_index,
|
||||
elementIndex,
|
||||
GAME_COMMAND_MODIFY_TILE,
|
||||
0,
|
||||
0
|
||||
@@ -920,7 +917,7 @@ static void window_tile_inspector_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
window_tile_inspector_rotate_element(w->selected_list_item);
|
||||
break;
|
||||
case WIDX_BUTTON_SORT:
|
||||
window_tile_inspector_sort_elements(w);
|
||||
window_tile_inspector_sort_elements();
|
||||
break;
|
||||
case WIDX_BUTTON_COPY:
|
||||
window_tile_inspector_copy_element(w);
|
||||
@@ -1036,9 +1033,9 @@ static void window_tile_inspector_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
break;
|
||||
case WIDX_TRACK_CHECK_CHAIN_LIFT:
|
||||
{
|
||||
bool entire_track_block = widget_is_pressed(w, WIDX_TRACK_CHECK_APPLY_TO_ALL);
|
||||
bool new_lift = !track_element_is_lift_hill(mapElement);
|
||||
window_tile_inspector_track_block_set_lift(w->selected_list_item, entire_track_block, new_lift);
|
||||
bool entireTrackBlock = widget_is_pressed(w, WIDX_TRACK_CHECK_APPLY_TO_ALL);
|
||||
bool newLift = !track_element_is_lift_hill(mapElement);
|
||||
window_tile_inspector_track_block_set_lift(w->selected_list_item, entireTrackBlock, newLift);
|
||||
break;
|
||||
}
|
||||
} // switch widget index
|
||||
@@ -1293,9 +1290,9 @@ static void window_tile_inspector_scrollgetsize(rct_window *w, sint32 scrollInde
|
||||
void window_tile_inspector_set_page(rct_window *w, const tile_inspector_page page)
|
||||
{
|
||||
w->page = page;
|
||||
w->widgets = tileInspectorWidgets[page];
|
||||
w->enabled_widgets = windowTileInspectorEnabledWidgets[page];
|
||||
w->disabled_widgets = windowTileInspectorDisabledWidgets[page];
|
||||
w->widgets = PageWidgets[page];
|
||||
w->enabled_widgets = PageEnabledWidgets[page];
|
||||
w->disabled_widgets = PageDisabledWidgets[page];
|
||||
}
|
||||
|
||||
void window_tile_inspector_auto_set_buttons(rct_window *w)
|
||||
@@ -1391,11 +1388,11 @@ static void window_tile_inspector_invalidate(rct_window *w)
|
||||
else {
|
||||
w->widgets[WIDX_GROUPBOX_DETAILS].type = WWT_GROUPBOX;
|
||||
w->widgets[WIDX_GROUPBOX_PROPERTIES].type = WWT_GROUPBOX;
|
||||
w->widgets[WIDX_GROUPBOX_DETAILS].image = pageGroupBoxSettings[w->page - 1].string_idx;
|
||||
w->widgets[WIDX_GROUPBOX_DETAILS].top = w->height - pageGroupBoxSettings[w->page - 1].detailsTopOffset;
|
||||
w->widgets[WIDX_GROUPBOX_DETAILS].bottom = w->height - pageGroupBoxSettings[w->page - 1].detailsBottomOffset;
|
||||
w->widgets[WIDX_GROUPBOX_PROPERTIES].top = w->height - pageGroupBoxSettings[w->page - 1].properties_top_offset;
|
||||
w->widgets[WIDX_GROUPBOX_PROPERTIES].bottom = w->height - pageGroupBoxSettings[w->page - 1].properties_bottom_offset;
|
||||
w->widgets[WIDX_GROUPBOX_DETAILS].image = PageGroupBoxSettings[w->page - 1].string_id;
|
||||
w->widgets[WIDX_GROUPBOX_DETAILS].top = w->height - PageGroupBoxSettings[w->page - 1].details_top_offset;
|
||||
w->widgets[WIDX_GROUPBOX_DETAILS].bottom = w->height - PageGroupBoxSettings[w->page - 1].details_bottom_offset;
|
||||
w->widgets[WIDX_GROUPBOX_PROPERTIES].top = w->height - PageGroupBoxSettings[w->page - 1].properties_top_offset;
|
||||
w->widgets[WIDX_GROUPBOX_PROPERTIES].bottom = w->height - PageGroupBoxSettings[w->page - 1].properties_bottom_offset;
|
||||
w->widgets[WIDX_LIST].bottom = w->widgets[WIDX_GROUPBOX_DETAILS].top - GROUPBOX_PADDING;
|
||||
}
|
||||
|
||||
@@ -1550,7 +1547,7 @@ static void window_tile_inspector_invalidate(rct_window *w)
|
||||
w->widgets[WIDX_FENCE_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4;
|
||||
w->widgets[WIDX_FENCE_DROPDOWN_SLOPE].top = GBBT(propertiesAnchor, 1) + 3;
|
||||
w->widgets[WIDX_FENCE_DROPDOWN_SLOPE].bottom = GBBB(propertiesAnchor, 1) - 3;
|
||||
w->widgets[WIDX_FENCE_DROPDOWN_SLOPE].text = fenceSlopeStringIds[(mapElement->type & 0xC0) >> 6];
|
||||
w->widgets[WIDX_FENCE_DROPDOWN_SLOPE].text = FenceSlopeStringIds[(mapElement->type & 0xC0) >> 6];
|
||||
w->widgets[WIDX_FENCE_DROPDOWN_SLOPE_BUTTON].top = GBBT(propertiesAnchor, 1) + 4;
|
||||
w->widgets[WIDX_FENCE_DROPDOWN_SLOPE_BUTTON].bottom = GBBB(propertiesAnchor, 1) - 4;
|
||||
break;
|
||||
@@ -1639,13 +1636,13 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
case TILE_INSPECTOR_PAGE_SURFACE: {
|
||||
// Details
|
||||
// Terrain texture name
|
||||
rct_string_id terrainNameId = terrainTypeStringIds[map_element_get_terrain(mapElement)];
|
||||
rct_string_id terrainNameId = TerrainTypeStringIds[map_element_get_terrain(mapElement)];
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SURFACE_TERAIN, &terrainNameId, COLOUR_DARK_GREEN, x, y);
|
||||
|
||||
// Edge texture name
|
||||
sint32 idx = map_element_get_terrain_edge(mapElement);
|
||||
openrct2_assert(idx < countof(terrainEdgeTypeStringIds), "Tried accessing invalid entry %d in terrainEdgeTypeStringIds", idx);
|
||||
rct_string_id terrainEdgeNameId = terrainEdgeTypeStringIds[map_element_get_terrain_edge(mapElement)];
|
||||
openrct2_assert(idx < countof(TerrainEdgeTypeStringIds), "Tried accessing invalid entry %d in terrainEdgeTypeStringIds", idx);
|
||||
rct_string_id terrainEdgeNameId = TerrainEdgeTypeStringIds[map_element_get_terrain_edge(mapElement)];
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SURFACE_EDGE, &terrainEdgeNameId, COLOUR_DARK_GREEN, x, y + 11);
|
||||
|
||||
// Land ownership
|
||||
@@ -1787,7 +1784,7 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
case TILE_INSPECTOR_PAGE_ENTRANCE: {
|
||||
// Details
|
||||
// Entrance type
|
||||
rct_string_id entranceType = entranceTypeStringIds[mapElement->properties.entrance.type];
|
||||
rct_string_id entranceType = EntranceTypeStringIds[mapElement->properties.entrance.type];
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRANCE_TYPE, &entranceType, COLOUR_DARK_GREEN, x, y);
|
||||
|
||||
if (mapElement->properties.entrance.type == ENTRANCE_TYPE_PARK_ENTRANCE) {
|
||||
@@ -1812,7 +1809,7 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
|
||||
if (mapElement->properties.entrance.type == ENTRANCE_TYPE_PARK_ENTRANCE) {
|
||||
// Entrance part
|
||||
rct_string_id entrancePart = parkEntrancePartStringIds[mapElement->properties.entrance.index & 0x0F];
|
||||
rct_string_id entrancePart = ParkEntrancePartStringIds[mapElement->properties.entrance.index & 0x0F];
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRANCE_PART, &entrancePart, COLOUR_DARK_GREEN, x, y + 22);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -57,10 +57,10 @@ static void map_swap_elements_at(sint32 x, sint32 y, sint16 first, sint16 second
|
||||
/**
|
||||
* Inserts a corrupt element under a given element on a given tile
|
||||
* @param x, y: The coordinates of the tile
|
||||
* @param element_index: The nth element on this tile
|
||||
* @param elementIndex: The nth element on this tile
|
||||
* Returns 0 on success, MONEY_UNDEFINED otherwise.
|
||||
*/
|
||||
sint32 tile_inspector_insert_corrupt_at(sint32 x, sint32 y, sint16 element_index, sint32 flags)
|
||||
sint32 tile_inspector_insert_corrupt_at(sint32 x, sint32 y, sint16 elementIndex, sint32 flags)
|
||||
{
|
||||
// Make sure there is enough space for the new element
|
||||
if (!map_check_free_elements_and_reorganise(1))
|
||||
@@ -80,12 +80,12 @@ sint32 tile_inspector_insert_corrupt_at(sint32 x, sint32 y, sint16 element_index
|
||||
curruptElement->type = MAP_ELEMENT_TYPE_CORRUPT;
|
||||
|
||||
// Set the base height to be the same as the selected element
|
||||
rct_map_element *const selectedElement = map_get_first_element_at(x, y) + element_index;
|
||||
rct_map_element *const selectedElement = map_get_first_element_at(x, y) + elementIndex;
|
||||
curruptElement->base_height = curruptElement->clearance_height = selectedElement->base_height;
|
||||
|
||||
// Move the corrupt element up until the selected list item is reached
|
||||
// this way it's placed under the selected element, even when there are multiple elements with the same base height
|
||||
for (sint16 i = 0; i < element_index; i++)
|
||||
for (sint16 i = 0; i < elementIndex; i++)
|
||||
{
|
||||
map_swap_elements_at(x, y, i, i + 1);
|
||||
}
|
||||
@@ -93,24 +93,24 @@ sint32 tile_inspector_insert_corrupt_at(sint32 x, sint32 y, sint16 element_index
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
|
||||
// Update the tile inspector's list for everyone who has the tile selected
|
||||
rct_window *const tile_inspector_window = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tile_inspector_window != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
rct_window *const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tileInspectorWindow != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
{
|
||||
windowTileInspectorElementCount++;
|
||||
|
||||
// Keep other elements (that are not being hidden) selected
|
||||
if (tile_inspector_window->selected_list_item > element_index)
|
||||
if (tileInspectorWindow->selected_list_item > elementIndex)
|
||||
{
|
||||
tile_inspector_window->selected_list_item++;
|
||||
tileInspectorWindow->selected_list_item++;
|
||||
}
|
||||
|
||||
if (tile_inspector_window->selected_list_item == element_index)
|
||||
if (tileInspectorWindow->selected_list_item == elementIndex)
|
||||
{
|
||||
window_tile_inspector_set_page(tile_inspector_window, TILE_INSPECTOR_PAGE_CORRUPT);
|
||||
window_tile_inspector_set_page(tileInspectorWindow, TILE_INSPECTOR_PAGE_CORRUPT);
|
||||
}
|
||||
|
||||
window_tile_inspector_auto_set_buttons(tile_inspector_window);
|
||||
window_invalidate(tile_inspector_window);
|
||||
window_tile_inspector_auto_set_buttons(tileInspectorWindow);
|
||||
window_invalidate(tileInspectorWindow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,35 +121,35 @@ sint32 tile_inspector_insert_corrupt_at(sint32 x, sint32 y, sint16 element_index
|
||||
/**
|
||||
* Forcefully removes an element for a given tile
|
||||
* @param x, y: The coordinates of the tile
|
||||
* @param element_index: The nth element on this tile
|
||||
* @param elementIndex: The nth element on this tile
|
||||
*/
|
||||
sint32 tile_inspector_remove_element_at(sint32 x, sint32 y, sint16 element_index, sint32 flags)
|
||||
sint32 tile_inspector_remove_element_at(sint32 x, sint32 y, sint16 elementIndex, sint32 flags)
|
||||
{
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
// Forcefully remove the element
|
||||
rct_map_element *const mapElement = map_get_first_element_at(x, y) + element_index;
|
||||
rct_map_element *const mapElement = map_get_first_element_at(x, y) + elementIndex;
|
||||
map_element_remove(mapElement);
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
|
||||
// Update the window
|
||||
rct_window *const tile_inspector_window = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tile_inspector_window != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
rct_window *const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tileInspectorWindow != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
{
|
||||
windowTileInspectorElementCount--;
|
||||
|
||||
if (tile_inspector_window->selected_list_item > element_index)
|
||||
if (tileInspectorWindow->selected_list_item > elementIndex)
|
||||
{
|
||||
tile_inspector_window->selected_list_item--;
|
||||
tileInspectorWindow->selected_list_item--;
|
||||
}
|
||||
else if (tile_inspector_window->selected_list_item == element_index)
|
||||
else if (tileInspectorWindow->selected_list_item == elementIndex)
|
||||
{
|
||||
tile_inspector_window->selected_list_item = -1;
|
||||
window_tile_inspector_set_page(tile_inspector_window, TILE_INSPECTOR_PAGE_DEFAULT);
|
||||
tileInspectorWindow->selected_list_item = -1;
|
||||
window_tile_inspector_set_page(tileInspectorWindow, TILE_INSPECTOR_PAGE_DEFAULT);
|
||||
}
|
||||
|
||||
window_tile_inspector_auto_set_buttons(tile_inspector_window);
|
||||
window_invalidate(tile_inspector_window);
|
||||
window_tile_inspector_auto_set_buttons(tileInspectorWindow);
|
||||
window_invalidate(tileInspectorWindow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,30 +164,30 @@ sint32 tile_inspector_swap_elements_at(sint32 x, sint32 y, sint16 first, sint16
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
|
||||
// Update the window
|
||||
rct_window *const tile_inspector_window = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tile_inspector_window != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
rct_window *const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tileInspectorWindow != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
{
|
||||
// If one of them was selected, update selected list item
|
||||
if (tile_inspector_window->selected_list_item == first)
|
||||
tile_inspector_window->selected_list_item = second;
|
||||
else if (tile_inspector_window->selected_list_item == second)
|
||||
tile_inspector_window->selected_list_item = first;
|
||||
if (tileInspectorWindow->selected_list_item == first)
|
||||
tileInspectorWindow->selected_list_item = second;
|
||||
else if (tileInspectorWindow->selected_list_item == second)
|
||||
tileInspectorWindow->selected_list_item = first;
|
||||
|
||||
window_tile_inspector_auto_set_buttons(tile_inspector_window);
|
||||
window_invalidate(tile_inspector_window);
|
||||
window_tile_inspector_auto_set_buttons(tileInspectorWindow);
|
||||
window_invalidate(tileInspectorWindow);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sint32 tile_inspector_rotate_element_at(sint32 x, sint32 y, sint32 element_index, sint32 flags)
|
||||
sint32 tile_inspector_rotate_element_at(sint32 x, sint32 y, sint32 elementIndex, sint32 flags)
|
||||
{
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
uint8 newRotation, pathEdges, pathCorners;
|
||||
|
||||
rct_map_element *const mapElement = map_get_first_element_at(x, y) + element_index;
|
||||
rct_map_element *const mapElement = map_get_first_element_at(x, y) + elementIndex;
|
||||
switch (map_element_get_type(mapElement))
|
||||
{
|
||||
case MAP_ELEMENT_TYPE_PATH:
|
||||
@@ -252,20 +252,20 @@ sint32 tile_inspector_paste_element_at(sint32 x, sint32 y, rct_map_element eleme
|
||||
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
|
||||
rct_window *const tile_inspector_window = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tile_inspector_window != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
rct_window *const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tileInspectorWindow != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
{
|
||||
windowTileInspectorElementCount++;
|
||||
|
||||
// Select new element if there was none selected already
|
||||
sint16 new_index = (sint16)(pastedElement - map_get_first_element_at(x, y));
|
||||
if (tile_inspector_window->selected_list_item == -1)
|
||||
tile_inspector_window->selected_list_item = new_index;
|
||||
else if (tile_inspector_window->selected_list_item >= new_index)
|
||||
tile_inspector_window->selected_list_item++;
|
||||
sint16 newIndex = (sint16)(pastedElement - map_get_first_element_at(x, y));
|
||||
if (tileInspectorWindow->selected_list_item == -1)
|
||||
tileInspectorWindow->selected_list_item = newIndex;
|
||||
else if (tileInspectorWindow->selected_list_item >= newIndex)
|
||||
tileInspectorWindow->selected_list_item++;
|
||||
|
||||
window_tile_inspector_auto_set_buttons(tile_inspector_window);
|
||||
window_invalidate(tile_inspector_window);
|
||||
window_tile_inspector_auto_set_buttons(tileInspectorWindow);
|
||||
window_invalidate(tileInspectorWindow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,21 +276,21 @@ sint32 tile_inspector_sort_elements_at(sint32 x, sint32 y, sint32 flags)
|
||||
{
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
const rct_map_element *const first_element = map_get_first_element_at(x, y);
|
||||
const rct_map_element *const firstElement = map_get_first_element_at(x, y);
|
||||
|
||||
// Count elements on tile
|
||||
sint32 num_element = 0;
|
||||
const rct_map_element *element_iterator = first_element;
|
||||
sint32 numElement = 0;
|
||||
const rct_map_element *elementIterator = firstElement;
|
||||
do
|
||||
{
|
||||
num_element++;
|
||||
} while (!map_element_is_last_for_tile(element_iterator++));
|
||||
numElement++;
|
||||
} while (!map_element_is_last_for_tile(elementIterator++));
|
||||
|
||||
// Bubble sort
|
||||
for (sint32 loopStart = 1; loopStart < num_element; loopStart++)
|
||||
for (sint32 loopStart = 1; loopStart < numElement; loopStart++)
|
||||
{
|
||||
sint32 currentId = loopStart;
|
||||
const rct_map_element *currentElement = first_element + currentId;
|
||||
const rct_map_element *currentElement = firstElement + currentId;
|
||||
const rct_map_element *otherElement = currentElement - 1;
|
||||
|
||||
// While current element's base height is lower, or (when their baseheight is the same) the other map element's clearance height is lower...
|
||||
@@ -308,123 +308,123 @@ sint32 tile_inspector_sort_elements_at(sint32 x, sint32 y, sint32 flags)
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
|
||||
// Deselect tile for clients who had it selected
|
||||
rct_window *const tile_inspector_window = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tile_inspector_window != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
rct_window *const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tileInspectorWindow != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
{
|
||||
window_tile_inspector_set_page(tile_inspector_window, TILE_INSPECTOR_PAGE_DEFAULT);
|
||||
tile_inspector_window->selected_list_item = -1;
|
||||
window_tile_inspector_auto_set_buttons(tile_inspector_window);
|
||||
window_invalidate(tile_inspector_window);
|
||||
window_tile_inspector_set_page(tileInspectorWindow, TILE_INSPECTOR_PAGE_DEFAULT);
|
||||
tileInspectorWindow->selected_list_item = -1;
|
||||
window_tile_inspector_auto_set_buttons(tileInspectorWindow);
|
||||
window_invalidate(tileInspectorWindow);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sint32 tile_inspector_any_base_height_offset(sint32 x, sint32 y, sint16 element_index, sint8 height_offset, sint32 flags)
|
||||
sint32 tile_inspector_any_base_height_offset(sint32 x, sint32 y, sint16 elementIndex, sint8 heightOffset, sint32 flags)
|
||||
{
|
||||
rct_map_element *const map_element = map_get_first_element_at(x, y) + element_index;
|
||||
sint16 new_base_height = (sint16)map_element->base_height + height_offset;
|
||||
sint16 new_clearance_height = (sint16)map_element->clearance_height + height_offset;
|
||||
if (new_base_height < 0 || new_base_height > 0xff || new_clearance_height < 0 || new_clearance_height > 0xff)
|
||||
rct_map_element *const mapElement = map_get_first_element_at(x, y) + elementIndex;
|
||||
sint16 newBaseHeight = (sint16)mapElement->base_height + heightOffset;
|
||||
sint16 newClearanceHeight = (sint16)mapElement->clearance_height + heightOffset;
|
||||
if (newBaseHeight < 0 || newBaseHeight > 0xff || newClearanceHeight < 0 || newClearanceHeight > 0xff)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
map_element->base_height += height_offset;
|
||||
map_element->clearance_height += height_offset;
|
||||
mapElement->base_height += heightOffset;
|
||||
mapElement->clearance_height += heightOffset;
|
||||
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
|
||||
rct_window *const tile_inspector_window = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tile_inspector_window != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
rct_window *const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tileInspectorWindow != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
{
|
||||
window_invalidate(tile_inspector_window);
|
||||
window_invalidate(tileInspectorWindow);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sint32 tile_inspector_surface_show_park_fences(sint32 x, sint32 y, bool show_fences, sint32 flags)
|
||||
sint32 tile_inspector_surface_show_park_fences(sint32 x, sint32 y, bool showFences, sint32 flags)
|
||||
{
|
||||
rct_map_element *const surface = map_get_surface_element_at(x, y);
|
||||
rct_map_element *const surfaceelement = map_get_surface_element_at(x, y);
|
||||
|
||||
// No surface element on tile
|
||||
if (surface == NULL)
|
||||
if (surfaceelement == NULL)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
if (!show_fences)
|
||||
surface->properties.surface.ownership &= ~0x0F;
|
||||
if (!showFences)
|
||||
surfaceelement->properties.surface.ownership &= ~0x0F;
|
||||
else
|
||||
update_park_fences(x << 5, y << 5);
|
||||
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
|
||||
rct_window *const tile_inspector_window = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tile_inspector_window != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
rct_window *const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tileInspectorWindow != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
{
|
||||
window_invalidate(tile_inspector_window);
|
||||
window_invalidate(tileInspectorWindow);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sint32 tile_inspector_surface_toggle_corner(sint32 x, sint32 y, sint32 corner_index, sint32 flags)
|
||||
sint32 tile_inspector_surface_toggle_corner(sint32 x, sint32 y, sint32 cornerIndex, sint32 flags)
|
||||
{
|
||||
rct_map_element *const surface = map_get_surface_element_at(x, y);
|
||||
rct_map_element *const surfaceElement = map_get_surface_element_at(x, y);
|
||||
|
||||
// No surface element on tile
|
||||
if (surface == NULL)
|
||||
if (surfaceElement == NULL)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
const uint8 originalSlope = surface->properties.surface.slope;
|
||||
const uint8 originalSlope = surfaceElement->properties.surface.slope;
|
||||
const bool diagonal = (originalSlope & 0x10) >> 4;
|
||||
|
||||
surface->properties.surface.slope ^= 1 << corner_index;
|
||||
if (surface->properties.surface.slope & 0x0F)
|
||||
surfaceElement->properties.surface.slope ^= 1 << cornerIndex;
|
||||
if (surfaceElement->properties.surface.slope & 0x0F)
|
||||
{
|
||||
surface->clearance_height = surface->base_height + 2;
|
||||
surfaceElement->clearance_height = surfaceElement->base_height + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
surface->clearance_height = surface->base_height;
|
||||
surfaceElement->clearance_height = surfaceElement->base_height;
|
||||
}
|
||||
|
||||
// All corners are raised
|
||||
if ((surface->properties.surface.slope & 0x0F) == 0x0F)
|
||||
if ((surfaceElement->properties.surface.slope & 0x0F) == 0x0F)
|
||||
{
|
||||
surface->properties.surface.slope &= ~0x1F;
|
||||
surfaceElement->properties.surface.slope &= ~0x1F;
|
||||
|
||||
if (diagonal)
|
||||
{
|
||||
switch (originalSlope & 0x0F)
|
||||
{
|
||||
case 0b1011: surface->properties.surface.slope |= (1 << 0); break;
|
||||
case 0b0111: surface->properties.surface.slope |= (1 << 1); break;
|
||||
case 0b1110: surface->properties.surface.slope |= (1 << 2); break;
|
||||
case 0b1101: surface->properties.surface.slope |= (1 << 3); break;
|
||||
case 0b1011: surfaceElement->properties.surface.slope |= (1 << 0); break;
|
||||
case 0b0111: surfaceElement->properties.surface.slope |= (1 << 1); break;
|
||||
case 0b1110: surfaceElement->properties.surface.slope |= (1 << 2); break;
|
||||
case 0b1101: surfaceElement->properties.surface.slope |= (1 << 3); break;
|
||||
}
|
||||
}
|
||||
|
||||
// Update base and clearance heights
|
||||
surface->base_height += 2;
|
||||
surface->clearance_height = surface->base_height + (diagonal ? 2 : 0);
|
||||
surfaceElement->base_height += 2;
|
||||
surfaceElement->clearance_height = surfaceElement->base_height + (diagonal ? 2 : 0);
|
||||
}
|
||||
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
|
||||
rct_window *const tile_inspector_window = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tile_inspector_window != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
rct_window *const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tileInspectorWindow != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
{
|
||||
window_invalidate(tile_inspector_window);
|
||||
window_invalidate(tileInspectorWindow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,94 +433,94 @@ sint32 tile_inspector_surface_toggle_corner(sint32 x, sint32 y, sint32 corner_in
|
||||
|
||||
sint32 tile_inspector_surface_toggle_diagonal(sint32 x, sint32 y, sint32 flags)
|
||||
{
|
||||
rct_map_element *const surface = map_get_surface_element_at(x, y);
|
||||
rct_map_element *const surfaceElement = map_get_surface_element_at(x, y);
|
||||
|
||||
// No surface element on tile
|
||||
if (surface == NULL)
|
||||
if (surfaceElement == NULL)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
surface->properties.surface.slope ^= 0x10;
|
||||
if (surface->properties.surface.slope & 0x10)
|
||||
surfaceElement->properties.surface.slope ^= 0x10;
|
||||
if (surfaceElement->properties.surface.slope & 0x10)
|
||||
{
|
||||
surface->clearance_height = surface->base_height + 4;
|
||||
surfaceElement->clearance_height = surfaceElement->base_height + 4;
|
||||
}
|
||||
else if (surface->properties.surface.slope & 0x0F)
|
||||
else if (surfaceElement->properties.surface.slope & 0x0F)
|
||||
{
|
||||
surface->clearance_height = surface->base_height + 2;
|
||||
surfaceElement->clearance_height = surfaceElement->base_height + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
surface->clearance_height = surface->base_height;
|
||||
surfaceElement->clearance_height = surfaceElement->base_height;
|
||||
}
|
||||
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
|
||||
rct_window *const tile_inspector_window = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tile_inspector_window != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
rct_window *const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tileInspectorWindow != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
{
|
||||
window_invalidate(tile_inspector_window);
|
||||
window_invalidate(tileInspectorWindow);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sint32 tile_inspector_path_set_sloped(sint32 x, sint32 y, sint32 element_index, bool sloped, sint32 flags)
|
||||
sint32 tile_inspector_path_set_sloped(sint32 x, sint32 y, sint32 elementIndex, bool sloped, sint32 flags)
|
||||
{
|
||||
rct_map_element *const path_element = map_get_first_element_at(x, y) + element_index;
|
||||
rct_map_element *const pathElement = map_get_first_element_at(x, y) + elementIndex;
|
||||
|
||||
if (!path_element || map_element_get_type(path_element) != MAP_ELEMENT_TYPE_PATH)
|
||||
if (!pathElement || map_element_get_type(pathElement) != MAP_ELEMENT_TYPE_PATH)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
path_element->properties.path.type &= ~(1 << 2);
|
||||
pathElement->properties.path.type &= ~(1 << 2);
|
||||
if (sloped)
|
||||
{
|
||||
path_element->properties.path.type |= (1 << 2);
|
||||
pathElement->properties.path.type |= (1 << 2);
|
||||
}
|
||||
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
|
||||
rct_window *const tile_inspector_window = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tile_inspector_window != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
rct_window *const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tileInspectorWindow != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
{
|
||||
window_invalidate(tile_inspector_window);
|
||||
window_invalidate(tileInspectorWindow);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sint32 tile_inspector_path_toggle_edge(sint32 x, sint32 y, sint32 element_index, sint32 edge_index, sint32 flags)
|
||||
sint32 tile_inspector_path_toggle_edge(sint32 x, sint32 y, sint32 elementIndex, sint32 edgeIndex, sint32 flags)
|
||||
{
|
||||
rct_map_element *const path_element = map_get_first_element_at(x, y) + element_index;
|
||||
rct_map_element *const pathElement = map_get_first_element_at(x, y) + elementIndex;
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
path_element->properties.path.edges ^= 1 << edge_index;
|
||||
pathElement->properties.path.edges ^= 1 << edgeIndex;
|
||||
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
|
||||
rct_window *const tile_inspector_window = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tile_inspector_window != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
rct_window *const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tileInspectorWindow != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
{
|
||||
window_invalidate(tile_inspector_window);
|
||||
window_invalidate(tileInspectorWindow);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sint32 tile_inspector_fence_set_slope(sint32 x, sint32 y, sint32 element_index, sint32 slope_value, sint32 flags)
|
||||
sint32 tile_inspector_fence_set_slope(sint32 x, sint32 y, sint32 elementIndex, sint32 slopeValue, sint32 flags)
|
||||
{
|
||||
rct_map_element *const fence_element = map_get_first_element_at(x, y) + element_index;
|
||||
rct_map_element *const fenceElement = map_get_first_element_at(x, y) + elementIndex;
|
||||
|
||||
if (!fence_element || map_element_get_type(fence_element) != MAP_ELEMENT_TYPE_FENCE)
|
||||
if (!fenceElement || map_element_get_type(fenceElement) != MAP_ELEMENT_TYPE_FENCE)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
@@ -528,15 +528,15 @@ sint32 tile_inspector_fence_set_slope(sint32 x, sint32 y, sint32 element_index,
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
// Set new slope value
|
||||
fence_element->type &= ~0xC0;
|
||||
fence_element->type |= slope_value;
|
||||
fenceElement->type &= ~0xC0;
|
||||
fenceElement->type |= slopeValue;
|
||||
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
|
||||
rct_window *const tile_inspector_window = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tile_inspector_window != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
rct_window *const tileInspectorWindow = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (tileInspectorWindow != NULL && (uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
{
|
||||
window_invalidate(tile_inspector_window);
|
||||
window_invalidate(tileInspectorWindow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,33 +545,33 @@ sint32 tile_inspector_fence_set_slope(sint32 x, sint32 y, sint32 element_index,
|
||||
|
||||
// Changes the height of all track elements that belong to the same track piece
|
||||
// Broxzier: Copied from track_remove and stripped of unneeded code, but I think this should be smaller
|
||||
sint32 tile_inspector_track_base_height_offset(sint32 x, sint32 y, sint32 element_index, sint8 offset, sint32 flags)
|
||||
sint32 tile_inspector_track_base_height_offset(sint32 x, sint32 y, sint32 elementIndex, sint8 offset, sint32 flags)
|
||||
{
|
||||
rct_map_element *const track_element = map_get_first_element_at(x, y) + element_index;
|
||||
rct_map_element *const trackElement = map_get_first_element_at(x, y) + elementIndex;
|
||||
|
||||
if (offset == 0)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (!track_element || map_element_get_type(track_element) != MAP_ELEMENT_TYPE_TRACK)
|
||||
if (!trackElement || map_element_get_type(trackElement) != MAP_ELEMENT_TYPE_TRACK)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
uint8 type = track_element->properties.track.type;
|
||||
uint8 type = trackElement->properties.track.type;
|
||||
sint16 originX = x << 5;
|
||||
sint16 originY = y << 5;
|
||||
sint16 originZ = track_element->base_height * 8;
|
||||
uint8 rotation = map_element_get_direction(track_element);
|
||||
uint8 rideIndex = track_element->properties.track.ride_index;
|
||||
sint16 originZ = trackElement->base_height * 8;
|
||||
uint8 rotation = map_element_get_direction(trackElement);
|
||||
uint8 rideIndex = trackElement->properties.track.ride_index;
|
||||
rct_ride* ride = get_ride(rideIndex);
|
||||
const rct_preview_track* trackBlock = get_track_def_from_ride(ride, type);
|
||||
trackBlock += track_element->properties.track.sequence & 0x0F;
|
||||
trackBlock += trackElement->properties.track.sequence & 0x0F;
|
||||
|
||||
uint8 originDirection = map_element_get_direction(track_element);
|
||||
uint8 originDirection = map_element_get_direction(trackElement);
|
||||
switch (originDirection)
|
||||
{
|
||||
case 0:
|
||||
@@ -597,54 +597,54 @@ sint32 tile_inspector_track_base_height_offset(sint32 x, sint32 y, sint32 elemen
|
||||
trackBlock = get_track_def_from_ride(ride, type);
|
||||
for (; trackBlock->index != 255; trackBlock++)
|
||||
{
|
||||
sint16 elem_x = originX, elem_y = originY, elem_z = originZ;
|
||||
sint16 elemX = originX, elemY = originY, elemZ = originZ;
|
||||
|
||||
switch (originDirection)
|
||||
{
|
||||
case 0:
|
||||
elem_x += trackBlock->x;
|
||||
elem_y += trackBlock->y;
|
||||
elemX += trackBlock->x;
|
||||
elemY += trackBlock->y;
|
||||
break;
|
||||
case 1:
|
||||
elem_x += trackBlock->y;
|
||||
elem_y -= trackBlock->x;
|
||||
elemX += trackBlock->y;
|
||||
elemY -= trackBlock->x;
|
||||
break;
|
||||
case 2:
|
||||
elem_x -= trackBlock->x;
|
||||
elem_y -= trackBlock->y;
|
||||
elemX -= trackBlock->x;
|
||||
elemY -= trackBlock->y;
|
||||
break;
|
||||
case 3:
|
||||
elem_x -= trackBlock->y;
|
||||
elem_y += trackBlock->x;
|
||||
elemX -= trackBlock->y;
|
||||
elemY += trackBlock->x;
|
||||
break;
|
||||
}
|
||||
|
||||
elem_z += trackBlock->z;
|
||||
elemZ += trackBlock->z;
|
||||
|
||||
map_invalidate_tile_full(elem_x, elem_y);
|
||||
map_invalidate_tile_full(elemX, elemY);
|
||||
|
||||
bool found = false;
|
||||
rct_map_element *map_element = map_get_first_element_at(elem_x >> 5, elem_y >> 5);
|
||||
rct_map_element *mapElement = map_get_first_element_at(elemX >> 5, elemY >> 5);
|
||||
do
|
||||
{
|
||||
if (map_element->base_height != elem_z / 8)
|
||||
if (mapElement->base_height != elemZ / 8)
|
||||
continue;
|
||||
|
||||
if (map_element_get_type(map_element) != MAP_ELEMENT_TYPE_TRACK)
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_TRACK)
|
||||
continue;
|
||||
|
||||
if ((map_element->type & MAP_ELEMENT_DIRECTION_MASK) != rotation)
|
||||
if ((mapElement->type & MAP_ELEMENT_DIRECTION_MASK) != rotation)
|
||||
continue;
|
||||
|
||||
if ((map_element->properties.track.sequence & 0x0F) != trackBlock->index)
|
||||
if ((mapElement->properties.track.sequence & 0x0F) != trackBlock->index)
|
||||
continue;
|
||||
|
||||
if (map_element->properties.track.type != type)
|
||||
if (mapElement->properties.track.type != type)
|
||||
continue;
|
||||
|
||||
found = true;
|
||||
break;
|
||||
} while (!map_element_is_last_for_tile(map_element++));
|
||||
} while (!map_element_is_last_for_tile(mapElement++));
|
||||
|
||||
if (!found)
|
||||
{
|
||||
@@ -653,13 +653,13 @@ sint32 tile_inspector_track_base_height_offset(sint32 x, sint32 y, sint32 elemen
|
||||
}
|
||||
|
||||
// track_remove returns here on failure, not sure when this would ever be hit. Only thing I can think of is for when you decrease the map size.
|
||||
openrct2_assert(map_get_surface_element_at(elem_x >> 5, elem_y >> 5) != NULL, "No surface at %d,%d", elem_x >> 5, elem_y >> 5);
|
||||
openrct2_assert(map_get_surface_element_at(elemX >> 5, elemY >> 5) != NULL, "No surface at %d,%d", elemX >> 5, elemY >> 5);
|
||||
|
||||
// Keep?
|
||||
//invalidate_test_results(ride_index);
|
||||
//invalidate_test_results(rideIndex);
|
||||
|
||||
map_element->base_height += offset;
|
||||
map_element->clearance_height += offset;
|
||||
mapElement->base_height += offset;
|
||||
mapElement->clearance_height += offset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -671,39 +671,39 @@ sint32 tile_inspector_track_base_height_offset(sint32 x, sint32 y, sint32 elemen
|
||||
|
||||
// Sets chainlift, optionally for an entire track block
|
||||
// Broxzier: Basically a copy of the above function, with just two different lines... should probably be combined somehow
|
||||
sint32 tile_inspector_track_set_chain(sint32 x, sint32 y, sint32 element_index, bool entire_track_block, bool set_chain, sint32 flags)
|
||||
sint32 tile_inspector_track_set_chain(sint32 x, sint32 y, sint32 elementIndex, bool entireTrackBlock, bool setChain, sint32 flags)
|
||||
{
|
||||
rct_map_element *const track_element = map_get_first_element_at(x, y) + element_index;
|
||||
rct_map_element *const trackElement = map_get_first_element_at(x, y) + elementIndex;
|
||||
|
||||
if (!track_element || map_element_get_type(track_element) != MAP_ELEMENT_TYPE_TRACK)
|
||||
if (!trackElement || map_element_get_type(trackElement) != MAP_ELEMENT_TYPE_TRACK)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
if (!entire_track_block)
|
||||
if (!entireTrackBlock)
|
||||
{
|
||||
// Set chain for only the selected piece
|
||||
if (track_element_is_lift_hill(track_element) != set_chain)
|
||||
if (track_element_is_lift_hill(trackElement) != setChain)
|
||||
{
|
||||
track_element->type ^= TRACK_ELEMENT_FLAG_CHAIN_LIFT;
|
||||
trackElement->type ^= TRACK_ELEMENT_FLAG_CHAIN_LIFT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8 type = track_element->properties.track.type;
|
||||
uint8 type = trackElement->properties.track.type;
|
||||
sint16 originX = x << 5;
|
||||
sint16 originY = y << 5;
|
||||
sint16 originZ = track_element->base_height * 8;
|
||||
uint8 rotation = map_element_get_direction(track_element);
|
||||
uint8 rideIndex = track_element->properties.track.ride_index;
|
||||
sint16 originZ = trackElement->base_height * 8;
|
||||
uint8 rotation = map_element_get_direction(trackElement);
|
||||
uint8 rideIndex = trackElement->properties.track.ride_index;
|
||||
rct_ride* ride = get_ride(rideIndex);
|
||||
const rct_preview_track* trackBlock = get_track_def_from_ride(ride, type);
|
||||
trackBlock += track_element->properties.track.sequence & 0x0F;
|
||||
trackBlock += trackElement->properties.track.sequence & 0x0F;
|
||||
|
||||
uint8 originDirection = map_element_get_direction(track_element);
|
||||
uint8 originDirection = map_element_get_direction(trackElement);
|
||||
switch (originDirection)
|
||||
{
|
||||
case 0:
|
||||
@@ -729,54 +729,54 @@ sint32 tile_inspector_track_set_chain(sint32 x, sint32 y, sint32 element_index,
|
||||
trackBlock = get_track_def_from_ride(ride, type);
|
||||
for (; trackBlock->index != 255; trackBlock++)
|
||||
{
|
||||
sint16 elem_x = originX, elem_y = originY, elem_z = originZ;
|
||||
sint16 elemX = originX, elemY = originY, elemZ = originZ;
|
||||
|
||||
switch (originDirection)
|
||||
{
|
||||
case 0:
|
||||
elem_x += trackBlock->x;
|
||||
elem_y += trackBlock->y;
|
||||
elemX += trackBlock->x;
|
||||
elemY += trackBlock->y;
|
||||
break;
|
||||
case 1:
|
||||
elem_x += trackBlock->y;
|
||||
elem_y -= trackBlock->x;
|
||||
elemX += trackBlock->y;
|
||||
elemY -= trackBlock->x;
|
||||
break;
|
||||
case 2:
|
||||
elem_x -= trackBlock->x;
|
||||
elem_y -= trackBlock->y;
|
||||
elemX -= trackBlock->x;
|
||||
elemY -= trackBlock->y;
|
||||
break;
|
||||
case 3:
|
||||
elem_x -= trackBlock->y;
|
||||
elem_y += trackBlock->x;
|
||||
elemX -= trackBlock->y;
|
||||
elemY += trackBlock->x;
|
||||
break;
|
||||
}
|
||||
|
||||
elem_z += trackBlock->z;
|
||||
elemZ += trackBlock->z;
|
||||
|
||||
map_invalidate_tile_full(elem_x, elem_y);
|
||||
map_invalidate_tile_full(elemX, elemY);
|
||||
|
||||
bool found = false;
|
||||
rct_map_element *map_element = map_get_first_element_at(elem_x >> 5, elem_y >> 5);
|
||||
rct_map_element *mapElement = map_get_first_element_at(elemX >> 5, elemY >> 5);
|
||||
do
|
||||
{
|
||||
if (map_element->base_height != elem_z / 8)
|
||||
if (mapElement->base_height != elemZ / 8)
|
||||
continue;
|
||||
|
||||
if (map_element_get_type(map_element) != MAP_ELEMENT_TYPE_TRACK)
|
||||
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_TRACK)
|
||||
continue;
|
||||
|
||||
if ((map_element->type & MAP_ELEMENT_DIRECTION_MASK) != rotation)
|
||||
if ((mapElement->type & MAP_ELEMENT_DIRECTION_MASK) != rotation)
|
||||
continue;
|
||||
|
||||
if ((map_element->properties.track.sequence & 0x0F) != trackBlock->index)
|
||||
if ((mapElement->properties.track.sequence & 0x0F) != trackBlock->index)
|
||||
continue;
|
||||
|
||||
if (map_element->properties.track.type != type)
|
||||
if (mapElement->properties.track.type != type)
|
||||
continue;
|
||||
|
||||
found = true;
|
||||
break;
|
||||
} while (!map_element_is_last_for_tile(map_element++));
|
||||
} while (!map_element_is_last_for_tile(mapElement++));
|
||||
|
||||
if (!found)
|
||||
{
|
||||
@@ -785,14 +785,14 @@ sint32 tile_inspector_track_set_chain(sint32 x, sint32 y, sint32 element_index,
|
||||
}
|
||||
|
||||
// track_remove returns here on failure, not sure when this would ever be hit. Only thing I can think of is for when you decrease the map size.
|
||||
openrct2_assert(map_get_surface_element_at(elem_x >> 5, elem_y >> 5) != NULL, "No surface at %d,%d", elem_x >> 5, elem_y >> 5);
|
||||
openrct2_assert(map_get_surface_element_at(elemX >> 5, elemY >> 5) != NULL, "No surface at %d,%d", elemX >> 5, elemY >> 5);
|
||||
|
||||
// Keep?
|
||||
//invalidate_test_results(ride_index);
|
||||
//invalidate_test_results(rideIndex);
|
||||
|
||||
if (track_element_is_lift_hill(map_element) != set_chain)
|
||||
if (track_element_is_lift_hill(mapElement) != setChain)
|
||||
{
|
||||
map_element->type ^= TRACK_ELEMENT_FLAG_CHAIN_LIFT;
|
||||
mapElement->type ^= TRACK_ELEMENT_FLAG_CHAIN_LIFT;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -803,9 +803,9 @@ sint32 tile_inspector_track_set_chain(sint32 x, sint32 y, sint32 element_index,
|
||||
return 0;
|
||||
}
|
||||
|
||||
sint32 tile_inspector_scenery_set_quarter_location(sint32 x, sint32 y, sint32 element_index, sint32 quarter_index, sint32 flags)
|
||||
sint32 tile_inspector_scenery_set_quarter_location(sint32 x, sint32 y, sint32 elementIndex, sint32 quarterIndex, sint32 flags)
|
||||
{
|
||||
rct_map_element *mapElement = map_get_first_element_at(x, y) + element_index;
|
||||
rct_map_element *mapElement = map_get_first_element_at(x, y) + elementIndex;
|
||||
|
||||
if (!mapElement || map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_SCENERY)
|
||||
{
|
||||
@@ -816,11 +816,11 @@ sint32 tile_inspector_scenery_set_quarter_location(sint32 x, sint32 y, sint32 el
|
||||
{
|
||||
// Set quadrant index
|
||||
mapElement->type &= ~MAP_ELEMENT_QUADRANT_MASK;
|
||||
mapElement->type |= quarter_index << 6;
|
||||
mapElement->type |= quarterIndex << 6;
|
||||
|
||||
// Update collision
|
||||
mapElement->flags &= 0xF0;
|
||||
mapElement->flags |= 1 << ((quarter_index + 2) & 3);
|
||||
mapElement->flags |= 1 << ((quarterIndex + 2) & 3);
|
||||
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
if ((uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
@@ -832,9 +832,9 @@ sint32 tile_inspector_scenery_set_quarter_location(sint32 x, sint32 y, sint32 el
|
||||
return 0;
|
||||
}
|
||||
|
||||
sint32 tile_inspector_scenery_set_quarter_collision(sint32 x, sint32 y, sint32 element_index, sint32 quarter_index, sint32 flags)
|
||||
sint32 tile_inspector_scenery_set_quarter_collision(sint32 x, sint32 y, sint32 elementIndex, sint32 quarterIndex, sint32 flags)
|
||||
{
|
||||
rct_map_element *const mapElement = map_get_first_element_at(x, y) + element_index;
|
||||
rct_map_element *const mapElement = map_get_first_element_at(x, y) + elementIndex;
|
||||
|
||||
if (!mapElement || map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_SCENERY)
|
||||
{
|
||||
@@ -843,7 +843,7 @@ sint32 tile_inspector_scenery_set_quarter_collision(sint32 x, sint32 y, sint32 e
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
mapElement->flags ^= 1 << quarter_index;
|
||||
mapElement->flags ^= 1 << quarterIndex;
|
||||
|
||||
map_invalidate_tile_full(x << 5, y << 5);
|
||||
if ((uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
@@ -855,9 +855,9 @@ sint32 tile_inspector_scenery_set_quarter_collision(sint32 x, sint32 y, sint32 e
|
||||
return 0;
|
||||
}
|
||||
|
||||
sint32 tile_inspector_banner_toggle_blocking_edge(sint32 x, sint32 y, sint32 element_index, sint32 edge_index, sint32 flags)
|
||||
sint32 tile_inspector_banner_toggle_blocking_edge(sint32 x, sint32 y, sint32 elementIndex, sint32 edgeIndex, sint32 flags)
|
||||
{
|
||||
rct_map_element *const bannerElement = map_get_first_element_at(x, y) + element_index;
|
||||
rct_map_element *const bannerElement = map_get_first_element_at(x, y) + elementIndex;
|
||||
|
||||
if (!bannerElement || map_element_get_type(bannerElement) != MAP_ELEMENT_TYPE_BANNER)
|
||||
{
|
||||
@@ -866,7 +866,7 @@ sint32 tile_inspector_banner_toggle_blocking_edge(sint32 x, sint32 y, sint32 ele
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
bannerElement->properties.banner.flags ^= 1 << edge_index;
|
||||
bannerElement->properties.banner.flags ^= 1 << edgeIndex;
|
||||
|
||||
if ((uint32)x == windowTileInspectorTileX && (uint32)y == windowTileInspectorTileY)
|
||||
{
|
||||
@@ -877,9 +877,9 @@ sint32 tile_inspector_banner_toggle_blocking_edge(sint32 x, sint32 y, sint32 ele
|
||||
return 0;
|
||||
}
|
||||
|
||||
sint32 tile_inspector_corrupt_clamp(sint32 x, sint32 y, sint32 element_index, sint32 flags)
|
||||
sint32 tile_inspector_corrupt_clamp(sint32 x, sint32 y, sint32 elementIndex, sint32 flags)
|
||||
{
|
||||
rct_map_element *const corruptElement = map_get_first_element_at(x, y) + element_index;
|
||||
rct_map_element *const corruptElement = map_get_first_element_at(x, y) + elementIndex;
|
||||
|
||||
if (!corruptElement || map_element_get_type(corruptElement) != MAP_ELEMENT_TYPE_CORRUPT)
|
||||
{
|
||||
|
||||
@@ -54,22 +54,22 @@ typedef enum {
|
||||
TILE_INSPECTOR_CORRUPT_CLAMP,
|
||||
} tile_inspector_instruction;
|
||||
|
||||
sint32 tile_inspector_insert_corrupt_at(sint32 x, sint32 y, sint16 element_index, sint32 flags);
|
||||
sint32 tile_inspector_remove_element_at(sint32 x, sint32 y, sint16 element_index, sint32 flags);
|
||||
sint32 tile_inspector_insert_corrupt_at(sint32 x, sint32 y, sint16 elementIndex, sint32 flags);
|
||||
sint32 tile_inspector_remove_element_at(sint32 x, sint32 y, sint16 elementIndex, sint32 flags);
|
||||
sint32 tile_inspector_swap_elements_at(sint32 x, sint32 y, sint16 first, sint16 second, sint32 flags);
|
||||
sint32 tile_inspector_rotate_element_at(sint32 x, sint32 y, sint32 element_index, sint32 flags);
|
||||
sint32 tile_inspector_rotate_element_at(sint32 x, sint32 y, sint32 elementIndex, sint32 flags);
|
||||
sint32 tile_inspector_paste_element_at(sint32 x, sint32 y, rct_map_element element, sint32 flags);
|
||||
sint32 tile_inspector_sort_elements_at(sint32 x, sint32 y, sint32 flags);
|
||||
sint32 tile_inspector_any_base_height_offset(sint32 x, sint32 y, sint16 element_index, sint8 height_offset, sint32 flags);
|
||||
sint32 tile_inspector_any_base_height_offset(sint32 x, sint32 y, sint16 elementIndex, sint8 heightOffset, sint32 flags);
|
||||
sint32 tile_inspector_surface_show_park_fences(sint32 x, sint32 y, bool enabled, sint32 flags);
|
||||
sint32 tile_inspector_surface_toggle_corner(sint32 x, sint32 y, sint32 corner_index, sint32 flags);
|
||||
sint32 tile_inspector_surface_toggle_corner(sint32 x, sint32 y, sint32 cornerIndex, sint32 flags);
|
||||
sint32 tile_inspector_surface_toggle_diagonal(sint32 x, sint32 y, sint32 flags);
|
||||
sint32 tile_inspector_path_set_sloped(sint32 x, sint32 y, sint32 element_index, bool sloped, sint32 flags);
|
||||
sint32 tile_inspector_path_toggle_edge(sint32 x, sint32 y, sint32 element_index, sint32 corner_index, sint32 flags);
|
||||
sint32 tile_inspector_fence_set_slope(sint32 x, sint32 y, sint32 element_index, sint32 slope_value, sint32 flags);
|
||||
sint32 tile_inspector_track_base_height_offset(sint32 x, sint32 y, sint32 element_index, sint8 offset, sint32 flags);
|
||||
sint32 tile_inspector_track_set_chain(sint32 x, sint32 y, sint32 element_index, bool entire_track_block, bool set_chain, sint32 flags);
|
||||
sint32 tile_inspector_scenery_set_quarter_location(sint32 x, sint32 y, sint32 element_index, sint32 quarter_index, sint32 flags);
|
||||
sint32 tile_inspector_scenery_set_quarter_collision(sint32 x, sint32 y, sint32 element_index, sint32 quarter_index, sint32 flags);
|
||||
sint32 tile_inspector_banner_toggle_blocking_edge(sint32 x, sint32 y, sint32 element_index, sint32 edge_index, sint32 flags);
|
||||
sint32 tile_inspector_corrupt_clamp(sint32 x, sint32 y, sint32 element_index, sint32 flags);
|
||||
sint32 tile_inspector_path_set_sloped(sint32 x, sint32 y, sint32 elementIndex, bool sloped, sint32 flags);
|
||||
sint32 tile_inspector_path_toggle_edge(sint32 x, sint32 y, sint32 elementIndex, sint32 cornerIndex, sint32 flags);
|
||||
sint32 tile_inspector_fence_set_slope(sint32 x, sint32 y, sint32 elementIndex, sint32 slopeValue, sint32 flags);
|
||||
sint32 tile_inspector_track_base_height_offset(sint32 x, sint32 y, sint32 elementIndex, sint8 offset, sint32 flags);
|
||||
sint32 tile_inspector_track_set_chain(sint32 x, sint32 y, sint32 elementIndex, bool entireTrackBlock, bool setChain, sint32 flags);
|
||||
sint32 tile_inspector_scenery_set_quarter_location(sint32 x, sint32 y, sint32 elementIndex, sint32 quarterIndex, sint32 flags);
|
||||
sint32 tile_inspector_scenery_set_quarter_collision(sint32 x, sint32 y, sint32 elementIndex, sint32 quarterIndex, sint32 flags);
|
||||
sint32 tile_inspector_banner_toggle_blocking_edge(sint32 x, sint32 y, sint32 elementIndex, sint32 edgeIndex, sint32 flags);
|
||||
sint32 tile_inspector_corrupt_clamp(sint32 x, sint32 y, sint32 elementIndex, sint32 flags);
|
||||
|
||||
Reference in New Issue
Block a user