mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
implement SI units for distance / speed measurement, closes #2496
This commit is contained in:
@@ -3921,6 +3921,8 @@ STR_5579 :Window scale factor:
|
|||||||
STR_5580 :Czech koruna (Kc)
|
STR_5580 :Czech koruna (Kc)
|
||||||
STR_5581 :Show FPS
|
STR_5581 :Show FPS
|
||||||
STR_5582 :Trap mouse cursor in window
|
STR_5582 :Trap mouse cursor in window
|
||||||
|
STR_5583 :{COMMA16}ms{POWERNEGATIVEONE}
|
||||||
|
STR_5584 :SI
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
# Rides/attractions #
|
# Rides/attractions #
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
- Feature: Add displaying of frames per second (FPS).
|
- Feature: Add displaying of frames per second (FPS).
|
||||||
- Feature: Changing the number of trains no longer requires retesting.
|
- Feature: Changing the number of trains no longer requires retesting.
|
||||||
|
- Feature: Add SI units as a new measurement system for distance / speed.
|
||||||
- Fix: [#2126] Ferris Wheels set to "backward rotation" stop working (original
|
- Fix: [#2126] Ferris Wheels set to "backward rotation" stop working (original
|
||||||
bug)
|
bug)
|
||||||
- Fix: [#2449] Turning off Day/Night Circle while it is night doesn't reset back to day
|
- Fix: [#2449] Turning off Day/Night Circle while it is night doesn't reset back to day
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ config_enum_definition _screenShotFormatEnum[] = {
|
|||||||
config_enum_definition _measurementFormatEnum[] = {
|
config_enum_definition _measurementFormatEnum[] = {
|
||||||
{ "IMPERIAL", MEASUREMENT_FORMAT_IMPERIAL },
|
{ "IMPERIAL", MEASUREMENT_FORMAT_IMPERIAL },
|
||||||
{ "METRIC", MEASUREMENT_FORMAT_METRIC },
|
{ "METRIC", MEASUREMENT_FORMAT_METRIC },
|
||||||
|
{ "SI", MEASUREMENT_FORMAT_SI },
|
||||||
END_OF_ENUM
|
END_OF_ENUM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,8 @@ enum {
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
MEASUREMENT_FORMAT_IMPERIAL,
|
MEASUREMENT_FORMAT_IMPERIAL,
|
||||||
MEASUREMENT_FORMAT_METRIC
|
MEASUREMENT_FORMAT_METRIC,
|
||||||
|
MEASUREMENT_FORMAT_SI
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|||||||
@@ -450,11 +450,20 @@ void format_length(char **dest, sint16 value)
|
|||||||
|
|
||||||
void format_velocity(char **dest, uint16 value)
|
void format_velocity(char **dest, uint16 value)
|
||||||
{
|
{
|
||||||
rct_string_id stringId = 2734;
|
rct_string_id stringId;
|
||||||
|
|
||||||
if (gConfigGeneral.measurement_format == MEASUREMENT_FORMAT_METRIC) {
|
switch (gConfigGeneral.measurement_format) {
|
||||||
|
default:
|
||||||
|
stringId = STR_UNIT_SUFFIX_MILES_PER_HOUR;
|
||||||
|
break;
|
||||||
|
case MEASUREMENT_FORMAT_METRIC:
|
||||||
value = mph_to_kmph(value);
|
value = mph_to_kmph(value);
|
||||||
stringId++;
|
stringId = STR_UNIT_SUFFIX_KILOMETRES_PER_HOUR;
|
||||||
|
break;
|
||||||
|
case MEASUREMENT_FORMAT_SI:
|
||||||
|
value = mph_to_mps(value);
|
||||||
|
stringId = STR_UNIT_SUFFIX_METRES_PER_SECOND;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 *argRef = &value;
|
uint16 *argRef = &value;
|
||||||
|
|||||||
@@ -1407,6 +1407,11 @@ enum {
|
|||||||
STR_SAVE_EVERY_HOUR = 2705,
|
STR_SAVE_EVERY_HOUR = 2705,
|
||||||
STR_SAVE_NEVER = 2706,
|
STR_SAVE_NEVER = 2706,
|
||||||
|
|
||||||
|
STR_UNIT_SUFFIX_FEET = 2732,
|
||||||
|
STR_UNIT_SUFFIX_METRES = 2733,
|
||||||
|
STR_UNIT_SUFFIX_MILES_PER_HOUR = 2734,
|
||||||
|
STR_UNIT_SUFFIX_KILOMETRES_PER_HOUR = 2735,
|
||||||
|
|
||||||
STR_DATE_FORMAT_DMY = 2737,
|
STR_DATE_FORMAT_DMY = 2737,
|
||||||
|
|
||||||
STR_ROLLERCOASTER_TYCOON_1_DROPDOWN = 2740,
|
STR_ROLLERCOASTER_TYCOON_1_DROPDOWN = 2740,
|
||||||
@@ -2182,6 +2187,9 @@ enum {
|
|||||||
|
|
||||||
STR_TRAP_MOUSE = 5582,
|
STR_TRAP_MOUSE = 5582,
|
||||||
|
|
||||||
|
STR_UNIT_SUFFIX_METRES_PER_SECOND = 5583,
|
||||||
|
STR_SI = 5584,
|
||||||
|
|
||||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||||
STR_COUNT = 32768
|
STR_COUNT = 32768
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,7 +40,13 @@ int mph_to_kmph(int mph)
|
|||||||
{
|
{
|
||||||
// 1 mph = 1.60934 kmph
|
// 1 mph = 1.60934 kmph
|
||||||
// RCT2 approximates as 1.609375
|
// RCT2 approximates as 1.609375
|
||||||
return (mph * 1648) / 1024;
|
return (mph * 1648) >> 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
int mph_to_mps(int mph)
|
||||||
|
{
|
||||||
|
// 1 mph = 0.44704 m/s
|
||||||
|
return (mph * 58594) >> 17;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool filename_valid_characters(const utf8 *filename)
|
bool filename_valid_characters(const utf8 *filename)
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
int squaredmetres_to_squaredfeet(int squaredMetres);
|
int squaredmetres_to_squaredfeet(int squaredMetres);
|
||||||
int metres_to_feet(int metres);
|
int metres_to_feet(int metres);
|
||||||
int mph_to_kmph(int mph);
|
int mph_to_kmph(int mph);
|
||||||
|
int mph_to_mps(int mph);
|
||||||
|
|
||||||
bool filename_valid_characters(const utf8 *filename);
|
bool filename_valid_characters(const utf8 *filename);
|
||||||
|
|
||||||
|
|||||||
@@ -830,10 +830,12 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
|||||||
case WIDX_DISTANCE_DROPDOWN:
|
case WIDX_DISTANCE_DROPDOWN:
|
||||||
gDropdownItemsFormat[0] = 1142;
|
gDropdownItemsFormat[0] = 1142;
|
||||||
gDropdownItemsFormat[1] = 1142;
|
gDropdownItemsFormat[1] = 1142;
|
||||||
|
gDropdownItemsFormat[2] = 1142;
|
||||||
gDropdownItemsArgs[0] = STR_IMPERIAL;
|
gDropdownItemsArgs[0] = STR_IMPERIAL;
|
||||||
gDropdownItemsArgs[1] = STR_METRIC;
|
gDropdownItemsArgs[1] = STR_METRIC;
|
||||||
|
gDropdownItemsArgs[2] = STR_SI;
|
||||||
|
|
||||||
window_options_show_dropdown(w, widget, 2);
|
window_options_show_dropdown(w, widget, 3);
|
||||||
|
|
||||||
dropdown_set_checked(gConfigGeneral.measurement_format, true);
|
dropdown_set_checked(gConfigGeneral.measurement_format, true);
|
||||||
break;
|
break;
|
||||||
@@ -1225,8 +1227,17 @@ static void window_options_invalidate(rct_window *w)
|
|||||||
// currency: pounds, dollars, etc. (10 total)
|
// currency: pounds, dollars, etc. (10 total)
|
||||||
RCT2_GLOBAL(0x013CE952 + 12, uint16) = CurrencyDescriptors[gConfigGeneral.currency_format].stringId;
|
RCT2_GLOBAL(0x013CE952 + 12, uint16) = CurrencyDescriptors[gConfigGeneral.currency_format].stringId;
|
||||||
|
|
||||||
// distance: metric/imperial
|
// distance: metric / imperial / si
|
||||||
RCT2_GLOBAL(0x013CE952 + 14, uint16) = STR_IMPERIAL + gConfigGeneral.measurement_format;
|
{
|
||||||
|
rct_string_id stringId;
|
||||||
|
switch (gConfigGeneral.measurement_format) {
|
||||||
|
default:
|
||||||
|
case MEASUREMENT_FORMAT_IMPERIAL: stringId = STR_IMPERIAL; break;
|
||||||
|
case MEASUREMENT_FORMAT_METRIC: stringId = STR_METRIC; break;
|
||||||
|
case MEASUREMENT_FORMAT_SI: stringId = STR_SI; break;
|
||||||
|
}
|
||||||
|
RCT2_GLOBAL(0x013CE952 + 14, uint16) = stringId;
|
||||||
|
}
|
||||||
|
|
||||||
// temperature: celsius/fahrenheit
|
// temperature: celsius/fahrenheit
|
||||||
RCT2_GLOBAL(0x013CE952 + 20, uint16) = STR_CELSIUS + gConfigGeneral.temperature_format;
|
RCT2_GLOBAL(0x013CE952 + 20, uint16) = STR_CELSIUS + gConfigGeneral.temperature_format;
|
||||||
|
|||||||
@@ -1585,7 +1585,7 @@ static void window_park_stats_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||||||
// Draw park size
|
// Draw park size
|
||||||
parkSize = RCT2_GLOBAL(RCT2_ADDRESS_PARK_SIZE, uint16) * 10;
|
parkSize = RCT2_GLOBAL(RCT2_ADDRESS_PARK_SIZE, uint16) * 10;
|
||||||
stringIndex = STR_PARK_SIZE_METRIC_LABEL;
|
stringIndex = STR_PARK_SIZE_METRIC_LABEL;
|
||||||
if (!RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, uint8)) {
|
if (gConfigGeneral.measurement_format == MEASUREMENT_FORMAT_IMPERIAL) {
|
||||||
stringIndex = STR_PARK_SIZE_IMPERIAL_LABEL;
|
stringIndex = STR_PARK_SIZE_IMPERIAL_LABEL;
|
||||||
parkSize = squaredmetres_to_squaredfeet(parkSize);
|
parkSize = squaredmetres_to_squaredfeet(parkSize);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user