1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 11:33:03 +01:00

Integrate variables in park.c

This commit is contained in:
Ted John
2016-09-10 17:46:34 +01:00
parent d1801f860b
commit 20c35b10eb
8 changed files with 29 additions and 27 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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;
}
}

View File

@@ -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;