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); }