add global macro: gParkRating

This commit is contained in:
Ted John 2016-04-23 01:47:03 +01:00
parent fda4542d63
commit 0971d8ad51
8 changed files with 16 additions and 15 deletions

View File

@ -467,7 +467,7 @@ static int cc_get(const utf8 **argv, int argc)
{ {
if (argc > 0) { if (argc > 0) {
if (strcmp(argv[0], "park_rating") == 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) { 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); 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);

View File

@ -416,7 +416,7 @@ static int award_is_deserved_most_disappointing(int awardType, int activeAwardTy
if (activeAwardTypes & (1 << PARK_AWARD_BEST_VALUE)) if (activeAwardTypes & (1 << PARK_AWARD_BEST_VALUE))
return 0; return 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) > 650) if (gParkRating > 650)
return 0; return 0;
// Count the number of disappointing rides // Count the number of disappointing rides

View File

@ -932,7 +932,7 @@ void S4Importer::ImportParkFlags()
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16) = _s4.day; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16) = _s4.day;
// Park rating // Park rating
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) = _s4.park_rating; gParkRating = _s4.park_rating;
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
{ {
gParkRatingHistory[i] = _s4.park_rating_history[i]; gParkRatingHistory[i] = _s4.park_rating_history[i];

View File

@ -277,7 +277,7 @@ void scenario_begin()
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) != OBJECTIVE_NONE) if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) != OBJECTIVE_NONE)
window_park_objective_open(); 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_PARK_VALUE, money32) = calculate_park_value();
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, money32) = calculate_company_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); 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() static void scenario_objective_check_guests_by()
{ {
uint8 objectiveYear = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8); 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 guestsInPark = gNumGuestsInPark;
sint16 objectiveGuests = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16); sint16 objectiveGuests = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16);
sint16 currentMonthYear = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16); 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() 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)++; RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16)++;
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16) == 1) { if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16) == 1) {
if (gConfigNotifications.park_rating_warnings) { 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; 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)) if (gNumGuestsInPark >= RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16))
scenario_success(); scenario_success();
} }
@ -1447,7 +1447,7 @@ static void scenario_objective_check()
{ {
uint8 objective_type = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8), uint8 objective_type = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8),
objective_year = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, 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, guests_in_park = gNumGuestsInPark,
objective_guests = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16), objective_guests = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16),
cur_month_year = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16); cur_month_year = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16);

View File

@ -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); RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, int) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, sint32);
break; break;
case WIDX_PARK_RATING: 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; break;
case WIDX_DATE: case WIDX_DATE:
month = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) & 7; 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->colours[3],
w->x + window_game_bottom_toolbar_widgets[WIDX_PARK_RATING].left + 11, w->x + window_game_bottom_toolbar_widgets[WIDX_PARK_RATING].left + 11,
w->y + window_game_bottom_toolbar_widgets[WIDX_PARK_RATING].top, 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)
); );
} }

View File

@ -1242,7 +1242,7 @@ static void window_park_rating_paint(rct_window *w, rct_drawpixelinfo *dpi)
widget = &window_park_rating_widgets[WIDX_PAGE_BACKGROUND]; widget = &window_park_rating_widgets[WIDX_PAGE_BACKGROUND];
// Current value // 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 // 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); 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);

View File

@ -84,7 +84,7 @@ void park_init()
RCT2_GLOBAL(RCT2_ADDRESS_LAST_GUESTS_IN_PARK, uint16) = 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_GUESTS_HEADING_FOR_PARK, uint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_CHANGE_MODIFIER, uint16) = 0; RCT2_GLOBAL(RCT2_ADDRESS_GUEST_CHANGE_MODIFIER, uint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) = 0; gParkRating = 0;
_guestGenerationProbability = 0; _guestGenerationProbability = 0;
RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, uint16) = 0; RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, uint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_LAST_RESEARCHED_ITEM_SUBJECT, sint32) = -1; RCT2_GLOBAL(RCT2_ADDRESS_LAST_RESEARCHED_ITEM_SUBJECT, sint32) = -1;
@ -413,7 +413,7 @@ static int park_calculate_guest_generation_probability()
_suggestedGuestMaximum = suggestedMaxGuests; _suggestedGuestMaximum = suggestedMaxGuests;
// Begin with 50 + park rating // 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 // The more guests, the lower the chance of a new one
int numGuests = gNumGuestsInPark + RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16); int numGuests = gNumGuestsInPark + RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16);
@ -540,7 +540,7 @@ void park_update()
// Every 5 seconds approximately // Every 5 seconds approximately
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) % 512 == 0) { 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_PARK_VALUE, money32) = calculate_park_value();
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, money32) = calculate_company_value(); RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, money32) = calculate_company_value();
window_invalidate_by_class(WC_FINANCES); 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){ void set_forced_park_rating(int rating){
gForcedParkRating = 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; RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PARK_RATING;
window_invalidate_by_class(WC_PARK_INFORMATION); window_invalidate_by_class(WC_PARK_INFORMATION);
} }

View File

@ -51,6 +51,7 @@ enum {
#define gParkName RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id) #define gParkName RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id)
#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 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 gParkEntranceFee RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16)
#define gNumGuestsInPark RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) #define gNumGuestsInPark RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)