diff --git a/src/editor.c b/src/editor.c index a18543aa7c..613b9ba654 100644 --- a/src/editor.c +++ b/src/editor.c @@ -429,7 +429,7 @@ static void editor_clear_map_for_editing() reset_sprite_list(); staff_reset_modes(); - RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) = 0; + gNumGuestsInPark = 0; RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16) = 0; RCT2_GLOBAL(RCT2_ADDRESS_LAST_GUESTS_IN_PARK, uint16) = 0; RCT2_GLOBAL(RCT2_ADDRESS_GUEST_CHANGE_MODIFIER, uint16) = 0; @@ -443,7 +443,7 @@ static void editor_clear_map_for_editing() gParkFlags &= ~PARK_FLAGS_NO_MONEY_SCENARIO; gParkFlags |= PARK_FLAGS_NO_MONEY; - if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) == 0) + if (gParkEntranceFee == 0) gParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY; else gParkFlags &= ~PARK_FLAGS_PARK_FREE_ENTRY; diff --git a/src/game.c b/src/game.c index 2371b299f6..83b20cf050 100644 --- a/src/game.c +++ b/src/game.c @@ -802,7 +802,7 @@ void game_fix_save_vars() { peepCount++; } - RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) = peepCount; + gNumGuestsInPark = peepCount; // Fixes broken saves where a surface element could be null for (int y = 0; y < 256; y++) { diff --git a/src/management/award.c b/src/management/award.c index 4ccbefd143..b7bb2e7c98 100644 --- a/src/management/award.c +++ b/src/management/award.c @@ -91,7 +91,7 @@ static int award_is_deserved_most_untidy(int awardType, int activeAwardTypes) } } - return (negativeCount > RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) / 16); + return (negativeCount > gNumGuestsInPark / 16); } /** More than 1/64 of the total guests must be thinking tidy thoughts and less than 6 guests thinking untidy thoughts. */ @@ -127,7 +127,7 @@ static int award_is_deserved_most_tidy(int awardType, int activeAwardTypes) } } - return (negativeCount <= 5 && positiveCount > RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) / 64); + return (negativeCount <= 5 && positiveCount > gNumGuestsInPark / 64); } /** At least 6 open roller coasters. */ @@ -166,7 +166,7 @@ static int award_is_deserved_best_value(int awardType, int activeAwardTypes) return 0; if (RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, money16) < MONEY(10, 00)) return 0; - if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) + MONEY(0, 10) >= RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, money16) / 2) + if (gParkEntranceFee + MONEY(0, 10) >= RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, money16) / 2) return 0; return 1; } @@ -204,7 +204,7 @@ static int award_is_deserved_most_beautiful(int awardType, int activeAwardTypes) } } - return (negativeCount <= 15 && positiveCount > RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) / 128); + return (negativeCount <= 15 && positiveCount > gNumGuestsInPark / 128); } /** Entrance fee is more than total ride value. */ @@ -214,9 +214,9 @@ static int award_is_deserved_worse_value(int awardType, int activeAwardTypes) return 0; if (gParkFlags & PARK_FLAGS_NO_MONEY) return 0; - if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) == MONEY(0, 00)) + if (gParkEntranceFee == MONEY(0, 00)) return 0; - if (RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, money16) >= RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16)) + if (RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, money16) >= gParkEntranceFee) return 0; return 1; } @@ -308,7 +308,7 @@ static int award_is_deserved_best_food(int awardType, int activeAwardTypes) } } - if (shops < 7 || uniqueShops < 4 || shops < RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) / 128) + if (shops < 7 || uniqueShops < 4 || shops < gNumGuestsInPark / 128) return 0; // Count hungry peeps @@ -357,7 +357,7 @@ static int award_is_deserved_worst_food(int awardType, int activeAwardTypes) } } - if (uniqueShops > 2 || shops > RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) / 256) + if (uniqueShops > 2 || shops > gNumGuestsInPark / 256) return 0; // Count hungry peeps @@ -392,7 +392,7 @@ static int award_is_deserved_best_restrooms(int awardType, int activeAwardTypes) return 0; // At least one open restroom for every 128 guests - if (numRestrooms < RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) / 128U) + if (numRestrooms < gNumGuestsInPark / 128U) return 0; // Count number of guests who are thinking they need the restroom diff --git a/src/management/marketing.c b/src/management/marketing.c index bfc2787a2f..07e2398576 100644 --- a/src/management/marketing.c +++ b/src/management/marketing.c @@ -52,11 +52,11 @@ int marketing_get_campaign_guest_generation_probability(int campaign) // Lower probability of guest generation if price was already low switch (campaign) { case ADVERTISING_CAMPAIGN_PARK_ENTRY_FREE: - if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) < 4) + if (gParkEntranceFee < 4) probability /= 8; break; case ADVERTISING_CAMPAIGN_PARK_ENTRY_HALF_PRICE: - if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) < 6) + if (gParkEntranceFee < 6) probability /= 8; break; case ADVERTISING_CAMPAIGN_RIDE_FREE: diff --git a/src/network/network.cpp b/src/network/network.cpp index 9147d260f9..90ea8b5ccf 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -1127,7 +1127,7 @@ void Network::AdvertiseHeartbeat() json_object_set_new(gameInfo, "mapSize", json_integer(RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_MINUS_2, sint16))); json_object_set_new(gameInfo, "day", json_integer(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16))); json_object_set_new(gameInfo, "month", json_integer(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16))); - json_object_set_new(gameInfo, "guests", json_integer(RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16))); + json_object_set_new(gameInfo, "guests", json_integer(gNumGuestsInPark)); json_object_set_new(gameInfo, "parkValue", json_integer(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, money32))); if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { money32 cash = DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32)); diff --git a/src/peep/peep.c b/src/peep/peep.c index be0c882f12..d0d5b491dc 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -1317,7 +1317,7 @@ void peep_sprite_remove(rct_peep* peep){ void peep_remove(rct_peep* peep){ if (peep->type == PEEP_TYPE_GUEST){ if (peep->outside_of_park == 0){ - RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)--; + gNumGuestsInPark--; RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PEEP_COUNT; } if (peep->state == PEEP_STATE_ENTERING_PARK){ @@ -4371,7 +4371,7 @@ static void peep_update_leaving_park(rct_peep* peep){ peep->outside_of_park = 1; peep->destination_tolerence = 5; - RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)--; + gNumGuestsInPark--; RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PEEP_COUNT; peep->var_37 = 1; @@ -4494,7 +4494,7 @@ static void peep_update_entering_park(rct_peep* peep){ peep->outside_of_park = 0; peep->time_in_park = RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32); - RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)++; + gNumGuestsInPark++; RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)--; RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PEEP_COUNT; window_invalidate_by_class(WC_GUEST_LIST); @@ -5785,7 +5785,7 @@ void peep_problem_warnings_update() rct_peep* peep; rct_ride* ride; uint16 spriteIndex; - uint16 guests_in_park = RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16); + uint16 guests_in_park = gNumGuestsInPark; 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; uint8* warning_throttle = RCT2_ADDRESS(0x01358750, uint8); @@ -7024,7 +7024,7 @@ static int peep_interact_with_entrance(rct_peep* peep, sint16 x, sint16 y, rct_m return peep_return_to_center_of_tile(peep); } - money16 entranceFee = RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16); + money16 entranceFee = gParkEntranceFee; if (entranceFee != 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY)){ if (peep->item_standard_flags & PEEP_ITEM_VOUCHER){ if (peep->voucher_type == VOUCHER_TYPE_PARK_ENTRY_HALF_PRICE){ diff --git a/src/rct1/S4Importer.cpp b/src/rct1/S4Importer.cpp index fdd06e7b4c..f2e49092b0 100644 --- a/src/rct1/S4Importer.cpp +++ b/src/rct1/S4Importer.cpp @@ -652,7 +652,7 @@ void S4Importer::ImportMapAnimations() void S4Importer::ImportFinance() { - RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) = _s4.park_entrance_fee; + gParkEntranceFee = _s4.park_entrance_fee; RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) = _s4.land_price; RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16) = _s4.construction_rights_price; diff --git a/src/ride/vehicle.c b/src/ride/vehicle.c index 1a52a01985..cdb733e76d 100644 --- a/src/ride/vehicle.c +++ b/src/ride/vehicle.c @@ -4089,7 +4089,7 @@ static void vehicle_kill_all_passengers(rct_vehicle* vehicle) { for (uint8 i = 0; i < curVehicle->num_peeps; i++) { rct_peep* peep = GET_PEEP(curVehicle->peep[i]); if (peep->outside_of_park == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)--; + gNumGuestsInPark--; RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PEEP_COUNT; } diff --git a/src/scenario.c b/src/scenario.c index c3ece79918..3a5c4ea2d6 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -363,7 +363,7 @@ void scenario_begin() // Open park with free entry when there is no money if (gParkFlags & PARK_FLAGS_NO_MONEY) { gParkFlags |= PARK_FLAGS_PARK_OPEN; - RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, uint16) = 0; + gParkEntranceFee = 0; } gParkFlags |= PARK_FLAGS_18; @@ -464,7 +464,7 @@ void scenario_entrance_fee_too_high_check() { uint16 x = 0, y = 0; uint16 totalRideValue = RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, uint16); - uint16 park_entrance_fee = RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, uint16); + uint16 park_entrance_fee = gParkEntranceFee; int max_fee = totalRideValue + (totalRideValue / 2); uint32 game_flags = gParkFlags, packed_xy; @@ -1255,7 +1255,7 @@ static void scenario_objective_check_guests_by() { uint8 objectiveYear = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8); sint16 parkRating = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16); - sint16 guestsInPark = RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16); + sint16 guestsInPark = gNumGuestsInPark; sint16 objectiveGuests = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16); sint16 currentMonthYear = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16); @@ -1350,7 +1350,7 @@ static void scenario_objective_check_guests_and_rating() } if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) >= 700) - if (RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) >= RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16)) + if (gNumGuestsInPark >= RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16)) scenario_success(); } @@ -1448,7 +1448,7 @@ static void scenario_objective_check() uint8 objective_type = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8), objective_year = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8); sint16 park_rating = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16), - guests_in_park = RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16), + guests_in_park = gNumGuestsInPark, objective_guests = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16), cur_month_year = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16); uint32 scenario_completed_company_value = RCT2_GLOBAL(RCT2_ADDRESS_COMPLETED_COMPANY_VALUE, uint32); diff --git a/src/windows/editor_scenario_options.c b/src/windows/editor_scenario_options.c index 58c4309593..dd0c848953 100644 --- a/src/windows/editor_scenario_options.c +++ b/src/windows/editor_scenario_options.c @@ -1012,16 +1012,16 @@ static void window_editor_scenario_options_park_mousedown(int widgetIndex, rct_w window_invalidate(w); break; case WIDX_ENTRY_PRICE_INCREASE: - if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) < MONEY(100,00)) { - RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) += MONEY(1,00); + if (gParkEntranceFee < MONEY(100,00)) { + gParkEntranceFee += MONEY(1,00); } else { window_error_open(3264, STR_NONE); } window_invalidate(w); break; case WIDX_ENTRY_PRICE_DECREASE: - if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) > MONEY(0,00)) { - RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) -= MONEY(1,00); + if (gParkEntranceFee > MONEY(0,00)) { + gParkEntranceFee -= MONEY(1,00); } else { window_error_open(3265, STR_NONE); } @@ -1061,12 +1061,12 @@ static void window_editor_scenario_options_park_dropdown(rct_window *w, int widg if (dropdownIndex == 0) { if (!(gParkFlags & PARK_FLAGS_PARK_FREE_ENTRY)) { gParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY; - RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) = MONEY(0, 00); + gParkEntranceFee = MONEY(0, 00); } } else { if (gParkFlags & PARK_FLAGS_PARK_FREE_ENTRY) { gParkFlags &= ~PARK_FLAGS_PARK_FREE_ENTRY; - RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) = MONEY(10, 00); + gParkEntranceFee = MONEY(10, 00); } } } @@ -1228,7 +1228,7 @@ static void window_editor_scenario_options_park_paint(rct_window *w, rct_drawpix // Entry price value x = w->x + w->widgets[WIDX_ENTRY_PRICE].left + 1; y = w->y + w->widgets[WIDX_ENTRY_PRICE].top; - arg = RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16); + arg = gParkEntranceFee; gfx_draw_string_left(dpi, 3246, &arg, 0, x, y); } } diff --git a/src/windows/game_bottom_toolbar.c b/src/windows/game_bottom_toolbar.c index 75c940a3d1..d101b71228 100644 --- a/src/windows/game_bottom_toolbar.c +++ b/src/windows/game_bottom_toolbar.c @@ -397,7 +397,7 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo *dpi, r STR_NUM_GUESTS + RCT2_GLOBAL(RCT2_ADDRESS_GUEST_CHANGE_MODIFIER, uint8), x, y, (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_GUESTS ? COLOUR_WHITE : w->colours[0] & 0x7F), - (void*)RCT2_ADDRESS_GUESTS_IN_PARK + &gNumGuestsInPark ); // Draw park rating diff --git a/src/windows/park.c b/src/windows/park.c index 168cb8d070..403dad18bf 100644 --- a/src/windows/park.c +++ b/src/windows/park.c @@ -1359,7 +1359,7 @@ static void window_park_guests_paint(rct_window *w, rct_drawpixelinfo *dpi) widget = &window_park_guests_widgets[WIDX_PAGE_BACKGROUND]; // Current value - gfx_draw_string_left(dpi, STR_GUESTS_IN_PARK_LABEL, (void*)RCT2_ADDRESS_GUESTS_IN_PARK, 0, x + widget->left + 3, y + widget->top + 2); + gfx_draw_string_left(dpi, STR_GUESTS_IN_PARK_LABEL, &gNumGuestsInPark, 0, x + widget->left + 3, y + widget->top + 2); // Graph border gfx_fill_rect_inset(dpi, x + widget->left + 4, y + widget->top + 15, x + widget->right - 4, y + widget->bottom - 4, w->colours[1], 0x30); @@ -1418,11 +1418,11 @@ static void window_park_price_mousedown(int widgetIndex, rct_window*w, rct_widge window_park_set_page(w, widgetIndex - WIDX_TAB_1); break; case WIDX_INCREASE_PRICE: - newFee = min(MONEY(100,00), RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) + MONEY(1,00)); + newFee = min(MONEY(100,00), gParkEntranceFee + MONEY(1,00)); park_set_entrance_fee(newFee); break; case WIDX_DECREASE_PRICE: - newFee = max(MONEY(0,00), RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) - MONEY(1,00)); + newFee = max(MONEY(0,00), gParkEntranceFee - MONEY(1,00)); park_set_entrance_fee(newFee); break; } @@ -1469,8 +1469,8 @@ static void window_park_price_invalidate(rct_window *w) window_park_price_widgets[WIDX_DECREASE_PRICE].type = WWT_DROPDOWN_BUTTON; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, uint16); - window_park_price_widgets[WIDX_PRICE].image = RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, uint16) == 0 ? STR_FREE : 1429; + RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint32) = gParkEntranceFee; + window_park_price_widgets[WIDX_PRICE].image = gParkEntranceFee == 0 ? STR_FREE : 1429; window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_7); window_park_anchor_border_widgets(w); @@ -1582,7 +1582,7 @@ static void window_park_stats_paint(rct_window *w, rct_drawpixelinfo *dpi) y = w->y + window_park_awards_widgets[WIDX_PAGE_BACKGROUND].top + 4; // Draw park size - parkSize = RCT2_GLOBAL(RCT2_ADDRESS_PARK_SIZE, uint16) * 10; + parkSize = gParkSize * 10; stringIndex = STR_PARK_SIZE_METRIC_LABEL; if (gConfigGeneral.measurement_format == MEASUREMENT_FORMAT_IMPERIAL) { stringIndex = STR_PARK_SIZE_IMPERIAL_LABEL; @@ -1607,7 +1607,7 @@ static void window_park_stats_paint(rct_window *w, rct_drawpixelinfo *dpi) y += 10; // Draw number of guests in park - gfx_draw_string_left(dpi, STR_GUESTS_IN_PARK_LABEL, (void*)RCT2_ADDRESS_GUESTS_IN_PARK, 0, x, y); + gfx_draw_string_left(dpi, STR_GUESTS_IN_PARK_LABEL, &gNumGuestsInPark, 0, x, y); y += 10; gfx_draw_string_left(dpi, STR_TOTAL_ADMISSIONS, (void*)RCT2_ADDRESS_TOTAL_ADMISSIONS, 0, x, y); } diff --git a/src/world/park.c b/src/world/park.c index 29b553e2ca..23a23ab727 100644 --- a/src/world/park.c +++ b/src/world/park.c @@ -75,7 +75,7 @@ void park_init() RCT2_GLOBAL(RCT2_ADDRESS_HANDYMAN_COLOUR, uint8) = COLOUR_BRIGHT_RED; RCT2_GLOBAL(RCT2_ADDRESS_MECHANIC_COLOUR, uint8) = COLOUR_LIGHT_BLUE; RCT2_GLOBAL(RCT2_ADDRESS_SECURITY_COLOUR, uint8) = COLOUR_YELLOW; - RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) = 0; + gNumGuestsInPark = 0; RCT2_GLOBAL(RCT2_ADDRESS_LAST_GUESTS_IN_PARK, uint16) = 0; RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16) = 0; RCT2_GLOBAL(RCT2_ADDRESS_GUEST_CHANGE_MODIFIER, uint16) = 0; @@ -96,7 +96,7 @@ void park_init() for (i = 0; i < 56; i++) RCT2_ADDRESS(0x01357BD0, sint32)[i] = -1; - RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) = MONEY(10, 00); + gParkEntranceFee = MONEY(10, 00); RCT2_GLOBAL(RCT2_ADDRESS_PEEP_SPAWNS, sint16) = -1; RCT2_GLOBAL(0x013573F8, sint16) = -1; RCT2_GLOBAL(RCT2_ADDRESS_ACTIVE_RESEARCH_TYPES, uint16) = 127; @@ -153,8 +153,8 @@ int park_calculate_size() } } while (map_element_iterator_next(&it)); - if (tiles != RCT2_GLOBAL(RCT2_ADDRESS_PARK_SIZE, uint16)) { - RCT2_GLOBAL(RCT2_ADDRESS_PARK_SIZE, uint16) = tiles; + if (tiles != gParkSize) { + gParkSize = tiles; window_invalidate_by_class(WC_PARK_INFORMATION); } @@ -184,7 +184,7 @@ int calculate_park_rating() int num_lost_guests; // -150 to +3 based on a range of guests from 0 to 2000 - result -= 150 - (min(2000, RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)) / 13); + result -= 150 - (min(2000, gNumGuestsInPark) / 13); // Find the number of happy peeps and the number of peeps who can't find the park exit num_happy_peeps = 0; @@ -201,8 +201,8 @@ int calculate_park_rating() // Peep happiness -500 to +0 result -= 500; - if (RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) > 0) - result += 2 * min(250, (num_happy_peeps * 300) / RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)); + if (gNumGuestsInPark > 0) + result += 2 * min(250, (num_happy_peeps * 300) / gNumGuestsInPark); // Up to 25 guests can be lost without affecting the park rating. if (num_lost_guests > 25) @@ -308,7 +308,7 @@ money32 calculate_park_value() } // +7.00 per guest - result += RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) * MONEY(7, 00); + result += gNumGuestsInPark * MONEY(7, 00); return result; } @@ -411,7 +411,7 @@ static int park_calculate_guest_generation_probability() probability = 50 + clamp(0, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) - 200, 650); // The more guests, the lower the chance of a new one - int numGuests = RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) + RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16); + int numGuests = gNumGuestsInPark + RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16); if (numGuests > suggestedMaxGuests) { probability /= 4; @@ -427,7 +427,7 @@ static int park_calculate_guest_generation_probability() // Check if money is enabled if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { // Penalty for overpriced entrance fee relative to total ride value - money16 entranceFee = RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16); + money16 entranceFee = gParkEntranceFee; if (entranceFee > totalRideValue) { probability /= 4; @@ -509,7 +509,7 @@ static void park_generate_new_guests() // Generate a new guest for some probability if ((int)(scenario_rand() & 0xFFFF) < _guestGenerationProbability) { int difficultGeneration = (gParkFlags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) != 0; - if (!difficultGeneration || _suggestedGuestMaximum + 150 >= RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)) + if (!difficultGeneration || _suggestedGuestMaximum + 150 >= gNumGuestsInPark) park_generate_new_guest(); } @@ -578,7 +578,7 @@ uint8 calculate_guest_initial_happiness(uint8 percentage) { */ void park_update_histories() { - int guestsInPark = RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16); + int guestsInPark = gNumGuestsInPark; int lastGuestsInPark = RCT2_GLOBAL(RCT2_ADDRESS_LAST_GUESTS_IN_PARK, uint16); RCT2_GLOBAL(RCT2_ADDRESS_LAST_GUESTS_IN_PARK, uint16) = guestsInPark; RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= 4; @@ -642,7 +642,7 @@ void game_command_set_park_entrance_fee(int *eax, int *ebx, int *ecx, int *edx, { RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = RCT_EXPENDITURE_TYPE_PARK_ENTRANCE_TICKETS * 4; if (*ebx & GAME_COMMAND_FLAG_APPLY) { - RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) = (*edi & 0xFFFF); + gParkEntranceFee = (*edi & 0xFFFF); window_invalidate_by_class(WC_PARK_INFORMATION); } *ebx = 0; diff --git a/src/world/park.h b/src/world/park.h index 9872d9ad28..3a9924e79c 100644 --- a/src/world/park.h +++ b/src/world/park.h @@ -47,7 +47,10 @@ enum { PARK_FLAGS_SIX_FLAGS_DEPRECATED = (1 << 19) // Not used anymore }; -#define gParkFlags RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) +#define gParkFlags RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) +#define gParkSize RCT2_GLOBAL(RCT2_ADDRESS_PARK_SIZE, uint16) +#define gParkEntranceFee RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) +#define gNumGuestsInPark RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) extern uint8 *gParkRatingHistory; extern uint8 *gGuestsInParkHistory;