2016-05-04 19:24:41 +02:00
|
|
|
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
2015-06-01 03:33:56 +02:00
|
|
|
/*****************************************************************************
|
2016-05-04 19:24:41 +02:00
|
|
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
|
|
|
*
|
|
|
|
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
|
|
|
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
|
|
|
*
|
|
|
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* A full copy of the GNU General Public License can be found in licence.txt
|
|
|
|
*****************************************************************************/
|
|
|
|
#pragma endregion
|
2015-06-01 03:33:56 +02:00
|
|
|
|
2016-07-06 19:26:14 +02:00
|
|
|
#include "../input.h"
|
2016-01-30 15:00:41 +01:00
|
|
|
#include "../interface/themes.h"
|
2016-06-05 22:07:11 +02:00
|
|
|
#include "../interface/viewport.h"
|
2015-06-01 03:33:56 +02:00
|
|
|
#include "../interface/widget.h"
|
|
|
|
#include "../interface/window.h"
|
2016-06-05 22:07:11 +02:00
|
|
|
#include "../localisation/localisation.h"
|
|
|
|
#include "../ride/track.h"
|
2016-01-01 19:29:41 +01:00
|
|
|
#include "../sprites.h"
|
2016-06-05 22:07:11 +02:00
|
|
|
#include "../world/footpath.h"
|
|
|
|
#include "../world/map.h"
|
|
|
|
#include "../world/scenery.h"
|
2015-06-01 03:33:56 +02:00
|
|
|
|
2016-07-14 14:07:49 +02:00
|
|
|
static const rct_string_id TerrainTypes[] = {
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_GRASS,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_SAND,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_DIRT,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_ROCK,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_MARTIAN,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_CHECKERBOARD,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_GRASS_CLUMPS,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_ICE,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_GRID_RED,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_GRID_YELLOW,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_GRID_BLUE,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_GRID_GREEN,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_SAND_DARK,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_SAND_LIGHT,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_CHECKERBOARD_INVERTED,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_UNDERGROUND_VIEW,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const rct_string_id TerrainEdgeTypes[] = {
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_EDGE_ROCK,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_EDGE_WOOD_RED,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_EDGE_WOOD_BLACK,
|
|
|
|
STR_TILE_INSPECTOR_TERRAIN_EDGE_ICE,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
static const rct_string_id EntranceTypes[] = {
|
|
|
|
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
|
|
|
enum WINDOW_TILE_INSPECTOR_PAGES {
|
|
|
|
PAGE_DEFAULT,
|
|
|
|
PAGE_SURFACE,
|
|
|
|
PAGE_PATH,
|
|
|
|
PAGE_TRACK,
|
|
|
|
PAGE_SCENERY,
|
|
|
|
PAGE_ENTRANCE,
|
|
|
|
PAGE_FENCE,
|
|
|
|
PAGE_LARGE_SCENERY,
|
|
|
|
PAGE_BANNER,
|
|
|
|
PAGE_CORRUPT
|
|
|
|
};
|
2016-07-14 14:07:49 +02:00
|
|
|
|
2015-06-01 03:33:56 +02:00
|
|
|
enum WINDOW_TILE_INSPECTOR_WIDGET_IDX {
|
|
|
|
WIDX_BACKGROUND,
|
|
|
|
WIDX_TITLE,
|
|
|
|
WIDX_CLOSE,
|
2015-12-28 23:11:36 +01:00
|
|
|
WIDX_LIST,
|
2016-06-05 00:45:13 +02:00
|
|
|
WIDX_SPINNER_X,
|
|
|
|
WIDX_SPINNER_X_INCREASE,
|
|
|
|
WIDX_SPINNER_X_DECREASE,
|
|
|
|
WIDX_SPINNER_Y,
|
|
|
|
WIDX_SPINNER_Y_INCREASE,
|
|
|
|
WIDX_SPINNER_Y_DECREASE,
|
2016-06-11 19:39:51 +02:00
|
|
|
WIDX_BUTTON_CORRUPT,
|
|
|
|
WIDX_BUTTON_REMOVE,
|
|
|
|
WIDX_BUTTON_MOVE_DOWN,
|
|
|
|
WIDX_BUTTON_MOVE_UP,
|
|
|
|
WIDX_BUTTON_ROTATE,
|
|
|
|
WIDX_BUTTON_SORT,
|
2016-01-01 20:06:00 +01:00
|
|
|
WIDX_COLUMN_TYPE,
|
|
|
|
WIDX_COLUMN_BASEHEIGHT,
|
|
|
|
WIDX_COLUMN_CLEARANCEHEIGHT,
|
|
|
|
WIDX_COLUMN_GHOSTFLAG,
|
|
|
|
WIDX_COLUMN_BROKENFLAG,
|
|
|
|
WIDX_COLUMN_LASTFLAG,
|
2016-05-31 20:13:26 +02:00
|
|
|
WIDX_GROUPBOX_DETAILS,
|
|
|
|
WIDX_GROUPBOX_PROPERTIES,
|
2016-05-29 16:12:53 +02:00
|
|
|
|
2016-05-31 20:13:26 +02:00
|
|
|
PAGE_WIDGETS,
|
2016-05-29 16:12:53 +02:00
|
|
|
|
|
|
|
// Surface
|
2016-09-18 15:52:03 +02:00
|
|
|
WIDX_SURFACE_SPINNER_HEIGHT = PAGE_WIDGETS,
|
|
|
|
WIDX_SURFACE_SPINNER_HEIGHT_INCREASE,
|
|
|
|
WIDX_SURFACE_SPINNER_HEIGHT_DECREASE,
|
|
|
|
WIDX_SURFACE_BUTTON_REMOVE_FENCES,
|
2016-05-29 16:12:53 +02:00
|
|
|
WIDX_SURFACE_BUTTON_RESTORE_FENCES,
|
2016-09-18 14:30:34 +02:00
|
|
|
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
|
|
|
|
|
|
|
// Path
|
2016-06-01 22:31:10 +02:00
|
|
|
WIDX_PATH_SPINNER_HEIGHT = PAGE_WIDGETS,
|
|
|
|
WIDX_PATH_SPINNER_HEIGHT_INCREASE,
|
|
|
|
WIDX_PATH_SPINNER_HEIGHT_DECREASE,
|
2016-09-11 23:02:34 +02:00
|
|
|
WIDX_PATH_CHECK_EDGE_NE, // Note: This is NOT named after the world orientation, but after the way
|
2016-06-01 22:31:10 +02:00
|
|
|
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.
|
2016-09-11 23:02:34 +02:00
|
|
|
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
|
|
|
|
2016-05-31 20:13:26 +02:00
|
|
|
// Track
|
2016-06-05 12:50:42 +02:00
|
|
|
WIDX_TRACK_CHECK_APPLY_TO_ALL = PAGE_WIDGETS,
|
2016-06-05 22:07:11 +02:00
|
|
|
WIDX_TRACK_SPINNER_HEIGHT,
|
|
|
|
WIDX_TRACK_SPINNER_HEIGHT_INCREASE,
|
|
|
|
WIDX_TRACK_SPINNER_HEIGHT_DECREASE,
|
|
|
|
WIDX_TRACK_CHECK_CHAIN_LIFT,
|
2016-05-29 16:12:53 +02:00
|
|
|
|
2016-05-31 20:13:26 +02:00
|
|
|
// Scenery
|
2016-09-18 10:29:48 +02:00
|
|
|
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
|
|
|
|
2016-05-31 20:13:26 +02:00
|
|
|
// Entrance
|
2016-05-29 16:12:53 +02:00
|
|
|
|
2016-05-31 20:13:26 +02:00
|
|
|
// Fence
|
2016-09-11 23:02:34 +02:00
|
|
|
WIDX_FENCE_SPINNER_HEIGHT = PAGE_WIDGETS,
|
|
|
|
WIDX_FENCE_SPINNER_HEIGHT_INCREASE,
|
|
|
|
WIDX_FENCE_SPINNER_HEIGHT_DECREASE,
|
2016-05-29 16:12:53 +02:00
|
|
|
|
2016-05-31 20:13:26 +02:00
|
|
|
// Large
|
2016-05-29 16:12:53 +02:00
|
|
|
|
2016-05-31 20:13:26 +02:00
|
|
|
// Banner
|
2016-05-29 16:12:53 +02:00
|
|
|
|
2016-05-31 20:13:26 +02:00
|
|
|
// Corrupt
|
2015-06-01 03:33:56 +02:00
|
|
|
};
|
|
|
|
|
2016-01-01 19:29:41 +01:00
|
|
|
#define WW 400
|
2016-06-05 22:07:11 +02:00
|
|
|
#define WH 280
|
2015-12-28 23:11:36 +01:00
|
|
|
#define MIN_WW WW
|
2016-01-01 19:29:41 +01:00
|
|
|
#define MAX_WW WW
|
2016-06-05 22:07:11 +02:00
|
|
|
#define MIN_WH 240
|
2015-06-01 03:33:56 +02:00
|
|
|
#define MAX_WH 800
|
|
|
|
|
2016-05-30 00:35:50 +02:00
|
|
|
#define BW (WW - 5) // Button's right side
|
|
|
|
#define BX (BW - 23) // Button's left side
|
|
|
|
#define BY 17 // Button's Top
|
|
|
|
#define BH (BY + 23) // Button's Bottom
|
2016-01-01 19:29:41 +01:00
|
|
|
#define BS 24
|
2015-12-28 23:11:36 +01:00
|
|
|
|
2016-05-29 16:12:53 +02:00
|
|
|
#define PADDING_BOTTOM 15
|
|
|
|
#define GROUPBOX_PADDING 6
|
2015-12-28 23:11:36 +01:00
|
|
|
#define LIST_ITEM_HEIGHT 11
|
2015-12-21 00:52:42 +01:00
|
|
|
|
2016-05-30 00:35:50 +02:00
|
|
|
// Column offsets for the table headers
|
|
|
|
#define COL_X_TYPE 3 // Type
|
|
|
|
#define COL_X_BH (COL_X_TYPE + 300) // Base height
|
|
|
|
#define COL_X_CH (COL_X_BH + 20) // Clearance height
|
|
|
|
#define COL_X_GF (COL_X_CH + 20) // Ghost flag
|
|
|
|
#define COL_X_BF (COL_X_GF + 12) // Broken flag
|
|
|
|
#define COL_X_LF (COL_X_BF + 12) // Last for tile flag
|
2015-12-29 23:19:01 +01:00
|
|
|
|
2016-05-29 16:12:53 +02:00
|
|
|
#define MAIN_TILE_INSPECTOR_WIDGETS \
|
|
|
|
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0xFFFFFFFF, STR_NONE }, /* panel / background */ \
|
|
|
|
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_TILE_INSPECTOR_TITLE, STR_WINDOW_TITLE_TIP }, /* title bar */ \
|
|
|
|
{ WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, /* close x button */ \
|
|
|
|
{ WWT_SCROLL, 1, 3, WW - 4, 57, WH - PADDING_BOTTOM, 2, STR_NONE }, /* Element list */ \
|
2016-06-05 00:45:13 +02:00
|
|
|
{ WWT_SPINNER, 1, 20, 61, 23, 34, STR_NONE, STR_NONE }, /* Spinner for X */ \
|
|
|
|
{ WWT_DROPDOWN_BUTTON, 1, 51, 60, 24, 28, STR_NUMERIC_UP, STR_NONE }, /* increase X */ \
|
|
|
|
{ WWT_DROPDOWN_BUTTON, 1, 51, 60, 29, 33, STR_NUMERIC_DOWN, STR_NONE }, /* decrease X */ \
|
|
|
|
{ WWT_SPINNER, 1, 77, 118, 23, 34, STR_NONE, STR_NONE }, /* Spinner for Y */ \
|
|
|
|
{ WWT_DROPDOWN_BUTTON, 1, 108, 117, 24, 28, STR_NUMERIC_UP, STR_NONE }, /* increase Y */ \
|
|
|
|
{ WWT_DROPDOWN_BUTTON, 1, 108, 117, 29, 33, STR_NUMERIC_DOWN, STR_NONE }, /* decrease Y */ \
|
2016-05-29 16:12:53 +02:00
|
|
|
/* Buttons */ \
|
|
|
|
{ WWT_FLATBTN, 1, BX, BW, BY, BH, SPR_MAP, STR_INSERT_CORRUPT_TIP }, /* Insert corrupt button */ \
|
|
|
|
{ WWT_FLATBTN, 1, BX - BS * 1, BW - BS * 1, BY, BH, SPR_DEMOLISH, STR_REMOVE_SELECTED_ELEMENT_TIP }, /* Remove button */ \
|
|
|
|
{ WWT_CLOSEBOX, 1, BX - BS * 2, BW - BS * 2, BY, BY + 11, STR_UP, STR_MOVE_SELECTED_ELEMENT_UP_TIP }, /* Move down */ \
|
|
|
|
{ WWT_CLOSEBOX, 1, BX - BS * 2, BW - BS * 2, BH - 11, BH, STR_DOWN, STR_MOVE_SELECTED_ELEMENT_DOWN_TIP }, /* Move up */ \
|
|
|
|
{ WWT_FLATBTN, 1, BX - BS * 3, BW - BS * 3, BY, BH, SPR_ROTATE_ARROW, STR_ROTATE_SELECTED_ELEMENT_TIP }, /* Rotate button */ \
|
2016-06-11 19:39:51 +02:00
|
|
|
{ WWT_FLATBTN, 1, BX - BS * 4, BW - BS * 4, BY, BH, SPR_G2_SORT, STR_TILE_INSPECTOR_SORT_TIP }, /* Sort button */ \
|
2016-05-29 16:12:53 +02:00
|
|
|
/* Column headers */ \
|
|
|
|
{ WWT_13, 1, COL_X_TYPE, COL_X_BH - 1, 42, 42 + 13, STR_NONE, STR_NONE }, /* Type */ \
|
|
|
|
{ WWT_13, 1, COL_X_BH, COL_X_CH - 1, 42, 42 + 13, STR_NONE, STR_TILE_INSPECTOR_BASE_HEIGHT }, /* Base height */ \
|
|
|
|
{ WWT_13, 1, COL_X_CH, COL_X_GF - 1, 42, 42 + 13, STR_NONE, STR_TILE_INSPECTOR_CLEARANCE_HEIGHT }, /* Clearance height */ \
|
|
|
|
{ WWT_13, 1, COL_X_GF, COL_X_BF - 1, 42, 42 + 13, STR_NONE, STR_TILE_INSPECTOR_FLAG_GHOST }, /* Ghost flag */ \
|
|
|
|
{ WWT_13, 1, COL_X_BF, COL_X_LF - 1, 42, 42 + 13, STR_NONE, STR_TILE_INSPECTOR_FLAG_BROKEN }, /* Broken flag */ \
|
2016-05-31 20:13:26 +02:00
|
|
|
{ WWT_13, 1, COL_X_LF, WW - 3, 42, 42 + 13, STR_NONE, STR_TILE_INSPECTOR_FLAG_LAST }, /* Last of tile flag */ \
|
|
|
|
{ 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 */
|
2016-05-29 16:12:53 +02:00
|
|
|
|
2016-06-05 00:45:13 +02:00
|
|
|
static rct_widget window_tile_inspector_widgets[] = {
|
2016-05-29 16:12:53 +02:00
|
|
|
MAIN_TILE_INSPECTOR_WIDGETS,
|
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
|
|
|
// Calculates the .left, .right, .top and .bottom for buttons in a group box
|
2016-06-01 22:31:10 +02:00
|
|
|
#define GBBL(col) (12 + col * 115)
|
|
|
|
#define GBBR(col) (GBBL(col) + 110)
|
|
|
|
#define GBBT(GROUPTOP, row) ((GROUPTOP) + 14 + row * 21)
|
|
|
|
#define GBBB(GROUPTOP, row) (GBBT((GROUPTOP), row) + 17)
|
|
|
|
#define GBB(GROUPTOP, col, row) GBBL(col), GBBR(col), GBBT((GROUPTOP), row), GBBB((GROUPTOP), row)
|
2016-06-05 22:07:11 +02:00
|
|
|
#define GBBF(GROUPTOP, col, row)GBBL(col), WW - 10, GBBT((GROUPTOP), row), GBBB((GROUPTOP), row) // Full width
|
2016-05-31 20:13:26 +02:00
|
|
|
|
2016-05-30 00:35:50 +02:00
|
|
|
// Same, but for spinners and their increase/decrease buttons
|
|
|
|
#define GBS(GBT, col, row) GBBL(col), GBBR(col), GBBT(GBT, row) + 3, GBBB(GBT, row) - 3
|
|
|
|
#define GBSI(GBT, col, row) GBBR(col) - 11, GBBR(col) - 1, GBBT(GBT, row) + 4, GBBT(GBT, row) + 8
|
|
|
|
#define GBSD(GBT, col, row) GBBR(col) - 11, GBBR(col) - 1, GBBB(GBT, row) - 8, GBBB(GBT, row) - 4
|
2016-05-29 16:12:53 +02:00
|
|
|
|
2016-06-01 22:31:10 +02:00
|
|
|
// Checkbox - given topleft corner
|
2016-06-05 22:07:11 +02:00
|
|
|
#define CHK(x, y) x, x + 13, y + 2, y + 15
|
2016-06-01 22:31:10 +02:00
|
|
|
|
2016-05-31 20:13:26 +02:00
|
|
|
// Group boxes .top and .bottom for a given window height offsets from the bottom
|
2016-05-29 16:12:53 +02:00
|
|
|
#define SUR_GBPB PADDING_BOTTOM // Surface group box properties bottom
|
2016-09-18 15:52:03 +02:00
|
|
|
#define SUR_GBPT (SUR_GBPB + 16 + 4 * 21) // Surface group box properties top
|
2016-05-29 16:12:53 +02:00
|
|
|
#define SUR_GBDB (SUR_GBPT + GROUPBOX_PADDING) // Surface group box details bottom
|
2016-06-05 12:50:42 +02:00
|
|
|
#define SUR_GBDT (SUR_GBDB + 20 + 4 * 11) // Surface group box details top
|
2016-06-05 00:45:13 +02:00
|
|
|
static rct_widget window_tile_inspector_widgets_surface[] = {
|
2016-05-29 16:12:53 +02:00
|
|
|
MAIN_TILE_INSPECTOR_WIDGETS,
|
2016-09-18 15:52:03 +02:00
|
|
|
{ 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
|
|
|
|
{ WWT_DROPDOWN_BUTTON, 1, GBSD(WH - SUR_GBPT, 1, 0), STR_NUMERIC_DOWN, STR_NONE }, // WIDX_SURFACE_SPINNER_HEIGHT_DECREASE
|
|
|
|
{ WWT_CLOSEBOX, 1, GBB(WH - SUR_GBPT, 0, 1), STR_TILE_INSPECTOR_SURFACE_REMOVE_FENCES, STR_NONE }, // WIDX_SURFACE_BUTTON_REMOVE_FENCES
|
|
|
|
{ WWT_CLOSEBOX, 1, GBB(WH - SUR_GBPT, 1, 1), STR_TILE_INSPECTOR_SURFACE_RESTORE_FENCES, STR_NONE }, // WIDX_SURFACE_BUTTON_RESTORE_FENCES
|
2016-09-18 14:30:34 +02:00
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 1, GBBT(WH - SUR_GBPT, 2) + 7 * 0), STR_NONE, STR_NONE }, // WIDX_SURFACE_CHECK_CORNER_N
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 2, GBBT(WH - SUR_GBPT, 2) + 7 * 1), STR_NONE, STR_NONE }, // WIDX_SURFACE_CHECK_CORNER_E
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 1, GBBT(WH - SUR_GBPT, 2) + 7 * 2), STR_NONE, STR_NONE }, // WIDX_SURFACE_CHECK_CORNER_S
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 0, GBBT(WH - SUR_GBPT, 2) + 7 * 1), STR_NONE, STR_NONE }, // WIDX_SURFACE_CHECK_CORNER_W
|
2016-09-18 15:52:03 +02:00
|
|
|
{ WWT_CHECKBOX, 1, GBBF(WH - SUR_GBPT, 0, 4), STR_TILE_INSPECTOR_SURFACE_DIAGONAL, STR_NONE }, // WIDX_SURFACE_CHECK_DIAGONAL
|
2016-05-29 16:12:53 +02:00
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
|
|
|
#define PAT_GBPB PADDING_BOTTOM // Path group box properties bottom
|
2016-05-30 00:35:50 +02:00
|
|
|
#define PAT_GBPT (PAT_GBPB + 16 + 3 * 21) // Path group box properties top
|
2016-05-29 16:12:53 +02:00
|
|
|
#define PAT_GBDB (PAT_GBPT + GROUPBOX_PADDING) // Path group box info bottom
|
2016-09-12 22:47:58 +02:00
|
|
|
#define PAT_GBDT (PAT_GBDB + 20 + 2 * 11) // Path group box info top
|
2016-06-05 00:45:13 +02:00
|
|
|
static rct_widget window_tile_inspector_widgets_path[] = {
|
2016-05-29 16:12:53 +02:00
|
|
|
MAIN_TILE_INSPECTOR_WIDGETS,
|
2016-06-01 22:31:10 +02:00
|
|
|
{ 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
|
|
|
|
{ WWT_DROPDOWN_BUTTON, 1, GBSD(WH - PAT_GBPT, 1, 0), STR_NUMERIC_DOWN, STR_NONE }, // WIDX_PATH_SPINNER_HEIGHT_DECREASE
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 3, GBBT(WH - PAT_GBPT, 1) + 7 * 1), STR_NONE, STR_NONE }, // WIDX_PATH_CHECK_EDGE_NE
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 4, GBBT(WH - PAT_GBPT, 1) + 7 * 2), STR_NONE, STR_NONE }, // WIDX_PATH_CHECK_EDGE_E
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 3, GBBT(WH - PAT_GBPT, 1) + 7 * 3), STR_NONE, STR_NONE }, // WIDX_PATH_CHECK_EDGE_SE
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 2, GBBT(WH - PAT_GBPT, 1) + 7 * 4), STR_NONE, STR_NONE }, // WIDX_PATH_CHECK_EDGE_S
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 1, GBBT(WH - PAT_GBPT, 1) + 7 * 3), STR_NONE, STR_NONE }, // WIDX_PATH_CHECK_EDGE_SW
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 0, GBBT(WH - PAT_GBPT, 1) + 7 * 2), STR_NONE, STR_NONE }, // WIDX_PATH_CHECK_EDGE_W
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 1, GBBT(WH - PAT_GBPT, 1) + 7 * 1), STR_NONE, STR_NONE }, // WIDX_PATH_CHECK_EDGE_NW
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 2, GBBT(WH - PAT_GBPT, 1) + 7 * 0), STR_NONE, STR_NONE }, // WIDX_PATH_CHECK_EDGE_N
|
2016-05-29 16:12:53 +02:00
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
2016-06-05 23:35:41 +02:00
|
|
|
#define TRA_GBPB PADDING_BOTTOM // Track group box properties bottom
|
|
|
|
#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
|
2016-06-05 00:45:13 +02:00
|
|
|
static rct_widget window_tile_inspector_widgets_track[] = {
|
2016-05-29 16:12:53 +02:00
|
|
|
MAIN_TILE_INSPECTOR_WIDGETS,
|
2016-06-05 22:07:11 +02:00
|
|
|
{ WWT_CHECKBOX, 1, GBBF(WH - TRA_GBPT, 0, 0), STR_TILE_INSPECTOR_TRACK_ENTIRE_TRACK_PIECE, STR_NONE }, // WIDX_TRACK_CHECK_APPLY_TO_ALL
|
2016-09-18 10:29:48 +02:00
|
|
|
{ WWT_SPINNER, 1, GBS(WH - TRA_GBPT, 1, 1), STR_NONE, STR_NONE }, // WIDX_TRACK_SPINNER_HEIGHT
|
|
|
|
{ WWT_DROPDOWN_BUTTON, 1, GBSI(WH - TRA_GBPT, 1, 1), STR_NUMERIC_UP, STR_NONE }, // WIDX_TRACK_SPINNER_HEIGHT_INCREASE
|
|
|
|
{ WWT_DROPDOWN_BUTTON, 1, GBSD(WH - TRA_GBPT, 1, 1), STR_NUMERIC_DOWN, STR_NONE }, // WIDX_TRACK_SPINNER_HEIGHT_DECREASE
|
2016-06-05 22:07:11 +02:00
|
|
|
{ WWT_CHECKBOX, 1, GBBF(WH - TRA_GBPT, 0, 2), STR_TILE_INSPECTOR_TRACK_CHAIN_LIFT, STR_NONE }, // WIDX_TRACK_CHECK_CHAIN_LIFT
|
2016-05-29 16:12:53 +02:00
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
2016-06-05 23:35:41 +02:00
|
|
|
#define SCE_GBPB PADDING_BOTTOM // Scenery group box properties bottom
|
2016-09-18 10:29:48 +02:00
|
|
|
#define SCE_GBPT (SCE_GBPB + 16 + 4 * 21) // Scenery group box properties top
|
2016-06-05 23:35:41 +02:00
|
|
|
#define SCE_GBDB (SCE_GBPT + GROUPBOX_PADDING) // Scenery group box info bottom
|
2016-09-18 10:29:48 +02:00
|
|
|
#define SCE_GBDT (SCE_GBDB + 20 + 3 * 11) // Scenery group box info top
|
2016-06-05 00:45:13 +02:00
|
|
|
static rct_widget window_tile_inspector_widgets_scenery[] = {
|
2016-05-29 16:12:53 +02:00
|
|
|
MAIN_TILE_INSPECTOR_WIDGETS,
|
2016-09-18 10:29:48 +02:00
|
|
|
{ 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
|
|
|
|
{ WWT_DROPDOWN_BUTTON, 1, GBSD(WH - SCE_GBPT, 1, 0), STR_NUMERIC_DOWN, STR_NONE }, // WIDX_SCENERY_SPINNER_HEIGHT_DECREASE
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 1, GBBT(WH - SCE_GBPT, 1) + 7 * 0), STR_NONE, STR_NONE }, // WIDX_SCENERY_CHECK_QUARTER_N
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 2, GBBT(WH - SCE_GBPT, 1) + 7 * 1), STR_NONE, STR_NONE }, // WIDX_SCENERY_CHECK_QUARTER_E
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 1, GBBT(WH - SCE_GBPT, 1) + 7 * 2), STR_NONE, STR_NONE }, // WIDX_SCENERY_CHECK_QUARTER_S
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 0, GBBT(WH - SCE_GBPT, 1) + 7 * 1), STR_NONE, STR_NONE }, // WIDX_SCENERY_CHECK_QUARTER_W
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 1, GBBT(WH - SCE_GBPT, 2) + 7 * 0), STR_NONE, STR_NONE }, // WIDX_SCENERY_CHECK_COLLISION_N
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 2, GBBT(WH - SCE_GBPT, 2) + 7 * 1), STR_NONE, STR_NONE }, // WIDX_SCENERY_CHECK_COLLISION_E
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 1, GBBT(WH - SCE_GBPT, 2) + 7 * 2), STR_NONE, STR_NONE }, // WIDX_SCENERY_CHECK_COLLISION_S
|
|
|
|
{ WWT_CHECKBOX, 1, CHK(GBBL(1) + 14 * 0, GBBT(WH - SCE_GBPT, 2) + 7 * 1), STR_NONE, STR_NONE }, // WIDX_SCENERY_CHECK_COLLISION_W
|
2016-05-29 16:12:53 +02:00
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
2016-06-05 23:35:41 +02:00
|
|
|
#define ENT_GBPB PADDING_BOTTOM // Entrance group box properties bottom
|
|
|
|
#define ENT_GBPT (ENT_GBPB + 16 + 0 * 21) // Entrance group box properties top
|
|
|
|
#define ENT_GBDB (ENT_GBPT + GROUPBOX_PADDING) // Entrance group box info bottom
|
|
|
|
#define ENT_GBDT (ENT_GBDB + 20 + 0 * 11) // Entrance group box info top
|
2016-06-05 00:45:13 +02:00
|
|
|
static rct_widget window_tile_inspector_widgets_entrance[] = {
|
2016-05-29 16:12:53 +02:00
|
|
|
MAIN_TILE_INSPECTOR_WIDGETS,
|
2015-06-01 03:33:56 +02:00
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
2016-06-05 23:35:41 +02:00
|
|
|
#define FEN_GBPB PADDING_BOTTOM // Fence group box properties bottom
|
2016-09-10 22:37:47 +02:00
|
|
|
#define FEN_GBPT (FEN_GBPB + 16 + 1 * 21) // Fence group box properties top
|
2016-06-05 23:35:41 +02:00
|
|
|
#define FEN_GBDB (FEN_GBPT + GROUPBOX_PADDING) // Fence group box info bottom
|
|
|
|
#define FEN_GBDT (FEN_GBDB + 20 + 0 * 11) // Fence group box info top
|
2016-06-05 00:45:13 +02:00
|
|
|
static rct_widget window_tile_inspector_widgets_fence[] = {
|
2016-05-29 16:12:53 +02:00
|
|
|
MAIN_TILE_INSPECTOR_WIDGETS,
|
2016-09-11 23:02:34 +02:00
|
|
|
{ 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
|
|
|
|
{ WWT_DROPDOWN_BUTTON, 1, GBSD(WH - FEN_GBPT, 1, 0), STR_NUMERIC_DOWN, STR_NONE }, // WIDX_FENCE_SPINNER_HEIGHT_DECREASE
|
2016-05-29 16:12:53 +02:00
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
2016-06-05 23:35:41 +02:00
|
|
|
#define LAR_GBPB PADDING_BOTTOM // Large scenery group box properties bottom
|
|
|
|
#define LAR_GBPT (LAR_GBPB + 16 + 0 * 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 + 0 * 11) // Large scenery group box info top
|
2016-06-05 00:45:13 +02:00
|
|
|
static rct_widget window_tile_inspector_widgets_large_scenery[] = {
|
2016-05-29 16:12:53 +02:00
|
|
|
MAIN_TILE_INSPECTOR_WIDGETS,
|
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
2016-06-05 23:35:41 +02:00
|
|
|
#define BAN_GBPB PADDING_BOTTOM // Banner group box properties bottom
|
|
|
|
#define BAN_GBPT (BAN_GBPB + 16 + 0 * 21) // Banner group box properties top
|
|
|
|
#define BAN_GBDB (BAN_GBPT + GROUPBOX_PADDING) // Banner group box info bottom
|
|
|
|
#define BAN_GBDT (BAN_GBDB + 20 + 0 * 11) // Banner group box info top
|
2016-06-05 00:45:13 +02:00
|
|
|
static rct_widget window_tile_inspector_widgets_banner[] = {
|
2016-05-29 16:12:53 +02:00
|
|
|
MAIN_TILE_INSPECTOR_WIDGETS,
|
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
2016-06-05 23:35:41 +02:00
|
|
|
#define COR_GBPB PADDING_BOTTOM // Corrupt element group box properties bottom
|
|
|
|
#define COR_GBPT (COR_GBPB + 16 + 0 * 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
|
2016-06-05 00:45:13 +02:00
|
|
|
static rct_widget window_tile_inspector_widgets_corrupt[] = {
|
2016-05-29 16:12:53 +02:00
|
|
|
MAIN_TILE_INSPECTOR_WIDGETS,
|
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
2016-06-05 00:45:13 +02:00
|
|
|
static rct_widget *tile_inspector_widgets[] = {
|
2016-05-29 16:12:53 +02:00
|
|
|
window_tile_inspector_widgets,
|
|
|
|
window_tile_inspector_widgets_surface,
|
|
|
|
window_tile_inspector_widgets_path,
|
|
|
|
window_tile_inspector_widgets_track,
|
|
|
|
window_tile_inspector_widgets_scenery,
|
|
|
|
window_tile_inspector_widgets_entrance,
|
|
|
|
window_tile_inspector_widgets_fence,
|
|
|
|
window_tile_inspector_widgets_large_scenery,
|
|
|
|
window_tile_inspector_widgets_banner,
|
|
|
|
window_tile_inspector_widgets_corrupt,
|
|
|
|
};
|
|
|
|
|
2016-05-31 20:13:26 +02:00
|
|
|
static struct {
|
|
|
|
// Offsets from the bottom of the window
|
|
|
|
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;
|
|
|
|
} page_group_box_settings[] = {
|
|
|
|
{ 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 },
|
|
|
|
{ SCE_GBDT, SCE_GBDB, SCE_GBPT, SCE_GBPB, STR_TILE_INSPECTOR_GROUPBOX_SCENERY_INFO },
|
|
|
|
{ ENT_GBDT, ENT_GBDB, ENT_GBPT, ENT_GBPB, STR_TILE_INSPECTOR_GROUPBOX_ENTRANCE_INFO },
|
|
|
|
{ FEN_GBDT, FEN_GBDB, FEN_GBPT, FEN_GBPB, STR_TILE_INSPECTOR_GROUPBOX_FENCE_INFO },
|
|
|
|
{ LAR_GBDT, LAR_GBDB, LAR_GBPT, LAR_GBPB, STR_TILE_INSPECTOR_GROUPBOX_LARGE_SCENERY_INFO },
|
|
|
|
{ BAN_GBDT, BAN_GBDB, BAN_GBPT, BAN_GBPB, STR_TILE_INSPECTOR_GROUPBOX_BANNER_INFO },
|
|
|
|
{ COR_GBDT, COR_GBDB, COR_GBPT, COR_GBPB, STR_TILE_INSPECTOR_GROUPBOX_CORRUPT_INFO }
|
2016-05-29 16:12:53 +02:00
|
|
|
};
|
|
|
|
|
2015-12-28 23:11:36 +01:00
|
|
|
static sint16 window_tile_inspector_highlighted_index = -1;
|
|
|
|
|
2016-06-05 22:07:11 +02:00
|
|
|
static int window_tile_inspector_tile_x = -1;
|
|
|
|
static int window_tile_inspector_tile_y = -1;
|
|
|
|
static int window_tile_inspector_item_count = 0;
|
|
|
|
static bool window_tile_inspector_apply_to_all = false;
|
2015-06-01 03:33:56 +02:00
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_tile_inspector_mouseup(rct_window *w, int widgetIndex);
|
|
|
|
static void window_tile_inspector_resize(rct_window *w);
|
2016-07-06 19:33:12 +02:00
|
|
|
static void window_tile_inspector_update(rct_window *w);
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_tile_inspector_tool_update(rct_window* w, int widgetIndex, int x, int y);
|
|
|
|
static void window_tile_inspector_tool_down(rct_window* w, int widgetIndex, int x, int y);
|
|
|
|
static void window_tile_inspector_scrollgetsize(rct_window *w, int scrollIndex, int *width, int *height);
|
2015-12-28 23:11:36 +01:00
|
|
|
static void window_tile_inspector_scrollmousedown(rct_window *w, int scrollIndex, int x, int y);
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_tile_inspector_scrollmouseover(rct_window *w, int scrollIndex, int x, int y);
|
|
|
|
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, int scrollIndex);
|
2016-09-12 20:37:16 +02:00
|
|
|
static void window_tile_inspector_set_page(rct_window *w, const int page);
|
2015-12-29 17:55:35 +01:00
|
|
|
static void window_tile_inspector_auto_set_buttons(rct_window *w);
|
2015-12-28 23:11:36 +01:00
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static rct_window_event_list window_tile_inspector_events = {
|
2016-07-06 19:26:14 +02:00
|
|
|
NULL,
|
2015-06-01 03:33:56 +02:00
|
|
|
window_tile_inspector_mouseup,
|
|
|
|
window_tile_inspector_resize,
|
2015-07-10 02:39:16 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2016-07-06 19:33:12 +02:00
|
|
|
window_tile_inspector_update,
|
2015-07-10 02:39:16 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2015-06-01 03:33:56 +02:00
|
|
|
window_tile_inspector_tool_update,
|
|
|
|
window_tile_inspector_tool_down,
|
2015-07-10 02:39:16 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2016-07-06 19:26:14 +02:00
|
|
|
NULL,
|
2015-07-10 02:39:16 +02:00
|
|
|
NULL,
|
2015-06-01 03:33:56 +02:00
|
|
|
window_tile_inspector_scrollgetsize,
|
2015-12-28 23:11:36 +01:00
|
|
|
window_tile_inspector_scrollmousedown,
|
2015-07-10 02:39:16 +02:00
|
|
|
NULL,
|
2015-06-01 03:33:56 +02:00
|
|
|
window_tile_inspector_scrollmouseover,
|
2015-07-10 02:39:16 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2015-06-01 03:33:56 +02:00
|
|
|
window_tile_inspector_invalidate,
|
|
|
|
window_tile_inspector_paint,
|
|
|
|
window_tile_inspector_scrollpaint
|
|
|
|
};
|
|
|
|
|
2016-05-29 16:12:53 +02:00
|
|
|
static uint64 window_tile_inspector_page_enabled_widgets[] = {
|
2016-06-11 19:39:51 +02:00
|
|
|
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT),
|
2016-09-18 15:52:03 +02:00
|
|
|
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE) | (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),
|
2016-06-11 19:39:51 +02:00
|
|
|
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE) | (1ULL << WIDX_PATH_SPINNER_HEIGHT_INCREASE) | (1ULL << WIDX_PATH_SPINNER_HEIGHT_DECREASE) | (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),
|
2016-09-10 22:37:47 +02:00
|
|
|
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE) | (1ULL << WIDX_TRACK_CHECK_APPLY_TO_ALL) | (1ULL << WIDX_TRACK_SPINNER_HEIGHT_INCREASE) | (1ULL << WIDX_TRACK_SPINNER_HEIGHT_DECREASE) | (1ULL << WIDX_TRACK_CHECK_CHAIN_LIFT),
|
2016-09-18 10:29:48 +02:00
|
|
|
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE) | (1ULL << WIDX_SCENERY_SPINNER_HEIGHT_INCREASE) | (1ULL << WIDX_SCENERY_SPINNER_HEIGHT_DECREASE) | (1ULL << WIDX_SCENERY_CHECK_QUARTER_N) | (1ULL << WIDX_SCENERY_CHECK_QUARTER_E) | (1ULL << WIDX_SCENERY_CHECK_QUARTER_S) | (1ULL << WIDX_SCENERY_CHECK_QUARTER_W) | (1ULL << WIDX_SCENERY_CHECK_COLLISION_N) | (1ULL << WIDX_SCENERY_CHECK_COLLISION_E) | (1ULL << WIDX_SCENERY_CHECK_COLLISION_S) | (1ULL << WIDX_SCENERY_CHECK_COLLISION_W),
|
2016-06-11 19:39:51 +02:00
|
|
|
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE),
|
2016-09-11 23:02:34 +02:00
|
|
|
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE) | (1ULL << WIDX_FENCE_SPINNER_HEIGHT_INCREASE) | (1ULL << WIDX_FENCE_SPINNER_HEIGHT_DECREASE),
|
2016-06-11 19:39:51 +02:00
|
|
|
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE),
|
|
|
|
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE),
|
|
|
|
(1ULL << WIDX_CLOSE) | (1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_REMOVE),
|
2016-05-29 16:12:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static uint64 window_tile_inspector_page_disabled_widgets[] = {
|
2016-06-11 19:39:51 +02:00
|
|
|
(1ULL << WIDX_BUTTON_CORRUPT) | (1ULL << WIDX_BUTTON_MOVE_UP) | (1ULL << WIDX_BUTTON_MOVE_DOWN) | (1ULL << WIDX_BUTTON_REMOVE) | (1ULL << WIDX_BUTTON_ROTATE),
|
2016-05-29 16:12:53 +02:00
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
2016-06-11 19:39:51 +02:00
|
|
|
(1ULL << WIDX_BUTTON_ROTATE),
|
2016-05-29 16:12:53 +02:00
|
|
|
0,
|
2016-06-11 19:39:51 +02:00
|
|
|
(1ULL << WIDX_BUTTON_ROTATE),
|
2016-05-29 16:12:53 +02:00
|
|
|
};
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
void window_tile_inspector_open() {
|
2015-06-01 03:33:56 +02:00
|
|
|
rct_window* window;
|
|
|
|
|
|
|
|
// Check if window is already open
|
|
|
|
window = window_bring_to_front_by_class(WC_TILE_INSPECTOR);
|
|
|
|
if (window != NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
window = window_create(
|
|
|
|
0,
|
|
|
|
29,
|
|
|
|
WW,
|
|
|
|
WH,
|
2015-07-10 02:39:16 +02:00
|
|
|
&window_tile_inspector_events,
|
2015-06-01 03:33:56 +02:00
|
|
|
WC_TILE_INSPECTOR,
|
2015-06-13 23:16:14 +02:00
|
|
|
WF_RESIZABLE
|
2015-06-01 03:33:56 +02:00
|
|
|
);
|
2016-06-11 19:39:51 +02:00
|
|
|
window_tile_inspector_set_page(window, PAGE_DEFAULT);
|
2015-06-01 03:33:56 +02:00
|
|
|
|
|
|
|
window_init_scroll_widgets(window);
|
2015-12-28 23:11:36 +01:00
|
|
|
window->min_width = MIN_WW;
|
2015-06-01 03:33:56 +02:00
|
|
|
window->min_height = MIN_WH;
|
2015-12-28 23:11:36 +01:00
|
|
|
window->max_width = MAX_WW;
|
2015-06-01 03:33:56 +02:00
|
|
|
window->max_height = MAX_WH;
|
2015-12-28 23:11:36 +01:00
|
|
|
window->selected_list_item = -1;
|
2015-06-01 03:33:56 +02:00
|
|
|
|
|
|
|
window_tile_inspector_tile_x = -1;
|
|
|
|
window_tile_inspector_tile_y = -1;
|
|
|
|
|
2015-06-13 17:05:56 +02:00
|
|
|
tool_set(window, WIDX_BACKGROUND, 12);
|
2016-06-05 00:45:13 +02:00
|
|
|
window_tile_inspector_auto_set_buttons(window);
|
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void window_tile_inspector_load_tile(rct_window* w) {
|
2016-06-05 00:45:13 +02:00
|
|
|
rct_map_element *element = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y);
|
|
|
|
int numItems = 0;
|
2016-09-18 16:07:07 +02:00
|
|
|
do {
|
2016-06-05 00:45:13 +02:00
|
|
|
numItems++;
|
|
|
|
} while (!map_element_is_last_for_tile(element++));
|
|
|
|
|
|
|
|
window_tile_inspector_item_count = numItems;
|
|
|
|
|
|
|
|
// Set default page
|
2016-06-11 19:39:51 +02:00
|
|
|
window_tile_inspector_set_page(w, PAGE_DEFAULT);
|
|
|
|
|
2016-06-05 00:45:13 +02:00
|
|
|
// undo selection and buttons affecting it
|
|
|
|
w->selected_list_item = -1;
|
2016-06-11 19:39:51 +02:00
|
|
|
window_tile_inspector_auto_set_buttons(w);
|
2016-06-05 00:45:13 +02:00
|
|
|
|
|
|
|
w->scrolls[0].v_top = 0;
|
|
|
|
window_invalidate(w);
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
|
|
|
|
2016-04-17 11:58:13 +02:00
|
|
|
static void corrupt_element() {
|
2015-11-07 11:04:57 +01:00
|
|
|
rct_map_element* mapElement;
|
2016-04-17 00:35:11 +02:00
|
|
|
mapElement = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y);
|
2015-11-07 11:04:57 +01:00
|
|
|
|
|
|
|
while (!map_element_is_last_for_tile(mapElement++));
|
|
|
|
mapElement--;
|
|
|
|
|
2016-04-17 00:35:11 +02:00
|
|
|
mapElement = map_element_insert(window_tile_inspector_tile_x, window_tile_inspector_tile_y, mapElement->base_height, 0);
|
2016-02-26 20:49:01 +01:00
|
|
|
assert(mapElement != NULL);
|
2015-11-07 11:04:57 +01:00
|
|
|
mapElement->type = (8 << 2);
|
2016-04-17 00:37:50 +02:00
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
2015-11-07 11:04:57 +01:00
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void remove_element(int index) {
|
2015-12-29 15:43:49 +01:00
|
|
|
assert(index < window_tile_inspector_item_count);
|
|
|
|
rct_map_element *mapElement = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y);
|
|
|
|
mapElement += index;
|
|
|
|
map_element_remove(mapElement);
|
2015-12-29 15:45:24 +01:00
|
|
|
window_tile_inspector_item_count--;
|
2016-04-17 00:37:50 +02:00
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
2015-12-29 15:43:49 +01:00
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void rotate_element(int index) {
|
2016-06-05 00:45:13 +02:00
|
|
|
uint8 new_rotation, path_edges, path_corners;
|
2016-04-17 00:35:11 +02:00
|
|
|
|
|
|
|
assert(index < window_tile_inspector_item_count);
|
|
|
|
rct_map_element *mapElement = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y);
|
|
|
|
mapElement += index;
|
2016-09-18 16:07:07 +02:00
|
|
|
switch (map_element_get_type(mapElement)) {
|
2016-06-05 00:45:13 +02:00
|
|
|
case MAP_ELEMENT_TYPE_PATH:
|
2016-05-30 00:35:50 +02:00
|
|
|
if (footpath_element_is_sloped(mapElement)) {
|
2016-09-10 22:37:47 +02:00
|
|
|
new_rotation = (footpath_element_get_slope_direction(mapElement) + 1) & MAP_ELEMENT_DIRECTION_MASK;
|
|
|
|
mapElement->properties.path.type &= ~MAP_ELEMENT_DIRECTION_MASK;
|
2016-05-29 16:12:53 +02:00
|
|
|
mapElement->properties.path.type |= new_rotation;
|
|
|
|
}
|
2016-06-05 00:45:13 +02:00
|
|
|
path_edges = mapElement->properties.path.edges & 0xF;
|
|
|
|
path_corners = mapElement->properties.path.edges & 0xF0;
|
|
|
|
mapElement->properties.path.edges = 0;
|
|
|
|
mapElement->properties.path.edges |= ((path_edges << 1) | (path_edges >> 3)) & 0xF;
|
|
|
|
mapElement->properties.path.edges |= ((path_corners << 1) | (path_corners >> 3)) & 0xF0;
|
2016-05-30 00:35:50 +02:00
|
|
|
break;
|
2016-05-29 16:12:53 +02:00
|
|
|
case MAP_ELEMENT_TYPE_TRACK:
|
|
|
|
case MAP_ELEMENT_TYPE_SCENERY:
|
|
|
|
case MAP_ELEMENT_TYPE_ENTRANCE:
|
|
|
|
case MAP_ELEMENT_TYPE_FENCE:
|
2016-06-05 00:45:13 +02:00
|
|
|
case MAP_ELEMENT_TYPE_BANNER:
|
2016-09-10 22:37:47 +02:00
|
|
|
new_rotation = (mapElement->type + 1) & MAP_ELEMENT_DIRECTION_MASK;
|
|
|
|
mapElement->type &= ~MAP_ELEMENT_DIRECTION_MASK;
|
2016-05-29 16:12:53 +02:00
|
|
|
mapElement->type |= new_rotation;
|
|
|
|
break;
|
2016-04-17 00:35:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
}
|
|
|
|
|
2015-12-28 23:11:36 +01:00
|
|
|
// Swap element with its parent
|
2016-09-18 16:07:07 +02:00
|
|
|
static void swap_elements(sint16 first, sint16 second) {
|
2015-12-28 23:11:36 +01:00
|
|
|
rct_map_element *mapElement;
|
|
|
|
rct_map_element *firstElement = NULL;
|
|
|
|
rct_map_element *secondElement = NULL;
|
|
|
|
mapElement = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y);
|
2015-12-21 00:52:42 +01:00
|
|
|
|
2015-12-28 23:11:36 +01:00
|
|
|
// swap_elements shouldn't be called when there is only one element on the tile
|
|
|
|
assert(!map_element_is_last_for_tile(mapElement));
|
2015-12-21 00:52:42 +01:00
|
|
|
|
2015-12-28 23:11:36 +01:00
|
|
|
// Search for the elements
|
|
|
|
sint16 i = 0;
|
|
|
|
do {
|
|
|
|
if (i == first) firstElement = mapElement;
|
|
|
|
if (i == second) secondElement = mapElement;
|
|
|
|
i++;
|
2015-12-21 00:52:42 +01:00
|
|
|
|
2015-12-28 23:11:36 +01:00
|
|
|
// Check if both elements have been found
|
|
|
|
if (firstElement != NULL && secondElement != NULL)
|
|
|
|
break;
|
|
|
|
} while (!map_element_is_last_for_tile(mapElement++));
|
2015-12-21 00:52:42 +01:00
|
|
|
|
2015-12-28 23:11:36 +01:00
|
|
|
// Swap their memory
|
|
|
|
rct_map_element temp = *firstElement;
|
|
|
|
*firstElement = *secondElement;
|
|
|
|
*secondElement = temp;
|
|
|
|
|
|
|
|
// Swap the 'last map element for tile' flag if either one of them was last
|
|
|
|
if (map_element_is_last_for_tile(firstElement) || map_element_is_last_for_tile(secondElement)) {
|
|
|
|
firstElement->flags ^= MAP_ELEMENT_FLAG_LAST_TILE;
|
|
|
|
secondElement->flags ^= MAP_ELEMENT_FLAG_LAST_TILE;
|
|
|
|
}
|
2016-04-17 00:37:50 +02:00
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
2015-12-21 00:52:42 +01:00
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void sort_elements(rct_window *w) {
|
2016-06-11 19:39:51 +02:00
|
|
|
const rct_map_element *const firstElement = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y);
|
|
|
|
|
|
|
|
// Bubble sort
|
2016-09-18 16:07:07 +02:00
|
|
|
for (int loop_start = 1; loop_start < window_tile_inspector_item_count; loop_start++) {
|
2016-06-11 19:39:51 +02:00
|
|
|
int current_id = loop_start;
|
|
|
|
const rct_map_element *currentElement = firstElement + current_id;
|
|
|
|
const rct_map_element *otherElement = currentElement - 1;
|
|
|
|
|
2016-09-18 14:30:34 +02:00
|
|
|
// While current element's base height is lower, or (when their baseheight is the same) the other map element's clearance height is lower...
|
2016-09-18 16:07:07 +02:00
|
|
|
while (current_id > 0 && (otherElement->base_height > currentElement->base_height || (otherElement->base_height == currentElement->base_height && otherElement->clearance_height > currentElement->clearance_height))) {
|
2016-06-11 19:39:51 +02:00
|
|
|
swap_elements(current_id - 1, current_id);
|
|
|
|
current_id--;
|
|
|
|
currentElement--;
|
|
|
|
otherElement--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-10 22:37:47 +02:00
|
|
|
// Copied from track.c (track_remove), and modified for raising/lowering
|
2016-09-11 23:02:34 +02:00
|
|
|
// Not sure if this should be in this file, track.c, or maybe another one
|
2016-09-18 16:07:07 +02:00
|
|
|
static void track_block_height_offset(rct_map_element *mapElement, uint8 offset) {
|
2016-09-10 22:37:47 +02:00
|
|
|
uint8 type = mapElement->properties.track.type;
|
|
|
|
uint8 sequence = mapElement->properties.track.sequence;
|
|
|
|
sint16 originX = window_tile_inspector_tile_x << 5;
|
|
|
|
sint16 originY = window_tile_inspector_tile_y << 5;
|
|
|
|
sint16 originZ = mapElement->base_height * 8;
|
|
|
|
uint8 rotation = map_element_get_direction(mapElement);
|
|
|
|
|
|
|
|
sint16 trackpieceZ = originZ;
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
switch (type) {
|
2016-09-10 22:37:47 +02:00
|
|
|
case TRACK_ELEM_BEGIN_STATION:
|
|
|
|
case TRACK_ELEM_MIDDLE_STATION:
|
|
|
|
type = TRACK_ELEM_END_STATION;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 rideIndex = mapElement->properties.track.ride_index;
|
|
|
|
type = mapElement->properties.track.type;
|
|
|
|
|
|
|
|
rct_ride* ride = get_ride(rideIndex);
|
|
|
|
const rct_preview_track* trackBlock = get_track_def_from_ride(ride, type);
|
|
|
|
trackBlock += mapElement->properties.track.sequence & 0xF;
|
|
|
|
|
|
|
|
uint8 originDirection = map_element_get_direction(mapElement);
|
2016-09-18 16:07:07 +02:00
|
|
|
switch (originDirection) {
|
2016-09-10 22:37:47 +02:00
|
|
|
case 0:
|
|
|
|
originX -= trackBlock->x;
|
|
|
|
originY -= trackBlock->y;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
originX -= trackBlock->y;
|
|
|
|
originY += trackBlock->x;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
originX += trackBlock->x;
|
|
|
|
originY += trackBlock->y;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
originX += trackBlock->y;
|
|
|
|
originY -= trackBlock->x;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
originZ -= trackBlock->z;
|
|
|
|
|
|
|
|
trackBlock = get_track_def_from_ride(ride, type);
|
2016-09-18 16:07:07 +02:00
|
|
|
for (; trackBlock->index != 255; trackBlock++) {
|
2016-09-10 22:37:47 +02:00
|
|
|
sint16 x = originX, y = originY, z = originZ;
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
switch (originDirection) {
|
2016-09-10 22:37:47 +02:00
|
|
|
case 0:
|
|
|
|
x += trackBlock->x;
|
|
|
|
y += trackBlock->y;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
x += trackBlock->y;
|
|
|
|
y -= trackBlock->x;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
x -= trackBlock->x;
|
|
|
|
y -= trackBlock->y;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
x -= trackBlock->y;
|
|
|
|
y += trackBlock->x;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
z += trackBlock->z;
|
|
|
|
|
|
|
|
map_invalidate_tile_full(x, y);
|
|
|
|
|
|
|
|
trackpieceZ = z;
|
|
|
|
|
|
|
|
bool found = false;
|
|
|
|
mapElement = map_get_first_element_at(x / 32, y / 32);
|
2016-09-18 16:07:07 +02:00
|
|
|
do {
|
2016-09-10 22:37:47 +02:00
|
|
|
if (mapElement->base_height != z / 8)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_TRACK)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((mapElement->type & MAP_ELEMENT_DIRECTION_MASK) != rotation)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((mapElement->properties.track.sequence & 0xF) != trackBlock->index)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (mapElement->properties.track.type != type)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
} while (!map_element_is_last_for_tile(mapElement++));
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
if (!found) {
|
2016-09-10 22:37:47 +02:00
|
|
|
log_error("Track map element part not found!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
assert(map_get_surface_element_at(x / 32, y / 32) != NULL);
|
|
|
|
|
|
|
|
// Keep?
|
|
|
|
//invalidate_test_results(rideIndex);
|
|
|
|
|
|
|
|
mapElement->base_height += offset;
|
|
|
|
mapElement->clearance_height += offset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-11 23:02:34 +02:00
|
|
|
// Sets chainlift for entire block
|
|
|
|
// Basically a copy of the above function, with just two different lines... should probably be combined somehow
|
2016-09-18 16:07:07 +02:00
|
|
|
static void track_block_set_lift(rct_map_element *mapElement, bool chain) {
|
2016-09-11 23:02:34 +02:00
|
|
|
uint8 type = mapElement->properties.track.type;
|
|
|
|
uint8 sequence = mapElement->properties.track.sequence;
|
|
|
|
sint16 originX = window_tile_inspector_tile_x << 5;
|
|
|
|
sint16 originY = window_tile_inspector_tile_y << 5;
|
|
|
|
sint16 originZ = mapElement->base_height * 8;
|
|
|
|
uint8 rotation = map_element_get_direction(mapElement);
|
|
|
|
|
|
|
|
sint16 trackpieceZ = originZ;
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
switch (type) {
|
2016-09-11 23:02:34 +02:00
|
|
|
case TRACK_ELEM_BEGIN_STATION:
|
|
|
|
case TRACK_ELEM_MIDDLE_STATION:
|
|
|
|
type = TRACK_ELEM_END_STATION;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 rideIndex = mapElement->properties.track.ride_index;
|
|
|
|
type = mapElement->properties.track.type;
|
|
|
|
|
|
|
|
rct_ride* ride = get_ride(rideIndex);
|
|
|
|
const rct_preview_track* trackBlock = get_track_def_from_ride(ride, type);
|
|
|
|
trackBlock += mapElement->properties.track.sequence & 0xF;
|
|
|
|
|
|
|
|
uint8 originDirection = map_element_get_direction(mapElement);
|
2016-09-18 16:07:07 +02:00
|
|
|
switch (originDirection) {
|
2016-09-11 23:02:34 +02:00
|
|
|
case 0:
|
|
|
|
originX -= trackBlock->x;
|
|
|
|
originY -= trackBlock->y;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
originX -= trackBlock->y;
|
|
|
|
originY += trackBlock->x;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
originX += trackBlock->x;
|
|
|
|
originY += trackBlock->y;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
originX += trackBlock->y;
|
|
|
|
originY -= trackBlock->x;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
originZ -= trackBlock->z;
|
|
|
|
|
|
|
|
trackBlock = get_track_def_from_ride(ride, type);
|
2016-09-18 16:07:07 +02:00
|
|
|
for (; trackBlock->index != 255; trackBlock++) {
|
2016-09-11 23:02:34 +02:00
|
|
|
sint16 x = originX, y = originY, z = originZ;
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
switch (originDirection) {
|
2016-09-11 23:02:34 +02:00
|
|
|
case 0:
|
|
|
|
x += trackBlock->x;
|
|
|
|
y += trackBlock->y;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
x += trackBlock->y;
|
|
|
|
y -= trackBlock->x;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
x -= trackBlock->x;
|
|
|
|
y -= trackBlock->y;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
x -= trackBlock->y;
|
|
|
|
y += trackBlock->x;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
z += trackBlock->z;
|
|
|
|
|
|
|
|
map_invalidate_tile_full(x, y);
|
|
|
|
|
|
|
|
trackpieceZ = z;
|
|
|
|
|
|
|
|
bool found = false;
|
|
|
|
mapElement = map_get_first_element_at(x / 32, y / 32);
|
2016-09-18 16:07:07 +02:00
|
|
|
do {
|
2016-09-11 23:02:34 +02:00
|
|
|
if (mapElement->base_height != z / 8)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_TRACK)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((mapElement->type & MAP_ELEMENT_DIRECTION_MASK) != rotation)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((mapElement->properties.track.sequence & 0xF) != trackBlock->index)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (mapElement->properties.track.type != type)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
} while (!map_element_is_last_for_tile(mapElement++));
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
if (!found) {
|
2016-09-11 23:02:34 +02:00
|
|
|
log_error("Track map element part not found!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
assert(map_get_surface_element_at(x / 32, y / 32) != NULL);
|
|
|
|
|
|
|
|
// Keep?
|
|
|
|
//invalidate_test_results(rideIndex);
|
|
|
|
|
|
|
|
if (track_element_is_lift_hill(mapElement) != chain) {
|
|
|
|
mapElement->type ^= TRACK_ELEMENT_FLAG_CHAIN_LIFT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-18 10:29:48 +02:00
|
|
|
static void quarter_tile_set(rct_map_element *const mapElement, const int index) {
|
|
|
|
// index is widget index relative to WIDX_SCENERY_CHECK_QUARTER_N, so a value from 0-3
|
|
|
|
assert(index >= 0 && index < 4);
|
|
|
|
|
|
|
|
const int clicked_direction = (4 + index - get_current_rotation()) % 4;
|
|
|
|
|
|
|
|
// Set quadrant index
|
|
|
|
mapElement->type &= ~MAP_ELEMENT_QUADRANT_MASK;
|
|
|
|
mapElement->type |= clicked_direction << 6;
|
|
|
|
|
|
|
|
// Update collision
|
|
|
|
mapElement->flags &= 0xF0;
|
|
|
|
mapElement->flags |= 1 << ((index + 6 - get_current_rotation()) % 4);
|
|
|
|
|
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void toggle_quarter_collision(rct_map_element *const mapElement, const int index) {
|
|
|
|
// index is widget index relative to WIDX_SCENERY_CHECK_COLLISION_N, so a value from 0-3
|
|
|
|
assert(index >= 0 && index < 4);
|
|
|
|
|
|
|
|
mapElement->flags ^= 1 << ((index + 6 - get_current_rotation()) % 4);
|
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void window_tile_inspector_mouseup(rct_window *w, int widgetIndex) {
|
2015-06-01 03:33:56 +02:00
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_CLOSE:
|
2016-07-06 19:26:14 +02:00
|
|
|
tool_cancel();
|
2015-06-01 03:33:56 +02:00
|
|
|
window_close(w);
|
|
|
|
break;
|
2016-06-05 00:45:13 +02:00
|
|
|
case WIDX_SPINNER_X_INCREASE:
|
|
|
|
window_tile_inspector_tile_x = min(window_tile_inspector_tile_x + 1, 255);
|
|
|
|
window_tile_inspector_load_tile(w);
|
|
|
|
window_tile_inspector_auto_set_buttons(w);
|
|
|
|
break;
|
|
|
|
case WIDX_SPINNER_X_DECREASE:
|
|
|
|
window_tile_inspector_tile_x = max(window_tile_inspector_tile_x - 1, 0);
|
|
|
|
window_tile_inspector_load_tile(w);
|
|
|
|
window_tile_inspector_auto_set_buttons(w);
|
|
|
|
break;
|
|
|
|
case WIDX_SPINNER_Y_INCREASE:
|
|
|
|
window_tile_inspector_tile_y = min(window_tile_inspector_tile_y + 1, 255);
|
|
|
|
window_tile_inspector_load_tile(w);
|
|
|
|
window_tile_inspector_auto_set_buttons(w);
|
|
|
|
break;
|
|
|
|
case WIDX_SPINNER_Y_DECREASE:
|
|
|
|
window_tile_inspector_tile_y = max(window_tile_inspector_tile_y - 1, 0);
|
|
|
|
window_tile_inspector_load_tile(w);
|
|
|
|
window_tile_inspector_auto_set_buttons(w);
|
|
|
|
break;
|
2016-06-11 19:39:51 +02:00
|
|
|
case WIDX_BUTTON_CORRUPT:
|
2016-04-17 00:35:11 +02:00
|
|
|
corrupt_element();
|
2016-06-11 19:39:51 +02:00
|
|
|
window_tile_inspector_set_page(w, PAGE_CORRUPT);
|
2015-11-07 11:04:57 +01:00
|
|
|
w->scrolls[0].v_top = 0;
|
2016-01-01 19:29:41 +01:00
|
|
|
w->selected_list_item = window_tile_inspector_item_count++;
|
|
|
|
window_tile_inspector_auto_set_buttons(w);
|
|
|
|
widget_invalidate(w, WIDX_LIST);
|
2015-11-07 11:04:57 +01:00
|
|
|
break;
|
2016-06-11 19:39:51 +02:00
|
|
|
case WIDX_BUTTON_REMOVE:
|
2015-12-29 15:43:49 +01:00
|
|
|
remove_element(w->selected_list_item);
|
2016-06-11 19:39:51 +02:00
|
|
|
window_tile_inspector_set_page(w, PAGE_DEFAULT);
|
2015-12-29 15:43:49 +01:00
|
|
|
w->selected_list_item = -1;
|
2016-06-11 19:39:51 +02:00
|
|
|
window_tile_inspector_set_page(w, PAGE_DEFAULT);
|
2016-01-01 17:21:48 +01:00
|
|
|
window_tile_inspector_auto_set_buttons(w);
|
2016-06-11 19:39:51 +02:00
|
|
|
window_invalidate(w);
|
2015-12-28 23:11:36 +01:00
|
|
|
break;
|
2016-06-11 19:39:51 +02:00
|
|
|
case WIDX_BUTTON_ROTATE:
|
2016-04-17 00:35:11 +02:00
|
|
|
rotate_element(w->selected_list_item);
|
2016-06-05 00:45:13 +02:00
|
|
|
window_invalidate(w);
|
2016-04-17 00:35:11 +02:00
|
|
|
break;
|
2016-06-11 19:39:51 +02:00
|
|
|
case WIDX_BUTTON_SORT:
|
|
|
|
w->selected_list_item = -1;
|
|
|
|
sort_elements(w);
|
|
|
|
window_invalidate(w);
|
|
|
|
break;
|
|
|
|
case WIDX_BUTTON_MOVE_DOWN:
|
2015-12-28 23:11:36 +01:00
|
|
|
swap_elements(w->selected_list_item, w->selected_list_item + 1);
|
|
|
|
w->selected_list_item++;
|
2015-12-29 17:55:35 +01:00
|
|
|
window_tile_inspector_auto_set_buttons(w);
|
2015-12-28 23:11:36 +01:00
|
|
|
widget_invalidate(w, WIDX_LIST);
|
|
|
|
break;
|
2016-06-11 19:39:51 +02:00
|
|
|
case WIDX_BUTTON_MOVE_UP:
|
2015-12-28 23:11:36 +01:00
|
|
|
swap_elements(w->selected_list_item - 1, w->selected_list_item);
|
|
|
|
w->selected_list_item--;
|
2015-12-29 17:55:35 +01:00
|
|
|
window_tile_inspector_auto_set_buttons(w);
|
2015-12-28 23:11:36 +01:00
|
|
|
widget_invalidate(w, WIDX_LIST);
|
2015-12-21 00:52:42 +01:00
|
|
|
break;
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
2016-05-29 16:12:53 +02:00
|
|
|
|
2016-09-18 10:29:48 +02:00
|
|
|
// Get the selected map element
|
|
|
|
rct_map_element *const mapElement = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y) + w->selected_list_item;
|
2016-05-29 16:12:53 +02:00
|
|
|
|
|
|
|
// Page widgets
|
|
|
|
switch (w->page) {
|
|
|
|
case PAGE_SURFACE:
|
|
|
|
switch (widgetIndex) {
|
2016-09-18 15:52:03 +02:00
|
|
|
case WIDX_SURFACE_SPINNER_HEIGHT_INCREASE:
|
|
|
|
mapElement->base_height++;
|
|
|
|
mapElement->clearance_height++;
|
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
widget_invalidate(w, WIDX_PATH_SPINNER_HEIGHT);
|
|
|
|
break;
|
|
|
|
case WIDX_SURFACE_SPINNER_HEIGHT_DECREASE:
|
|
|
|
mapElement->base_height--;
|
|
|
|
mapElement->clearance_height--;
|
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
widget_invalidate(w, WIDX_PATH_SPINNER_HEIGHT);
|
|
|
|
break;
|
2016-05-29 16:12:53 +02:00
|
|
|
case WIDX_SURFACE_BUTTON_REMOVE_FENCES:
|
|
|
|
mapElement->properties.surface.ownership &= ~0xF;
|
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
break;
|
|
|
|
case WIDX_SURFACE_BUTTON_RESTORE_FENCES:
|
|
|
|
update_park_fences(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
2016-05-30 00:35:50 +02:00
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
break;
|
2016-09-18 14:30:34 +02:00
|
|
|
case WIDX_SURFACE_CHECK_CORNER_N:
|
|
|
|
case WIDX_SURFACE_CHECK_CORNER_E:
|
|
|
|
case WIDX_SURFACE_CHECK_CORNER_S:
|
|
|
|
case WIDX_SURFACE_CHECK_CORNER_W:
|
|
|
|
mapElement->properties.surface.slope ^= 1 << (((widgetIndex - WIDX_SURFACE_CHECK_CORNER_N) + 6 - get_current_rotation()) % 4);
|
2016-09-18 15:52:03 +02:00
|
|
|
if (mapElement->properties.surface.slope & 0x0F) {
|
|
|
|
mapElement->clearance_height = mapElement->base_height + 2;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
mapElement->clearance_height = mapElement->base_height;
|
|
|
|
}
|
2016-09-18 14:30:34 +02:00
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
widget_invalidate(w, widgetIndex);
|
|
|
|
break;
|
|
|
|
case WIDX_SURFACE_CHECK_DIAGONAL:
|
|
|
|
mapElement->properties.surface.slope ^= 0x10;
|
2016-09-18 15:52:03 +02:00
|
|
|
if (mapElement->properties.surface.slope & 0x10) {
|
|
|
|
mapElement->clearance_height = mapElement->base_height + 4;
|
|
|
|
}
|
2016-09-18 14:30:34 +02:00
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
widget_invalidate(w, widgetIndex);
|
|
|
|
break;
|
2016-05-30 00:35:50 +02:00
|
|
|
} // switch widgetindex
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PAGE_PATH:
|
|
|
|
switch (widgetIndex) {
|
2016-06-01 22:31:10 +02:00
|
|
|
case WIDX_PATH_SPINNER_HEIGHT_INCREASE:
|
2016-05-30 00:35:50 +02:00
|
|
|
mapElement->base_height++;
|
|
|
|
mapElement->clearance_height++;
|
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
2016-09-11 23:02:34 +02:00
|
|
|
widget_invalidate(w, WIDX_PATH_SPINNER_HEIGHT);
|
2016-05-30 00:35:50 +02:00
|
|
|
break;
|
2016-06-01 22:31:10 +02:00
|
|
|
case WIDX_PATH_SPINNER_HEIGHT_DECREASE:
|
2016-05-30 00:35:50 +02:00
|
|
|
mapElement->base_height--;
|
|
|
|
mapElement->clearance_height--;
|
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
2016-09-11 23:02:34 +02:00
|
|
|
widget_invalidate(w, WIDX_PATH_SPINNER_HEIGHT);
|
2016-05-30 00:35:50 +02:00
|
|
|
break;
|
2016-06-01 22:31:10 +02:00
|
|
|
case WIDX_PATH_CHECK_EDGE_E:
|
|
|
|
case WIDX_PATH_CHECK_EDGE_S:
|
|
|
|
case WIDX_PATH_CHECK_EDGE_W:
|
|
|
|
case WIDX_PATH_CHECK_EDGE_N:
|
|
|
|
widget_set_checkbox_value(w, widgetIndex, !widget_is_pressed(w, widgetIndex));
|
|
|
|
mapElement->properties.path.edges ^= (1 << (4 + (((widgetIndex - WIDX_PATH_CHECK_EDGE_E) / 2 - get_current_rotation() + 4) % 4))) & 0xF0;
|
2016-05-30 00:35:50 +02:00
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
break;
|
2016-06-01 22:31:10 +02:00
|
|
|
case WIDX_PATH_CHECK_EDGE_NE:
|
|
|
|
case WIDX_PATH_CHECK_EDGE_SE:
|
|
|
|
case WIDX_PATH_CHECK_EDGE_SW:
|
|
|
|
case WIDX_PATH_CHECK_EDGE_NW:
|
|
|
|
widget_set_checkbox_value(w, widgetIndex, !widget_is_pressed(w, widgetIndex));
|
|
|
|
mapElement->properties.path.edges ^= (1 << (((widgetIndex - WIDX_PATH_CHECK_EDGE_NE) / 2 - get_current_rotation() + 4) % 4)) & 0x0F;
|
2016-05-30 00:35:50 +02:00
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
break;
|
2016-06-05 22:07:11 +02:00
|
|
|
} // switch widget index
|
2016-05-29 16:12:53 +02:00
|
|
|
break;
|
2016-05-30 00:35:50 +02:00
|
|
|
|
|
|
|
case PAGE_TRACK:
|
2016-06-05 22:07:11 +02:00
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_TRACK_CHECK_APPLY_TO_ALL:
|
|
|
|
window_tile_inspector_apply_to_all ^= 1;
|
|
|
|
widget_invalidate(w, widgetIndex);
|
|
|
|
break;
|
|
|
|
case WIDX_TRACK_SPINNER_HEIGHT_INCREASE:
|
2016-09-10 22:37:47 +02:00
|
|
|
if (widget_is_pressed(w, WIDX_TRACK_CHECK_APPLY_TO_ALL)) {
|
|
|
|
track_block_height_offset(mapElement, 1);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
mapElement->base_height++;
|
|
|
|
mapElement->clearance_height++;
|
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
}
|
2016-09-11 23:02:34 +02:00
|
|
|
widget_invalidate(w, WIDX_TRACK_SPINNER_HEIGHT);
|
2016-06-05 22:07:11 +02:00
|
|
|
break;
|
|
|
|
case WIDX_TRACK_SPINNER_HEIGHT_DECREASE:
|
2016-09-10 22:37:47 +02:00
|
|
|
if (widget_is_pressed(w, WIDX_TRACK_CHECK_APPLY_TO_ALL)) {
|
|
|
|
track_block_height_offset(mapElement, -1);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
mapElement->base_height--;
|
|
|
|
mapElement->clearance_height--;
|
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
}
|
2016-09-11 23:02:34 +02:00
|
|
|
widget_invalidate(w, WIDX_TRACK_SPINNER_HEIGHT);
|
2016-06-05 22:07:11 +02:00
|
|
|
break;
|
|
|
|
case WIDX_TRACK_CHECK_CHAIN_LIFT:
|
2016-09-11 23:02:34 +02:00
|
|
|
if (widget_is_pressed(w, WIDX_TRACK_CHECK_APPLY_TO_ALL)) {
|
|
|
|
bool new_lift = !track_element_is_lift_hill(mapElement);
|
|
|
|
track_block_set_lift(mapElement, new_lift);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
mapElement->type ^= TRACK_ELEMENT_FLAG_CHAIN_LIFT;
|
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
}
|
2016-06-05 22:07:11 +02:00
|
|
|
widget_invalidate(w, widgetIndex);
|
|
|
|
break;
|
|
|
|
} // switch widget index
|
|
|
|
break;
|
|
|
|
|
2016-05-30 00:35:50 +02:00
|
|
|
case PAGE_SCENERY:
|
2016-09-18 10:29:48 +02:00
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_SCENERY_SPINNER_HEIGHT_INCREASE:
|
|
|
|
mapElement->base_height++;
|
|
|
|
mapElement->clearance_height++;
|
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
widget_invalidate(w, WIDX_SCENERY_SPINNER_HEIGHT);
|
|
|
|
break;
|
|
|
|
case WIDX_SCENERY_SPINNER_HEIGHT_DECREASE:
|
|
|
|
mapElement->base_height--;
|
|
|
|
mapElement->clearance_height--;
|
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
widget_invalidate(w, WIDX_SCENERY_SPINNER_HEIGHT);
|
|
|
|
break;
|
|
|
|
case WIDX_SCENERY_CHECK_QUARTER_N:
|
|
|
|
case WIDX_SCENERY_CHECK_QUARTER_E:
|
|
|
|
case WIDX_SCENERY_CHECK_QUARTER_S:
|
|
|
|
case WIDX_SCENERY_CHECK_QUARTER_W:
|
|
|
|
quarter_tile_set(mapElement, widgetIndex - WIDX_SCENERY_CHECK_QUARTER_N);
|
|
|
|
window_invalidate(w);
|
|
|
|
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:
|
|
|
|
toggle_quarter_collision(mapElement, widgetIndex - WIDX_SCENERY_CHECK_COLLISION_N);
|
|
|
|
window_invalidate(w);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2016-05-30 00:35:50 +02:00
|
|
|
case PAGE_ENTRANCE:
|
2016-09-10 22:37:47 +02:00
|
|
|
break;
|
|
|
|
|
2016-09-18 10:29:48 +02:00
|
|
|
case PAGE_FENCE:
|
2016-09-10 22:37:47 +02:00
|
|
|
switch (widgetIndex) {
|
2016-09-11 23:02:34 +02:00
|
|
|
case WIDX_FENCE_SPINNER_HEIGHT_INCREASE:
|
2016-09-10 22:37:47 +02:00
|
|
|
mapElement->base_height++;
|
|
|
|
mapElement->clearance_height++;
|
2016-09-11 23:02:34 +02:00
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
widget_invalidate(w, WIDX_FENCE_SPINNER_HEIGHT);
|
|
|
|
break;
|
|
|
|
case WIDX_FENCE_SPINNER_HEIGHT_DECREASE:
|
|
|
|
mapElement->base_height--;
|
|
|
|
mapElement->clearance_height--;
|
|
|
|
map_invalidate_tile_full(window_tile_inspector_tile_x << 5, window_tile_inspector_tile_y << 5);
|
|
|
|
widget_invalidate(w, WIDX_FENCE_SPINNER_HEIGHT);
|
2016-09-10 22:37:47 +02:00
|
|
|
break;
|
|
|
|
} // switch widget index
|
|
|
|
break;
|
2016-05-30 00:35:50 +02:00
|
|
|
case PAGE_LARGE_SCENERY:
|
|
|
|
case PAGE_BANNER:
|
|
|
|
case PAGE_CORRUPT:
|
|
|
|
break;
|
|
|
|
} // switch page
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void window_tile_inspector_resize(rct_window *w) {
|
2015-06-01 03:33:56 +02:00
|
|
|
w->min_width = WW;
|
|
|
|
w->min_height = MIN_WH;
|
|
|
|
if (w->width < w->min_width) {
|
|
|
|
window_invalidate(w);
|
|
|
|
w->width = w->min_width;
|
|
|
|
}
|
|
|
|
if (w->height < w->min_height) {
|
|
|
|
window_invalidate(w);
|
|
|
|
w->height = w->min_height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void window_tile_inspector_update(rct_window *w) {
|
2015-12-28 23:11:36 +01:00
|
|
|
// Check if the mouse is hovering over the list
|
2016-05-30 00:35:50 +02:00
|
|
|
if (!widget_is_highlighted(w, WIDX_LIST)) {
|
2015-12-28 23:11:36 +01:00
|
|
|
window_tile_inspector_highlighted_index = -1;
|
|
|
|
widget_invalidate(w, WIDX_LIST);
|
|
|
|
}
|
2016-07-06 19:26:14 +02:00
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
if (gCurrentToolWidget.window_classification != WC_TILE_INSPECTOR)
|
2016-07-06 19:26:14 +02:00
|
|
|
window_close(w);
|
2015-12-28 23:11:36 +01:00
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void window_tile_inspector_tool_update(rct_window* w, int widgetIndex, int x, int y) {
|
2015-06-01 03:33:56 +02:00
|
|
|
int direction;
|
2015-07-10 02:39:16 +02:00
|
|
|
short mapX, mapY;
|
2015-06-01 03:33:56 +02:00
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
2016-06-05 00:45:13 +02:00
|
|
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
2015-06-01 03:33:56 +02:00
|
|
|
|
2015-07-13 22:43:54 +02:00
|
|
|
mapX = x;
|
|
|
|
mapY = y;
|
|
|
|
screen_pos_to_map_pos(&mapX, &mapY, &direction);
|
|
|
|
if (mapX == (short)0x8000) {
|
2016-06-05 00:45:13 +02:00
|
|
|
gMapSelectPositionA.x = gMapSelectPositionB.x = window_tile_inspector_tile_x << 5;
|
|
|
|
gMapSelectPositionA.y = gMapSelectPositionB.y = window_tile_inspector_tile_y << 5;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
|
|
|
gMapSelectPositionA.x = gMapSelectPositionB.x = mapX;
|
|
|
|
gMapSelectPositionA.y = gMapSelectPositionB.y = mapY;
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
|
|
|
|
2016-05-14 01:54:13 +02:00
|
|
|
gMapSelectType = MAP_SELECT_TYPE_FULL;
|
2015-06-01 03:33:56 +02:00
|
|
|
map_invalidate_selection_rect();
|
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void window_tile_inspector_tool_down(rct_window* w, int widgetIndex, int x, int y) {
|
2015-06-01 03:33:56 +02:00
|
|
|
int direction;
|
2015-07-10 02:39:16 +02:00
|
|
|
short mapX, mapY;
|
2015-06-01 03:33:56 +02:00
|
|
|
|
2015-07-13 22:43:54 +02:00
|
|
|
mapX = x;
|
|
|
|
mapY = y;
|
2015-07-10 02:39:16 +02:00
|
|
|
screen_pos_to_map_pos(&mapX, &mapY, &direction);
|
2015-07-13 22:43:54 +02:00
|
|
|
if (mapX == (short)0x8000) {
|
2015-06-01 03:33:56 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-07-13 22:43:54 +02:00
|
|
|
window_tile_inspector_tile_x = mapX >> 5;
|
|
|
|
window_tile_inspector_tile_y = mapY >> 5;
|
2015-06-01 03:33:56 +02:00
|
|
|
|
2016-06-05 00:45:13 +02:00
|
|
|
window_tile_inspector_load_tile(w);
|
|
|
|
window_tile_inspector_auto_set_buttons(w);
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void window_tile_inspector_scrollgetsize(rct_window *w, int scrollIndex, int *width, int *height) {
|
2015-07-10 02:39:16 +02:00
|
|
|
*width = WW - 30;
|
2015-12-28 23:11:36 +01:00
|
|
|
*height = window_tile_inspector_item_count * LIST_ITEM_HEIGHT;
|
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void window_tile_inspector_set_page(rct_window *w, const int page) {
|
2016-06-11 19:39:51 +02:00
|
|
|
w->page = page;
|
|
|
|
w->widgets = tile_inspector_widgets[page];
|
|
|
|
w->enabled_widgets = window_tile_inspector_page_enabled_widgets[page];
|
|
|
|
w->disabled_widgets = window_tile_inspector_page_disabled_widgets[page];
|
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void window_tile_inspector_auto_set_buttons(rct_window *w) {
|
2016-06-05 00:45:13 +02:00
|
|
|
// X and Y spinners
|
|
|
|
bool tile_is_selected = (window_tile_inspector_tile_x != -1) && (window_tile_inspector_tile_y != -1);
|
|
|
|
widget_set_enabled(w, WIDX_SPINNER_X_INCREASE, (tile_is_selected && (window_tile_inspector_tile_x < 255)));
|
|
|
|
widget_set_enabled(w, WIDX_SPINNER_X_DECREASE, (tile_is_selected && (window_tile_inspector_tile_x > 0)));
|
|
|
|
widget_set_enabled(w, WIDX_SPINNER_Y_INCREASE, (tile_is_selected && (window_tile_inspector_tile_y < 255)));
|
|
|
|
widget_set_enabled(w, WIDX_SPINNER_Y_DECREASE, (tile_is_selected && (window_tile_inspector_tile_y > 0)));
|
|
|
|
|
2016-06-11 19:39:51 +02:00
|
|
|
// Sort buttons
|
|
|
|
widget_set_enabled(w, WIDX_BUTTON_SORT, (tile_is_selected && window_tile_inspector_item_count > 1));
|
2016-04-17 00:55:56 +02:00
|
|
|
|
2015-12-29 17:55:35 +01:00
|
|
|
// Move Up button
|
2016-06-11 19:39:51 +02:00
|
|
|
widget_set_enabled(w, WIDX_BUTTON_MOVE_UP, (w->selected_list_item > 0));
|
|
|
|
widget_invalidate(w, WIDX_BUTTON_MOVE_UP);
|
2015-12-28 23:11:36 +01:00
|
|
|
|
2015-12-29 17:55:35 +01:00
|
|
|
// Move Down button
|
2016-06-11 19:39:51 +02:00
|
|
|
widget_set_enabled(w, WIDX_BUTTON_MOVE_DOWN, (w->selected_list_item != -1 && w->selected_list_item < window_tile_inspector_item_count - 1));
|
|
|
|
widget_invalidate(w, WIDX_BUTTON_MOVE_DOWN);
|
2015-12-28 23:11:36 +01:00
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void window_tile_inspector_scrollmousedown(rct_window *w, int scrollIndex, int x, int y) {
|
2016-06-11 19:39:51 +02:00
|
|
|
// Because the list items are displayed in reverse order, subtract the calculated index from the amount of elements
|
|
|
|
const sint16 index = window_tile_inspector_item_count - (y - 1) / LIST_ITEM_HEIGHT - 1;
|
|
|
|
int page;
|
2016-05-29 16:12:53 +02:00
|
|
|
if (index < 0 || index >= window_tile_inspector_item_count) {
|
|
|
|
w->selected_list_item = -1;
|
2016-06-11 19:39:51 +02:00
|
|
|
page = 0;
|
2016-05-29 16:12:53 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
w->selected_list_item = index;
|
|
|
|
|
2016-06-11 19:39:51 +02:00
|
|
|
// Get type of selected map element to select the correct page
|
2016-05-29 16:12:53 +02:00
|
|
|
rct_map_element *mapElement = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y);
|
|
|
|
mapElement += index;
|
2016-06-11 19:39:51 +02:00
|
|
|
page = (min(map_element_get_type(mapElement), MAP_ELEMENT_TYPE_CORRUPT) >> 2) + 1;
|
2016-05-29 16:12:53 +02:00
|
|
|
}
|
|
|
|
|
2016-06-11 19:39:51 +02:00
|
|
|
window_tile_inspector_set_page(w, page);
|
2015-12-28 23:11:36 +01:00
|
|
|
|
2015-12-29 17:55:35 +01:00
|
|
|
// Enable/disable buttons
|
|
|
|
window_tile_inspector_auto_set_buttons(w);
|
2016-05-29 16:12:53 +02:00
|
|
|
window_invalidate(w);
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void window_tile_inspector_scrollmouseover(rct_window *w, int scrollIndex, int x, int y) {
|
2015-12-28 23:11:36 +01:00
|
|
|
sint16 index = window_tile_inspector_item_count - (y - 1) / LIST_ITEM_HEIGHT - 1;
|
|
|
|
if (index < 0 || index >= window_tile_inspector_item_count)
|
|
|
|
window_tile_inspector_highlighted_index = -1;
|
|
|
|
else
|
|
|
|
window_tile_inspector_highlighted_index = index;
|
|
|
|
|
|
|
|
widget_invalidate(w, WIDX_LIST);
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void window_tile_inspector_invalidate(rct_window *w) {
|
2016-01-30 15:00:41 +01:00
|
|
|
colour_scheme_update(w);
|
|
|
|
|
2016-05-29 16:12:53 +02:00
|
|
|
w->widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
|
|
|
|
2016-05-31 20:13:26 +02:00
|
|
|
if (w->page == PAGE_DEFAULT) {
|
|
|
|
w->widgets[WIDX_GROUPBOX_DETAILS].type = WWT_EMPTY;
|
|
|
|
w->widgets[WIDX_GROUPBOX_PROPERTIES].type = WWT_EMPTY;
|
|
|
|
w->widgets[WIDX_LIST].bottom = w->height - PADDING_BOTTOM;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
w->widgets[WIDX_GROUPBOX_DETAILS].type = WWT_GROUPBOX;
|
|
|
|
w->widgets[WIDX_GROUPBOX_PROPERTIES].type = WWT_GROUPBOX;
|
|
|
|
w->widgets[WIDX_GROUPBOX_DETAILS].image = page_group_box_settings[w->page - 1].string_idx;
|
|
|
|
w->widgets[WIDX_GROUPBOX_DETAILS].top = w->height - page_group_box_settings[w->page - 1].details_top_offset;
|
|
|
|
w->widgets[WIDX_GROUPBOX_DETAILS].bottom = w->height - page_group_box_settings[w->page - 1].details_bottom_offset;
|
|
|
|
w->widgets[WIDX_GROUPBOX_PROPERTIES].top = w->height - page_group_box_settings[w->page - 1].properties_top_offset;
|
|
|
|
w->widgets[WIDX_GROUPBOX_PROPERTIES].bottom = w->height - page_group_box_settings[w->page - 1].properties_bottom_offset;
|
|
|
|
w->widgets[WIDX_LIST].bottom = w->widgets[WIDX_GROUPBOX_DETAILS].top - GROUPBOX_PADDING;
|
|
|
|
}
|
|
|
|
|
2016-09-18 14:30:34 +02:00
|
|
|
// Only page-specific widgets related to the map element will be
|
|
|
|
if (w->page == PAGE_DEFAULT) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-05-31 20:13:26 +02:00
|
|
|
// Using a switch, because I don't think giving each page their own callbacks is
|
|
|
|
// needed here, as only the mouseup and invalidate functions would be different.
|
2016-09-18 10:29:48 +02:00
|
|
|
const int details_anchor = w->widgets[WIDX_GROUPBOX_DETAILS].top;
|
|
|
|
const int properties_anchor = w->widgets[WIDX_GROUPBOX_PROPERTIES].top;
|
2016-09-18 14:30:34 +02:00
|
|
|
rct_map_element *const mapElement = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y) + w->selected_list_item;
|
|
|
|
|
2016-05-29 16:12:53 +02:00
|
|
|
switch (w->page) {
|
|
|
|
case PAGE_SURFACE:
|
2016-09-18 15:52:03 +02:00
|
|
|
w->widgets[WIDX_SURFACE_SPINNER_HEIGHT].top = GBBT(properties_anchor, 0) + 3;
|
|
|
|
w->widgets[WIDX_SURFACE_SPINNER_HEIGHT].bottom = GBBB(properties_anchor, 0) - 3;
|
|
|
|
w->widgets[WIDX_SURFACE_SPINNER_HEIGHT_INCREASE].top = GBBT(properties_anchor, 0) + 4;
|
|
|
|
w->widgets[WIDX_SURFACE_SPINNER_HEIGHT_INCREASE].bottom = GBBT(properties_anchor, 0) + 8;
|
|
|
|
w->widgets[WIDX_SURFACE_SPINNER_HEIGHT_DECREASE].top = GBBB(properties_anchor, 0) - 8;
|
|
|
|
w->widgets[WIDX_SURFACE_SPINNER_HEIGHT_DECREASE].bottom = GBBB(properties_anchor, 0) - 4;
|
|
|
|
w->widgets[WIDX_SURFACE_BUTTON_REMOVE_FENCES].top = GBBT(properties_anchor, 1);
|
|
|
|
w->widgets[WIDX_SURFACE_BUTTON_REMOVE_FENCES].bottom = GBBB(properties_anchor, 1);
|
|
|
|
w->widgets[WIDX_SURFACE_BUTTON_RESTORE_FENCES].top = GBBT(properties_anchor, 1);
|
|
|
|
w->widgets[WIDX_SURFACE_BUTTON_RESTORE_FENCES].bottom = GBBB(properties_anchor, 1);
|
|
|
|
w->widgets[WIDX_SURFACE_CHECK_CORNER_N].top = GBBT(properties_anchor, 2) + 7 * 0;
|
2016-09-18 14:30:34 +02:00
|
|
|
w->widgets[WIDX_SURFACE_CHECK_CORNER_N].bottom = w->widgets[WIDX_SURFACE_CHECK_CORNER_N].top + 13;
|
2016-09-18 15:52:03 +02:00
|
|
|
w->widgets[WIDX_SURFACE_CHECK_CORNER_E].top = GBBT(properties_anchor, 2) + 7 * 1;
|
2016-09-18 14:30:34 +02:00
|
|
|
w->widgets[WIDX_SURFACE_CHECK_CORNER_E].bottom = w->widgets[WIDX_SURFACE_CHECK_CORNER_E].top + 13;
|
2016-09-18 15:52:03 +02:00
|
|
|
w->widgets[WIDX_SURFACE_CHECK_CORNER_S].top = GBBT(properties_anchor, 2) + 7 * 2;
|
2016-09-18 14:30:34 +02:00
|
|
|
w->widgets[WIDX_SURFACE_CHECK_CORNER_S].bottom = w->widgets[WIDX_SURFACE_CHECK_CORNER_S].top + 13;
|
2016-09-18 15:52:03 +02:00
|
|
|
w->widgets[WIDX_SURFACE_CHECK_CORNER_W].top = GBBT(properties_anchor, 2) + 7 * 1;
|
2016-09-18 14:30:34 +02:00
|
|
|
w->widgets[WIDX_SURFACE_CHECK_CORNER_W].bottom = w->widgets[WIDX_SURFACE_CHECK_CORNER_W].top + 13;
|
2016-09-18 15:52:03 +02:00
|
|
|
w->widgets[WIDX_SURFACE_CHECK_DIAGONAL].top = GBBT(properties_anchor, 3) + 7 * 1;
|
|
|
|
w->widgets[WIDX_SURFACE_CHECK_DIAGONAL].bottom = w->widgets[WIDX_SURFACE_CHECK_DIAGONAL].top + 13;
|
2016-09-18 14:30:34 +02:00
|
|
|
widget_set_checkbox_value(w, WIDX_SURFACE_CHECK_CORNER_N, mapElement->properties.surface.slope & (1 << ((4 + 2 - get_current_rotation()) % 4)));
|
|
|
|
widget_set_checkbox_value(w, WIDX_SURFACE_CHECK_CORNER_E, mapElement->properties.surface.slope & (1 << ((4 + 3 - get_current_rotation()) % 4)));
|
|
|
|
widget_set_checkbox_value(w, WIDX_SURFACE_CHECK_CORNER_S, mapElement->properties.surface.slope & (1 << ((4 + 0 - get_current_rotation()) % 4)));
|
|
|
|
widget_set_checkbox_value(w, WIDX_SURFACE_CHECK_CORNER_W, mapElement->properties.surface.slope & (1 << ((4 + 1 - get_current_rotation()) % 4)));
|
|
|
|
widget_set_checkbox_value(w, WIDX_SURFACE_CHECK_DIAGONAL, mapElement->properties.surface.slope & 0x10);
|
2016-05-29 16:12:53 +02:00
|
|
|
break;
|
|
|
|
case PAGE_PATH:
|
2016-09-18 10:29:48 +02:00
|
|
|
w->widgets[WIDX_PATH_SPINNER_HEIGHT].top = GBBT(properties_anchor, 0) + 3;
|
|
|
|
w->widgets[WIDX_PATH_SPINNER_HEIGHT].bottom = GBBB(properties_anchor, 0) - 3;
|
|
|
|
w->widgets[WIDX_PATH_SPINNER_HEIGHT_INCREASE].top = GBBT(properties_anchor, 0) + 4;
|
|
|
|
w->widgets[WIDX_PATH_SPINNER_HEIGHT_INCREASE].bottom = GBBT(properties_anchor, 0) + 8;
|
|
|
|
w->widgets[WIDX_PATH_SPINNER_HEIGHT_DECREASE].top = GBBB(properties_anchor, 0) - 8;
|
|
|
|
w->widgets[WIDX_PATH_SPINNER_HEIGHT_DECREASE].bottom = GBBB(properties_anchor, 0) - 4;
|
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_N].top = GBBT(properties_anchor, 1) + 7 * 0;
|
2016-06-01 22:31:10 +02:00
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_N].bottom = w->widgets[WIDX_PATH_CHECK_EDGE_N].top + 13;
|
2016-09-18 10:29:48 +02:00
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_NE].top = GBBT(properties_anchor, 1) + 7 * 1;
|
2016-06-01 22:31:10 +02:00
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_NE].bottom = w->widgets[WIDX_PATH_CHECK_EDGE_NE].top + 13;
|
2016-09-18 10:29:48 +02:00
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_E].top = GBBT(properties_anchor, 1) + 7 * 2;
|
2016-06-01 22:31:10 +02:00
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_E].bottom = w->widgets[WIDX_PATH_CHECK_EDGE_E].top + 13;
|
2016-09-18 10:29:48 +02:00
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_SE].top = GBBT(properties_anchor, 1) + 7 * 3;
|
2016-06-01 22:31:10 +02:00
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_SE].bottom = w->widgets[WIDX_PATH_CHECK_EDGE_SE].top + 13;
|
2016-09-18 10:29:48 +02:00
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_S].top = GBBT(properties_anchor, 1) + 7 * 4;
|
2016-06-01 22:31:10 +02:00
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_S].bottom = w->widgets[WIDX_PATH_CHECK_EDGE_S].top + 13;
|
2016-09-18 10:29:48 +02:00
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_SW].top = GBBT(properties_anchor, 1) + 7 * 3;
|
2016-06-01 22:31:10 +02:00
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_SW].bottom = w->widgets[WIDX_PATH_CHECK_EDGE_SW].top + 13;
|
2016-09-18 10:29:48 +02:00
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_W].top = GBBT(properties_anchor, 1) + 7 * 2;
|
2016-06-01 22:31:10 +02:00
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_W].bottom = w->widgets[WIDX_PATH_CHECK_EDGE_W].top + 13;
|
2016-09-18 10:29:48 +02:00
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_NW].top = GBBT(properties_anchor, 1) + 7 * 1;
|
2016-06-01 22:31:10 +02:00
|
|
|
w->widgets[WIDX_PATH_CHECK_EDGE_NW].bottom = w->widgets[WIDX_PATH_CHECK_EDGE_NW].top + 13;
|
2016-09-18 10:29:48 +02:00
|
|
|
widget_set_checkbox_value(w, WIDX_PATH_CHECK_EDGE_NE, mapElement->properties.path.edges & (1 << ((0 + 4 - get_current_rotation()) % 4)));
|
|
|
|
widget_set_checkbox_value(w, WIDX_PATH_CHECK_EDGE_SE, mapElement->properties.path.edges & (1 << ((1 + 4 - get_current_rotation()) % 4)));
|
|
|
|
widget_set_checkbox_value(w, WIDX_PATH_CHECK_EDGE_SW, mapElement->properties.path.edges & (1 << ((2 + 4 - get_current_rotation()) % 4)));
|
|
|
|
widget_set_checkbox_value(w, WIDX_PATH_CHECK_EDGE_NW, mapElement->properties.path.edges & (1 << ((3 + 4 - get_current_rotation()) % 4)));
|
|
|
|
widget_set_checkbox_value(w, WIDX_PATH_CHECK_EDGE_E, mapElement->properties.path.edges & (1 << ((0 + 4 - get_current_rotation()) % 4 + 4)));
|
|
|
|
widget_set_checkbox_value(w, WIDX_PATH_CHECK_EDGE_S, mapElement->properties.path.edges & (1 << ((1 + 4 - get_current_rotation()) % 4 + 4)));
|
|
|
|
widget_set_checkbox_value(w, WIDX_PATH_CHECK_EDGE_W, mapElement->properties.path.edges & (1 << ((2 + 4 - get_current_rotation()) % 4 + 4)));
|
|
|
|
widget_set_checkbox_value(w, WIDX_PATH_CHECK_EDGE_N, mapElement->properties.path.edges & (1 << ((3 + 4 - get_current_rotation()) % 4 + 4)));
|
2016-05-29 16:12:53 +02:00
|
|
|
break;
|
|
|
|
case PAGE_TRACK:
|
2016-09-18 10:29:48 +02:00
|
|
|
w->widgets[WIDX_TRACK_CHECK_APPLY_TO_ALL].top = GBBT(properties_anchor, 0);
|
|
|
|
w->widgets[WIDX_TRACK_CHECK_APPLY_TO_ALL].bottom = GBBB(properties_anchor, 0);
|
|
|
|
w->widgets[WIDX_TRACK_SPINNER_HEIGHT].top = GBBT(properties_anchor, 1) + 3;
|
|
|
|
w->widgets[WIDX_TRACK_SPINNER_HEIGHT].bottom = GBBB(properties_anchor, 1) - 3;
|
|
|
|
w->widgets[WIDX_TRACK_SPINNER_HEIGHT_INCREASE].top = GBBT(properties_anchor, 1) + 4;
|
|
|
|
w->widgets[WIDX_TRACK_SPINNER_HEIGHT_INCREASE].bottom = GBBT(properties_anchor, 1) + 8;
|
|
|
|
w->widgets[WIDX_TRACK_SPINNER_HEIGHT_DECREASE].top = GBBB(properties_anchor, 1) - 8;
|
|
|
|
w->widgets[WIDX_TRACK_SPINNER_HEIGHT_DECREASE].bottom = GBBB(properties_anchor, 1) - 4;
|
|
|
|
w->widgets[WIDX_TRACK_CHECK_CHAIN_LIFT].top = GBBT(properties_anchor, 2);
|
|
|
|
w->widgets[WIDX_TRACK_CHECK_CHAIN_LIFT].bottom = GBBB(properties_anchor, 2);
|
2016-06-05 22:07:11 +02:00
|
|
|
widget_set_checkbox_value(w, WIDX_TRACK_CHECK_APPLY_TO_ALL, window_tile_inspector_apply_to_all);
|
|
|
|
widget_set_checkbox_value(w, WIDX_TRACK_CHECK_CHAIN_LIFT, track_element_is_lift_hill(mapElement));
|
2016-05-29 16:12:53 +02:00
|
|
|
break;
|
2016-09-18 10:29:48 +02:00
|
|
|
case PAGE_SCENERY: {
|
|
|
|
// Raise / Lower
|
|
|
|
w->widgets[WIDX_SCENERY_SPINNER_HEIGHT].top = GBBT(properties_anchor, 0) + 3;
|
|
|
|
w->widgets[WIDX_SCENERY_SPINNER_HEIGHT].bottom = GBBB(properties_anchor, 0) - 3;
|
|
|
|
w->widgets[WIDX_SCENERY_SPINNER_HEIGHT_INCREASE].top = GBBT(properties_anchor, 0) + 4;
|
|
|
|
w->widgets[WIDX_SCENERY_SPINNER_HEIGHT_INCREASE].bottom = GBBT(properties_anchor, 0) + 8;
|
|
|
|
w->widgets[WIDX_SCENERY_SPINNER_HEIGHT_DECREASE].top = GBBB(properties_anchor, 0) - 8;
|
|
|
|
w->widgets[WIDX_SCENERY_SPINNER_HEIGHT_DECREASE].bottom = GBBB(properties_anchor, 0) - 4;
|
|
|
|
|
|
|
|
// Quadrant checkboxes
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_QUARTER_N].top = GBBT(properties_anchor, 1) - 5 + 7 * 0;
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_QUARTER_N].bottom = w->widgets[WIDX_SCENERY_CHECK_QUARTER_N].top + 13;
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_QUARTER_E].top = GBBT(properties_anchor, 1) - 5 + 7 * 1;
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_QUARTER_E].bottom = w->widgets[WIDX_SCENERY_CHECK_QUARTER_E].top + 13;
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_QUARTER_S].top = GBBT(properties_anchor, 1) - 5 + 7 * 2;
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_QUARTER_S].bottom = w->widgets[WIDX_SCENERY_CHECK_QUARTER_S].top + 13;
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_QUARTER_W].top = GBBT(properties_anchor, 1) - 5 + 7 * 1;
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_QUARTER_W].bottom = w->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 = (mapElement->type & MAP_ELEMENT_QUADRANT_MASK) == ((0 + 4 - get_current_rotation()) % 4) << 6;
|
|
|
|
bool E = (mapElement->type & MAP_ELEMENT_QUADRANT_MASK) == ((1 + 4 - get_current_rotation()) % 4) << 6;
|
|
|
|
bool S = (mapElement->type & MAP_ELEMENT_QUADRANT_MASK) == ((2 + 4 - get_current_rotation()) % 4) << 6;
|
|
|
|
bool W = (mapElement->type & MAP_ELEMENT_QUADRANT_MASK) == ((3 + 4 - get_current_rotation()) % 4) << 6;
|
|
|
|
widget_set_checkbox_value(w, WIDX_SCENERY_CHECK_QUARTER_N, N);
|
|
|
|
widget_set_checkbox_value(w, WIDX_SCENERY_CHECK_QUARTER_E, E);
|
|
|
|
widget_set_checkbox_value(w, WIDX_SCENERY_CHECK_QUARTER_S, S);
|
|
|
|
widget_set_checkbox_value(w, WIDX_SCENERY_CHECK_QUARTER_W, W);
|
|
|
|
|
|
|
|
// Collision checkboxes
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_COLLISION_N].top = GBBT(properties_anchor, 2) + 5 + 7 * 0;
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_COLLISION_N].bottom = w->widgets[WIDX_SCENERY_CHECK_COLLISION_N].top + 13;
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_COLLISION_E].top = GBBT(properties_anchor, 2) + 5 + 7 * 1;
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_COLLISION_E].bottom = w->widgets[WIDX_SCENERY_CHECK_COLLISION_E].top + 13;
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_COLLISION_S].top = GBBT(properties_anchor, 2) + 5 + 7 * 2;
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_COLLISION_S].bottom = w->widgets[WIDX_SCENERY_CHECK_COLLISION_S].top + 13;
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_COLLISION_W].top = GBBT(properties_anchor, 2) + 5 + 7 * 1;
|
|
|
|
w->widgets[WIDX_SCENERY_CHECK_COLLISION_W].bottom = w->widgets[WIDX_SCENERY_CHECK_COLLISION_W].top + 13;
|
|
|
|
N = mapElement->flags & (1 << ((2 + 4 - get_current_rotation()) % 4));
|
|
|
|
E = mapElement->flags & (1 << ((3 + 4 - get_current_rotation()) % 4));
|
|
|
|
S = mapElement->flags & (1 << ((0 + 4 - get_current_rotation()) % 4));
|
|
|
|
W = mapElement->flags & (1 << ((1 + 4 - get_current_rotation()) % 4));
|
|
|
|
widget_set_checkbox_value(w, WIDX_SCENERY_CHECK_COLLISION_N, N);
|
|
|
|
widget_set_checkbox_value(w, WIDX_SCENERY_CHECK_COLLISION_E, E);
|
|
|
|
widget_set_checkbox_value(w, WIDX_SCENERY_CHECK_COLLISION_S, S);
|
|
|
|
widget_set_checkbox_value(w, WIDX_SCENERY_CHECK_COLLISION_W, W);
|
2016-05-29 16:12:53 +02:00
|
|
|
break;
|
2016-09-18 10:29:48 +02:00
|
|
|
}
|
2016-05-29 16:12:53 +02:00
|
|
|
case PAGE_ENTRANCE:
|
2016-05-31 20:13:26 +02:00
|
|
|
|
2016-05-29 16:12:53 +02:00
|
|
|
break;
|
|
|
|
case PAGE_FENCE:
|
2016-09-18 10:29:48 +02:00
|
|
|
w->widgets[WIDX_FENCE_SPINNER_HEIGHT].top = GBBT(properties_anchor, 0) + 3;
|
|
|
|
w->widgets[WIDX_FENCE_SPINNER_HEIGHT].bottom = GBBB(properties_anchor, 0) - 3;
|
|
|
|
w->widgets[WIDX_FENCE_SPINNER_HEIGHT_INCREASE].top = GBBT(properties_anchor, 0) + 4;
|
|
|
|
w->widgets[WIDX_FENCE_SPINNER_HEIGHT_INCREASE].bottom = GBBT(properties_anchor, 0) + 8;
|
|
|
|
w->widgets[WIDX_FENCE_SPINNER_HEIGHT_DECREASE].top = GBBB(properties_anchor, 0) - 8;
|
|
|
|
w->widgets[WIDX_FENCE_SPINNER_HEIGHT_DECREASE].bottom = GBBB(properties_anchor, 0) - 4;
|
2016-05-29 16:12:53 +02:00
|
|
|
break;
|
|
|
|
case PAGE_LARGE_SCENERY:
|
2016-05-31 20:13:26 +02:00
|
|
|
|
2016-05-29 16:12:53 +02:00
|
|
|
break;
|
|
|
|
case PAGE_BANNER:
|
2016-05-31 20:13:26 +02:00
|
|
|
|
2016-05-29 16:12:53 +02:00
|
|
|
break;
|
|
|
|
case PAGE_CORRUPT:
|
2016-05-31 20:13:26 +02:00
|
|
|
|
2016-05-29 16:12:53 +02:00
|
|
|
break;
|
|
|
|
}
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) {
|
2015-06-01 03:33:56 +02:00
|
|
|
window_draw_widgets(w, dpi);
|
|
|
|
|
2016-01-01 20:06:00 +01:00
|
|
|
// Set medium font size
|
2016-04-26 00:00:58 +02:00
|
|
|
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
2016-01-01 20:06:00 +01:00
|
|
|
|
|
|
|
// Draw column headers
|
|
|
|
rct_widget *widget;
|
2016-09-18 16:07:07 +02:00
|
|
|
if ((widget = &w->widgets[WIDX_COLUMN_TYPE])->type != WWT_EMPTY) {
|
2016-05-15 23:03:53 +02:00
|
|
|
gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_ELEMENT_TYPE, gCommonFormatArgs, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left);
|
2016-01-01 20:06:00 +01:00
|
|
|
}
|
2016-05-30 00:35:50 +02:00
|
|
|
if ((widget = &w->widgets[WIDX_COLUMN_BASEHEIGHT])->type != WWT_EMPTY) {
|
2016-05-15 23:03:53 +02:00
|
|
|
gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_SHORT, gCommonFormatArgs, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left);
|
2016-01-01 20:06:00 +01:00
|
|
|
}
|
2016-05-30 00:35:50 +02:00
|
|
|
if ((widget = &w->widgets[WIDX_COLUMN_CLEARANCEHEIGHT])->type != WWT_EMPTY) {
|
2016-05-15 23:03:53 +02:00
|
|
|
gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_CLEARANGE_HEIGHT_SHORT, gCommonFormatArgs, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left);
|
2016-01-01 20:06:00 +01:00
|
|
|
}
|
2016-05-30 00:35:50 +02:00
|
|
|
if ((widget = &w->widgets[WIDX_COLUMN_GHOSTFLAG])->type != WWT_EMPTY) {
|
2016-05-15 23:03:53 +02:00
|
|
|
gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_FLAG_GHOST_SHORT, gCommonFormatArgs, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left);
|
2016-01-01 20:06:00 +01:00
|
|
|
}
|
2016-05-30 00:35:50 +02:00
|
|
|
if ((widget = &w->widgets[WIDX_COLUMN_BROKENFLAG])->type != WWT_EMPTY) {
|
2016-05-15 23:03:53 +02:00
|
|
|
gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_FLAG_BROKEN_SHORT, gCommonFormatArgs, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left);
|
2016-01-01 20:06:00 +01:00
|
|
|
}
|
2016-05-30 00:35:50 +02:00
|
|
|
if ((widget = &w->widgets[WIDX_COLUMN_LASTFLAG])->type != WWT_EMPTY) {
|
2016-05-15 23:03:53 +02:00
|
|
|
gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_FLAG_LAST_SHORT, gCommonFormatArgs, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left);
|
2016-01-01 20:06:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Draw coordinates
|
2016-06-05 00:45:13 +02:00
|
|
|
gfx_draw_string(dpi, "X:", 12, w->x + 6, w->y + 24);
|
|
|
|
gfx_draw_string(dpi, "Y:", 12, w->x + 64, w->y + 24);
|
|
|
|
if (window_tile_inspector_tile_x != -1 && window_tile_inspector_tile_y != -1) {
|
2016-09-11 23:02:34 +02:00
|
|
|
gfx_draw_string_right(dpi, STR_FORMAT_INTEGER, &window_tile_inspector_tile_x, 12, w->x + 48, w->y + 24);
|
|
|
|
gfx_draw_string_right(dpi, STR_FORMAT_INTEGER, &window_tile_inspector_tile_y, 12, w->x + 105, w->y + 24);
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
2016-05-29 16:12:53 +02:00
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
if (w->selected_list_item != -1) {
|
2016-09-11 23:02:34 +02:00
|
|
|
// X and Y of first element in detail box
|
|
|
|
int x = w->x + w->widgets[WIDX_GROUPBOX_DETAILS].left + 7;
|
|
|
|
int y = w->y + w->widgets[WIDX_GROUPBOX_DETAILS].top + 14;
|
|
|
|
|
2016-05-29 16:12:53 +02:00
|
|
|
// Get map element
|
|
|
|
rct_map_element *mapElement = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y);
|
|
|
|
mapElement += w->selected_list_item;
|
|
|
|
|
2016-06-05 22:07:11 +02:00
|
|
|
switch (w->page) {
|
|
|
|
case PAGE_SURFACE: {
|
2016-09-18 14:30:34 +02:00
|
|
|
// Details
|
|
|
|
// Terrain texture name
|
2016-05-29 16:12:53 +02:00
|
|
|
rct_string_id terrain_name_id = TerrainTypes[map_element_get_terrain(mapElement)];
|
2016-09-18 14:30:34 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SURFACE_TERAIN, &terrain_name_id, 12, x, y);
|
|
|
|
|
|
|
|
// Edge texture name
|
2016-05-29 16:12:53 +02:00
|
|
|
rct_string_id terrain_edge_name_id = TerrainEdgeTypes[map_element_get_terrain_edge(mapElement)];
|
2016-09-18 14:30:34 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SURFACE_EDGE, &terrain_edge_name_id, 12, x, y + 11);
|
|
|
|
|
|
|
|
// Land ownership
|
2016-06-05 12:50:42 +02:00
|
|
|
rct_string_id land_ownership;
|
|
|
|
if (mapElement->properties.surface.ownership & OWNERSHIP_OWNED) land_ownership = STR_LAND_OWNED;
|
|
|
|
else if (mapElement->properties.surface.ownership & OWNERSHIP_AVAILABLE) land_ownership = STR_LAND_SALE;
|
|
|
|
else if (mapElement->properties.surface.ownership & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED) land_ownership = STR_CONSTRUCTION_RIGHTS_OWNED;
|
|
|
|
else if (mapElement->properties.surface.ownership & OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE) land_ownership = STR_CONSTRUCTION_RIGHTS_SALE;
|
2016-09-18 16:07:07 +02:00
|
|
|
else land_ownership = STR_TILE_INSPECTOR_LAND_NOT_OWNED_AND_NOT_AVAILABLE;
|
2016-06-05 12:50:42 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SURFACE_OWNERSHIP, &land_ownership, 12, x, y + 22);
|
2016-09-18 14:30:34 +02:00
|
|
|
|
|
|
|
// Water level
|
|
|
|
int water_level = mapElement->properties.surface.terrain & MAP_ELEMENT_WATER_HEIGHT_MASK;
|
2016-06-05 12:50:42 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SURFACE_WATER_LEVEL, &water_level, 12, x, y + 33);
|
2016-09-18 14:30:34 +02:00
|
|
|
|
|
|
|
// Properties
|
2016-09-18 15:52:03 +02:00
|
|
|
// Raise / lower label
|
|
|
|
x = w->x + w->widgets[WIDX_GROUPBOX_DETAILS].left + 7;
|
|
|
|
y = w->y + w->widgets[WIDX_SURFACE_SPINNER_HEIGHT].top;
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_RAISE_LOWER, NULL, 12, x, y);
|
|
|
|
|
|
|
|
// Current base height
|
|
|
|
x = w->x + w->widgets[WIDX_SURFACE_SPINNER_HEIGHT].left + 3;
|
|
|
|
int base_height = mapElement->base_height;
|
|
|
|
gfx_draw_string_left(dpi, STR_FORMAT_INTEGER, &base_height, 12, x, y);
|
|
|
|
|
2016-09-18 14:30:34 +02:00
|
|
|
// Raised corners
|
|
|
|
x = w->x + w->widgets[WIDX_GROUPBOX_DETAILS].left + 7;
|
|
|
|
y = w->y + w->widgets[WIDX_SURFACE_CHECK_CORNER_E].top;
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SURFACE_CORNERS, NULL, 12, x, y);
|
2016-05-29 16:12:53 +02:00
|
|
|
break;
|
|
|
|
}
|
2016-05-30 00:35:50 +02:00
|
|
|
|
2016-06-05 22:07:11 +02:00
|
|
|
case PAGE_PATH: {
|
2016-09-12 22:47:58 +02:00
|
|
|
// Details
|
|
|
|
// Path name
|
|
|
|
rct_string_id path_name_id = get_footpath_entry(footpath_element_get_type(mapElement))->string_idx;
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_PATH_NAME, &path_name_id, 12, x, y);
|
|
|
|
|
|
|
|
// Path addition
|
2016-05-30 00:35:50 +02:00
|
|
|
if (footpath_element_has_path_scenery(mapElement)) {
|
|
|
|
const uint8 pathAdditionType = footpath_element_get_path_scenery_index(mapElement);
|
|
|
|
rct_string_id addition_name_id = get_footpath_item_entry(pathAdditionType)->name;
|
2016-09-12 22:47:58 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_PATH_ADDITIONS, &addition_name_id, 12, x, y + 11);
|
2016-05-30 00:35:50 +02:00
|
|
|
}
|
|
|
|
else
|
2016-09-12 22:47:58 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_PATH_ADDITIONS_NONE, NULL, 12, x, y + 11);
|
2016-05-30 00:35:50 +02:00
|
|
|
|
2016-09-12 22:47:58 +02:00
|
|
|
// Properties
|
2016-06-01 22:31:10 +02:00
|
|
|
// Raise / lower label
|
2016-05-31 20:13:26 +02:00
|
|
|
x = w->x + w->widgets[WIDX_GROUPBOX_DETAILS].left + 7;
|
2016-06-01 22:31:10 +02:00
|
|
|
y = w->y + w->widgets[WIDX_PATH_SPINNER_HEIGHT].top;
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_RAISE_LOWER, NULL, 12, x, y);
|
|
|
|
|
|
|
|
// Current base height
|
|
|
|
x = w->x + w->widgets[WIDX_PATH_SPINNER_HEIGHT].left + 3;
|
|
|
|
int base_height = mapElement->base_height;
|
2016-09-11 23:02:34 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_FORMAT_INTEGER, &base_height, 12, x, y);
|
2016-06-01 22:31:10 +02:00
|
|
|
|
|
|
|
// Path connections
|
2016-05-31 20:13:26 +02:00
|
|
|
x = w->x + w->widgets[WIDX_GROUPBOX_DETAILS].left + 7;
|
2016-06-01 22:31:10 +02:00
|
|
|
y = w->y + w->widgets[WIDX_PATH_CHECK_EDGE_W].top;
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_PATH_CONECTED_EDGES, NULL, 12, x, y);
|
2016-05-30 00:35:50 +02:00
|
|
|
break;
|
|
|
|
}
|
2016-06-05 22:07:11 +02:00
|
|
|
|
|
|
|
case PAGE_TRACK: {
|
|
|
|
// Details
|
2016-06-05 23:33:34 +02:00
|
|
|
// Ride
|
2016-06-05 22:07:11 +02:00
|
|
|
sint16 ride_id = mapElement->properties.track.ride_index;
|
2016-06-05 23:11:01 +02:00
|
|
|
rct_ride *ride = get_ride(ride_id);
|
|
|
|
rct_string_id ride_type = STR_RIDE_NAME_SPIRAL_ROLLER_COASTER + ride->type;
|
2016-06-05 22:07:11 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_TRACK_RIDE_TYPE, &ride_type, 12, x, y);
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_TRACK_RIDE_ID, &ride_id, 12, x, y + 11);
|
2016-06-05 23:11:01 +02:00
|
|
|
set_format_arg(0, rct_string_id, ride->name);
|
|
|
|
set_format_arg(0 + sizeof(rct_string_id), uint32, ride->name_arguments);
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_TRACK_RIDE_NAME, gCommonFormatArgs, 12, x, y + 22);
|
2016-06-05 23:33:34 +02:00
|
|
|
// Track
|
|
|
|
sint16 track_type = mapElement->properties.track.type;
|
|
|
|
sint16 sequence_number = mapElement->properties.track.sequence & 0xF;
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_TRACK_PIECE_ID, &track_type, 12, x, y + 33);
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_TRACK_SEQUENCE, &sequence_number, 12, x, y + 44);
|
2016-06-05 22:07:11 +02:00
|
|
|
|
|
|
|
// Properties
|
|
|
|
// Raise / lower label
|
|
|
|
y = w->y + w->widgets[WIDX_TRACK_SPINNER_HEIGHT].top;
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_RAISE_LOWER, NULL, 12, x, y);
|
|
|
|
|
|
|
|
// Current base height
|
|
|
|
x = w->x + w->widgets[WIDX_TRACK_SPINNER_HEIGHT].left + 3;
|
|
|
|
int base_height = mapElement->base_height;
|
2016-09-11 23:02:34 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_FORMAT_INTEGER, &base_height, 12, x, y);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
case PAGE_SCENERY: {
|
2016-09-18 10:29:48 +02:00
|
|
|
// Details
|
|
|
|
// Age
|
2016-09-18 14:30:34 +02:00
|
|
|
sint16 age = mapElement->properties.scenery.age;
|
2016-09-18 10:29:48 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SCENERY_AGE, &age, 12, x, y);
|
|
|
|
|
|
|
|
// Quadrant value
|
|
|
|
if (!(get_small_scenery_entry(mapElement->properties.scenery.type)->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE)) {
|
|
|
|
sint16 quadrant = (mapElement->type & MAP_ELEMENT_QUADRANT_MASK) >> 6;
|
|
|
|
static rct_string_id quadrant_string_idx[] = {
|
|
|
|
STR_TILE_INSPECTOR_SCENERY_QUADRANT_SW,
|
|
|
|
STR_TILE_INSPECTOR_SCENERY_QUADRANT_NW,
|
|
|
|
STR_TILE_INSPECTOR_SCENERY_QUADRANT_NE,
|
|
|
|
STR_TILE_INSPECTOR_SCENERY_QUADRANT_SE
|
|
|
|
};
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SCENERY_QUADRANT, &quadrant_string_idx[quadrant], 12, x, y + 11);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Scenery ID
|
|
|
|
sint16 idx = mapElement->properties.scenery.type;
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SCENERY_ENTRY_IDX, &idx, 12, x, y + 22);
|
|
|
|
|
|
|
|
// Properties
|
|
|
|
// Raise / Lower
|
|
|
|
y = w->y + w->widgets[WIDX_SCENERY_SPINNER_HEIGHT].top;
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_RAISE_LOWER, NULL, 12, x, y);
|
|
|
|
|
|
|
|
// Current base height
|
|
|
|
x = w->x + w->widgets[WIDX_SCENERY_SPINNER_HEIGHT].left + 3;
|
|
|
|
int base_height = mapElement->base_height;
|
|
|
|
gfx_draw_string_left(dpi, STR_FORMAT_INTEGER, &base_height, 12, x, y);
|
|
|
|
|
|
|
|
// Quarter tile
|
|
|
|
x = w->x + w->widgets[WIDX_GROUPBOX_DETAILS].left + 7;
|
|
|
|
y = w->y + w->widgets[WIDX_SCENERY_CHECK_QUARTER_E].top;
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_SCENERY_QUADRANT_LABEL, NULL, 12, x, y);
|
|
|
|
|
|
|
|
// Collision
|
|
|
|
y = w->y + w->widgets[WIDX_SCENERY_CHECK_COLLISION_E].top;
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_COLLISSION, NULL, 12, x, y);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PAGE_FENCE: {
|
2016-09-11 23:02:34 +02:00
|
|
|
// Properties
|
|
|
|
// Raise / lower label
|
|
|
|
y = w->y + w->widgets[WIDX_FENCE_SPINNER_HEIGHT].top;
|
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_RAISE_LOWER, NULL, 12, x, y);
|
|
|
|
|
|
|
|
// Current base height
|
|
|
|
x = w->x + w->widgets[WIDX_FENCE_SPINNER_HEIGHT].left + 3;
|
|
|
|
int base_height = mapElement->base_height;
|
|
|
|
gfx_draw_string_left(dpi, STR_FORMAT_INTEGER, &base_height, 12, x, y);
|
2016-06-05 22:07:11 +02:00
|
|
|
break;
|
2016-05-29 16:12:53 +02:00
|
|
|
}
|
2016-06-05 22:07:11 +02:00
|
|
|
} // switch page
|
2016-05-29 16:12:53 +02:00
|
|
|
}
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
|
|
|
|
2016-09-18 16:07:07 +02:00
|
|
|
static void window_tile_inspector_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex) {
|
2015-12-28 23:11:36 +01:00
|
|
|
int x = 3;
|
|
|
|
int y = LIST_ITEM_HEIGHT * (window_tile_inspector_item_count - 1);
|
|
|
|
int i = 0;
|
2015-06-01 03:33:56 +02:00
|
|
|
char buffer[256];
|
|
|
|
|
|
|
|
if (window_tile_inspector_tile_x == -1)
|
|
|
|
return;
|
|
|
|
|
2016-06-05 22:07:11 +02:00
|
|
|
rct_map_element *mapElement = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y);
|
2015-06-01 03:33:56 +02:00
|
|
|
|
2016-04-26 00:00:58 +02:00
|
|
|
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
2015-06-01 03:33:56 +02:00
|
|
|
do {
|
2016-06-05 22:07:11 +02:00
|
|
|
int type = map_element_get_type(mapElement);
|
2015-06-01 03:33:56 +02:00
|
|
|
char *type_name;
|
2016-06-05 22:07:11 +02:00
|
|
|
int base_height = mapElement->base_height;
|
|
|
|
int clearance_height = mapElement->clearance_height;
|
2015-06-01 03:33:56 +02:00
|
|
|
|
2015-12-28 23:11:36 +01:00
|
|
|
// Fill colour for current list element
|
2015-12-29 23:19:01 +01:00
|
|
|
const int list_width = w->widgets[WIDX_LIST].right - w->widgets[WIDX_LIST].left;
|
2015-12-28 23:11:36 +01:00
|
|
|
if (i == w->selected_list_item) // Currently selected element
|
2015-12-29 23:19:01 +01:00
|
|
|
gfx_fill_rect(dpi, 0, y, list_width, y + LIST_ITEM_HEIGHT - 1, ColourMapA[w->colours[1]].darker | 0x1000000);
|
2015-12-28 23:11:36 +01:00
|
|
|
else if (i == window_tile_inspector_highlighted_index) // Hovering
|
2015-12-29 23:19:01 +01:00
|
|
|
gfx_fill_rect(dpi, 0, y, list_width, y + LIST_ITEM_HEIGHT - 1, ColourMapA[w->colours[1]].mid_dark | 0x1000000);
|
2015-12-28 23:11:36 +01:00
|
|
|
else if ((i & 1) != 0) // odd / even check
|
2015-12-29 23:19:01 +01:00
|
|
|
gfx_fill_rect(dpi, 0, y, list_width, y + LIST_ITEM_HEIGHT - 1, ColourMapA[w->colours[1]].lighter | 0x1000000);
|
2015-06-01 03:33:56 +02:00
|
|
|
|
|
|
|
switch (type) {
|
2016-05-29 16:12:53 +02:00
|
|
|
case MAP_ELEMENT_TYPE_SURFACE:
|
|
|
|
type_name = "Surface";
|
|
|
|
break;
|
|
|
|
case MAP_ELEMENT_TYPE_PATH:
|
2016-06-05 22:07:11 +02:00
|
|
|
type_name = footpath_element_is_queue(mapElement) ? "Queue" : "Footpath";
|
|
|
|
break;
|
2016-05-29 16:12:53 +02:00
|
|
|
case MAP_ELEMENT_TYPE_TRACK:
|
2016-06-05 22:07:11 +02:00
|
|
|
type_name = "Track";
|
2015-06-01 03:33:56 +02:00
|
|
|
break;
|
2016-05-29 16:12:53 +02:00
|
|
|
case MAP_ELEMENT_TYPE_SCENERY:
|
|
|
|
snprintf(
|
|
|
|
buffer, sizeof(buffer),
|
|
|
|
"Scenery (%s)",
|
2016-06-05 22:07:11 +02:00
|
|
|
language_get_string(get_small_scenery_entry(mapElement->properties.scenery.type)->name)
|
2016-05-29 16:12:53 +02:00
|
|
|
);
|
|
|
|
type_name = buffer;
|
|
|
|
break;
|
|
|
|
case MAP_ELEMENT_TYPE_ENTRANCE:
|
|
|
|
snprintf(
|
|
|
|
buffer, sizeof(buffer),
|
|
|
|
"Entrance (%s)",
|
2016-06-05 22:07:11 +02:00
|
|
|
language_get_string(EntranceTypes[mapElement->properties.entrance.type])
|
|
|
|
);
|
2016-05-29 16:12:53 +02:00
|
|
|
type_name = buffer;
|
|
|
|
break;
|
|
|
|
case MAP_ELEMENT_TYPE_FENCE:
|
|
|
|
snprintf(
|
|
|
|
buffer, sizeof(buffer),
|
|
|
|
"Fence (%s)",
|
2016-06-05 22:07:11 +02:00
|
|
|
language_get_string(get_wall_entry(mapElement->properties.scenery.type)->name)
|
|
|
|
);
|
2016-05-29 16:12:53 +02:00
|
|
|
type_name = buffer;
|
|
|
|
break;
|
|
|
|
case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
|
|
|
|
type_name = "Scenery multiple";
|
|
|
|
break;
|
|
|
|
case MAP_ELEMENT_TYPE_BANNER:
|
|
|
|
snprintf(
|
|
|
|
buffer, sizeof(buffer),
|
|
|
|
"Banner (%d)",
|
2016-06-05 22:07:11 +02:00
|
|
|
mapElement->properties.banner.index
|
2016-05-29 16:12:53 +02:00
|
|
|
);
|
|
|
|
type_name = buffer;
|
|
|
|
break;
|
|
|
|
case MAP_ELEMENT_TYPE_CORRUPT:
|
|
|
|
// fall-through
|
|
|
|
default:
|
|
|
|
snprintf(buffer, sizeof(buffer), "Unknown (type %d)", type);
|
|
|
|
type_name = buffer;
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
|
|
|
|
2015-12-29 23:19:01 +01:00
|
|
|
// Undo relative scroll offset, but keep the 3 pixel padding
|
2016-01-01 19:29:41 +01:00
|
|
|
x = -w->widgets[WIDX_LIST].left;
|
2016-06-05 22:07:11 +02:00
|
|
|
const bool ghost = (mapElement->flags & MAP_ELEMENT_FLAG_GHOST) != 0;
|
|
|
|
const bool broken = (mapElement->flags & MAP_ELEMENT_FLAG_BROKEN) != 0;
|
|
|
|
const bool last = (mapElement->flags & MAP_ELEMENT_FLAG_LAST_TILE) != 0;
|
2016-01-01 19:29:41 +01:00
|
|
|
gfx_draw_string(dpi, type_name, 12, x + COL_X_TYPE + 3, y); // 3px padding
|
2016-07-14 14:07:49 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_FORMAT_INTEGER, &base_height, 12, x + COL_X_BH, y);
|
|
|
|
gfx_draw_string_left(dpi, STR_FORMAT_INTEGER, &clearance_height, 12, x + COL_X_CH, y);
|
2016-01-01 20:35:08 +01:00
|
|
|
if (ghost) gfx_draw_string(dpi, (char*)CheckBoxMarkString, w->colours[1], x + COL_X_GF, y);
|
|
|
|
if (broken) gfx_draw_string(dpi, (char*)CheckBoxMarkString, w->colours[1], x + COL_X_BF, y);
|
|
|
|
if (last) gfx_draw_string(dpi, (char*)CheckBoxMarkString, w->colours[1], x + COL_X_LF, y);
|
2015-06-01 03:33:56 +02:00
|
|
|
|
2015-12-28 23:11:36 +01:00
|
|
|
y -= LIST_ITEM_HEIGHT;
|
2015-06-01 03:33:56 +02:00
|
|
|
i++;
|
2016-06-05 22:07:11 +02:00
|
|
|
} while (!map_element_is_last_for_tile(mapElement++));
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|