1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 06:44:38 +01:00

Display clip height in METRIC/SI units with 1DP.

This commit is contained in:
zaxcav
2017-01-06 20:46:04 +01:00
parent c97f624965
commit a008dcb186
3 changed files with 9 additions and 19 deletions

View File

@@ -4316,6 +4316,7 @@ STR_6004 :Enable cut-away view
STR_6005 :Cut-away view only displays map elements at or below the cut height
STR_6006 :Cut height
STR_6007 :Select cut height
STE_6008 :{COMMA1DP16}m
#############
# Scenarios #

View File

@@ -3659,6 +3659,7 @@ enum {
STR_VIEW_CLIPPING_HEIGHT_ENABLE_TIP = 6005,
STR_VIEW_CLIPPING_HEIGHT_VALUE = 6006,
STR_VIEW_CLIPPING_HEIGHT_SCROLL_TIP = 6007,
STR_UNIT1DP_SUFFIX_METRES = 6008,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768

View File

@@ -210,8 +210,6 @@ static void window_view_clipping_paint(rct_window *w, rct_drawpixelinfo *dpi)
window_draw_widgets(w, dpi);
// Clip height value
// Currently as a spinner.
// Alternately could try putting the value on the scrollbar.
int x;
int y;
x = w->x + 8;
@@ -222,31 +220,21 @@ static void window_view_clipping_paint(rct_window *w, rct_drawpixelinfo *dpi)
y = w->y + w->widgets[WIDX_CLIP_HEIGHT_VALUE].top;
gfx_draw_string_left(dpi, STR_FORMAT_INTEGER, &gClipHeight, w->colours[1], x, y); //Printing the raw value.
// Set the height units symbol
rct_string_id clipHeight_Units_StringId;
// Print the value in the configured game units.
fixed16_1dp clipHeightValueInMeters;
sint16 clipHeightValueInFeet;
switch (gConfigGeneral.measurement_format) {
case MEASUREMENT_FORMAT_METRIC:
case MEASUREMENT_FORMAT_SI:
clipHeight_Units_StringId = STR_UNIT_SUFFIX_METRES;
clipHeightValueInMeters = FIXED_1DP(gClipHeight, 0) / 2 * 1.5 - FIXED_1DP(10,5);
gfx_draw_string_left(dpi, STR_UNIT1DP_SUFFIX_METRES, &clipHeightValueInMeters, w->colours[1], x + 30, y);
break;
case MEASUREMENT_FORMAT_IMPERIAL:
default:
clipHeight_Units_StringId = STR_UNIT_SUFFIX_FEET;
clipHeightValueInFeet = gClipHeight / 2 * 5 - 35;
gfx_draw_string_left(dpi, STR_UNIT_SUFFIX_FEET, &clipHeightValueInFeet, w->colours[1], x + 30, y);
break;
}
fixed16_1dp clipHeightValueInUnits; // The clip height in the unit type - feet or meters. For value in meters a fixed point number is needed.
switch (clipHeight_Units_StringId) {
case STR_UNIT_SUFFIX_FEET:
clipHeightValueInUnits = FIXED_1DP(gClipHeight, 0) / 2 * 5 - FIXED_1DP(35,0);
break;
case STR_UNIT_SUFFIX_METRES:
default:
clipHeightValueInUnits = FIXED_1DP(gClipHeight, 0) / 2 * 1.5 - FIXED_1DP(10,5);
break;
}
// TODO: Display fixed point value correctly.
gfx_draw_string_left(dpi, clipHeight_Units_StringId, &clipHeightValueInUnits, w->colours[1], x + 30, y);
}
static void window_view_clipping_scrollgetsize(rct_window *w, int scrollIndex, int *width, int *height)