mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Clean up some residual usages of old config (#3484)
This commit is contained in:
committed by
Ted John
parent
13701660c9
commit
142c54852d
17
src/config.c
17
src/config.c
@@ -23,6 +23,7 @@
|
||||
#include "interface/keyboard_shortcut.h"
|
||||
#include "interface/themes.h"
|
||||
#include "interface/title_sequences.h"
|
||||
#include "interface/viewport.h"
|
||||
#include "localisation/language.h"
|
||||
#include "localisation/localisation.h"
|
||||
#include "network/network.h"
|
||||
@@ -942,20 +943,8 @@ void config_apply_to_old_addresses()
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) = gConfigGeneral.measurement_format;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, sint8) = gConfigGeneral.temperature_format;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CONSTRUCTION_MARKER, uint8) = gConfigGeneral.construction_marker_colour;
|
||||
if (gConfigGeneral.show_height_as_units) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = 0;
|
||||
} else {
|
||||
switch (gConfigGeneral.measurement_format) {
|
||||
default:
|
||||
case MEASUREMENT_FORMAT_IMPERIAL:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = 1 * 256;
|
||||
break;
|
||||
case MEASUREMENT_FORMAT_METRIC:
|
||||
case MEASUREMENT_FORMAT_SI:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = 2 * 256;
|
||||
break;
|
||||
}
|
||||
}
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = get_height_marker_offset();
|
||||
|
||||
int configFlags = 0;
|
||||
if (gConfigGeneral.always_show_gridlines)
|
||||
configFlags |= CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES;
|
||||
|
||||
@@ -1054,7 +1054,7 @@ void viewport_surface_paint_setup(uint8 direction, uint16 height, rct_map_elemen
|
||||
dx += 3;
|
||||
|
||||
int image_id = (SPR_HEIGHT_MARKER_BASE + dx / 16) | 0x20780000;
|
||||
image_id += RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, uint16);
|
||||
image_id += get_height_marker_offset();
|
||||
image_id -= RCT2_GLOBAL(0x01359208, uint16);
|
||||
|
||||
sub_98196C(image_id, 16, 16, 1, 1, 0, height, get_current_rotation());
|
||||
@@ -1312,7 +1312,7 @@ void viewport_surface_paint_setup(uint8 direction, uint16 height, rct_map_elemen
|
||||
&& has_surface
|
||||
&& !(gCurrentViewportFlags & VIEWPORT_FLAG_UNDERGROUND_INSIDE)
|
||||
&& !(gCurrentViewportFlags & VIEWPORT_FLAG_HIDE_BASE)
|
||||
&& !(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_DISABLE_SMOOTH_LANDSCAPE)) {
|
||||
&& gConfigGeneral.landscape_smoothing) {
|
||||
viewport_surface_smoothen_edge(EDGE_TOPLEFT, tileDescriptors[0], tileDescriptors[3]);
|
||||
viewport_surface_smoothen_edge(EDGE_TOPRIGHT, tileDescriptors[0], tileDescriptors[4]);
|
||||
viewport_surface_smoothen_edge(EDGE_BOTTOMLEFT, tileDescriptors[0], tileDescriptors[1]);
|
||||
|
||||
@@ -1813,7 +1813,7 @@ void viewport_track_paint_setup(uint8 direction, int height, rct_map_element *ma
|
||||
if (RCT2_ADDRESS(0x00999694, uint32)[trackType] & (1 << trackSequence)) {
|
||||
uint16 ax = RideData5[ride->type].z_offset;
|
||||
uint32 ebx = 0x20381689 + (height + 8) / 16;
|
||||
ebx += RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, uint16);
|
||||
ebx += get_height_marker_offset();
|
||||
ebx -= RCT2_GLOBAL(0x01359208, uint16);
|
||||
sub_98197C(ebx, 16, 16, 1, 1, 0, height + ax + 3, 1000, 1000, 2047, get_current_rotation());
|
||||
}
|
||||
@@ -1909,7 +1909,7 @@ void viewport_entrance_paint_setup(uint8 direction, int height, rct_map_element*
|
||||
int z = map_element->base_height * 8 + 3;
|
||||
uint32 image_id =
|
||||
z / 16 +
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS,sint16) +
|
||||
get_height_marker_offset() +
|
||||
0x20101689;
|
||||
|
||||
image_id -= RCT2_GLOBAL(0x01359208, sint16);
|
||||
@@ -3505,3 +3505,17 @@ uint8 get_current_rotation()
|
||||
#endif // DEBUG_LEVEL_1
|
||||
return rotation_masked;
|
||||
}
|
||||
|
||||
sint16 get_height_marker_offset()
|
||||
{
|
||||
// Height labels in units
|
||||
if (gConfigGeneral.show_height_as_units)
|
||||
return 0;
|
||||
|
||||
// Height labels in feet
|
||||
if (gConfigGeneral.measurement_format == MEASUREMENT_FORMAT_IMPERIAL)
|
||||
return 1 * 256;
|
||||
|
||||
// Height labels in metres
|
||||
return 2 * 256;
|
||||
}
|
||||
|
||||
@@ -193,5 +193,6 @@ void screen_get_map_xy_side(sint16 screenX, sint16 screenY, sint16 *mapX, sint16
|
||||
void screen_get_map_xy_side_with_z(sint16 screenX, sint16 screenY, sint16 z, sint16 *mapX, sint16 *mapY, uint8 *side);
|
||||
|
||||
uint8 get_current_rotation();
|
||||
sint16 get_height_marker_offset();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -168,7 +168,7 @@ void window_banner_open(rct_windownumber number)
|
||||
-1
|
||||
);
|
||||
|
||||
w->viewport->flags = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES) ? VIEWPORT_FLAG_GRIDLINES : 0;
|
||||
w->viewport->flags = gConfigGeneral.always_show_gridlines ? VIEWPORT_FLAG_GRIDLINES : 0;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
@@ -363,6 +363,6 @@ static void window_banner_unknown_14(rct_window *w)
|
||||
-1
|
||||
);
|
||||
|
||||
w->viewport->flags = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES) ? VIEWPORT_FLAG_GRIDLINES : 0;
|
||||
w->viewport->flags = gConfigGeneral.always_show_gridlines ? VIEWPORT_FLAG_GRIDLINES : 0;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo *dpi,
|
||||
|
||||
temperature = gClimateCurrentTemperature;
|
||||
format = STR_CELSIUS_VALUE;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, uint8)) {
|
||||
if (gConfigGeneral.temperature_format == TEMPERATURE_FORMAT_F) {
|
||||
temperature = climate_celsius_to_fahrenheit(temperature);
|
||||
format = STR_FAHRENHEIT_VALUE;
|
||||
}
|
||||
|
||||
@@ -1157,14 +1157,12 @@ static void window_options_dropdown(rct_window *w, int widgetIndex, int dropdown
|
||||
switch (widgetIndex) {
|
||||
case WIDX_HEIGHT_LABELS_DROPDOWN:
|
||||
// reset flag and set it to 1 if height as units is selected
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) &= ~CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS;
|
||||
gConfigGeneral.show_height_as_units = 0;
|
||||
|
||||
if (dropdownIndex == 0) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) |= CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS;
|
||||
gConfigGeneral.show_height_as_units = 1;
|
||||
}
|
||||
|
||||
config_save_default();
|
||||
window_options_update_height_markers();
|
||||
break;
|
||||
case WIDX_CURRENCY_DROPDOWN:
|
||||
@@ -1371,8 +1369,8 @@ static void window_options_invalidate(rct_window *w)
|
||||
break;
|
||||
|
||||
case WINDOW_OPTIONS_PAGE_RENDERING:
|
||||
widget_set_checkbox_value(w, WIDX_TILE_SMOOTHING_CHECKBOX, (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_DISABLE_SMOOTH_LANDSCAPE) == 0);
|
||||
widget_set_checkbox_value(w, WIDX_GRIDLINES_CHECKBOX, RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES);
|
||||
widget_set_checkbox_value(w, WIDX_TILE_SMOOTHING_CHECKBOX, gConfigGeneral.landscape_smoothing);
|
||||
widget_set_checkbox_value(w, WIDX_GRIDLINES_CHECKBOX, gConfigGeneral.always_show_gridlines);
|
||||
widget_set_checkbox_value(w, WIDX_DAY_NIGHT_CHECKBOX, gConfigGeneral.day_night_cycle);
|
||||
widget_set_checkbox_value(w, WIDX_UPPER_CASE_BANNERS_CHECKBOX, gConfigGeneral.upper_case_banners);
|
||||
widget_set_checkbox_value(w, WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX, gConfigGeneral.disable_lightning_effect);
|
||||
@@ -1743,8 +1741,6 @@ static void window_options_show_dropdown(rct_window *w, rct_widget *widget, int
|
||||
|
||||
static void window_options_update_height_markers()
|
||||
{
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, uint16) = gConfigGeneral.show_height_as_units ?
|
||||
0 : (gConfigGeneral.measurement_format + 1) * 256;
|
||||
config_save_default();
|
||||
gfx_invalidate_screen();
|
||||
}
|
||||
|
||||
@@ -1075,7 +1075,7 @@ static void window_park_init_viewport(rct_window *w)
|
||||
}
|
||||
|
||||
if (w->viewport == NULL) {
|
||||
viewportFlags = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES) ? VIEWPORT_FLAG_GRIDLINES : 0;
|
||||
viewportFlags = gConfigGeneral.always_show_gridlines ? VIEWPORT_FLAG_GRIDLINES : 0;
|
||||
} else {
|
||||
// if (w->var_482 == x && w->var_484 == y && w->var_486 == z && (uint16)w->var_488 >> 8 == r)
|
||||
// return;
|
||||
|
||||
@@ -210,7 +210,7 @@ void window_sign_open(rct_windownumber number)
|
||||
-1
|
||||
);
|
||||
|
||||
w->viewport->flags = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES) ? VIEWPORT_FLAG_GRIDLINES : 0;
|
||||
w->viewport->flags = gConfigGeneral.always_show_gridlines ? VIEWPORT_FLAG_GRIDLINES : 0;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ static void window_sign_unknown_14(rct_window *w)
|
||||
-1
|
||||
);
|
||||
|
||||
w->viewport->flags = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES) ? VIEWPORT_FLAG_GRIDLINES : 0;
|
||||
w->viewport->flags = gConfigGeneral.always_show_gridlines ? VIEWPORT_FLAG_GRIDLINES : 0;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ void window_sign_small_open(rct_windownumber number){
|
||||
-1
|
||||
);
|
||||
|
||||
w->viewport->flags = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES) ? VIEWPORT_FLAG_GRIDLINES : 0;
|
||||
w->viewport->flags = gConfigGeneral.always_show_gridlines ? VIEWPORT_FLAG_GRIDLINES : 0;
|
||||
w->flags |= WF_NO_SCROLLING;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user