From 708efdd08c39a9f8c9b83344724650ba43200808 Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 10 Sep 2016 14:46:53 +0100 Subject: [PATCH] Integrate unknown game variables --- src/game.c | 11 +++++++---- src/game.h | 3 +++ src/peep/peep.c | 2 +- src/rct2/S6Exporter.cpp | 2 +- src/rct2/S6Importer.cpp | 2 +- src/ride/ride.c | 4 ++-- src/world/park.c | 2 +- 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/game.c b/src/game.c index 8a9e6776af..003cb01262 100644 --- a/src/game.c +++ b/src/game.c @@ -67,6 +67,9 @@ bool gInUpdateCode = false; int gGameCommandNestLevel; bool gGameCommandIsNetworked; +uint8 gUnk13CA740; +uint8 gUnk141F568; + #ifdef NO_RCT2 uint32 gCurrentTicks; #endif @@ -342,7 +345,7 @@ void game_update() window_map_tooltip_update_visibility(); // Input - RCT2_GLOBAL(0x0141F568, uint8) = RCT2_GLOBAL(0x0013CA740, uint8); + gUnk141F568 = gUnk13CA740; game_handle_input(); } @@ -414,7 +417,7 @@ void game_logic_update() static int game_check_affordability(int cost) { if (cost <= 0)return cost; - if (RCT2_GLOBAL(0x141F568, uint8) & 0xF0)return cost; + if (gUnk141F568 & 0xF0) return cost; if (cost <= (sint32)(DECRYPT_MONEY(gCashEncrypted)))return cost; set_format_arg(0, uint32, cost); @@ -545,7 +548,7 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int * if (!(flags & 0x20)) { // Update money balance finance_payment(cost, gCommandExpenditureType); - if (RCT2_GLOBAL(0x0141F568, uint8) == RCT2_GLOBAL(0x013CA740, uint8)) { + if (gUnk141F568 == gUnk13CA740) { // Create a +/- money text effect if (cost != 0) money_effect_create(cost); @@ -570,7 +573,7 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int * game_command_callback = 0; // Show error window - if (gGameCommandNestLevel == 0 && (flags & GAME_COMMAND_FLAG_APPLY) && RCT2_GLOBAL(0x0141F568, uint8) == RCT2_GLOBAL(0x013CA740, uint8) && !(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && !(flags & GAME_COMMAND_FLAG_NETWORKED)) + if (gGameCommandNestLevel == 0 && (flags & GAME_COMMAND_FLAG_APPLY) && gUnk141F568 == gUnk13CA740 && !(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && !(flags & GAME_COMMAND_FLAG_NETWORKED)) window_error_open(gGameCommandErrorTitle, gGameCommandErrorText); gGameCommandErrorText = STR_NONE; diff --git a/src/game.h b/src/game.h index 36528b236e..7e2711250a 100644 --- a/src/game.h +++ b/src/game.h @@ -145,6 +145,9 @@ extern bool gInUpdateCode; extern int gGameCommandNestLevel; extern bool gGameCommandIsNetworked; +extern uint8 gUnk13CA740; +extern uint8 gUnk141F568; + void game_increase_game_speed(); void game_reduce_game_speed(); diff --git a/src/peep/peep.c b/src/peep/peep.c index 8176f82cdf..4b4dd85ea9 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -9664,7 +9664,7 @@ static void peep_spend_money(rct_peep *peep, money16 *peep_expend_type, money32 } window_invalidate_by_number(WC_PEEP, peep->sprite_index); - RCT2_GLOBAL(0x00141F568, uint8) = RCT2_GLOBAL(0x0013CA740, uint8); + gUnk141F568 = gUnk13CA740; finance_payment(-amount, gCommandExpenditureType); audio_play_sound_at_location(SOUND_PURCHASE, peep->x, peep->y, peep->z); diff --git a/src/rct2/S6Exporter.cpp b/src/rct2/S6Exporter.cpp index 4212f06f4c..df8a702dbc 100644 --- a/src/rct2/S6Exporter.cpp +++ b/src/rct2/S6Exporter.cpp @@ -405,7 +405,7 @@ void S6Exporter::Export() memcpy(_s6.staff_modes, gStaffModes, sizeof(_s6.staff_modes)); // unk_13CA73E // pad_13CA73F - _s6.byte_13CA740 = RCT2_GLOBAL(0x013CA740, uint8); + _s6.byte_13CA740 = gUnk13CA740; _s6.climate = gClimate; // pad_13CA741; memcpy(_s6.byte_13CA742, RCT2_ADDRESS(0x013CA742, uint8), sizeof(_s6.byte_13CA742)); diff --git a/src/rct2/S6Importer.cpp b/src/rct2/S6Importer.cpp index 31e404117f..13c297196f 100644 --- a/src/rct2/S6Importer.cpp +++ b/src/rct2/S6Importer.cpp @@ -323,7 +323,7 @@ void S6Importer::Import() memcpy(gStaffModes, _s6.staff_modes, sizeof(_s6.staff_modes)); // unk_13CA73E // pad_13CA73F - RCT2_GLOBAL(0x013CA740, uint8) = _s6.byte_13CA740; + gUnk13CA740 = _s6.byte_13CA740; gClimate = _s6.climate; // pad_13CA741; memcpy(RCT2_ADDRESS(0x013CA742, uint8), _s6.byte_13CA742, sizeof(_s6.byte_13CA742)); diff --git a/src/ride/ride.c b/src/ride/ride.c index 2c908e451c..773eae44ea 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -5119,7 +5119,7 @@ static void loc_6B51C0(int rideIndex) ride = get_ride(rideIndex); - if (RCT2_GLOBAL(0x0141F568, uint8) != RCT2_GLOBAL(0x013CA740, uint8)) + if (gUnk141F568 != gUnk13CA740) return; w = window_get_main(); @@ -5170,7 +5170,7 @@ static void loc_6B51C0(int rideIndex) */ static void ride_scroll_to_track_error(rct_xy_element *trackElement) { - if (!gGameCommandIsNetworked && RCT2_GLOBAL(0x0141F568, uint8) == RCT2_GLOBAL(0x013CA740, uint8)) { + if (!gGameCommandIsNetworked && gUnk141F568 == gUnk13CA740) { rct_window *w = window_get_main(); if (w != NULL) { window_scroll_to_location(w, trackElement->x, trackElement->y, trackElement->element->base_height * 8); diff --git a/src/world/park.c b/src/world/park.c index 713f5b83de..037b4113e2 100644 --- a/src/world/park.c +++ b/src/world/park.c @@ -93,7 +93,7 @@ void park_init() { int i; - RCT2_GLOBAL(0x013CA740, uint8) = 0; + gUnk13CA740 = 0; gParkName = STR_UNNAMED_PARK; gStaffHandymanColour = COLOUR_BRIGHT_RED; gStaffMechanicColour = COLOUR_LIGHT_BLUE;