mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #1310 from rd3k/debug-inspector
Add debug toolbar menu, start tile inspector
This commit is contained in:
commit
ae8464d31f
|
@ -3644,3 +3644,35 @@ STR_5307 :RollerCoaster Tycoon 1 (AA + LL)
|
|||
STR_5308 :RollerCoaster Tycoon 2
|
||||
STR_5309 :OpenRCT2
|
||||
STR_5310 :Random
|
||||
STR_5311 :{SMALLFONT}{BLACK}Debug tools
|
||||
STR_5312 :Show console
|
||||
STR_5313 :Show tile inspector
|
||||
STR_5314 :Tile inspector
|
||||
STR_5315 :Grass
|
||||
STR_5316 :Sand
|
||||
STR_5317 :Dirt
|
||||
STR_5318 :Rock
|
||||
STR_5319 :Martian
|
||||
STR_5320 :Checkerboard
|
||||
STR_5321 :Grass clumps
|
||||
STR_5322 :Ice
|
||||
STR_5323 :Grid (red)
|
||||
STR_5324 :Grid (yellow)
|
||||
STR_5325 :Grid (blue)
|
||||
STR_5326 :Grid (green)
|
||||
STR_5327 :Sand (dark)
|
||||
STR_5328 :Sand (light)
|
||||
STR_5329 :Checkerboard (inverted)
|
||||
STR_5330 :Underground view
|
||||
STR_5331 :Rock
|
||||
STR_5332 :Wood (red)
|
||||
STR_5333 :Wood (black)
|
||||
STR_5334 :Ice
|
||||
STR_5335 :Ride entrance
|
||||
STR_5336 :Ride exit
|
||||
STR_5337 :Park entrance
|
||||
STR_5338 :Element type
|
||||
STR_5339 :Base height
|
||||
STR_5340 :Clearance height
|
||||
STR_5341 :Flags
|
||||
STR_5342 :Choose a map tile
|
|
@ -142,6 +142,7 @@
|
|||
<ClCompile Include="..\src\windows\staff_list.c" />
|
||||
<ClCompile Include="..\src\windows\staff.c" />
|
||||
<ClCompile Include="..\src\windows\text_input.c" />
|
||||
<ClCompile Include="..\src\windows\tile_inspector.c" />
|
||||
<ClCompile Include="..\src\windows\title_exit.c" />
|
||||
<ClCompile Include="..\src\windows\title_logo.c" />
|
||||
<ClCompile Include="..\src\windows\title_menu.c" />
|
||||
|
|
|
@ -474,6 +474,9 @@
|
|||
<ClCompile Include="..\test\ride\ride_ratings_test.c">
|
||||
<Filter>Test\Ride</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\windows\tile_inspector.c">
|
||||
<Filter>Source\Windows</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\management\award.h">
|
||||
|
|
|
@ -403,6 +403,12 @@ static int cc_clear(const char **argv, int argc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cc_hide(const char **argv, int argc)
|
||||
{
|
||||
console_close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cc_echo(const char **argv, int argc)
|
||||
{
|
||||
if (argc > 0)
|
||||
|
@ -835,7 +841,8 @@ char* console_window_table[] = {
|
|||
};
|
||||
|
||||
console_command console_command_table[] = {
|
||||
{ "clear", cc_clear, "Clears the console." "clear"},
|
||||
{ "clear", cc_clear, "Clears the console.", "clear"},
|
||||
{ "hide", cc_hide, "Hides the console.", "hide"},
|
||||
{ "echo", cc_echo, "Echos the text to the console.", "echo <text>" },
|
||||
{ "help", cc_help, "Lists commands or info about a command.", "help [command]" },
|
||||
{ "get", cc_get, "Gets the value of the specified variable.", "get <variable>" },
|
||||
|
|
|
@ -412,11 +412,13 @@ enum {
|
|||
WC_TITLE_OPTIONS = 117,
|
||||
WC_LAND_RIGHTS = 118,
|
||||
WC_THEMES = 119,
|
||||
WC_TILE_INSPECTOR = 120,
|
||||
|
||||
// Only used for colour schemes
|
||||
WC_STAFF = 220,
|
||||
WC_EDITOR_TRACK_BOTTOM_TOOLBAR = 221,
|
||||
WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR = 222,
|
||||
|
||||
} WINDOW_CLASS;
|
||||
|
||||
enum PROMPT_MODE {
|
||||
|
@ -572,6 +574,7 @@ void window_publisher_credits_open();
|
|||
void window_track_manage_open();
|
||||
void window_viewport_open();
|
||||
void window_themes_open();
|
||||
void window_tile_inspector_open();
|
||||
void window_text_input_open(rct_window* call_w, int call_widget, rct_string_id title, rct_string_id description, rct_string_id existing_text, uint32 existing_args, int maxLength);
|
||||
void window_text_input_raw_open(rct_window* call_w, int call_widget, rct_string_id title, rct_string_id description, utf8string existing_text, int maxLength);
|
||||
rct_window *window_mapgen_open();
|
||||
|
|
|
@ -1491,6 +1491,19 @@ enum {
|
|||
STR_CHEAT_SANDBOX_MODE_DISABLE = 5279,
|
||||
STR_CHEAT_SANDBOX_MODE_TIP = 5280,
|
||||
|
||||
STR_DEBUG_TIP = 5311,
|
||||
STR_DEBUG_DROPDOWN_CONSOLE = 5312,
|
||||
STR_DEBUG_DROPDOWN_TILE_INSPECTOR = 5313,
|
||||
STR_TILE_INSPECTOR_TITLE = 5314,
|
||||
STR_TILE_INSPECTOR_TERRAIN_START = 5315,
|
||||
STR_TILE_INSPECTOR_TERRAIN_EDGE_START = 5331,
|
||||
STR_TILE_INSPECTOR_ENTRANCE_START = 5335,
|
||||
STR_TILE_INSPECTOR_ELEMENT_TYPE = 5338,
|
||||
STR_TILE_INSPECTOR_BASE_HEIGHT = 5339,
|
||||
STR_TILE_INSPECTOR_CLEARANGE_HEIGHT = 5340,
|
||||
STR_TILE_INSPECTOR_FLAGS = 5341,
|
||||
STR_TILE_INSPECTOR_CHOOSE_MSG = 5342,
|
||||
|
||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||
STR_COUNT = 32768
|
||||
};
|
||||
|
|
|
@ -119,8 +119,8 @@ enum WINDOW_OPTIONS_WIDGET_IDX {
|
|||
WIDX_AUTOSAVE,
|
||||
WIDX_AUTOSAVE_DROPDOWN,
|
||||
WIDX_ALLOW_SUBTYPE_SWITCHING,
|
||||
WIDX_DEBUGGING_TOOLS,
|
||||
WIDX_TEST_UNFINISHED_TRACKS,
|
||||
WIDX_DEBUGGING_TOOLS,
|
||||
|
||||
// Twitch
|
||||
WIDX_CHANNEL_BUTTON = WIDX_PAGE_START,
|
||||
|
@ -516,6 +516,7 @@ static void window_options_mouseup()
|
|||
gConfigGeneral.debugging_tools ^= 1;
|
||||
config_save_default();
|
||||
window_invalidate(w);
|
||||
window_invalidate_by_class(WC_TOP_TOOLBAR);
|
||||
break;
|
||||
case WIDX_TEST_UNFINISHED_TRACKS:
|
||||
gConfigGeneral.test_unfinished_tracks ^= 1;
|
||||
|
@ -1337,4 +1338,4 @@ static void window_options_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w
|
|||
window_options_draw_tab_image(dpi, w, WINDOW_OPTIONS_PAGE_TWITCH, SPR_G2_TAB_TWITCH);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
#pragma endregion
|
|
@ -0,0 +1,426 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (c) 2014 Ted John
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* This file is part of 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.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../addresses.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../interface/widget.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../world/scenery.h"
|
||||
#include "../world/map.h"
|
||||
#include "../world/footpath.h"
|
||||
|
||||
enum WINDOW_TILE_INSPECTOR_WIDGET_IDX {
|
||||
WIDX_BACKGROUND,
|
||||
WIDX_TITLE,
|
||||
WIDX_CLOSE,
|
||||
WIDX_CONTENT_PANEL,
|
||||
WIDX_SCROLL
|
||||
};
|
||||
|
||||
#define WW 500
|
||||
#define WH 400
|
||||
#define MIN_WH 150
|
||||
#define MAX_WH 800
|
||||
|
||||
rct_widget window_tile_inspector_widgets[] = {
|
||||
{ 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
|
||||
{ WWT_RESIZE, 1, 0, WW - 1, 43, WH - 1, 0x0FFFFFFFF, STR_NONE }, // content panel
|
||||
{ WWT_SCROLL, 1, 3, WW - 3, 65, WH - 30, 3, STR_NONE }, // scroll area
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
static int window_tile_inspector_tile_x;
|
||||
static int window_tile_inspector_tile_y;
|
||||
static int window_tile_inspector_item_count;
|
||||
|
||||
static void window_tile_inspector_emptysub() { }
|
||||
static void window_tile_inspector_close();
|
||||
static void window_tile_inspector_tool_update();
|
||||
static void window_tile_inspector_tool_down();
|
||||
static void window_tile_inspector_tool_abort();
|
||||
static void window_tile_inspector_scrollgetsize();
|
||||
static void window_tile_inspector_scrollmouseover();
|
||||
static void window_tile_inspector_mouseup();
|
||||
static void window_tile_inspector_resize();
|
||||
static void window_tile_inspector_invalidate();
|
||||
static void window_tile_inspector_paint();
|
||||
static void window_tile_inspector_scrollpaint();
|
||||
|
||||
static void* window_tile_inspector_events[] = {
|
||||
window_tile_inspector_close,
|
||||
window_tile_inspector_mouseup,
|
||||
window_tile_inspector_resize,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_tool_update,
|
||||
window_tile_inspector_tool_down,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_tool_abort,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_scrollgetsize,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_scrollmouseover,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_emptysub,
|
||||
window_tile_inspector_emptysub,
|
||||
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,
|
||||
(uint32*)window_tile_inspector_events,
|
||||
WC_TILE_INSPECTOR,
|
||||
0x100
|
||||
);
|
||||
window->widgets = window_tile_inspector_widgets;
|
||||
window->enabled_widgets = (1 << WIDX_CLOSE);
|
||||
|
||||
window_init_scroll_widgets(window);
|
||||
window->colours[0] = 7;
|
||||
window->colours[1] = 7;
|
||||
window->colours[2] = 7;
|
||||
window->flags |= WF_RESIZABLE;
|
||||
window->min_width = WW;
|
||||
window->min_height = MIN_WH;
|
||||
window->max_width = WW;
|
||||
window->max_height = MAX_WH;
|
||||
|
||||
window_tile_inspector_tile_x = -1;
|
||||
window_tile_inspector_tile_y = -1;
|
||||
|
||||
tool_set(window, WIDX_BACKGROUND, 62);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_close()
|
||||
{
|
||||
tool_cancel();
|
||||
}
|
||||
|
||||
static void window_tile_inspector_mouseup()
|
||||
{
|
||||
short widgetIndex;
|
||||
rct_window *w;
|
||||
|
||||
window_widget_get_registers(w, widgetIndex);
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_CLOSE:
|
||||
window_close(w);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void window_tile_inspector_resize()
|
||||
{
|
||||
rct_window *w;
|
||||
|
||||
window_get_register(w);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
static void window_tile_inspector_tool_update()
|
||||
{
|
||||
short widgetIndex;
|
||||
rct_window *w;
|
||||
short x, y;
|
||||
int direction;
|
||||
|
||||
window_tool_get_registers(w, widgetIndex, x, y);
|
||||
map_invalidate_selection_rect();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~(1 << 0);
|
||||
screen_pos_to_map_pos(&x, &y, &direction);
|
||||
|
||||
if (x == (short)0x8000) {
|
||||
return;
|
||||
}
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) = x;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) = y;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) = x;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) = y;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 4;
|
||||
|
||||
map_invalidate_selection_rect();
|
||||
|
||||
}
|
||||
|
||||
static void window_tile_inspector_tool_down()
|
||||
{
|
||||
short widgetIndex;
|
||||
rct_window* w;
|
||||
short x, y;
|
||||
int direction;
|
||||
|
||||
window_tool_get_registers(w, widgetIndex, x, y);
|
||||
screen_pos_to_map_pos(&x, &y, &direction);
|
||||
|
||||
if (x == (short)0x8000) {
|
||||
return;
|
||||
}
|
||||
|
||||
window_tile_inspector_tile_x = x >> 5;
|
||||
window_tile_inspector_tile_y = y >> 5;
|
||||
|
||||
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;
|
||||
|
||||
w->scrolls[0].v_top = 0;
|
||||
window_invalidate(w);
|
||||
|
||||
}
|
||||
|
||||
static void window_tile_inspector_tool_abort()
|
||||
{
|
||||
rct_window *w;
|
||||
short widgetIndex, x, y;
|
||||
window_tool_get_registers(w, widgetIndex, x, y);
|
||||
window_close(w);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_scrollgetsize()
|
||||
{
|
||||
|
||||
rct_window *w;
|
||||
int width, height;
|
||||
window_get_register(w);
|
||||
|
||||
height = window_tile_inspector_item_count * 11;
|
||||
width = WW - 30;
|
||||
|
||||
window_scrollsize_set_registers(width, height);
|
||||
|
||||
}
|
||||
|
||||
static void window_tile_inspector_scrollmouseover()
|
||||
{
|
||||
short x, y, scrollIndex;
|
||||
rct_window *w;
|
||||
|
||||
window_scrollmouse_get_registers(w, scrollIndex, x, y);
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_invalidate()
|
||||
{
|
||||
rct_window *w;
|
||||
|
||||
window_get_register(w);
|
||||
|
||||
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;
|
||||
window_tile_inspector_widgets[WIDX_CONTENT_PANEL].right = w->width - 1;
|
||||
window_tile_inspector_widgets[WIDX_CONTENT_PANEL].bottom = w->height - 1;
|
||||
window_tile_inspector_widgets[WIDX_SCROLL].bottom = w->height - 30;
|
||||
}
|
||||
|
||||
static void window_tile_inspector_paint()
|
||||
{
|
||||
int x, y;
|
||||
rct_window *w;
|
||||
rct_drawpixelinfo *dpi;
|
||||
char buffer[256];
|
||||
|
||||
window_paint_get_registers(w, dpi);
|
||||
|
||||
window_draw_widgets(w, dpi);
|
||||
|
||||
x = w->x + 20;
|
||||
y = w->y + 25;
|
||||
|
||||
if (window_tile_inspector_tile_x == -1) {
|
||||
|
||||
// No tile selected
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_CHOOSE_MSG, NULL, 12, x, y);
|
||||
|
||||
} else {
|
||||
|
||||
sprintf(
|
||||
buffer,
|
||||
"X: %d, Y: %d",
|
||||
window_tile_inspector_tile_x,
|
||||
window_tile_inspector_tile_y
|
||||
);
|
||||
|
||||
gfx_draw_string(dpi, buffer, 12, x, y);
|
||||
|
||||
}
|
||||
|
||||
y += 25;
|
||||
|
||||
draw_string_left_underline(dpi, STR_TILE_INSPECTOR_ELEMENT_TYPE, NULL, 12, x, y);
|
||||
draw_string_left_underline(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT, NULL, 12, x + 200, y);
|
||||
draw_string_left_underline(dpi, STR_TILE_INSPECTOR_CLEARANGE_HEIGHT, NULL, 12, x + 280, y);
|
||||
draw_string_left_underline(dpi, STR_TILE_INSPECTOR_FLAGS, NULL, 12, x + 390, y);
|
||||
|
||||
}
|
||||
|
||||
static void window_tile_inspector_scrollpaint()
|
||||
{
|
||||
int x = 15, y = 11 * (window_tile_inspector_item_count - 1), i = 0;
|
||||
rct_window *w;
|
||||
rct_drawpixelinfo *dpi;
|
||||
char buffer[256];
|
||||
|
||||
window_paint_get_registers(w, dpi);
|
||||
|
||||
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);
|
||||
|
||||
do {
|
||||
|
||||
int type = map_element_get_type(element);
|
||||
char *type_name;
|
||||
int base_height = element->base_height;
|
||||
int clearance_height = element->clearance_height;
|
||||
|
||||
if ((i & 1) != 0)
|
||||
gfx_fill_rect(dpi, x - 15, y, x + WW - 20, y + 11, RCT2_GLOBAL(0x0141FC4A + (w->colours[1] * 8), uint8) | 0x1000000);
|
||||
|
||||
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:
|
||||
{
|
||||
// TODO: use these
|
||||
uint8 pathType, pathDirection;
|
||||
pathType = element->properties.path.type >> 2;
|
||||
pathDirection = element->properties.path.type & 3;
|
||||
}
|
||||
sprintf(
|
||||
buffer,
|
||||
"Path (%s)",
|
||||
"" // TODO: queue? has bins? has benches? e.t.c.
|
||||
);
|
||||
type_name = buffer;
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_TRACK:
|
||||
type_name = "Track"; // TODO: show type?
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_SCENERY:
|
||||
sprintf(
|
||||
buffer,
|
||||
"Scenery (%s)",
|
||||
language_get_string(g_smallSceneryEntries[element->properties.scenery.type]->name)
|
||||
);
|
||||
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)",
|
||||
language_get_string(g_wallSceneryEntries[element->properties.scenery.type]->name)
|
||||
);
|
||||
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;
|
||||
}
|
||||
|
||||
gfx_draw_string(dpi, type_name, 12, x, y);
|
||||
gfx_draw_string_left(dpi, 5182, &base_height, 12, x + 200, y);
|
||||
gfx_draw_string_left(dpi, 5182, &clearance_height, 12, x + 280, y);
|
||||
|
||||
uint8 flags = element->flags;
|
||||
char j;
|
||||
|
||||
buffer[8] = '\0';
|
||||
|
||||
for (j = 7; j >= 0; j--, flags >>= 1) {
|
||||
buffer[j] = flags & 1 ? '1' : '0';
|
||||
}
|
||||
|
||||
gfx_draw_string(dpi, buffer, 12, x + 390, y);
|
||||
|
||||
y -= 11;
|
||||
i++;
|
||||
|
||||
} while (!map_element_is_last_for_tile(element++));
|
||||
|
||||
}
|
|
@ -36,6 +36,7 @@
|
|||
#include "../world/banner.h"
|
||||
#include "dropdown.h"
|
||||
#include "../interface/themes.h"
|
||||
#include "../interface/console.h"
|
||||
|
||||
enum {
|
||||
WIDX_PAUSE,
|
||||
|
@ -59,6 +60,7 @@ enum {
|
|||
|
||||
WIDX_FASTFORWARD,
|
||||
WIDX_CHEATS,
|
||||
WIDX_DEBUG,
|
||||
WIDX_FINANCES,
|
||||
WIDX_RESEARCH,
|
||||
|
||||
|
@ -93,6 +95,11 @@ typedef enum {
|
|||
DDIDX_PATH_HEIGHTS = 11,
|
||||
} TOP_TOOLBAR_VIEW_MENU_DDIDX;
|
||||
|
||||
typedef enum {
|
||||
DDIDX_CONSOLE = 0,
|
||||
DDIDX_TILE_INSPECTOR = 1
|
||||
} TOP_TOOLBAR_DEBUG_DDIDX;
|
||||
|
||||
#pragma region Toolbar_widget_ordering
|
||||
|
||||
// from left to right
|
||||
|
@ -101,6 +108,7 @@ static const int left_aligned_widgets_order[] = {
|
|||
WIDX_FASTFORWARD,
|
||||
WIDX_FILE_MENU,
|
||||
WIDX_CHEATS,
|
||||
WIDX_DEBUG,
|
||||
|
||||
WIDX_SEPARATOR,
|
||||
|
||||
|
@ -154,7 +162,8 @@ static rct_widget window_top_toolbar_widgets[] = {
|
|||
|
||||
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, 5148 }, // Fast forward
|
||||
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, 5149 }, // Cheats
|
||||
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, 3235 }, // Finances
|
||||
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, STR_DEBUG_TIP }, // Debug
|
||||
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, 3235 }, // Finances
|
||||
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, 2275 }, // Research
|
||||
|
||||
{ WWT_EMPTY, 0, 0, 10-1, 0, 0, 0xFFFFFFFF, STR_NONE }, // Artificial widget separator
|
||||
|
@ -206,6 +215,8 @@ void top_toolbar_init_view_menu(rct_window *window, rct_widget *widget);
|
|||
void top_toolbar_view_menu_dropdown(short dropdownIndex);
|
||||
void top_toolbar_init_fastforward_menu(rct_window *window, rct_widget *widget);
|
||||
void top_toolbar_fastforward_menu_dropdown(short dropdownIndex);
|
||||
void top_toolbar_init_debug_menu(rct_window *window, rct_widget *widget);
|
||||
void top_toolbar_debug_menu_dropdown(short dropdownIndex);
|
||||
|
||||
void toggle_footpath_window();
|
||||
void toggle_land_window(rct_window *topToolbar, int widgetIndex);
|
||||
|
@ -408,6 +419,9 @@ static void window_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widg
|
|||
case WIDX_FASTFORWARD:
|
||||
top_toolbar_init_fastforward_menu(w, widget);
|
||||
break;
|
||||
case WIDX_DEBUG:
|
||||
top_toolbar_init_debug_menu(w, widget);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -489,6 +503,9 @@ static void window_top_toolbar_dropdown()
|
|||
case WIDX_FASTFORWARD:
|
||||
top_toolbar_fastforward_menu_dropdown(dropdownIndex);
|
||||
break;
|
||||
case WIDX_DEBUG:
|
||||
top_toolbar_debug_menu_dropdown(dropdownIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -527,6 +544,7 @@ static void window_top_toolbar_invalidate()
|
|||
window_top_toolbar_widgets[WIDX_RESEARCH].type = WWT_TRNBTN;
|
||||
window_top_toolbar_widgets[WIDX_FASTFORWARD].type = WWT_TRNBTN;
|
||||
window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_TRNBTN;
|
||||
window_top_toolbar_widgets[WIDX_DEBUG].type = WWT_TRNBTN;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) {
|
||||
window_top_toolbar_widgets[WIDX_PAUSE].type = WWT_EMPTY;
|
||||
|
@ -537,6 +555,7 @@ static void window_top_toolbar_invalidate()
|
|||
window_top_toolbar_widgets[WIDX_FINANCES].type = WWT_EMPTY;
|
||||
window_top_toolbar_widgets[WIDX_RESEARCH].type = WWT_EMPTY;
|
||||
window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_EMPTY;
|
||||
window_top_toolbar_widgets[WIDX_DEBUG].type = WWT_EMPTY;
|
||||
|
||||
if (g_editor_step != EDITOR_STEP_LANDSCAPE_EDITOR) {
|
||||
window_top_toolbar_widgets[WIDX_MAP].type = WWT_EMPTY;
|
||||
|
@ -567,6 +586,10 @@ static void window_top_toolbar_invalidate()
|
|||
|
||||
if (!gConfigInterface.toolbar_show_cheats)
|
||||
window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_EMPTY;
|
||||
|
||||
if (!gConfigGeneral.debugging_tools)
|
||||
window_top_toolbar_widgets[WIDX_DEBUG].type = WWT_EMPTY;
|
||||
|
||||
}
|
||||
|
||||
enabledWidgets = 0;
|
||||
|
@ -698,6 +721,16 @@ static void window_top_toolbar_paint()
|
|||
gfx_draw_sprite(dpi, imgId, x, y, 3);
|
||||
}
|
||||
|
||||
// Draw debug button
|
||||
if (window_top_toolbar_widgets[WIDX_DEBUG].type != WWT_EMPTY) {
|
||||
x = w->x + window_top_toolbar_widgets[WIDX_DEBUG].left;
|
||||
y = w->y + window_top_toolbar_widgets[WIDX_DEBUG].top - 1;
|
||||
if (widget_is_pressed(w, WIDX_DEBUG))
|
||||
y++;
|
||||
imgId = 5201;
|
||||
gfx_draw_sprite(dpi, imgId, x, y, 3);
|
||||
}
|
||||
|
||||
// Draw research button
|
||||
if (window_top_toolbar_widgets[WIDX_RESEARCH].type != WWT_EMPTY) {
|
||||
x = w->x + window_top_toolbar_widgets[WIDX_RESEARCH].left - 1;
|
||||
|
@ -2746,6 +2779,37 @@ void top_toolbar_fastforward_menu_dropdown(short dropdownIndex) {
|
|||
}
|
||||
}
|
||||
|
||||
void top_toolbar_init_debug_menu(rct_window* w, rct_widget* widget) {
|
||||
gDropdownItemsFormat[0] = STR_DEBUG_DROPDOWN_CONSOLE;
|
||||
gDropdownItemsFormat[1] = STR_DEBUG_DROPDOWN_TILE_INSPECTOR;
|
||||
|
||||
window_dropdown_show_text(
|
||||
w->x + widget->left,
|
||||
w->y + widget->top,
|
||||
widget->bottom - widget->top + 1,
|
||||
w->colours[1] | 0x80,
|
||||
0,
|
||||
2
|
||||
);
|
||||
|
||||
RCT2_GLOBAL(0x9DEBA2, uint16) = 0;
|
||||
}
|
||||
|
||||
void top_toolbar_debug_menu_dropdown(short dropdownIndex) {
|
||||
if (dropdownIndex == -1) dropdownIndex = RCT2_GLOBAL(0x9DEBA2, uint16);
|
||||
rct_window* w = window_get_main();
|
||||
if (w) {
|
||||
switch (dropdownIndex) {
|
||||
case DDIDX_CONSOLE:
|
||||
console_open();
|
||||
break;
|
||||
case DDIDX_TILE_INSPECTOR:
|
||||
window_tile_inspector_open();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0066CDE4
|
||||
|
|
|
@ -62,6 +62,7 @@ void park_update_histories();
|
|||
uint8 calculate_guest_initial_happiness(uint8 percentage);
|
||||
|
||||
void park_set_open(int open);
|
||||
int park_get_entrance_index(int x, int y, int z);
|
||||
void park_set_name(const char *name);
|
||||
void park_set_entrance_fee(money32 value);
|
||||
|
||||
|
|
Loading…
Reference in New Issue