From 843c45aafc16961600071a623c6d28b0272607b5 Mon Sep 17 00:00:00 2001 From: adrian17 Date: Fri, 18 Jul 2014 22:03:33 +0200 Subject: [PATCH] Use address names from addresses.h --- src/award.c | 8 ++++---- src/config.c | 4 ++-- src/game.c | 10 +++++----- src/object.c | 2 +- src/park.c | 12 ++++++------ src/scenario.c | 22 ++++++++++++++-------- src/viewport.c | 2 +- src/window_main.c | 2 +- src/window_ride_list.c | 4 ++-- src/window_title_logo.c | 2 +- 10 files changed, 37 insertions(+), 31 deletions(-) diff --git a/src/award.c b/src/award.c index 3f76984ebf..b4589e9eed 100644 --- a/src/award.c +++ b/src/award.c @@ -287,7 +287,7 @@ static int award_is_deserved_best_food(int awardType, int activeAwardTypes) FOR_ALL_RIDES(i, ride) { if (ride->status != RIDE_STATUS_OPEN) continue; - if (!(RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x800000)) + if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x800000)) continue; shops++; @@ -333,7 +333,7 @@ static int award_is_deserved_worst_food(int awardType, int activeAwardTypes) FOR_ALL_RIDES(i, ride) { if (ride->status != RIDE_STATUS_OPEN) continue; - if (!(RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x800000)) + if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x800000)) continue; shops++; @@ -458,7 +458,7 @@ static int award_is_deserved_best_custom_designed_rides(int awardType, int activ customDesignedRides = 0; FOR_ALL_RIDES(i, ride) { - if (!(RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x10000000)) + if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x10000000)) continue; if (ride->lifecycle_flags & 0x40000) continue; @@ -485,7 +485,7 @@ static int award_is_deserved_most_dazzling_ride_colours(int awardType, int activ countedRides = 0; colourfulRides = 0; FOR_ALL_RIDES(i, ride) { - if (!(RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x10000000)) + if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x10000000)) continue; countedRides++; diff --git a/src/config.c b/src/config.c index c82a4cb8b1..0903f071b0 100644 --- a/src/config.c +++ b/src/config.c @@ -187,9 +187,9 @@ void config_load() RCT2_GLOBAL(0x009AB4C6, sint8) = 1; // no idea on what this does - RCT2_GLOBAL(0x009AACBD, sint16) = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) + 2) * 256; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) + 2) * 256; 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) = 0; } diff --git a/src/game.c b/src/game.c index 65b25027f6..f00234d798 100644 --- a/src/game.c +++ b/src/game.c @@ -79,7 +79,7 @@ void update_rain_animation() return; // Draw picked-up peep - if (RCT2_GLOBAL(0x009DE550, uint32) != 0xFFFFFFFF) { + if (RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, uint32) != 0xFFFFFFFF) { gfx_draw_sprite( (rct_drawpixelinfo*)RCT2_ADDRESS_SCREEN_DPI, RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, uint32), @@ -1810,11 +1810,11 @@ static void game_load_or_quit() static int open_landscape_file_dialog() { int result; - format_string((char*)0x0141ED68, STR_LOAD_LANDSCAPE_DIALOG_TITLE, 0); + format_string((char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, STR_LOAD_LANDSCAPE_DIALOG_TITLE, 0); strcpy((char*)0x0141EF68, (char*)RCT2_ADDRESS_LANDSCAPES_PATH); format_string((char*)0x0141EE68, STR_RCT2_LANDSCAPE_FILE, 0); pause_sounds(); - result = osinterface_open_common_file_dialog(1, (char*)0x0141ED68, (char*)0x0141EF68, "*.SV6;*.SV4;*.SC6", (char*)0x0141EE68); + result = osinterface_open_common_file_dialog(1, (char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, (char*)0x0141EF68, "*.SV6;*.SV4;*.SC6", (char*)0x0141EE68); unpause_sounds(); // window_proc return result; @@ -1827,11 +1827,11 @@ static int open_landscape_file_dialog() static int open_load_game_dialog() { int result; - format_string((char*)0x0141ED68, STR_LOAD_GAME_DIALOG_TITLE, 0); + format_string((char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, STR_LOAD_GAME_DIALOG_TITLE, 0); strcpy((char*)0x0141EF68, (char*)RCT2_ADDRESS_SAVED_GAMES_PATH); format_string((char*)0x0141EE68, STR_RCT2_SAVED_GAME, 0); pause_sounds(); - result = osinterface_open_common_file_dialog(1, (char*)0x0141ED68, (char*)0x0141EF68, "*.SV6", (char*)0x0141EE68); + result = osinterface_open_common_file_dialog(1, (char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, (char*)0x0141EF68, "*.SV6", (char*)0x0141EE68); unpause_sounds(); // window_proc return result; diff --git a/src/object.c b/src/object.c index 58f4dd33b6..e503fd9f88 100644 --- a/src/object.c +++ b/src/object.c @@ -116,7 +116,7 @@ int object_get_scenario_text(rct_object_entry *entry) // RCT2_CALLPROC_X(0x006A9428, 0, 0, 0, 0, 0, 0, (int)entry); return; int i; - rct_object_entry *installedObject = RCT2_GLOBAL(0x009ADAE8, rct_object_entry*); + rct_object_entry *installedObject = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*); for (i = 0; i < RCT2_GLOBAL(0x00F42B6C, sint32); i++) { if (object_entry_compare(installedObject, entry)) { char path[260]; diff --git a/src/park.c b/src/park.c index 72eb1cd87f..15a2d37e4f 100644 --- a/src/park.c +++ b/src/park.c @@ -66,7 +66,7 @@ void park_init() RCT2_GLOBAL(RCT2_ADDRESS_SECURITY_COLOUR, uint8) = 28; RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) = 0; RCT2_GLOBAL(0x01357BC8, uint16) = 0; - RCT2_GLOBAL(0x01357846, uint16) = 0; + RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16) = 0; RCT2_GLOBAL(0x013573FE, uint16) = 0; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) = 0; _guestGenerationProbability = 0; @@ -88,7 +88,7 @@ void park_init() RCT2_ADDRESS(0x01357BD0, sint32)[i] = -1; RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) = MONEY(10, 00); - RCT2_GLOBAL(0x013573F2, sint16) = -1; + RCT2_GLOBAL(RCT2_ADDRESS_PEEP_SPAWNS, sint16) = -1; RCT2_GLOBAL(0x013573F8, sint16) = -1; RCT2_GLOBAL(0x01357CF2, uint16) = 127; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL, uint8) = 2; @@ -341,7 +341,7 @@ void reset_park_entrances() RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_X, uint16)[i] = 0x8000; } - RCT2_GLOBAL(0x013573F2, uint16) = 0xFFFF; + RCT2_GLOBAL(RCT2_ADDRESS_PEEP_SPAWNS, uint16) = 0xFFFF; RCT2_GLOBAL(0x013573F8, uint16) = 0xFFFF; } @@ -389,9 +389,9 @@ static int park_calculate_guest_generation_probability() if (ride->lifecycle_flags & 0x400) continue; - if (!(RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x10000000)) + if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x10000000)) continue; - if (!(RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x200)) + if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x200)) continue; if (!(ride->lifecycle_flags & 0x02)) continue; @@ -530,7 +530,7 @@ void park_update() return; // Every 5 seconds approximately - if (RCT2_GLOBAL(0x013628F4, uint8) % 512 == 0) { + if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint8) % 512 == 0) { RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) = calculate_park_rating(); RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, money32) = calculate_park_value(); RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, money32) = calculate_company_value(); diff --git a/src/scenario.c b/src/scenario.c index 7736341673..7ac5a2b486 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -245,22 +245,28 @@ void scenario_load_and_play(const rct_scenario_basic *scenario) char *ebp = RCT2_GLOBAL(0x009ADAE4, char*); // - format_string((char*)0x0141ED68, RCT2_GLOBAL(ebp + 2, uint16), 0); + format_string((char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, RCT2_GLOBAL(ebp + 2, uint16), 0); // Set park name RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_RENAME_PARK; - game_do_command(1, 1, 0, *((int*)(0x0141ED68 + 0)), 33, *((int*)(0x0141ED68 + 8)), *((int*)(0x0141ED68 + 4))); - game_do_command(2, 1, 0, *((int*)(0x0141ED68 + 12)), 33, *((int*)(0x0141ED68 + 20)), *((int*)(0x0141ED68 + 16))); - game_do_command(0, 1, 0, *((int*)(0x0141ED68 + 24)), 33, *((int*)(0x0141ED68 + 32)), *((int*)(0x0141ED68 + 28))); + game_do_command(1, 1, 0, *((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 0)), 33, + *((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 8)), + *((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 4))); + game_do_command(2, 1, 0, *((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 12)), 33, + *((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 20)), + *((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 16))); + game_do_command(0, 1, 0, *((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 24)), 33, + *((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 32)), + *((int*)(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER + 28))); // - format_string((char*)0x0141ED68, RCT2_GLOBAL(ebp + 0, uint16), 0); - strncpy((char*)RCT2_ADDRESS_SCENARIO_NAME, (char*)0x0141ED68, 31); + format_string((char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, RCT2_GLOBAL(ebp + 0, uint16), 0); + strncpy((char*)RCT2_ADDRESS_SCENARIO_NAME, (char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, 31); ((char*)RCT2_ADDRESS_SCENARIO_NAME)[31] = '\0'; // Set scenario details - format_string((char*)0x0141ED68, RCT2_GLOBAL(ebp + 4, uint16), 0); - strncpy((char*)RCT2_ADDRESS_SCENARIO_DETAILS, (char*)0x0141ED68, 255); + format_string((char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, RCT2_GLOBAL(ebp + 4, uint16), 0); + strncpy((char*)RCT2_ADDRESS_SCENARIO_DETAILS, (char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, 255); ((char*)RCT2_ADDRESS_SCENARIO_DETAILS)[255] = '\0'; } diff --git a/src/viewport.c b/src/viewport.c index 1b23c7c97f..c4003dc4ec 100644 --- a/src/viewport.c +++ b/src/viewport.c @@ -63,7 +63,7 @@ void viewport_init_all() RCT2_GLOBAL(0x009DE518, sint32) = 0; RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, sint8) = INPUT_STATE_RESET; RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass) = -1; - RCT2_GLOBAL(0x009DE550, sint32) = -1; + RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, sint32) = -1; RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_NOT_SHOWN_TICKS, sint16) = -1; RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, sint16) = 0; RCT2_GLOBAL(0x009DEA50, sint16) = -1; diff --git a/src/window_main.c b/src/window_main.c index 2ab518cc18..27c79eb774 100644 --- a/src/window_main.c +++ b/src/window_main.c @@ -86,5 +86,5 @@ void window_main_open() RCT2_GLOBAL(0x009E32B0, uint8) = 0; RCT2_GLOBAL(0x009E32B2, uint8) = 0; RCT2_GLOBAL(0x009E32B3, uint8) = 0; - RCT2_GLOBAL(0x00F3EFA2, uint8) = 0; + RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_PATH_TYPE, uint8) = 0; } diff --git a/src/window_ride_list.c b/src/window_ride_list.c index a32c142236..d1182228aa 100644 --- a/src/window_ride_list.c +++ b/src/window_ride_list.c @@ -701,12 +701,12 @@ static void window_ride_list_refresh_list(rct_window *w) switch (w->var_490) { case INFORMATION_TYPE_STATUS: RCT2_GLOBAL(0x013CE952, uint32) = ride->var_04C; - RCT2_CALLPROC_X(0x006C2538, ride->var_04A, 0, 0x013CE952, 0, 0, 0x0141ED68, 0); + RCT2_CALLPROC_X(0x006C2538, ride->var_04A, 0, 0x013CE952, 0, 0, RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, 0); while (--k >= 0) { otherRide = &g_ride_list[w->var_076[k]]; RCT2_GLOBAL(0x013CE952, uint32) = otherRide->var_04C; RCT2_CALLPROC_X(0x006C2538, otherRide->var_04A, 0, 0x013CE952, 0, 0, 0x0141EF68, 0); - if (strcmp((char*)0x0141ED68, (char*)0x0141EF68) >= 0) + if (strcmp((char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, (char*)0x0141EF68) >= 0) break; swapper = w->var_076[k]; diff --git a/src/window_title_logo.c b/src/window_title_logo.c index bc079e5b95..16cfaa776b 100644 --- a/src/window_title_logo.c +++ b/src/window_title_logo.c @@ -120,7 +120,7 @@ static void window_title_logo_paint() packs = RCT2_GLOBAL(RCT2_ADDRESS_EXPANSION_FLAGS, uint16); names = RCT2_ADDRESS(RCT2_ADDRESS_EXPANSION_NAMES, char); - buffer = (char*) 0x0141ED68; + buffer = (char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER; while (packs != 0) { if (packs & 1) {