1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Use localised strings for guest debug tab

This commit is contained in:
Ted John
2019-05-04 21:48:02 +00:00
parent f50695fc9b
commit a22f0a53fb
3 changed files with 49 additions and 36 deletions

View File

@@ -3757,7 +3757,14 @@ STR_6306 :{SMALLFONT}{BLACK}Experimental option to use multiple threads to re
STR_6307 :Colour scheme: {BLACK}{STRINGID}
STR_6308 :“{STRINGID}{OUTLINE}{TOPAZ}”{NEWLINE}{STRINGID}
STR_6309 :Reconnect
STR_6310 :{WINDOW_COLOUR_2}{STRING}: {BLACK}{STRING}
STR_6310 :{WINDOW_COLOUR_2}Position: {BLACK}{INT32} {INT32} {INT32}
STR_6311 :{WINDOW_COLOUR_2}Next: {BLACK}{INT32} {INT32} {INT32}
STR_6312 :(surface)
STR_6313 :(slope {INT32})
STR_6314 :{WINDOW_COLOUR_2}Dest: {BLACK}{INT32}, {INT32} tolerance {INT32}
STR_6315 :{WINDOW_COLOUR_2}Pathfind Goal: {BLACK}{INT32}, {INT32}, {INT32} dir {INT32}
STR_6316 :{WINDOW_COLOUR_2}Pathfind history:
STR_6317 :{BLACK}{INT32}, {INT32}, {INT32} dir {INT32}
#############
# Scenarios #

View File

@@ -2050,14 +2050,11 @@ void window_guest_debug_update(rct_window* w)
window_invalidate(w);
}
static void draw_debug_label(rct_drawpixelinfo* dpi, int32_t x, int32_t y, const char* label, const char* value)
{
const char* args[2] = { label, value };
gfx_draw_string_left(dpi, STR_PEEP_DEBUG_LABEL, args, 0, x, y);
}
void window_guest_debug_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
char buffer[512]{};
char buffer2[512]{};
window_draw_widgets(w, dpi);
window_guest_overview_tab_paint(w, dpi);
window_guest_stats_tab_paint(w, dpi);
@@ -2070,44 +2067,46 @@ void window_guest_debug_paint(rct_window* w, rct_drawpixelinfo* dpi)
auto peep = GET_PEEP(w->number);
auto x = w->x + window_guest_debug_widgets[WIDX_PAGE_BACKGROUND].left + 4;
auto y = w->y + window_guest_debug_widgets[WIDX_PAGE_BACKGROUND].top + 4;
char buffer[512]{};
snprintf(buffer, sizeof(buffer), "%i, %i, %i", peep->x, peep->y, peep->z);
draw_debug_label(dpi, x, y, "Position", buffer);
y += LIST_ROW_HEIGHT;
snprintf(buffer, sizeof(buffer), "%u, %u, %u", peep->next_x, peep->next_y, peep->next_z);
if (peep->GetNextIsSurface())
safe_strcat(buffer, " (surface)", sizeof(buffer));
if (peep->GetNextIsSloped())
{
char slopeBuf[32]{};
snprintf(slopeBuf, sizeof(slopeBuf), " (slope %u)", peep->GetNextDirection());
safe_strcat(buffer, slopeBuf, sizeof(buffer));
int32_t args[] = { peep->x, peep->y, peep->x };
gfx_draw_string_left(dpi, STR_PEEP_DEBUG_POSITION, args, 0, x, y);
}
draw_debug_label(dpi, x, y, "Next", buffer);
y += LIST_ROW_HEIGHT;
snprintf(
buffer, sizeof(buffer), "%u, %u, tolerance %u", peep->destination_x, peep->destination_y, peep->destination_tolerance);
draw_debug_label(dpi, x, y, "Dest", buffer);
{
int32_t args[] = { peep->next_x, peep->next_y, peep->next_z };
format_string(buffer, sizeof(buffer), STR_PEEP_DEBUG_NEXT, args);
if (peep->GetNextIsSurface())
{
format_string(buffer2, sizeof(buffer2), STR_PEEP_DEBUG_NEXT_SURFACE, nullptr);
safe_strcat(buffer, buffer2, sizeof(buffer));
}
if (peep->GetNextIsSloped())
{
int32_t args2[1] = { peep->GetNextDirection() };
format_string(buffer2, sizeof(buffer2), STR_PEEP_DEBUG_NEXT_SLOPE, args2);
safe_strcat(buffer, buffer2, sizeof(buffer));
}
gfx_draw_string(dpi, buffer, 0, x, y);
}
y += LIST_ROW_HEIGHT;
snprintf(
buffer, sizeof(buffer), "%u, %u, %u dir %u", peep->pathfind_goal.x, peep->pathfind_goal.y, peep->pathfind_goal.z,
peep->pathfind_goal.direction);
draw_debug_label(dpi, x, y, "Pathfind Goal", buffer);
{
int32_t args[] = { peep->destination_x, peep->destination_y, peep->destination_tolerance };
gfx_draw_string_left(dpi, STR_PEEP_DEBUG_DEST, args, 0, x, y);
}
y += LIST_ROW_HEIGHT;
draw_debug_label(dpi, x, y, "Pathfind history", nullptr);
{
int32_t args[] = { peep->pathfind_goal.x, peep->pathfind_goal.y, peep->pathfind_goal.z, peep->pathfind_goal.direction };
gfx_draw_string_left(dpi, STR_PEEP_DEBUG_PATHFIND_GOAL, args, 0, x, y);
}
y += LIST_ROW_HEIGHT;
gfx_draw_string_left(dpi, STR_PEEP_DEBUG_PATHFIND_HISTORY, nullptr, 0, x, y);
y += LIST_ROW_HEIGHT;
x += 10;
for (auto& point : peep->pathfind_history)
{
auto o = utf8_insert_codepoint(buffer, FORMAT_BLACK);
snprintf(buffer + o, sizeof(buffer) - o, "%u, %u, %u dir %u", point.x, point.y, point.z, point.direction);
gfx_draw_string(dpi, buffer, PALETTE_INDEX_10, x, y);
int32_t args[] = { point.x, point.y, point.z, point.direction };
gfx_draw_string_left(dpi, STR_PEEP_DEBUG_PATHFIND_HISTORY_ITEM, args, 0, x, y);
y += LIST_ROW_HEIGHT;
}
x -= 10;

View File

@@ -3943,7 +3943,14 @@ enum
STR_MULTIPLAYER_RECONNECT = 6309,
STR_PEEP_DEBUG_LABEL = 6310,
STR_PEEP_DEBUG_POSITION = 6310,
STR_PEEP_DEBUG_NEXT = 6311,
STR_PEEP_DEBUG_NEXT_SURFACE = 6312,
STR_PEEP_DEBUG_NEXT_SLOPE = 6313,
STR_PEEP_DEBUG_DEST = 6314,
STR_PEEP_DEBUG_PATHFIND_GOAL = 6315,
STR_PEEP_DEBUG_PATHFIND_HISTORY = 6316,
STR_PEEP_DEBUG_PATHFIND_HISTORY_ITEM = 6317,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768