From 7bfdbbd40912d4af76fa54763fbd94eec352b115 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Tue, 2 Aug 2016 18:49:04 +0200 Subject: [PATCH] Include ride stats labels --- src/localisation/string_ids.h | 4 ++-- src/windows/ride.c | 27 +++++++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index b0cfd4226b..ed804489f8 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -676,9 +676,9 @@ enum { STR_RIDE_STATS_ALTITUDE = 1416, STR_RIDE_STATS_VERT_G = 1417, STR_RIDE_STATS_LAT_G = 1418, - STR_RIDE_STATS_VELOCITY_FORMAT = 1419, // Unused + STR_RIDE_STATS_VELOCITY_FORMAT = 1419, STR_RIDE_STATS_ALTITUDE_FORMAT = 1420, - STR_RIDE_STATS_G_FORCE_FORMAT = 1421, // Unused + STR_RIDE_STATS_G_FORCE_FORMAT = 1421, STR_LOGGING_DATA_FROM_TIP = 1422, STR_QUEUE_LINE_PATH_TIP = 1423, STR_FOOTPATH_TIP = 1424, diff --git a/src/windows/ride.c b/src/windows/ride.c index ae4820dbd9..19ca83bd6e 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -1256,6 +1256,21 @@ static const window_ride_colour_preview TrackColourPreviews[] = { { SPR_RIDE_DESIGN_PREVIEW_LIM_LAUNCHED_ROLLER_COASTER_TRACK, SPR_RIDE_DESIGN_PREVIEW_LIM_LAUNCHED_ROLLER_COASTER_SUPPORTS}, }; +typedef struct rct_window_graphs_y_axis { + uint8 interval; + sint8 unit; + sint8 unit_interval; + rct_string_id label; +} rct_window_graphs_y_axis; + +/** rct2: 0x0098DD98 */ +static const rct_window_graphs_y_axis window_graphs_y_axi[] = { + {11, 0, 10, STR_RIDE_STATS_VELOCITY_FORMAT}, // GRAPH_VELOCITY + {10, 0, 15, STR_RIDE_STATS_ALTITUDE_FORMAT}, // GRAPH_ALTITUDE + {13, -3, 1, STR_RIDE_STATS_G_FORCE_FORMAT}, // GRAPH_VERTICAL + {13, -4, 1, STR_RIDE_STATS_G_FORCE_FORMAT}, // GRAPH_LATERAL +}; + static void window_ride_draw_tab_image(rct_drawpixelinfo *dpi, rct_window *w, int page, int spriteIndex) { int widgetIndex = WIDX_TAB_1 + page; @@ -5726,13 +5741,13 @@ static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi // Horizontal grid lines y = widget->bottom - widget->top - 13; - short yUnit = RCT2_GLOBAL(0x0098DD9A + (listType * 8), uint16); - rct_string_id stringID = RCT2_GLOBAL(0x0098DD9E + (listType * 8), rct_string_id); - short yUnitInterval = RCT2_GLOBAL(0x0098DD9C + (listType * 8), uint16); - short yInterval = RCT2_GLOBAL(0x0098DD98 + (listType * 8), uint16); + short yUnit = window_graphs_y_axi[listType].unit; + rct_string_id stringID = window_graphs_y_axi[listType].label; + short yUnitInterval = window_graphs_y_axi[listType].unit_interval; + short yInterval = window_graphs_y_axi[listType].interval; // Scale modifier - if (stringID == STR_RIDE_STATS_ALTITUDE_FORMAT) { + if (listType == GRAPH_ALTITUDE) { short unk = RCT2_GLOBAL(0x01359208, uint16); yUnit -= RCT2_GLOBAL(0x01359208, uint16); unk *= 2; @@ -5749,7 +5764,7 @@ static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi sint16 scaled_yUnit = yUnit; // Scale modifier - if (stringID == STR_RIDE_STATS_ALTITUDE_FORMAT) + if (listType == GRAPH_ALTITUDE) scaled_yUnit /= 2; gfx_draw_string_left(dpi, stringID, &scaled_yUnit, 0, w->scrolls[0].h_left + 1, y - 4);