diff --git a/src/interface/console.c b/src/interface/console.c index 30807f027f..49605c00d6 100644 --- a/src/interface/console.c +++ b/src/interface/console.c @@ -467,7 +467,7 @@ static int cc_get(const utf8 **argv, int argc) { if (argc > 0) { if (strcmp(argv[0], "park_rating") == 0) { - console_printf("park_rating %d", RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16)); + console_printf("park_rating %d", gParkRating); } else if (strcmp(argv[0], "money") == 0) { console_printf("money %d.%d0", DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32)) / 10, DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32)) % 10); diff --git a/src/management/award.c b/src/management/award.c index b7bb2e7c98..2dbc0bd5e1 100644 --- a/src/management/award.c +++ b/src/management/award.c @@ -416,7 +416,7 @@ static int award_is_deserved_most_disappointing(int awardType, int activeAwardTy if (activeAwardTypes & (1 << PARK_AWARD_BEST_VALUE)) return 0; - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) > 650) + if (gParkRating > 650) return 0; // Count the number of disappointing rides diff --git a/src/rct1/S4Importer.cpp b/src/rct1/S4Importer.cpp index f5beab4d22..219a1dbd4a 100644 --- a/src/rct1/S4Importer.cpp +++ b/src/rct1/S4Importer.cpp @@ -932,7 +932,7 @@ void S4Importer::ImportParkFlags() RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16) = _s4.day; // Park rating - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) = _s4.park_rating; + gParkRating = _s4.park_rating; for (int i = 0; i < 32; i++) { gParkRatingHistory[i] = _s4.park_rating_history[i]; diff --git a/src/scenario.c b/src/scenario.c index 8afff9357b..14042326d2 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -277,7 +277,7 @@ void scenario_begin() if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) != OBJECTIVE_NONE) window_park_objective_open(); - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16) = calculate_park_rating(); + gParkRating = 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(); RCT2_GLOBAL(0x013587D0, money32) = RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32); @@ -1254,7 +1254,7 @@ bool scenario_save_s6(SDL_RWops* rw, rct_s6_data *s6) 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 parkRating = gParkRating; sint16 guestsInPark = gNumGuestsInPark; sint16 objectiveGuests = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16); sint16 currentMonthYear = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16); @@ -1321,7 +1321,7 @@ static void scenario_objective_check_10_rollercoasters() */ static void scenario_objective_check_guests_and_rating() { - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) < 700 && RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) >= 1) { + if (gParkRating < 700 && RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) >= 1) { RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16)++; if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16) == 1) { if (gConfigNotifications.park_rating_warnings) { @@ -1349,7 +1349,7 @@ static void scenario_objective_check_guests_and_rating() RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16) = 0; } - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) >= 700) + if (gParkRating >= 700) if (gNumGuestsInPark >= RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16)) scenario_success(); } @@ -1447,7 +1447,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), + sint16 park_rating = gParkRating, 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); diff --git a/src/windows/game_bottom_toolbar.c b/src/windows/game_bottom_toolbar.c index d101b71228..226377fbf3 100644 --- a/src/windows/game_bottom_toolbar.c +++ b/src/windows/game_bottom_toolbar.c @@ -223,7 +223,7 @@ static void window_game_bottom_toolbar_tooltip(rct_window* w, int widgetIndex, r RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, int) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, sint32); break; case WIDX_PARK_RATING: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16); + RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = gParkRating; break; case WIDX_DATE: month = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) & 7; @@ -407,7 +407,7 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo *dpi, r w->colours[3], w->x + window_game_bottom_toolbar_widgets[WIDX_PARK_RATING].left + 11, w->y + window_game_bottom_toolbar_widgets[WIDX_PARK_RATING].top, - max(10, ((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16) / 4) * 263) / 256) + max(10, ((gParkRating / 4) * 263) / 256) ); } diff --git a/src/windows/park.c b/src/windows/park.c index 49ea99d631..5713a65f7c 100644 --- a/src/windows/park.c +++ b/src/windows/park.c @@ -1242,7 +1242,7 @@ static void window_park_rating_paint(rct_window *w, rct_drawpixelinfo *dpi) widget = &window_park_rating_widgets[WIDX_PAGE_BACKGROUND]; // Current value - gfx_draw_string_left(dpi, STR_PARK_RATING_LABEL, (void*)RCT2_ADDRESS_CURRENT_PARK_RATING, 0, x + widget->left + 3, y + widget->top + 2); + gfx_draw_string_left(dpi, STR_PARK_RATING_LABEL, &gParkRating, 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); diff --git a/src/world/park.c b/src/world/park.c index 942cae5740..f9f835d49f 100644 --- a/src/world/park.c +++ b/src/world/park.c @@ -84,7 +84,7 @@ void park_init() 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; - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) = 0; + gParkRating = 0; _guestGenerationProbability = 0; RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, uint16) = 0; RCT2_GLOBAL(RCT2_ADDRESS_LAST_RESEARCHED_ITEM_SUBJECT, sint32) = -1; @@ -413,7 +413,7 @@ static int park_calculate_guest_generation_probability() _suggestedGuestMaximum = suggestedMaxGuests; // Begin with 50 + park rating - probability = 50 + clamp(0, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) - 200, 650); + probability = 50 + clamp(0, gParkRating - 200, 650); // The more guests, the lower the chance of a new one int numGuests = gNumGuestsInPark + RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16); @@ -540,7 +540,7 @@ void park_update() // Every 5 seconds approximately if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) % 512 == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) = calculate_park_rating(); + gParkRating = 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(); window_invalidate_by_class(WC_FINANCES); @@ -1111,7 +1111,7 @@ void game_command_buy_land_rights(int *eax, int *ebx, int *ecx, int *edx, int *e void set_forced_park_rating(int rating){ gForcedParkRating = rating; - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) = calculate_park_rating(); + gParkRating = calculate_park_rating(); RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PARK_RATING; window_invalidate_by_class(WC_PARK_INFORMATION); } diff --git a/src/world/park.h b/src/world/park.h index e31b88e36c..aa6470c052 100644 --- a/src/world/park.h +++ b/src/world/park.h @@ -51,6 +51,7 @@ enum { #define gParkName RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id) #define gParkFlags RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) #define gParkSize RCT2_GLOBAL(RCT2_ADDRESS_PARK_SIZE, uint16) +#define gParkRating RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) #define gParkEntranceFee RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) #define gNumGuestsInPark RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)