From 20c35b10eb8bde6ef3e69a6799e7d2f37cfecc23 Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 10 Sep 2016 17:46:34 +0100 Subject: [PATCH] Integrate variables in park.c --- src/addresses.h | 10 +++++----- src/rct2/S6Exporter.cpp | 2 +- src/rct2/S6Importer.cpp | 2 +- src/windows/map.c | 4 +++- src/world/map.c | 7 ++++--- src/world/map.h | 2 ++ src/world/park.c | 21 +++++++++------------ src/world/park.h | 8 ++++---- 8 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index 4b9487fa20..23849c5885 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -222,11 +222,6 @@ #define RCT2_ADDRESS_PARK_RATING_WARNING_DAYS 0x0135883E -#define RCT2_ADDRESS_PARK_ENTRANCE_X 0x01359350 -#define RCT2_ADDRESS_PARK_ENTRANCE_Y 0x01359358 -#define RCT2_ADDRESS_PARK_ENTRANCE_Z 0x01359360 -#define RCT2_ADDRESS_PARK_ENTRANCE_DIRECTION 0x01359368 - #define RCT2_ADDRESS_CURRENT_TICKS 0x013628F4 #define RCT2_ADDRESS_RIDE_LIST 0x013628F8 @@ -554,6 +549,11 @@ #define RCT2_ADDRESS_SAME_PRICE_THROUGHOUT 0x01358838 #define RCT2_ADDRESS_SAME_PRICE_THROUGHOUT_EXTENDED 0x0135934C +#define RCT2_ADDRESS_PARK_ENTRANCE_X 0x01359350 +#define RCT2_ADDRESS_PARK_ENTRANCE_Y 0x01359358 +#define RCT2_ADDRESS_PARK_ENTRANCE_Z 0x01359360 +#define RCT2_ADDRESS_PARK_ENTRANCE_DIRECTION 0x01359368 + #define RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL 0x013573FF #define RCT2_ADDRESS_ACTIVE_RESEARCH_TYPES 0x01357CF2 #define RCT2_ADDRESS_RESEARH_PROGRESS_STAGE 0x01357CF3 diff --git a/src/rct2/S6Exporter.cpp b/src/rct2/S6Exporter.cpp index df8a702dbc..d1215c7467 100644 --- a/src/rct2/S6Exporter.cpp +++ b/src/rct2/S6Exporter.cpp @@ -347,7 +347,7 @@ void S6Exporter::Export() memcpy(_s6.awards, gCurrentAwards, sizeof(_s6.awards)); _s6.land_price = gLandPrice; _s6.construction_rights_price = gConstructionRightsPrice; - _s6.word_01358774 = RCT2_GLOBAL(0x01358774, uint16); + // unk_01358774 // pad_01358776 // _s6.cd_key // _s6.game_version_number diff --git a/src/rct2/S6Importer.cpp b/src/rct2/S6Importer.cpp index 13c297196f..68339b8c05 100644 --- a/src/rct2/S6Importer.cpp +++ b/src/rct2/S6Importer.cpp @@ -265,7 +265,7 @@ void S6Importer::Import() memcpy(gCurrentAwards, _s6.awards, sizeof(_s6.awards)); gLandPrice = _s6.land_price; gConstructionRightsPrice = _s6.construction_rights_price; - RCT2_GLOBAL(0x01358774, uint16) = _s6.word_01358774; + // unk_01358774 // pad_01358776 // _s6.cd_key _gameVersion = _s6.game_version_number; diff --git a/src/windows/map.c b/src/windows/map.c index f44d13b871..a23f6b6202 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -351,7 +351,9 @@ static void window_map_mouseup(rct_window *w, int widgetIndex) break; gLandToolSize = 0; - if (gPeepSpawns[0].x != UINT16_MAX && RCT2_GLOBAL(0x13573F8, sint16) != -1) { + if (gPeepSpawns[0].x != UINT16_MAX && + gPeepSpawns[1].x != UINT16_MAX + ) { gLandToolSize = 1; } diff --git a/src/world/map.c b/src/world/map.c index 3108cdb68b..7e5e71fedb 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -118,6 +118,8 @@ money32 gLandRightsCost; rct_xyz16 gCommandPosition; +uint8 gUnk9E2E28; + static void map_update_grass_length(int x, int y, rct_map_element *mapElement); static void map_set_grass_length(int x, int y, rct_map_element *mapElement, int length); static void clear_elements_at(int x, int y); @@ -1867,16 +1869,15 @@ static money32 map_set_land_ownership(uint8 flags, sint16 x1, sint16 y1, sint16 if (!(flags & GAME_COMMAND_FLAG_APPLY)) return 0; - RCT2_GLOBAL(0x009E2E28, uint8) = 0; - // Clamp to maximum addressable element to prevent long loop spamming the log x1 = clamp(0, x1, gMapSizeUnits); y1 = clamp(0, y1, gMapSizeUnits); x2 = min(x2, gMapSizeUnits); y2 = min(y2, gMapSizeUnits); + gUnk9E2E28 = 0; map_buy_land_rights(x1, y1, x2, y2, 6, flags | (newOwnership << 8)); - if (!(RCT2_GLOBAL(0x9E2E28, uint8) & 1)) { + if (!(gUnk9E2E28 & 1)) { return 0; } diff --git a/src/world/map.h b/src/world/map.h index 5a8cda5080..8042b0e452 100644 --- a/src/world/map.h +++ b/src/world/map.h @@ -383,6 +383,8 @@ extern money32 gLandRightsCost; extern rct_xyz16 gCommandPosition; +extern uint8 gUnk9E2E28; + void map_init(int size); void map_update_tile_pointers(); rct_map_element *map_get_first_element_at(int x, int y); diff --git a/src/world/park.c b/src/world/park.c index 037b4113e2..55cb543c97 100644 --- a/src/world/park.c +++ b/src/world/park.c @@ -14,7 +14,6 @@ *****************************************************************************/ #pragma endregion -#include "../addresses.h" #include "../cheats.h" #include "../config.h" #include "../game.h" @@ -70,10 +69,10 @@ int _suggestedGuestMaximum; */ int _guestGenerationProbability; -sint16 *gParkEntranceX = RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_X, sint16); -sint16 *gParkEntranceY = RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_Y, sint16); -sint16 *gParkEntranceZ = RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_Z, sint16); -uint8 *gParkEntranceDirection = RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_DIRECTION, uint8); +sint16 gParkEntranceX[4]; +sint16 gParkEntranceY[4]; +sint16 gParkEntranceZ[4]; +uint8 gParkEntranceDirection[4]; bool gParkEntranceGhostExists; rct_xyz16 gParkEntranceGhostPosition; @@ -142,7 +141,6 @@ void park_init() gScenarioObjectiveNumGuests = 1000; gLandPrice = MONEY(90, 00); gConstructionRightsPrice = MONEY(40,00); - RCT2_GLOBAL(0x01358774, uint16) = 0; gParkFlags = PARK_FLAGS_NO_MONEY | PARK_FLAGS_SHOW_REAL_GUEST_NAMES; park_reset_history(); finance_reset_history(); @@ -364,13 +362,12 @@ money32 calculate_company_value() void reset_park_entrances() { gParkName = 0; - - for (short i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { gParkEntranceX[i] = 0x8000; } - - gPeepSpawns[0].x = UINT16_MAX; - RCT2_GLOBAL(0x013573F8, uint16) = 0xFFFF; + for (int i = 0; i < 2; i++) { + gPeepSpawns[i].x = UINT16_MAX; + } } /** @@ -1076,7 +1073,7 @@ static money32 map_buy_land_rights_for_tile(int x, int y, int setting, int flags update_park_fences(x + 32, y); update_park_fences(x, y + 32); update_park_fences(x, y - 32); - RCT2_GLOBAL(0x9E2E28, uint8) |= 1; + gUnk9E2E28 |= 1; return 0; } } diff --git a/src/world/park.h b/src/world/park.h index c9f658c922..62762a6f42 100644 --- a/src/world/park.h +++ b/src/world/park.h @@ -65,10 +65,10 @@ extern uint8 gGuestsInParkHistory[32]; extern int _guestGenerationProbability; extern int _suggestedGuestMaximum; -extern sint16 *gParkEntranceX; -extern sint16 *gParkEntranceY; -extern sint16 *gParkEntranceZ; -extern uint8 *gParkEntranceDirection; +extern sint16 gParkEntranceX[4]; +extern sint16 gParkEntranceY[4]; +extern sint16 gParkEntranceZ[4]; +extern uint8 gParkEntranceDirection[4]; extern bool gParkEntranceGhostExists; extern rct_xyz16 gParkEntranceGhostPosition;