From 85a1e4aa6ddb2da898e5df986bf9f7e56db5ff04 Mon Sep 17 00:00:00 2001 From: ddevrien Date: Mon, 12 May 2014 16:50:13 +0200 Subject: [PATCH 01/12] config addresses test --- src/addresses.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/addresses.h b/src/addresses.h index cf565bfb0a..26706753cd 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -48,11 +48,15 @@ #define RCT2_ADDRESS_APP_PATH 0x009AA214 +#define RCT2_ADDRESS_CONFIG_MUSIC 0x009AAC72 #define RCT2_ADDRESS_CONFIG_FLAGS 0x009AAC74 +#define RCT2_ADDRESS_CONFIG_SOUND_QUALITY 0x009AAC77 #define RCT2_ADDRESS_CONFIG_METRIC 0x009AAC78 #define RCT2_ADDRESS_CONFIG_FAHRENHEIT 0x009AAC79 #define RCT2_ADDRESS_CONFIG_KEYBOARD_SHORTCUTS 0x009AAC7A #define RCT2_ADDRESS_CONFIG_EDGE_SCROLLING 0x009AACBA +#define RCT2_ADDRESS_CONFIG_CURRENCY 0x009AACBB +#define RCT2_ADDRESS_CONFIG_CONSTRUCTION_MARKER 0x009AACBF #define RCT2_ADDRESS_EXPANSION_NAMES 0x009AACC0 #define RCT2_ADDRESS_EXPANSION_FLAGS 0x009AB4C0 From c6fc8c634ba870d7aef3d0f5f713e6cdffa545a9 Mon Sep 17 00:00:00 2001 From: ddevrien Date: Mon, 12 May 2014 16:51:40 +0200 Subject: [PATCH 02/12] celsius fix --- src/climate.c | 4 ++-- src/climate.h | 2 +- src/config.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/climate.c b/src/climate.c index dd2275be2a..6c1d4a1fd7 100644 --- a/src/climate.c +++ b/src/climate.c @@ -41,9 +41,9 @@ static const rct_weather_transition* climate_transitions[4]; static void climate_determine_future_weather(); -int climate_celcius_to_fahrenheit(int celcius) +int climate_celsius_to_fahrenheit(int celsius) { - return (celcius * 29) / 16 + 32; + return (celsius * 29) / 16 + 32; } /** diff --git a/src/climate.h b/src/climate.h index 2c035b86f7..814039f10f 100644 --- a/src/climate.h +++ b/src/climate.h @@ -41,7 +41,7 @@ typedef struct { extern int gClimateNextWeather; extern const rct_weather climate_weather_data[6]; -int climate_celcius_to_fahrenheit(int celcius); +int climate_celsius_to_fahrenheit(int celsius); void climate_reset(int climate); void climate_update(); diff --git a/src/config.c b/src/config.c index 97263fb994..ee2d964fdd 100644 --- a/src/config.c +++ b/src/config.c @@ -103,7 +103,7 @@ void config_load() return; RCT2_GLOBAL(0x009AB4C6, sint8) = 1; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FAHRENHEIT, sint8) = 1; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, sint8) = 1; RCT2_GLOBAL(0x009AACBB, sint8) = 1; RCT2_GLOBAL(0x009AACBD, sint16) = 0; if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS)) From df97c22dae59bd966591eeeabfbbb2637eebdf09 Mon Sep 17 00:00:00 2001 From: ddevrien Date: Mon, 12 May 2014 16:56:28 +0200 Subject: [PATCH 03/12] some strings added --- src/addresses.h | 2 +- src/strings.h | 40 ++++++++++++++++++++++++-------- src/window_game_bottom_toolbar.c | 6 ++--- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index 26706753cd..162d8357fb 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -52,7 +52,7 @@ #define RCT2_ADDRESS_CONFIG_FLAGS 0x009AAC74 #define RCT2_ADDRESS_CONFIG_SOUND_QUALITY 0x009AAC77 #define RCT2_ADDRESS_CONFIG_METRIC 0x009AAC78 -#define RCT2_ADDRESS_CONFIG_FAHRENHEIT 0x009AAC79 +#define RCT2_ADDRESS_CONFIG_TEMPERATURE 0x009AAC79 #define RCT2_ADDRESS_CONFIG_KEYBOARD_SHORTCUTS 0x009AAC7A #define RCT2_ADDRESS_CONFIG_EDGE_SCROLLING 0x009AACBA #define RCT2_ADDRESS_CONFIG_CURRENCY 0x009AACBB diff --git a/src/strings.h b/src/strings.h index 7a92046a84..679a0a996c 100644 --- a/src/strings.h +++ b/src/strings.h @@ -280,6 +280,8 @@ enum { STR_SUMMARISED_GUESTS_TIP = 1753, STR_ADMISSION_PRICE = 1756, + STR_OFF = 1775, + STR_ON = 1776, STR_MUSIC = 1777, STR_ACTIONS = 1814, @@ -322,7 +324,7 @@ enum { STR_SHOW_SUBJECT_TIP = 1937, - STR_CELCIUS_VALUE = 2216, + STR_CELSIUS_VALUE = 2216, STR_FAHRENHEIT_VALUE = 2217, STR_PARK_RATING_LABEL = 2220, @@ -330,14 +332,6 @@ enum { STR_GUESTS_IN_PARK_LABEL = 2223, - STR_NUMBER_OF_RIDES_LABEL = 2321, - STR_STAFF_LABEL = 2322, - STR_PARK_SIZE_METRIC_LABEL = 2323, - STR_PARK_SIZE_IMPERIAL_LABEL = 2324, - - SPR_BUY_LAND_RIGHTS_TIP = 2325, - SPR_BUY_CONSTRUCTION_RIGHTS_TIP = 2326, - STR_PARK_INFORMATION_TIP = 2233, STR_RECENT_MESSAGES = 2234, @@ -360,19 +354,43 @@ enum { STR_CHANGE_VERTICAL_LAND_TIP = 2295, STR_SOUND_QUALITY = 2317, + STR_SOUND_LOW = 2318, + STR_SOUND_MEDIUM = 2319, + STR_SOUND_HIGH = 2320, + STR_NUMBER_OF_RIDES_LABEL = 2321, + STR_STAFF_LABEL = 2322, + STR_PARK_SIZE_METRIC_LABEL = 2323, + STR_PARK_SIZE_IMPERIAL_LABEL = 2324, + SPR_BUY_LAND_RIGHTS_TIP = 2325, + SPR_BUY_CONSTRUCTION_RIGHTS_TIP = 2326, STR_CURRENCY = 2328, STR_DISTANCE_AND_SPEED = 2329, STR_TEMPERATURE = 2330, STR_HEIGHT_LABELS = 2331, STR_UNITS = 2332, STR_SOUND = 2333, + STR_POUNDS = 2334, + STR_DOLLARS = 2335, + STR_FRANC = 2336, + STR_DEUTSCHMARK = 2337, + STR_YEN = 2338, + STR_PESETA = 2339, + STR_LIRA = 2340, + STR_GUILDERS = 2341, + STR_KRONA = 2342, + STR_EUROS = 2343, + STR_IMPERIAL = 2344, + STR_METRIC = 2345, STR_DISPLAY = 2346, + //STR_UNITS = 2358, + STR_REAL_VALUES = 2359, STR_DISPLAY_RESOLUTION = 2360, STR_TILE_SMOOTHING = 2361, STR_TILE_SMOOTHING_TIP = 2362, STR_GRIDLINES = 2363, STR_GRIDLINES_TIP = 2364, - + STR_CELSIUS = 2366, + STR_FAHRENHEIT = 2367, //STR_NONE = 2368, STR_LOW = 2369, STR_AVERAGE = 2370, @@ -494,6 +512,8 @@ enum { STR_UNABLE_TO_LOAD_FILE = 3010, STR_FILE_CONTAINS_INVALID_DATA = 3011, + STR_WHITE = 3055, + STR_TRANSLUCENT = 3056, STR_CONSTRUCTION_MARKER = 3057, STR_BEGINNER_PARKS = 3064, diff --git a/src/window_game_bottom_toolbar.c b/src/window_game_bottom_toolbar.c index 49c820abf2..c620f09a3a 100644 --- a/src/window_game_bottom_toolbar.c +++ b/src/window_game_bottom_toolbar.c @@ -471,9 +471,9 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo *dpi, y += 11; temperature = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TEMPERATURE, sint8); - format = STR_CELCIUS_VALUE; - if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FAHRENHEIT, uint8)) { - temperature = climate_celcius_to_fahrenheit(temperature); + format = STR_CELSIUS_VALUE; + if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, uint8)) { + temperature = climate_celsius_to_fahrenheit(temperature); format = STR_FAHRENHEIT_VALUE; } *((short*)0x013CE952) = temperature; From 942b722b2865544ace1872824b27a324f43f96c0 Mon Sep 17 00:00:00 2001 From: ddevrien Date: Mon, 12 May 2014 16:59:20 +0200 Subject: [PATCH 04/12] some work on options window --- src/window_options.c | 106 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 85 insertions(+), 21 deletions(-) diff --git a/src/window_options.c b/src/window_options.c index 142ca1dcb7..51168c8fe4 100644 --- a/src/window_options.c +++ b/src/window_options.c @@ -19,6 +19,7 @@ *****************************************************************************/ #include "addresses.h" +#include "config.h" #include "strings.h" #include "widget.h" #include "window.h" @@ -103,6 +104,7 @@ static void window_options_mousedown(); static void window_options_dropdown(); static void window_options_update(); static void window_options_paint(); +static void window_options_draw_dropdown_box(w, widget, num_items); static void* window_options_events[] = { window_options_emptysub, @@ -199,8 +201,7 @@ static void window_options_mouseup() */ static void window_options_mousedown() { - //RCT2_CALLPROC_EBPSAFE(0x006BB01B); - int numItems, i; + int num_items, i; sint64 device; short widgetIndex; rct_window *w; @@ -213,24 +214,16 @@ static void window_options_mousedown() switch (widgetIndex) { case WIDX_SOUND_DROPDOWN: - numItems = RCT2_GLOBAL(RCT2_ADDRESS_NUM_DSOUND_DEVICES, uint32); - if (numItems == 0) + num_items = RCT2_GLOBAL(RCT2_ADDRESS_NUM_DSOUND_DEVICES, uint32); + if (num_items == 0) break; - window_dropdown_show_text_custom_width( - w->x + widget->left, - w->y + widget->top, - widget->bottom - widget->top + 1, - w->colours[1], - 0x80, - numItems, - widget->right - widget->left - 3 - ); + window_options_draw_dropdown_box(w, widget, num_items); // populate the list with the sound devices device = RCT2_GLOBAL(RCT2_ADDRESS_DSOUND_DEVICES, sint32) + 0x10; - for (i = 0; i < numItems; i++) { + for (i = 0; i < num_items; i++) { gDropdownItemsFormat[i] = 1142; gDropdownItemsArgs[i] = 1170 | (device << 16); device += 0x210; @@ -239,28 +232,85 @@ static void window_options_mousedown() break; case WIDX_HEIGHT_LABELS_DROPDOWN: - RCT2_CALLPROC_EBPSAFE(0x006BB517); + window_options_draw_dropdown_box(w, widget, 2); + + gDropdownItemsFormat[0] = 1142; + gDropdownItemsFormat[1] = 1142; + gDropdownItemsArgs[0] = STR_UNITS; + gDropdownItemsArgs[1] = STR_REAL_VALUES; + + gDropdownItemsChecked = + (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & + CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS) ? 1 : 2; + break; case WIDX_MUSIC_DROPDOWN: - RCT2_CALLPROC_EBPSAFE(0x006BB5A8); + window_options_draw_dropdown_box(w, widget, 2); + + gDropdownItemsFormat[0] = 1142; + gDropdownItemsFormat[1] = 1142; + gDropdownItemsArgs[0] = STR_OFF; + gDropdownItemsArgs[1] = STR_ON; + + gDropdownItemsChecked = 1 << RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8); + break; case WIDX_SOUND_QUALITY_DROPDOWN: - RCT2_CALLPROC_EBPSAFE(0x006BB631); + num_items = 3; + window_options_draw_dropdown_box(w, widget, num_items); + + for (i = 0; i < num_items; i++) { + gDropdownItemsFormat[i] = 1142; + gDropdownItemsArgs[i] = STR_SOUND_LOW + i; // low, medium, high + } + gDropdownItemsChecked = 1 << RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, uint8); + break; case WIDX_CURRENCY_DROPDOWN: - RCT2_CALLPROC_EBPSAFE(0x006BB494); + num_items = 10; + window_options_draw_dropdown_box(w, widget, num_items); + + for (i = 0; i < num_items; i++) { + gDropdownItemsFormat[i] = 1142; + gDropdownItemsArgs[i] = STR_POUNDS + i; // all different currencies + } + gDropdownItemsChecked = 1 << (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CURRENCY, uint8) & 0x3F); + break; case WIDX_DISTANCE_DROPDOWN: - RCT2_CALLPROC_EBPSAFE(0x006BB3E6); + window_options_draw_dropdown_box(w, widget, 2); + + gDropdownItemsFormat[0] = 1142; + gDropdownItemsFormat[1] = 1142; + gDropdownItemsArgs[0] = STR_IMPERIAL; + gDropdownItemsArgs[1] = STR_METRIC; + + gDropdownItemsChecked = 1 << RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, uint8); + break; case WIDX_RESOLUTION_DROPDOWN: RCT2_CALLPROC_EBPSAFE(0x006BB2AF); break; case WIDX_TEMPERATURE_DROPDOWN: - RCT2_CALLPROC_EBPSAFE(0x006BB21F); + window_options_draw_dropdown_box(w, widget, 2); + + gDropdownItemsFormat[0] = 1142; + gDropdownItemsFormat[1] = 1142; + gDropdownItemsArgs[0] = STR_CELSIUS; + gDropdownItemsArgs[1] = STR_FAHRENHEIT; + + gDropdownItemsChecked = 1 << RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, uint8); + break; case WIDX_CONSTRUCTION_MARKER_DROPDOWN: - RCT2_CALLPROC_EBPSAFE(0x006BB18F); + window_options_draw_dropdown_box(w, widget, 2); + + gDropdownItemsFormat[0] = 1142; + gDropdownItemsFormat[1] = 1142; + gDropdownItemsArgs[0] = STR_WHITE; + gDropdownItemsArgs[1] = STR_TRANSLUCENT; + + gDropdownItemsChecked = 1 << RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CONSTRUCTION_MARKER, uint8); break; } } @@ -329,4 +379,18 @@ static void window_options_paint() w->y + window_options_widgets[WIDX_MUSIC].top + 1); gfx_draw_string_left(dpi, STR_SOUND_QUALITY, w, 0, w->x + 10, w->y + window_options_widgets[WIDX_SOUND_QUALITY].top + 1); +} + +// helper function, all dropdown boxes have similar properties +static void window_options_draw_dropdown_box(rct_window *w, rct_widget *widget, int num_items) +{ + window_dropdown_show_text_custom_width( + w->x + widget->left, + w->y + widget->top, + widget->bottom - widget->top + 1, + w->colours[1], + 0x80, + num_items, + widget->right - widget->left - 3 + ); } \ No newline at end of file From 4550a1de6828cd98f43ed8324cda97ccf3b62dae Mon Sep 17 00:00:00 2001 From: ddevrien Date: Mon, 12 May 2014 21:18:27 +0200 Subject: [PATCH 05/12] More work on options window dropdown function --- src/addresses.h | 1 + src/window_options.c | 82 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 79 insertions(+), 4 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index 162d8357fb..67d32db6a3 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -56,6 +56,7 @@ #define RCT2_ADDRESS_CONFIG_KEYBOARD_SHORTCUTS 0x009AAC7A #define RCT2_ADDRESS_CONFIG_EDGE_SCROLLING 0x009AACBA #define RCT2_ADDRESS_CONFIG_CURRENCY 0x009AACBB +#define RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS 0x009AACBD #define RCT2_ADDRESS_CONFIG_CONSTRUCTION_MARKER 0x009AACBF #define RCT2_ADDRESS_EXPANSION_NAMES 0x009AACC0 diff --git a/src/window_options.c b/src/window_options.c index 51168c8fe4..2eb28707ab 100644 --- a/src/window_options.c +++ b/src/window_options.c @@ -20,6 +20,7 @@ #include "addresses.h" #include "config.h" +#include "gfx.h" #include "strings.h" #include "widget.h" #include "window.h" @@ -105,6 +106,7 @@ static void window_options_dropdown(); static void window_options_update(); static void window_options_paint(); static void window_options_draw_dropdown_box(w, widget, num_items); +static void window_options_update_height_markers(); static void* window_options_events[] = { window_options_emptysub, @@ -321,18 +323,77 @@ static void window_options_mousedown() */ static void window_options_dropdown() { - RCT2_CALLPROC_EBPSAFE(0x006BB076); - /*short widgetIndex; + //RCT2_CALLPROC_EBPSAFE(0x006BB076); + short dropdownIndex; + short widgetIndex; rct_window *w; + __asm mov dropdownIndex, ax __asm mov widgetIndex, dx __asm mov w, esi + if (dropdownIndex == -1) + return; + switch (widgetIndex) { case WIDX_SOUND_DROPDOWN: - RCT2_CALLPROC_EBPSAFE(0x006BB757); + __asm movzx ax, dropdownIndex // the switch replaces ax value + RCT2_CALLPROC_EBPSAFE(0x006BA9B5); // part of init audio + window_invalidate(w); break; - }*/ + 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; + + if (dropdownIndex == 0) + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) |= CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS; + + window_options_update_height_markers(); + break; + case WIDX_MUSIC_DROPDOWN: + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8) = dropdownIndex; + config_save(); + RCT2_CALLPROC_EBPSAFE(0x006BCA9F); + window_invalidate(w); + break; + case WIDX_SOUND_QUALITY_DROPDOWN: + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, uint8) = dropdownIndex; + + // TODO: no clue what this does (and if it's correct) + RCT2_GLOBAL(0x009AAC75, uint8) = RCT2_GLOBAL(0x009AF601 + dropdownIndex, uint8); + RCT2_GLOBAL(0x009AAC76, uint8) = RCT2_GLOBAL(0x009AF604 + dropdownIndex, uint8); + + config_save(); + window_invalidate(w); + break; + case WIDX_CURRENCY_DROPDOWN: + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CURRENCY, uint8) = dropdownIndex | 0xC0; + config_save(); + gfx_invalidate_screen(); + break; + case WIDX_DISTANCE_DROPDOWN: + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, uint8) = dropdownIndex; + window_options_update_height_markers(); + break; + case WIDX_RESOLUTION_DROPDOWN: + __asm movzx ax, dropdownIndex // the switch replaces ax value + RCT2_CALLPROC_EBPSAFE(0x006BB37D); + break; + case WIDX_TEMPERATURE_DROPDOWN: + if (dropdownIndex != RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, uint8)) { + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, uint8) = dropdownIndex; + config_save(); + gfx_invalidate_screen(); + } + break; + case WIDX_CONSTRUCTION_MARKER_DROPDOWN: + if (dropdownIndex != RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CONSTRUCTION_MARKER, uint8)) { + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CONSTRUCTION_MARKER, uint8) = dropdownIndex; + config_save(); + gfx_invalidate_screen(); + } + break; + } } /** @@ -393,4 +454,17 @@ static void window_options_draw_dropdown_box(rct_window *w, rct_widget *widget, num_items, widget->right - widget->left - 3 ); +} + +static void window_options_update_height_markers() +{ + if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS) { + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, uint16) = 0; + } else { // use real values (metric or imperial) + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, uint16) = + (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, uint16) + 1) * 256; + } + + config_save(); + gfx_invalidate_screen(); } \ No newline at end of file From 0e02787bf39be92fc954b93f26ceee7cec611d9d Mon Sep 17 00:00:00 2001 From: adrian17 Date: Mon, 12 May 2014 22:03:24 +0200 Subject: [PATCH 06/12] Prefer the RCT2_GLOBAL macro --- src/osinterface.c | 4 ++-- src/window_game_bottom_toolbar.c | 20 ++++++++++---------- src/window_guest_list.c | 3 +-- src/window_park.c | 10 +++++----- src/window_title_scenarioselect.c | 24 ++++++++++++------------ 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/osinterface.c b/src/osinterface.c index 1c7afe06d6..38f30a3cb1 100644 --- a/src/osinterface.c +++ b/src/osinterface.c @@ -240,8 +240,8 @@ void osinterface_process_messages() } break; case SDL_MOUSEBUTTONUP: - *((int*)0x01424318) = e.button.x; - *((int*)0x0142431C) = e.button.y; + RCT2_GLOBAL(0x01424318, int) = e.button.x; + RCT2_GLOBAL(0x0142431C, int) = e.button.y; switch (e.button.button) { case SDL_BUTTON_LEFT: RCT2_CALLPROC_1(0x00406C96, int, 2); diff --git a/src/window_game_bottom_toolbar.c b/src/window_game_bottom_toolbar.c index c620f09a3a..1545a57e8c 100644 --- a/src/window_game_bottom_toolbar.c +++ b/src/window_game_bottom_toolbar.c @@ -211,20 +211,20 @@ static void window_game_bottom_toolbar_tooltip() switch (widgetIndex) { case WIDX_MONEY: - *((int*)0x013CE952) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, sint32); - *((int*)0x013CE956) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, sint32); + RCT2_GLOBAL(0x013CE952, int) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, sint32); + RCT2_GLOBAL(0x013CE956, int) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, sint32); widgetIndex = 0; break; case WIDX_PARK_RATING: - *((short*)0x013CE952) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16); + RCT2_GLOBAL(0x013CE952, short) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16); widgetIndex = 0; break; case WIDX_DATE: month = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) & 7; day = ((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, sint16) * days_in_month[month]) >> 16) & 0xFF; - - *((short*)0x013CE952) = STR_DATE_DAY_1 + day; - *((short*)0x013CE954) = STR_MONTH_MARCH + month; + + RCT2_GLOBAL(0x013CE952, short) = STR_DATE_DAY_1 + day; + RCT2_GLOBAL(0x013CE954, short) = STR_MONTH_MARCH + month; widgetIndex = 0; break; } @@ -386,10 +386,10 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo *dpi, r // Draw money if (!(RCT2_GLOBAL(0x0013573E4, uint32) & 0x800)) { - *((int*)0x013CE952) = DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32)); + RCT2_GLOBAL(0x013CE952, int) = DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32)); gfx_draw_string_centred( dpi, - (*((int*)0x013CE952) < 0 ? 1391 : 1390), + (RCT2_GLOBAL(0x013CE952, int) < 0 ? 1391 : 1390), x, y - 3, (RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, rct_windowclass) == 2 && RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, sint32) == WIDX_MONEY ? 2 : w->colours[0] & 0x7F), (void*)0x013CE952 @@ -456,7 +456,7 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo *dpi, y = window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].top + w->y + 2; // Date - *((short*)0x013CE952) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16); + RCT2_GLOBAL(0x013CE952, short) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16); gfx_draw_string_centred( dpi, 1845, @@ -476,7 +476,7 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo *dpi, temperature = climate_celsius_to_fahrenheit(temperature); format = STR_FAHRENHEIT_VALUE; } - *((short*)0x013CE952) = temperature; + RCT2_GLOBAL(0x013CE952, short) = temperature; gfx_draw_string_left(dpi, format, (void*)0x013CE952, 0, x, y + 6); x += 30; diff --git a/src/window_guest_list.c b/src/window_guest_list.c index 5bd202fa28..4083ab5d36 100644 --- a/src/window_guest_list.c +++ b/src/window_guest_list.c @@ -539,10 +539,9 @@ static void window_guest_list_paint() // Widgets window_draw_widgets(w, dpi); - // Tab 1 image i = (_window_guest_list_selected_tab == 0 ? w->var_490 & 0x0FFFFFFFC : 0); - i += ((int*)*((int*)0x00982708))[0] + 1; + i += RCT2_ADDRESS(RCT2_GLOBAL(0x00982708, int), int)[0] + 1; i |= 0xA1600000; gfx_draw_sprite( dpi, diff --git a/src/window_park.c b/src/window_park.c index c7ee646eae..d73576d8d0 100644 --- a/src/window_park.c +++ b/src/window_park.c @@ -1790,7 +1790,7 @@ static void window_park_objective_paint() x = w->x + window_park_objective_widgets[WIDX_PAGE_BACKGROUND].left + 4; y = w->y + window_park_objective_widgets[WIDX_PAGE_BACKGROUND].top + 7; strcpy((char*)0x009BC677, RCT2_ADDRESS(RCT2_ADDRESS_SCENARIO_DETAILS, char)); - *((short*)0x013CE952) = 3165; + RCT2_GLOBAL(0x013CE952, short) = 3165; y += gfx_draw_string_left_wrapped(dpi, (void*)0x013CE952, x, y, 222, 1191, 0); y += 5; @@ -1799,9 +1799,9 @@ static void window_park_objective_paint() y += 10; // Objective - *((short*)0x013CE952) = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16); - *((short*)0x013CE954) = date_get_total_months(MONTH_OCTOBER, RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8)); - *((int*)0x013CE956) = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, sint32); + RCT2_GLOBAL(0x013CE952, short) = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16); + RCT2_GLOBAL(0x013CE954, short) = date_get_total_months(MONTH_OCTOBER, RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8)); + RCT2_GLOBAL(0x013CE956, int) = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, sint32); gfx_draw_string_left_wrapped(dpi, (void*)0x013CE952, x, y, 221, 2385 + RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8), 0); y += 5; @@ -1813,7 +1813,7 @@ static void window_park_objective_paint() gfx_draw_string_left_wrapped(dpi, NULL, x, y, 222, 2789, 0); } else { // Objective completed - *((int*)0x013CE952) = RCT2_GLOBAL(RCT2_ADDRESS_COMPLETED_COMPANY_VALUE, uint32); + RCT2_GLOBAL(0x013CE952, int) = RCT2_GLOBAL(RCT2_ADDRESS_COMPLETED_COMPANY_VALUE, uint32); gfx_draw_string_left_wrapped(dpi, (void*)0x013CE952, x, y, 222, 2788, 0); } } diff --git a/src/window_title_scenarioselect.c b/src/window_title_scenarioselect.c index 70bb883045..5d0be5bba5 100644 --- a/src/window_title_scenarioselect.c +++ b/src/window_title_scenarioselect.c @@ -310,7 +310,7 @@ static void window_scenarioselect_paint() x = (widget->left + widget->right) / 2 + w->x; y = (widget->top + widget->bottom) / 2 + w->y - 3; - *((short*)(0x0013CE952 + 0)) = STR_BEGINNER_PARKS + i; + RCT2_GLOBAL(0x013CE952 + 0, short) = STR_BEGINNER_PARKS + i; gfx_draw_string_centred_wrapped(dpi, (void*)0x013CE952, x, y, 87, 1193, 10); } @@ -327,27 +327,27 @@ static void window_scenarioselect_paint() x = w->x + window_scenarioselect_widgets[WIDX_SCENARIOLIST].right + 4; y = w->y + window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5; strcpy((char*)0x009BC677, scenario->name); - *((short*)(0x0013CE952 + 0)) = 3165; + RCT2_GLOBAL(0x013CE952 + 0, short) = 3165; gfx_draw_string_centred_clipped(dpi, 1193, (void*)0x013CE952, 0, x + 85, y, 170); y += 15; // Scenario details strcpy((char*)0x009BC677, scenario->details); - *((short*)(0x0013CE952 + 0)) = 3165; + RCT2_GLOBAL(0x013CE952 + 0, short) = 3165; y += gfx_draw_string_left_wrapped(dpi, (void*)0x013CE952, x, y, 170, 1191, 0) + 5; // Scenario objective - *((short*)(0x0013CE952 + 0)) = scenario->objective_type + STR_OBJECTIVE_NONE; - *((short*)(0x0013CE952 + 2)) = scenario->objective_arg_3; - *((short*)(0x0013CE952 + 4)) = date_get_total_months(MONTH_OCTOBER, scenario->objective_arg_1); - *((int*)(0x0013CE952 + 6)) = scenario->objective_arg_2; + RCT2_GLOBAL(0x013CE952 + 0, short) = scenario->objective_type + STR_OBJECTIVE_NONE; + RCT2_GLOBAL(0x013CE952 + 2, short) = scenario->objective_arg_3; + RCT2_GLOBAL(0x013CE952 + 4, short) = date_get_total_months(MONTH_OCTOBER, scenario->objective_arg_1); + RCT2_GLOBAL(0x013CE952 + 6, int) = scenario->objective_arg_2; y += gfx_draw_string_left_wrapped(dpi, (void*)0x013CE952, x, y, 170, STR_OBJECTIVE, 0) + 5; // Scenario score if (scenario->flags & SCENARIO_FLAGS_COMPLETED) { strcpy((char*)0x009BC677, scenario->completed_by); - *((short*)(0x0013CE952 + 0)) = 3165; - *((int*)(0x0013CE952 + 2)) = scenario->company_value; + RCT2_GLOBAL(0x013CE952 + 0, short) = 3165; + RCT2_GLOBAL(0x013CE952 + 2, int) = scenario->company_value; y += gfx_draw_string_left_wrapped(dpi, (void*)0x013CE952, x, y, 170, STR_COMPLETED_BY_WITH_COMPANY_VALUE, 0); } } @@ -385,7 +385,7 @@ static void window_scenarioselect_scrollpaint() // Draw scenario name strcpy((char*)0x009BC677, scenario->name); - *((short*)0x013CE952) = 3165; + RCT2_GLOBAL(0x013CE952, short) = 3165; gfx_draw_string_centred(dpi, highlighted ? 1193 : 1191, 210, y + 1, 0, (void*)0x013CE952); // Check if scenario is completed @@ -395,8 +395,8 @@ static void window_scenarioselect_scrollpaint() // Draw completion score strcpy((char*)0x009BC677, scenario->completed_by); - *((short*)0x013CE952) = 2793; - *((short*)0x013CE954) = 3165; + RCT2_GLOBAL(0x013CE952, short) = 2793; + RCT2_GLOBAL(0x013CE954, short) = 3165; gfx_draw_string_centred(dpi, highlighted ? 1193 : 1191, 210, y + 11, 0, (void*)0x013CE952); } From 72d9d17bf7168bb8ba5612fd373f4018ce8b4fdb Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Mon, 12 May 2014 21:06:02 +0100 Subject: [PATCH 07/12] Added some more sprites and changed get_guest_face to use them --- src/sprites.h | 30 ++++++++++++++++++++++++++++++ src/window_guest_list.c | 30 ++++++++++++++++-------------- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/src/sprites.h b/src/sprites.h index 869f35ddc7..9dd8bec070 100644 --- a/src/sprites.h +++ b/src/sprites.h @@ -79,6 +79,22 @@ enum { SPR_TAB_STATS_5 = SPR_TAB_STATS_0 + 5, SPR_TAB_STATS_6 = SPR_TAB_STATS_0 + 6, + SPR_PEEP_LARGE_FACE_VERY_VERY_UNHAPPY = 5284, + SPR_PEEP_LARGE_FACE_VERY_UNHAPPY = 5285, + SPR_PEEP_LARGE_FACE_UNHAPPY = 5286, + SPR_PEEP_LARGE_FACE_NORMAL = 5287, + SPR_PEEP_LARGE_FACE_HAPPY = 5288, + SPR_PEEP_LARGE_FACE_VERY_HAPPY = 5289, + SPR_PEEP_LARGE_FACE_VERY_VERY_HAPPY = 5290, + SPR_PEEP_LARGE_FACE_TIRED = 5291, + SPR_PEEP_LARGE_FACE_VERY_TIRED = 5292, + SPR_PEEP_LARGE_FACE_SICK = 5293, + SPR_PEEP_LARGE_FACE_VERY_SICK = 5294, + + SPR_PEEP_LARGE_FACE_VERY_VERY_SICK = 5298, + + SPR_PEEP_LARGE_FACE_ANGRY = 5314, + SPR_TAB_SHOPS_AND_STALLS_0 = 5351, SPR_TAB_SHOPS_AND_STALLS_1 = SPR_TAB_SHOPS_AND_STALLS_0 + 1, SPR_TAB_SHOPS_AND_STALLS_2 = SPR_TAB_SHOPS_AND_STALLS_0 + 2, @@ -140,6 +156,20 @@ enum { SPR_MOST_CONFUSING_LAYOUT = SPR_AWARD_MOST_UNTIDY + 15, SPR_BEST_GENTLE_RIDES = SPR_AWARD_MOST_UNTIDY + 16, + SPR_PEEP_SMALL_FACE_VERY_VERY_UNHAPPY = 5486, + SPR_PEEP_SMALL_FACE_VERY_UNHAPPY = 5487, + SPR_PEEP_SMALL_FACE_UNHAPPY = 5488, + SPR_PEEP_SMALL_FACE_NORMAL = 5489, + SPR_PEEP_SMALL_FACE_HAPPY = 5490, + SPR_PEEP_SMALL_FACE_VERY_HAPPY = 5491, + SPR_PEEP_SMALL_FACE_VERY_VERY_HAPPY = 5492, + SPR_PEEP_SMALL_FACE_TIRED = 5493, + SPR_PEEP_SMALL_FACE_VERY_TIRED = 5494, + SPR_PEEP_SMALL_FACE_SICK = 5495, + SPR_PEEP_SMALL_FACE_VERY_SICK = 5496, + SPR_PEEP_SMALL_FACE_VERY_VERY_SICK = 5497, + SPR_PEEP_SMALL_FACE_ANGRY = 5498, + SPR_LAND_TOOL_DECREASE = 5499, SPR_LAND_TOOL_INCREASE = 5501, diff --git a/src/window_guest_list.c b/src/window_guest_list.c index 5bd202fa28..931ff33dee 100644 --- a/src/window_guest_list.c +++ b/src/window_guest_list.c @@ -935,26 +935,27 @@ static void window_guest_list_find_groups() static int get_guest_face_sprite_small(rct_peep *peep) { int sprite; - sprite = 0x157A; + sprite = SPR_PEEP_SMALL_FACE_ANGRY; if (peep->var_F3) return sprite; + sprite = SPR_PEEP_SMALL_FACE_VERY_VERY_SICK; - sprite = 0x1579; if (peep->nausea > 200) return sprite; - sprite--; + sprite--; //VERY_SICK if (peep->nausea > 170) return sprite; - sprite--; + sprite--; //SICK if (peep->nausea > 140) return sprite; - sprite = 0x1576; + sprite = SPR_PEEP_SMALL_FACE_VERY_TIRED; if (peep->energy < 46) return sprite; - sprite--; + sprite--; //TIRED if (peep->energy < 70) return sprite; - sprite = 0x156E; + sprite = SPR_PEEP_SMALL_FACE_VERY_VERY_UNHAPPY; + //There are 7 different happiness based faces for (int i = 37; peep->happiness >= i; i += 37) { sprite++; @@ -969,26 +970,27 @@ static int get_guest_face_sprite_small(rct_peep *peep) */ static int get_guest_face_sprite_large(rct_peep* peep){ int sprite; - sprite = 5314; + sprite = SPR_PEEP_LARGE_FACE_ANGRY; if (peep->var_F3) return sprite; + sprite = SPR_PEEP_LARGE_FACE_VERY_VERY_SICK; - sprite = 5298; if (peep->nausea > 200) return sprite; - sprite = 0x14AE; + sprite = SPR_PEEP_LARGE_FACE_VERY_SICK; if (peep->nausea > 170) return sprite; - sprite = 0x14AD; + sprite = SPR_PEEP_LARGE_FACE_SICK; if (peep->nausea > 140) return sprite; - sprite = 0x14AC; + sprite = SPR_PEEP_LARGE_FACE_VERY_TIRED; if (peep->energy < 46) return sprite; - sprite--; + sprite--; //TIRED if (peep->energy < 70) return sprite; - sprite = 0x14A4; + sprite = SPR_PEEP_LARGE_FACE_VERY_VERY_UNHAPPY; + //There are 7 different happiness based faces for (int i = 37; peep->happiness >= i; i += 37) { sprite++; From 62c9069c9fc56343d70effd16cfaa587815714aa Mon Sep 17 00:00:00 2001 From: adrian17 Date: Mon, 12 May 2014 22:22:20 +0200 Subject: [PATCH 08/12] Increase the warning_throttle array size to hold all 7 values --- src/peep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/peep.c b/src/peep.c index 8a04b3e95d..2e7af42148 100644 --- a/src/peep.c +++ b/src/peep.c @@ -87,7 +87,7 @@ void peep_problem_warnings_update() uint16 guests_in_park = RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16); int hunger_counter = 0, lost_counter = 0, noexit_counter = 0, thirst_counter = 0, litter_counter = 0, disgust_counter = 0, bathroom_counter = 0 ,vandalism_counter = 0; - static int warning_throttle[6] = { 0, 0, 0, 0, 0, 0 }; + static int warning_throttle[7] = { 0, 0, 0, 0, 0, 0, 0 }; RCT2_GLOBAL(RCT2_ADDRESS_RIDE_COUNT, sint16) = ride_get_count(); // refactor this to somewhere else From e71170334fd30bfa8ee39cfd57b88b9309c98bc5 Mon Sep 17 00:00:00 2001 From: ddevrien Date: Tue, 13 May 2014 00:13:23 +0200 Subject: [PATCH 09/12] options window mouseup code --- src/addresses.h | 1 + src/config.h | 3 ++- src/window_options.c | 57 ++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index 67d32db6a3..77e174086d 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -48,6 +48,7 @@ #define RCT2_ADDRESS_APP_PATH 0x009AA214 +#define RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER 0x009AAC6E #define RCT2_ADDRESS_CONFIG_MUSIC 0x009AAC72 #define RCT2_ADDRESS_CONFIG_FLAGS 0x009AAC74 #define RCT2_ADDRESS_CONFIG_SOUND_QUALITY 0x009AAC77 diff --git a/src/config.h b/src/config.h index 65ee7b4752..35b4b1e0b2 100644 --- a/src/config.h +++ b/src/config.h @@ -27,7 +27,8 @@ enum { CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES = (1 << 0), CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS = (1 << 1), - CONFIG_FLAG_DISABLE_SMOOTH_LANDSCAPE = (1 << 2) + CONFIG_FLAG_DISABLE_SMOOTH_LANDSCAPE = (1 << 2), + CONFIG_FLAG_SAVE_PLUGIN_DATA = (1 << 3) }; enum { diff --git a/src/window_options.c b/src/window_options.c index 2eb28707ab..a9de1ffd6b 100644 --- a/src/window_options.c +++ b/src/window_options.c @@ -19,9 +19,11 @@ *****************************************************************************/ #include "addresses.h" +#include "audio.h" #include "config.h" #include "gfx.h" #include "strings.h" +#include "viewport.h" #include "widget.h" #include "window.h" #include "window_dropdown.h" @@ -194,7 +196,59 @@ void window_options_open() */ static void window_options_mouseup() { - RCT2_CALLPROC_EBPSAFE(0x006BAFCA); + short widgetIndex; + rct_window *w; + + __asm mov widgetIndex, dx + __asm mov w, esi + + switch (widgetIndex) { + case WIDX_CLOSE: + window_close(w); + break; + case WIDX_HOTKEY_DROPDOWN: + RCT2_CALLPROC_EBPSAFE(0x006E3884); + break; + case WIDX_SCREEN_EDGE_SCROLLING: + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_EDGE_SCROLLING, uint8) ^= 1; + config_save(); + window_invalidate(w); + break; + case WIDX_REAL_NAME_CHECKBOX: + RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; + + if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES) + __asm xor al, al + else + __asm mov al, 1 + + RCT2_CALLPROC_EBPSAFE(0x0069C52F); + break; + case WIDX_TILE_SMOOTHING_CHECKBOX: + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) ^= CONFIG_FLAG_DISABLE_SMOOTH_LANDSCAPE; + config_save(); + gfx_invalidate_screen(); + break; + case WIDX_GRIDLINES_CHECKBOX: + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) ^= CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES; + config_save(); + gfx_invalidate_screen(); + + if ((w = window_get_main()) != NULL) { + if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES) + w->viewport->flags |= VIEWPORT_FLAG_GRIDLINES; + else + w->viewport->flags &= ~VIEWPORT_FLAG_GRIDLINES; + } + break; + case WIDX_SOUND_SW_BUFFER_CHECKBOX: + pause_sounds(); + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER, uint8) ^= 1; + config_save(); + unpause_sounds(); + window_invalidate(w); + break; + } } /** @@ -323,7 +377,6 @@ static void window_options_mousedown() */ static void window_options_dropdown() { - //RCT2_CALLPROC_EBPSAFE(0x006BB076); short dropdownIndex; short widgetIndex; rct_window *w; From 98ab959ef91ca16a7705775c7dd763ce5b3bb60f Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Mon, 12 May 2014 23:19:36 +0100 Subject: [PATCH 10/12] fix warnings in options window --- src/window_options.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/window_options.c b/src/window_options.c index 2eb28707ab..5533bbb9b9 100644 --- a/src/window_options.c +++ b/src/window_options.c @@ -351,13 +351,13 @@ static void window_options_dropdown() window_options_update_height_markers(); break; case WIDX_MUSIC_DROPDOWN: - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8) = dropdownIndex; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8) = (uint8)dropdownIndex; config_save(); RCT2_CALLPROC_EBPSAFE(0x006BCA9F); window_invalidate(w); break; case WIDX_SOUND_QUALITY_DROPDOWN: - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, uint8) = dropdownIndex; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, uint8) = (uint8)dropdownIndex; // TODO: no clue what this does (and if it's correct) RCT2_GLOBAL(0x009AAC75, uint8) = RCT2_GLOBAL(0x009AF601 + dropdownIndex, uint8); @@ -372,7 +372,7 @@ static void window_options_dropdown() gfx_invalidate_screen(); break; case WIDX_DISTANCE_DROPDOWN: - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, uint8) = dropdownIndex; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, uint8) = (uint8)dropdownIndex; window_options_update_height_markers(); break; case WIDX_RESOLUTION_DROPDOWN: @@ -381,14 +381,14 @@ static void window_options_dropdown() break; case WIDX_TEMPERATURE_DROPDOWN: if (dropdownIndex != RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, uint8)) { - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, uint8) = dropdownIndex; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, uint8) = (uint8)dropdownIndex; config_save(); gfx_invalidate_screen(); } break; case WIDX_CONSTRUCTION_MARKER_DROPDOWN: if (dropdownIndex != RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CONSTRUCTION_MARKER, uint8)) { - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CONSTRUCTION_MARKER, uint8) = dropdownIndex; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CONSTRUCTION_MARKER, uint8) = (uint8)dropdownIndex; config_save(); gfx_invalidate_screen(); } From 31424b6a0683cec3ac04944be118685a3120e0be Mon Sep 17 00:00:00 2001 From: adrian17 Date: Tue, 13 May 2014 23:37:45 +0200 Subject: [PATCH 11/12] Use macros defined in addresses.h where possible. Removed one doubled macro. --- src/addresses.h | 2 -- src/config.c | 20 ++++++++++---------- src/game.c | 4 ++-- src/gfx.c | 2 +- src/park.c | 2 +- src/scenario.c | 12 ++++++------ src/window_game_bottom_toolbar.c | 2 +- src/window_game_top_toolbar.c | 4 ++-- src/window_water.c | 4 ++-- 9 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index 77e174086d..9b4ebfa942 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -181,8 +181,6 @@ #define RCT2_ADDRESS_MECHANIC_COLOUR 0x01357BCE #define RCT2_ADDRESS_SECURITY_COLOUR 0x01357BCF -#define RCT2_ADDRESS_CURRENT_INTEREST_RATE 0x0135934A - #define RCT2_ADDRESS_MAP_SIZE 0x01358834 #define RCT2_ADDRESS_PARK_SIZE 0x013580EA diff --git a/src/config.c b/src/config.c index ee2d964fdd..916c183270 100644 --- a/src/config.c +++ b/src/config.c @@ -104,27 +104,27 @@ void config_load() RCT2_GLOBAL(0x009AB4C6, sint8) = 1; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) = 0; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, sint8) = 1; - RCT2_GLOBAL(0x009AACBB, sint8) = 1; - RCT2_GLOBAL(0x009AACBD, sint16) = 0; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CURRENCY, sint8) = 1; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = 0; if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS)) - RCT2_GLOBAL(0x009AACBD, sint16) = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) + 1) * 256; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) + 1) * 256; RCT2_GLOBAL(0x009AA00D, sint8) = 1; } } - RCT2_GLOBAL(0x009AAC77, sint8) = 0; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8) = 0; if (RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_PHYSICAL, uint32) > 0x4000000) { - RCT2_GLOBAL(0x009AAC77, sint8) = 1; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8) = 1; if (RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_PHYSICAL, uint32) > 0x8000000) - RCT2_GLOBAL(0x009AAC77, sint8) = 2; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8) = 2; } - RCT2_GLOBAL(0x009AAC75, sint8) = RCT2_ADDRESS(0x009AF601, sint8)[RCT2_GLOBAL(0x009AAC77, sint8)]; - RCT2_GLOBAL(0x009AAC76, sint8) = RCT2_ADDRESS(0x009AF604, sint8)[RCT2_GLOBAL(0x009AAC77, sint8)]; - RCT2_GLOBAL(0x009AACBD, sint16) = 0; + RCT2_GLOBAL(0x009AAC75, sint8) = RCT2_ADDRESS(0x009AF601, sint8)[RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8)]; + RCT2_GLOBAL(0x009AAC76, sint8) = RCT2_ADDRESS(0x009AF604, sint8)[RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8)]; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = 0; if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS)) - RCT2_GLOBAL(0x009AACBD, sint16) = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) + 1) * 256; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) + 1) * 256; RCT2_GLOBAL(0x009AA00D, sint8) = 1; } diff --git a/src/game.c b/src/game.c index c3f7c0f44c..37ce64cc66 100644 --- a/src/game.c +++ b/src/game.c @@ -1410,7 +1410,7 @@ static void load_landscape() strcpy(esi, ".SC6"); break; } - strcpy((char*)0x009ABB37, (char*)0x0141EF68); + strcpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, (char*)0x0141EF68); RCT2_CALLPROC_EBPSAFE(0x006758C0); // landscape_load if (1) { @@ -1546,7 +1546,7 @@ static void load_game() strcpy(esi, ".SV6"); break; } - strcpy((char*)0x009ABB37, (char*)0x0141EF68); + strcpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, (char*)0x0141EF68); if (game_load_save()) { gfx_invalidate_screen(); diff --git a/src/gfx.c b/src/gfx.c index b0f8a59487..dbcbefc35c 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -284,7 +284,7 @@ void gfx_transpose_palette(int pal, unsigned char product) uint8* esi, *edi; ebx = pal * 16; - esi = (uint8*)(*((int*)(0x009EBD28 + ebx))); + esi = (uint8*)(*((int*)(RCT2_ADDRESS_G1_ELEMENTS + ebx))); ebp = *((short*)(0x009EBD2C + ebx)); eax = *((short*)(0x009EBD30 + ebx)) * 4; edi = (uint8*)0x01424680 + eax; diff --git a/src/park.c b/src/park.c index bc39ff3d46..a3698008f7 100644 --- a/src/park.c +++ b/src/park.c @@ -74,7 +74,7 @@ void park_init() RCT2_GLOBAL(0x013573F2, sint16) = -1; RCT2_GLOBAL(0x013573F8, sint16) = -1; RCT2_GLOBAL(0x01357CF2, uint16) = 127; - RCT2_GLOBAL(0x013573FF, uint8) = 2; + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL, uint8) = 2; RCT2_GLOBAL(0x013580F4, uint16) = 500; RCT2_GLOBAL(0x013580E9, uint8) = 128; diff --git a/src/scenario.c b/src/scenario.c index 4e4461e635..8b7706df92 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -380,7 +380,7 @@ void scenario_load(char *path) sawyercoding_read_chunk(hFile, (uint8*)RCT2_ADDRESS_CURRENT_PARK_VALUE); // Read more game data, including research items and rides - sawyercoding_read_chunk(hFile, (uint8*)0x01358740); + sawyercoding_read_chunk(hFile, (uint8*)RCT2_ADDRESS_COMPLETED_COMPANY_VALUE); CloseHandle(hFile); @@ -468,8 +468,8 @@ void scenario_load_and_play(rct_scenario_basic *scenario) RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32) = ENCRYPT_MONEY(RCT2_GLOBAL(0x013573DC, sint32)); RCT2_CALLPROC_EBPSAFE(0x0069E869); // (loan related) - strcpy((char*)0x0135924A, s6Info->details); - strcpy((char*)0x0135920A, s6Info->name); + strcpy((char*)RCT2_ADDRESS_SCENARIO_DETAILS, s6Info->details); + strcpy((char*)RCT2_ADDRESS_SCENARIO_NAME, s6Info->name); if (RCT2_GLOBAL(0x009ADAE4, sint32) != -1) { char *ebp = RCT2_GLOBAL(0x009ADAE4, char*); @@ -495,9 +495,9 @@ void scenario_load_and_play(rct_scenario_basic *scenario) } // Set the last saved game path - strcpy((char*)0x009ABB37, (char*)0x009AB5DA); - format_string((char*)0x009ABB37 + strlen((char*)0x009ABB37), RCT2_GLOBAL(0x0013573D4, uint16), (void*)0x0013573D8); - strcat((char*)0x009ABB37, ".SV6"); + strcpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, (char*)RCT2_ADDRESS_SAVED_GAMES_PATH); + format_string((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2 + strlen((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2), RCT2_GLOBAL(0x0013573D4, uint16), (void*)0x0013573D8); + strcat((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, ".SV6"); memset((void*)0x001357848, 0, 56); RCT2_GLOBAL(0x0135832C, uint32) = 0; diff --git a/src/window_game_bottom_toolbar.c b/src/window_game_bottom_toolbar.c index 1545a57e8c..496a0e813c 100644 --- a/src/window_game_bottom_toolbar.c +++ b/src/window_game_bottom_toolbar.c @@ -403,7 +403,7 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo *dpi, r STR_NUM_GUESTS + RCT2_GLOBAL(0x013573FE, uint8), x, y, (RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, rct_windowclass) == 2 && RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, sint32) == WIDX_GUESTS ? 2 : w->colours[0] & 0x7F), - (void*)0x01357844 + (void*)RCT2_ADDRESS_GUESTS_IN_PARK ); // Draw park rating diff --git a/src/window_game_top_toolbar.c b/src/window_game_top_toolbar.c index f6d893d16d..9e2ed385fa 100644 --- a/src/window_game_top_toolbar.c +++ b/src/window_game_top_toolbar.c @@ -361,7 +361,7 @@ static void window_game_top_toolbar_dropdown() src++; } while (*src != '.' && *src != '\0'); strcpy(src, ".SV6"); - strcpy(0x009ABB37, 0x0141EF68); + strcpy(RCT2_ADDRESS_SAVED_GAMES_PATH_2, 0x0141EF68); eax = 0; if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & 8) @@ -482,6 +482,6 @@ static void window_game_top_toolbar_paint() imgId = 5627; if (widget_is_pressed(w, WIDX_STAFF)) imgId++; - imgId |= (RCT2_GLOBAL(0x01357BCD, uint8) << 19) | 0xA0000000 | (RCT2_GLOBAL(0x01357BCE, uint8) << 24); + imgId |= (RCT2_GLOBAL(RCT2_ADDRESS_HANDYMAN_COLOUR, uint8) << 19) | 0xA0000000 | (RCT2_GLOBAL(RCT2_ADDRESS_MECHANIC_COLOUR, uint8) << 24); gfx_draw_sprite(dpi, imgId, x, y); } diff --git a/src/window_water.c b/src/window_water.c index 0c22ddabae..a58cce6e2f 100644 --- a/src/window_water.c +++ b/src/window_water.c @@ -216,12 +216,12 @@ static void window_water_paint() x = (window_water_widgets[WIDX_PREVIEW].left + window_water_widgets[WIDX_PREVIEW].right) / 2 + w->x; y = window_water_widgets[WIDX_PREVIEW].bottom + w->y + 5; if (RCT2_GLOBAL(RCT2_ADDRESS_WATER_RAISE_COST, uint32) != 0x80000000 && RCT2_GLOBAL(RCT2_ADDRESS_WATER_RAISE_COST, uint32) != 0) - gfx_draw_string_centred(dpi, 984, x, y, 0, (void*)0x0141F738); + gfx_draw_string_centred(dpi, 984, x, y, 0, (void*)RCT2_ADDRESS_WATER_RAISE_COST); y += 10; // Draw lower cost amount if (RCT2_GLOBAL(RCT2_ADDRESS_WATER_LOWER_COST, uint32) != 0x80000000 && RCT2_GLOBAL(RCT2_ADDRESS_WATER_LOWER_COST, uint32) != 0) - gfx_draw_string_centred(dpi, 985, x, y, 0, (void*)0x0141F73C); + gfx_draw_string_centred(dpi, 985, x, y, 0, (void*)RCT2_ADDRESS_WATER_LOWER_COST); } /** From 92a803075c6e3b640aa0bc0d4b85bd583751123e Mon Sep 17 00:00:00 2001 From: ddevrien Date: Wed, 14 May 2014 00:59:34 +0200 Subject: [PATCH 12/12] implemented options window update method --- src/strings.h | 1 + src/window_options.c | 117 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 110 insertions(+), 8 deletions(-) diff --git a/src/strings.h b/src/strings.h index 679a0a996c..acfcd2ca76 100644 --- a/src/strings.h +++ b/src/strings.h @@ -218,6 +218,7 @@ enum { STR_ADJUST_WATER_TIP = 1160, STR_OPTIONS = 1168, + STR_SOUND_NONE = 1169, STR_BUILD_FOOTPATH_TIP = 1173, STR_CANT_BUILD_FOOTPATH_HERE = 1176, diff --git a/src/window_options.c b/src/window_options.c index a9de1ffd6b..a45f693d6a 100644 --- a/src/window_options.c +++ b/src/window_options.c @@ -181,8 +181,8 @@ void window_options_open() (1 << WIDX_HEIGHT_LABELS_DROPDOWN) | (1 << WIDX_TILE_SMOOTHING_CHECKBOX) | (1 << WIDX_GRIDLINES_CHECKBOX) | - (1 << WIDX_SOUND_SW_BUFFER_CHECKBOX); - // TODO: missing .text:006BAD22 or dword ptr [esi+0Ch], 1 + (1 << WIDX_SOUND_SW_BUFFER_CHECKBOX) | + (1ULL << WIDX_SAVE_PLUGIN_DATA_CHECKBOX); // doesn't seem to work? window_init_scroll_widgets(w); w->colours[0] = 7; @@ -241,6 +241,11 @@ static void window_options_mouseup() w->viewport->flags &= ~VIEWPORT_FLAG_GRIDLINES; } break; + case WIDX_SAVE_PLUGIN_DATA_CHECKBOX: + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) ^= CONFIG_FLAG_SAVE_PLUGIN_DATA; + config_save(); + window_invalidate(w); + break; case WIDX_SOUND_SW_BUFFER_CHECKBOX: pause_sounds(); RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER, uint8) ^= 1; @@ -404,13 +409,13 @@ static void window_options_dropdown() window_options_update_height_markers(); break; case WIDX_MUSIC_DROPDOWN: - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8) = dropdownIndex; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8) = (uint8)dropdownIndex; config_save(); RCT2_CALLPROC_EBPSAFE(0x006BCA9F); window_invalidate(w); break; case WIDX_SOUND_QUALITY_DROPDOWN: - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, uint8) = dropdownIndex; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, uint8) = (uint8)dropdownIndex; // TODO: no clue what this does (and if it's correct) RCT2_GLOBAL(0x009AAC75, uint8) = RCT2_GLOBAL(0x009AF601 + dropdownIndex, uint8); @@ -425,7 +430,7 @@ static void window_options_dropdown() gfx_invalidate_screen(); break; case WIDX_DISTANCE_DROPDOWN: - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, uint8) = dropdownIndex; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, uint8) = (uint8)dropdownIndex; window_options_update_height_markers(); break; case WIDX_RESOLUTION_DROPDOWN: @@ -434,14 +439,14 @@ static void window_options_dropdown() break; case WIDX_TEMPERATURE_DROPDOWN: if (dropdownIndex != RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, uint8)) { - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, uint8) = dropdownIndex; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, uint8) = (uint8)dropdownIndex; config_save(); gfx_invalidate_screen(); } break; case WIDX_CONSTRUCTION_MARKER_DROPDOWN: if (dropdownIndex != RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CONSTRUCTION_MARKER, uint8)) { - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CONSTRUCTION_MARKER, uint8) = dropdownIndex; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CONSTRUCTION_MARKER, uint8) = (uint8)dropdownIndex; config_save(); gfx_invalidate_screen(); } @@ -455,7 +460,103 @@ static void window_options_dropdown() */ static void window_options_update() { - RCT2_CALLPROC_EBPSAFE(0x006BAD48); + sint32 format_args = RCT2_GLOBAL(0x009AF280, sint32); + rct_window *w; + + __asm mov w, esi + + // sound devices + if (format_args == -1 || RCT2_GLOBAL(RCT2_ADDRESS_NUM_DSOUND_DEVICES, sint32) == 0) { + RCT2_GLOBAL(0x013CE952, uint16) = STR_SOUND_NONE; + } else { + format_args = RCT2_GLOBAL(RCT2_ADDRESS_DSOUND_DEVICES, uint32) + format_args * 0x210 + 16; + RCT2_GLOBAL(0x013CE952, uint16) = 1170; + RCT2_GLOBAL(0x013CE952 + 2, uint32) = format_args; + } + + // height: units/real values + if ((RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS)) + format_args = STR_UNITS; + else + format_args = STR_REAL_VALUES; + + RCT2_GLOBAL(0x013CE952 + 6, uint16) = (uint16)format_args; + + // music: on/off + RCT2_GLOBAL(0x013CE952 + 8, uint16) = STR_OFF + + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8); + + // sound quality: low/medium/high + RCT2_GLOBAL(0x013CE952 + 10, uint16) = STR_SOUND_LOW + + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, uint8); + + // currency: pounds, dollars, etc. (10 total) + RCT2_GLOBAL(0x013CE952 + 12, uint16) = STR_POUNDS + + (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CURRENCY, uint8) & 0x3F); + + // distance: metric/imperial + RCT2_GLOBAL(0x013CE952 + 14, uint16) = STR_IMPERIAL + + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, uint8); + + // resolution + RCT2_GLOBAL(0x013CE952 + 16, uint16) = + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_RESOLUTION_WIDTH, uint16); + RCT2_GLOBAL(0x013CE952 + 18, uint16) = + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_RESOLUTION_HEIGHT, uint16); + + // temperature: celsius/fahrenheit + RCT2_GLOBAL(0x013CE952 + 20, uint16) = STR_CELSIUS + + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, uint8); + + // construction marker: celsius/fahrenheit + window_options_widgets[WIDX_CONSTRUCTION_MARKER].image = STR_WHITE + + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CONSTRUCTION_MARKER, uint8); + + // sound software mixing buffer checkbox + if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER, uint8)) + w->pressed_widgets |= (1 << WIDX_SOUND_SW_BUFFER_CHECKBOX); + else + w->pressed_widgets &= ~(1 << WIDX_SOUND_SW_BUFFER_CHECKBOX); + + // screen edge scrolling checkbox + if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_EDGE_SCROLLING, uint8)) + w->pressed_widgets |= (1 << WIDX_SCREEN_EDGE_SCROLLING); + else + w->pressed_widgets &= ~(1 << WIDX_SCREEN_EDGE_SCROLLING); + + // real name checkbox + if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES) + w->pressed_widgets |= (1 << WIDX_REAL_NAME_CHECKBOX); + else + w->pressed_widgets &= ~(1 << WIDX_REAL_NAME_CHECKBOX); + + // landscape tile smoothing checkbox + if ((RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_DISABLE_SMOOTH_LANDSCAPE)) + w->pressed_widgets &= ~(1 << WIDX_TILE_SMOOTHING_CHECKBOX); + else + w->pressed_widgets |= (1 << WIDX_TILE_SMOOTHING_CHECKBOX); + + // show gridlines checkbox + if ((RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES)) + w->pressed_widgets |= (1 << WIDX_GRIDLINES_CHECKBOX); + else + w->pressed_widgets &= ~(1 << WIDX_GRIDLINES_CHECKBOX); + + // save plugin data checkbox + if ((RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_SAVE_PLUGIN_DATA)) + w->pressed_widgets |= (1ULL << WIDX_SAVE_PLUGIN_DATA_CHECKBOX); + else + w->pressed_widgets &= ~(1ULL << WIDX_SAVE_PLUGIN_DATA_CHECKBOX); + + // unknown park flag can disable real name checkbox + if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x8000) + w->disabled_widgets |= (1 << WIDX_REAL_NAME_CHECKBOX); + + // save plugin data checkbox: visible or not + if (RCT2_GLOBAL(0x00F42BDA, uint8) == 1) + window_options_widgets[WIDX_SAVE_PLUGIN_DATA_CHECKBOX].type = WWT_EMPTY; + else + window_options_widgets[WIDX_SAVE_PLUGIN_DATA_CHECKBOX].type = WWT_CHECKBOX; } /**