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
|
|
|
|
|
|
|
#include "../addresses.h"
|
2016-07-06 19:26:14 +02:00
|
|
|
#include "../input.h"
|
2015-06-01 03:33:56 +02:00
|
|
|
#include "../localisation/localisation.h"
|
2016-01-30 15:00:41 +01:00
|
|
|
#include "../interface/themes.h"
|
2015-06-01 03:33:56 +02:00
|
|
|
#include "../interface/widget.h"
|
|
|
|
#include "../interface/window.h"
|
|
|
|
#include "../interface/viewport.h"
|
|
|
|
#include "../world/scenery.h"
|
|
|
|
#include "../world/map.h"
|
|
|
|
#include "../world/footpath.h"
|
2016-01-01 19:29:41 +01:00
|
|
|
#include "../sprites.h"
|
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,
|
2015-11-07 11:04:57 +01:00
|
|
|
WIDX_CORRUPT,
|
2015-12-28 23:11:36 +01:00
|
|
|
WIDX_REMOVE,
|
|
|
|
WIDX_MOVE_DOWN,
|
|
|
|
WIDX_MOVE_UP,
|
2016-04-17 00:35:11 +02:00
|
|
|
WIDX_ROTATE,
|
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,
|
2015-06-01 03:33:56 +02:00
|
|
|
};
|
|
|
|
|
2016-01-01 19:29:41 +01:00
|
|
|
#define WW 400
|
2015-12-30 01:18:12 +01:00
|
|
|
#define WH 200
|
2015-12-28 23:11:36 +01:00
|
|
|
#define MIN_WW WW
|
2016-01-01 19:29:41 +01:00
|
|
|
#define MAX_WW WW
|
2015-06-01 03:33:56 +02:00
|
|
|
#define MIN_WH 150
|
|
|
|
#define MAX_WH 800
|
|
|
|
|
2016-01-01 19:29:41 +01: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
|
|
|
|
#define BS 24
|
2015-12-28 23:11:36 +01:00
|
|
|
|
|
|
|
#define SCROLL_BOTTOM_OFFSET 15
|
|
|
|
#define LIST_ITEM_HEIGHT 11
|
2015-12-21 00:52:42 +01:00
|
|
|
|
2015-12-29 23:19:01 +01:00
|
|
|
// Column offsets
|
2016-01-01 20:06:00 +01:00
|
|
|
#define COL_X_TYPE 3 // Type
|
2016-01-01 19:29:41 +01:00
|
|
|
#define COL_X_BH (COL_X_TYPE + 300) // Base height
|
2015-12-30 00:11:55 +01:00
|
|
|
#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
|
|
|
|
2015-06-01 03:33:56 +02:00
|
|
|
rct_widget window_tile_inspector_widgets[] = {
|
2016-04-17 00:35:11 +02:00
|
|
|
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0x0FFFFFFFF, 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
|
2015-12-28 23:11:36 +01:00
|
|
|
|
|
|
|
// Map element list
|
2016-04-17 00:35:11 +02:00
|
|
|
{ WWT_SCROLL, 1, 3, WW - 4, 57, WH - SCROLL_BOTTOM_OFFSET, 2, STR_NONE }, // scroll area
|
2015-12-28 23:11:36 +01:00
|
|
|
|
|
|
|
// Buttons
|
2016-04-17 00:35:11 +02:00
|
|
|
{ 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, 5375, STR_MOVE_SELECTED_ELEMENT_UP_TIP }, // Move down
|
|
|
|
{ WWT_CLOSEBOX, 1, BX - BS * 2, BW - BS * 2, BH - 11, BH, 5376, 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
|
2015-12-28 23:11:36 +01:00
|
|
|
|
2015-12-29 23:19:01 +01:00
|
|
|
// Column headers
|
2016-04-17 00:35:11 +02:00
|
|
|
{ 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
|
|
|
|
{ WWT_13, 1, COL_X_LF, WW - 3, 42, 42 + 13, STR_NONE, STR_TILE_INSPECTOR_FLAG_LAST }, // Last of tile flag
|
2015-12-29 23:19:01 +01:00
|
|
|
|
2015-06-01 03:33:56 +02:00
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
2015-12-28 23:11:36 +01:00
|
|
|
static sint16 window_tile_inspector_highlighted_index = -1;
|
|
|
|
|
2015-06-01 03:33:56 +02:00
|
|
|
static int window_tile_inspector_tile_x;
|
|
|
|
static int window_tile_inspector_tile_y;
|
|
|
|
static int window_tile_inspector_item_count;
|
|
|
|
|
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);
|
|
|
|
|
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
|
|
|
|
};
|
|
|
|
|
|
|
|
void window_tile_inspector_open()
|
|
|
|
{
|
|
|
|
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
|
|
|
);
|
|
|
|
window->widgets = window_tile_inspector_widgets;
|
|
|
|
window->enabled_widgets = (1 << WIDX_CLOSE);
|
2016-04-17 00:35:11 +02:00
|
|
|
window->disabled_widgets = (1 << WIDX_CORRUPT) | (1 << WIDX_MOVE_UP) | (1 << WIDX_MOVE_DOWN) | (1 << WIDX_REMOVE) | (1 << WIDX_ROTATE);
|
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);
|
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-04-17 11:58:13 +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-04-17 11:58:13 +02:00
|
|
|
static void rotate_element(int index)
|
2016-04-17 00:35:11 +02:00
|
|
|
{
|
|
|
|
uint8 new_rotation;
|
|
|
|
|
|
|
|
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;
|
|
|
|
switch (map_element_get_type(mapElement))
|
|
|
|
{
|
|
|
|
case MAP_ELEMENT_TYPE_PATH: // Only sloped paths have a direction
|
|
|
|
if (footpath_element_is_sloped(mapElement))
|
|
|
|
{
|
|
|
|
new_rotation = (footpath_element_get_slope_direction(mapElement) + 1) & 3;
|
|
|
|
mapElement->properties.path.type &= ~3;
|
|
|
|
mapElement->properties.path.type |= new_rotation;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MAP_ELEMENT_TYPE_TRACK:
|
|
|
|
case MAP_ELEMENT_TYPE_SCENERY:
|
|
|
|
case MAP_ELEMENT_TYPE_ENTRANCE:
|
|
|
|
case MAP_ELEMENT_TYPE_FENCE:
|
|
|
|
new_rotation = (mapElement->type + 1) & 0x3;
|
|
|
|
mapElement->type &= ~0x3;
|
|
|
|
mapElement->type |= new_rotation;
|
|
|
|
break;
|
|
|
|
case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
|
|
|
|
case MAP_ELEMENT_TYPE_BANNER:
|
|
|
|
case MAP_ELEMENT_TYPE_CORRUPT:
|
|
|
|
default:
|
|
|
|
// Not rotating - button should be disabled
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
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-04-17 11:58:13 +02:00
|
|
|
static void swap_elements(sint16 first, sint16 second)
|
2015-12-21 00:52:42 +01:00
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
2015-07-10 02:39:16 +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;
|
2015-11-07 11:04:57 +01:00
|
|
|
case WIDX_CORRUPT:
|
2016-04-17 00:35:11 +02:00
|
|
|
corrupt_element();
|
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;
|
2015-12-28 23:11:36 +01:00
|
|
|
case WIDX_REMOVE:
|
2015-12-29 15:43:49 +01:00
|
|
|
remove_element(w->selected_list_item);
|
|
|
|
w->selected_list_item = -1;
|
2016-01-01 17:21:48 +01:00
|
|
|
window_tile_inspector_auto_set_buttons(w);
|
2015-12-28 23:11:36 +01:00
|
|
|
widget_invalidate(w, WIDX_LIST);
|
|
|
|
break;
|
2016-04-17 00:35:11 +02:00
|
|
|
case WIDX_ROTATE:
|
|
|
|
rotate_element(w->selected_list_item);
|
|
|
|
break;
|
2015-12-28 23:11:36 +01:00
|
|
|
case WIDX_MOVE_DOWN:
|
|
|
|
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;
|
|
|
|
case WIDX_MOVE_UP:
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-10 02:39:16 +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-07-06 19:33:12 +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
|
|
|
|
if (!widget_is_highlighted(w, WIDX_LIST))
|
|
|
|
{
|
|
|
|
window_tile_inspector_highlighted_index = -1;
|
|
|
|
widget_invalidate(w, WIDX_LIST);
|
|
|
|
}
|
2016-07-06 19:26:14 +02:00
|
|
|
|
|
|
|
if(gCurrentToolWidget.window_classification != WC_TILE_INSPECTOR)
|
|
|
|
window_close(w);
|
2015-12-28 23:11:36 +01:00
|
|
|
}
|
|
|
|
|
2015-07-10 02:39:16 +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-05-14 01:54: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) {
|
2015-06-01 03:33:56 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-05-14 01:54:13 +02:00
|
|
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
|
|
|
gMapSelectPositionA.x = mapX;
|
|
|
|
gMapSelectPositionA.y = mapY;
|
|
|
|
gMapSelectPositionB.x = mapX;
|
|
|
|
gMapSelectPositionB.y = mapY;
|
|
|
|
gMapSelectType = MAP_SELECT_TYPE_FULL;
|
2015-06-01 03:33:56 +02:00
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-07-10 02:39:16 +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
|
|
|
|
|
|
|
rct_map_element *element = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y);
|
|
|
|
int numItems = 0;
|
|
|
|
do {
|
|
|
|
numItems++;
|
|
|
|
} while (!map_element_is_last_for_tile(element++));
|
|
|
|
|
|
|
|
window_tile_inspector_item_count = numItems;
|
|
|
|
|
2015-12-28 23:11:36 +01:00
|
|
|
// Enable 'insert corrupt element' button
|
|
|
|
w->enabled_widgets |= (1 << WIDX_CORRUPT);
|
|
|
|
w->disabled_widgets &= ~(1ULL << WIDX_CORRUPT);
|
|
|
|
// undo selection and buttons affecting it
|
|
|
|
w->selected_list_item = -1;
|
2016-04-17 00:35:11 +02:00
|
|
|
w->disabled_widgets |= (1ULL << WIDX_MOVE_UP) | (1ULL << WIDX_MOVE_DOWN) | (1ULL << WIDX_REMOVE) | (1 << WIDX_ROTATE);
|
|
|
|
w->enabled_widgets &= ~((1ULL << WIDX_MOVE_UP) | (1ULL << WIDX_MOVE_DOWN) | (1ULL << WIDX_REMOVE) | (1 << WIDX_ROTATE));
|
2015-11-07 11:04:57 +01:00
|
|
|
|
2015-06-01 03:33:56 +02:00
|
|
|
w->scrolls[0].v_top = 0;
|
|
|
|
window_invalidate(w);
|
|
|
|
}
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_tile_inspector_scrollgetsize(rct_window *w, int scrollIndex, int *width, int *height)
|
2015-06-01 03:33:56 +02:00
|
|
|
{
|
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;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2016-04-17 00:55:56 +02:00
|
|
|
// Remove button
|
2015-12-29 17:55:35 +01:00
|
|
|
if (w->selected_list_item == -1) { // Check if anything is selected
|
2016-04-17 12:21:45 +02:00
|
|
|
w->disabled_widgets |= (1ULL << WIDX_REMOVE);
|
|
|
|
w->enabled_widgets &= ~((1ULL << WIDX_REMOVE));
|
2015-12-29 17:55:35 +01:00
|
|
|
} else { // Nothing is selected
|
2016-04-17 12:21:45 +02:00
|
|
|
w->disabled_widgets &= ~((1ULL << WIDX_REMOVE));
|
|
|
|
w->enabled_widgets |= (1ULL << WIDX_REMOVE);
|
2015-12-29 17:55:35 +01:00
|
|
|
}
|
|
|
|
widget_invalidate(w, WIDX_REMOVE);
|
2016-04-17 00:55:56 +02:00
|
|
|
|
|
|
|
// Rotate button
|
|
|
|
rct_map_element *mapElement = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y);
|
|
|
|
mapElement += w->selected_list_item;
|
|
|
|
switch (map_element_get_type(mapElement)) {
|
|
|
|
case MAP_ELEMENT_TYPE_PATH:
|
|
|
|
case MAP_ELEMENT_TYPE_TRACK:
|
|
|
|
case MAP_ELEMENT_TYPE_SCENERY:
|
|
|
|
case MAP_ELEMENT_TYPE_ENTRANCE:
|
|
|
|
case MAP_ELEMENT_TYPE_FENCE:
|
|
|
|
w->enabled_widgets |= (1 << WIDX_ROTATE);
|
|
|
|
w->disabled_widgets &= ~(1 << WIDX_ROTATE);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
w->disabled_widgets |= (1 << WIDX_ROTATE);
|
|
|
|
w->enabled_widgets &= ~(1 << WIDX_ROTATE);
|
|
|
|
break;
|
|
|
|
}
|
2016-04-17 00:35:11 +02:00
|
|
|
widget_invalidate(w, WIDX_ROTATE);
|
2015-12-29 17:55:35 +01:00
|
|
|
|
|
|
|
// Move Up button
|
2016-01-01 19:29:41 +01:00
|
|
|
if (w->selected_list_item <= 0) { // Top element in list, or -1
|
2015-12-28 23:11:36 +01:00
|
|
|
w->disabled_widgets |= (1ULL << WIDX_MOVE_UP);
|
|
|
|
w->enabled_widgets &= ~(1ULL << WIDX_MOVE_UP);
|
|
|
|
} else { // Not the top element in the list
|
|
|
|
w->enabled_widgets |= (1ULL << WIDX_MOVE_UP);
|
|
|
|
w->disabled_widgets &= ~(1ULL << WIDX_MOVE_UP);
|
|
|
|
}
|
|
|
|
widget_invalidate(w, WIDX_MOVE_UP);
|
|
|
|
|
2015-12-29 17:55:35 +01:00
|
|
|
// Move Down button
|
2016-01-01 19:29:41 +01:00
|
|
|
if (w->selected_list_item == window_tile_inspector_item_count - 1 || w->selected_list_item == -1) { // Bottom element in list, or -1
|
2015-12-28 23:11:36 +01:00
|
|
|
w->disabled_widgets |= (1ULL << WIDX_MOVE_DOWN);
|
|
|
|
w->enabled_widgets &= ~(1ULL << WIDX_MOVE_DOWN);
|
|
|
|
} else { // Not the bottom element in the list
|
|
|
|
w->enabled_widgets |= (1ULL << WIDX_MOVE_DOWN);
|
|
|
|
w->disabled_widgets &= ~(1ULL << WIDX_MOVE_DOWN);
|
|
|
|
}
|
|
|
|
widget_invalidate(w, WIDX_MOVE_DOWN);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void window_tile_inspector_scrollmousedown(rct_window *w, int scrollIndex, int x, int y)
|
|
|
|
{
|
|
|
|
// Because the list items are displayed in reverse order, subtract the number from the amount of elements
|
|
|
|
sint16 index = window_tile_inspector_item_count - (y - 1) / LIST_ITEM_HEIGHT - 1;
|
|
|
|
if (index < 0 || index >= window_tile_inspector_item_count)
|
|
|
|
return;
|
|
|
|
w->selected_list_item = index;
|
|
|
|
|
2015-12-29 17:55:35 +01:00
|
|
|
// Enable/disable buttons
|
|
|
|
window_tile_inspector_auto_set_buttons(w);
|
2016-04-17 01:01:03 +02:00
|
|
|
widget_invalidate(w, WIDX_LIST);
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_tile_inspector_scrollmouseover(rct_window *w, int scrollIndex, int x, int y)
|
2015-06-01 03:33:56 +02:00
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_tile_inspector_invalidate(rct_window *w)
|
2015-06-01 03:33:56 +02:00
|
|
|
{
|
2016-01-30 15:00:41 +01:00
|
|
|
colour_scheme_update(w);
|
|
|
|
|
2015-06-01 03:33:56 +02:00
|
|
|
window_tile_inspector_widgets[WIDX_BACKGROUND].right = w->width - 1;
|
|
|
|
window_tile_inspector_widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
|
|
|
window_tile_inspector_widgets[WIDX_CLOSE].left = w->width - 13;
|
|
|
|
window_tile_inspector_widgets[WIDX_CLOSE].right = w->width - 3;
|
2015-12-28 23:11:36 +01:00
|
|
|
window_tile_inspector_widgets[WIDX_TITLE].right = w->width - 2;
|
2016-01-01 20:06:00 +01:00
|
|
|
window_tile_inspector_widgets[WIDX_LIST].right = w->width - 4;
|
2015-12-28 23:11:36 +01:00
|
|
|
window_tile_inspector_widgets[WIDX_LIST].bottom = w->height - SCROLL_BOTTOM_OFFSET;
|
2016-01-01 20:06:00 +01:00
|
|
|
window_tile_inspector_widgets[WIDX_COLUMN_LASTFLAG].right = w->width - 3;
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
|
|
|
|
2015-07-10 02:39:16 +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;
|
|
|
|
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
|
|
|
}
|
|
|
|
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
|
|
|
}
|
|
|
|
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
|
|
|
}
|
|
|
|
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
|
|
|
}
|
|
|
|
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
|
|
|
}
|
|
|
|
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-04-17 12:21:45 +02:00
|
|
|
int x = w->x + w->widgets[WIDX_LIST].left;
|
|
|
|
int y = w->y + w->height - 13;
|
|
|
|
|
2015-12-29 23:19:01 +01:00
|
|
|
if (window_tile_inspector_tile_x == -1) { // No tile selected
|
2015-06-01 03:33:56 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_CHOOSE_MSG, NULL, 12, x, y);
|
|
|
|
} else {
|
2016-04-17 12:21:45 +02:00
|
|
|
char buffer[256];
|
2015-06-01 03:33:56 +02:00
|
|
|
sprintf(
|
|
|
|
buffer,
|
|
|
|
"X: %d, Y: %d",
|
|
|
|
window_tile_inspector_tile_x,
|
|
|
|
window_tile_inspector_tile_y
|
|
|
|
);
|
|
|
|
|
|
|
|
gfx_draw_string(dpi, buffer, 12, x, y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_tile_inspector_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex)
|
2015-06-01 03:33:56 +02:00
|
|
|
{
|
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;
|
|
|
|
|
|
|
|
rct_map_element *element = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y);
|
|
|
|
|
2016-04-26 00:00:58 +02:00
|
|
|
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
2015-06-01 03:33:56 +02:00
|
|
|
do {
|
|
|
|
int type = map_element_get_type(element);
|
|
|
|
char *type_name;
|
|
|
|
int base_height = element->base_height;
|
|
|
|
int clearance_height = element->clearance_height;
|
|
|
|
|
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) {
|
|
|
|
case MAP_ELEMENT_TYPE_SURFACE:
|
|
|
|
sprintf(
|
|
|
|
buffer,
|
|
|
|
"Surface (%s, %s)",
|
|
|
|
language_get_string(STR_TILE_INSPECTOR_TERRAIN_START + map_element_get_terrain(element)),
|
|
|
|
language_get_string(STR_TILE_INSPECTOR_TERRAIN_EDGE_START + map_element_get_terrain_edge(element))
|
|
|
|
);
|
|
|
|
type_name = buffer;
|
|
|
|
break;
|
|
|
|
case MAP_ELEMENT_TYPE_PATH:
|
|
|
|
{
|
2015-12-03 23:49:26 +01:00
|
|
|
const uint8 pathType = footpath_element_get_type(element);
|
|
|
|
const uint8 pathHasScenery = footpath_element_has_path_scenery(element);
|
|
|
|
const uint8 pathAdditionType = footpath_element_get_path_scenery_index(element);
|
2015-08-04 18:40:02 +02:00
|
|
|
if (footpath_element_is_queue(element)) {
|
|
|
|
sprintf(
|
2015-12-03 16:20:05 +01:00
|
|
|
buffer, "Queue (%s)%s%s for (%d)",
|
2016-05-15 17:07:19 +02:00
|
|
|
language_get_string(get_footpath_entry(pathType)->string_idx), // Path name
|
2015-12-03 23:49:26 +01:00
|
|
|
pathHasScenery ? " with " : "", // Adds " with " when there is something on the path
|
2016-05-15 17:07:19 +02:00
|
|
|
pathHasScenery ? language_get_string(get_footpath_item_entry(pathAdditionType)->name) : "", // Path addition name
|
2015-12-03 23:49:26 +01:00
|
|
|
element->properties.path.ride_index // Ride index for queue
|
2015-08-04 18:40:02 +02:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
sprintf(
|
2015-12-03 16:20:05 +01:00
|
|
|
buffer, "Path (%s)%s%s",
|
2016-05-23 20:11:35 +02:00
|
|
|
language_get_string(get_footpath_entry(pathType)->string_idx), // Path name
|
2015-12-03 23:49:26 +01:00
|
|
|
pathHasScenery ? " with " : "", // Adds " with " when there is something on the path
|
2016-05-15 17:07:19 +02:00
|
|
|
pathHasScenery ? language_get_string(get_footpath_item_entry(pathAdditionType)->name) : "" // Path addition name
|
2015-08-04 18:40:02 +02:00
|
|
|
);
|
|
|
|
}
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
|
|
|
type_name = buffer;
|
|
|
|
break;
|
|
|
|
case MAP_ELEMENT_TYPE_TRACK:
|
2015-12-30 00:51:40 +01:00
|
|
|
sprintf(
|
|
|
|
buffer,
|
|
|
|
"Track (%s)",
|
2016-01-22 15:38:52 +01:00
|
|
|
language_get_string(2 + get_ride(element->properties.track.ride_index)->type)
|
2015-12-30 00:51:40 +01:00
|
|
|
);
|
|
|
|
type_name = buffer;
|
2015-06-01 03:33:56 +02:00
|
|
|
break;
|
|
|
|
case MAP_ELEMENT_TYPE_SCENERY:
|
|
|
|
sprintf(
|
|
|
|
buffer,
|
|
|
|
"Scenery (%s)",
|
2016-05-15 17:07:19 +02:00
|
|
|
language_get_string(get_small_scenery_entry(element->properties.scenery.type)->name)
|
2015-06-01 03:33:56 +02:00
|
|
|
);
|
|
|
|
type_name = buffer;
|
|
|
|
break;
|
|
|
|
case MAP_ELEMENT_TYPE_ENTRANCE:
|
|
|
|
sprintf(
|
|
|
|
buffer,
|
|
|
|
"Entrance (%s)",
|
|
|
|
language_get_string(STR_TILE_INSPECTOR_ENTRANCE_START + element->properties.entrance.type)
|
|
|
|
);
|
|
|
|
type_name = buffer;
|
|
|
|
break;
|
|
|
|
case MAP_ELEMENT_TYPE_FENCE:
|
|
|
|
sprintf(
|
|
|
|
buffer,
|
|
|
|
"Fence (%s)",
|
2016-05-15 17:07:19 +02:00
|
|
|
language_get_string(get_wall_entry(element->properties.scenery.type)->name)
|
2015-06-01 03:33:56 +02:00
|
|
|
);
|
|
|
|
type_name = buffer;
|
|
|
|
break;
|
|
|
|
case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
|
|
|
|
type_name = "Scenery multiple";
|
|
|
|
break;
|
|
|
|
case MAP_ELEMENT_TYPE_BANNER:
|
|
|
|
sprintf(
|
|
|
|
buffer,
|
|
|
|
"Banner (%d)",
|
|
|
|
element->properties.banner.index
|
|
|
|
);
|
|
|
|
type_name = buffer;
|
|
|
|
break;
|
2015-12-27 00:59:22 +01:00
|
|
|
case MAP_ELEMENT_TYPE_CORRUPT:
|
|
|
|
// fall-through
|
|
|
|
default:
|
|
|
|
sprintf(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-01-01 20:35:08 +01:00
|
|
|
const bool ghost = (element->flags & MAP_ELEMENT_FLAG_GHOST) != 0;
|
|
|
|
const bool broken = (element->flags & MAP_ELEMENT_FLAG_BROKEN) != 0;
|
|
|
|
const bool last = (element->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
|
2015-12-29 23:19:01 +01:00
|
|
|
gfx_draw_string_left(dpi, 5182, &base_height, 12, x + COL_X_BH, y);
|
|
|
|
gfx_draw_string_left(dpi, 5182, &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++;
|
|
|
|
} while (!map_element_is_last_for_tile(element++));
|
|
|
|
}
|