diff --git a/src/windows/map.c b/src/windows/map.c index 8f280227ff..e6658a2149 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -333,8 +333,9 @@ static void window_map_mouseup(rct_window *w, int widgetIndex) break; RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 0; - if (RCT2_GLOBAL(RCT2_ADDRESS_PEEP_SPAWNS, sint16) != -1 && RCT2_GLOBAL(0x13573F8, sint16) != -1) + if (gPeepSpawns[0].x != UINT16_MAX && RCT2_GLOBAL(0x13573F8, sint16) != -1) { RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1; + } show_gridlines(); show_land_rights(); diff --git a/src/world/footpath.c b/src/world/footpath.c index 235944714a..ef41e02a2b 100644 --- a/src/world/footpath.c +++ b/src/world/footpath.c @@ -77,7 +77,6 @@ static bool entrance_has_direction(rct_map_element *mapElement, int direction) */ static void automatically_set_peep_spawn(int x, int y, int z) { - rct2_peep_spawn *peepSpawn = (rct2_peep_spawn*)RCT2_ADDRESS_PEEP_SPAWNS; int direction = 0; if (x != 32) { direction++; @@ -91,6 +90,7 @@ static void automatically_set_peep_spawn(int x, int y, int z) } } + rct2_peep_spawn *peepSpawn = &gPeepSpawns[0]; peepSpawn->x = x + (word_981D6C[direction].x * 15) + 16; peepSpawn->y = y + (word_981D6C[direction].y * 15) + 16; peepSpawn->direction = direction; diff --git a/src/world/map.c b/src/world/map.c index 0e1c29d5d4..2a0a3f9a99 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -4480,10 +4480,10 @@ void map_extend_boundary_surface() static void clear_elements_at(int x, int y) { for (;;) { - rct2_peep_spawn *peepSpawns = RCT2_ADDRESS(RCT2_ADDRESS_PEEP_SPAWNS, rct2_peep_spawn); for (int i = 0; i < 2; i++) { - if ((peepSpawns[i].x & 0xFFE0) == x && (peepSpawns[i].y & 0xFFE0) == y) { - peepSpawns[i].x = 0xFFFF; + rct2_peep_spawn *peepSpawn = &gPeepSpawns[i]; + if (floor2(peepSpawn->x, 32) == x && floor2(peepSpawn->y, 32) == y) { + peepSpawn->x = UINT16_MAX; } } diff --git a/src/world/park.c b/src/world/park.c index 52543d529f..f8bbe9899f 100644 --- a/src/world/park.c +++ b/src/world/park.c @@ -107,7 +107,7 @@ void park_init() RCT2_ADDRESS(0x01357BD0, sint32)[i] = -1; gParkEntranceFee = MONEY(10, 00); - RCT2_GLOBAL(RCT2_ADDRESS_PEEP_SPAWNS, sint16) = -1; + gPeepSpawns[0].x = UINT16_MAX; RCT2_GLOBAL(0x013573F8, sint16) = -1; RCT2_GLOBAL(RCT2_ADDRESS_ACTIVE_RESEARCH_TYPES, uint16) = 127; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL, uint8) = 2; @@ -349,7 +349,7 @@ void reset_park_entrances() gParkEntranceX[i] = 0x8000; } - RCT2_GLOBAL(RCT2_ADDRESS_PEEP_SPAWNS, uint16) = 0xFFFF; + gPeepSpawns[0].x = UINT16_MAX; RCT2_GLOBAL(0x013573F8, uint16) = 0xFFFF; } @@ -467,12 +467,12 @@ static int park_calculate_guest_generation_probability() static void get_random_peep_spawn(rct2_peep_spawn *spawn) { - rct2_peep_spawn *peepSpawns = RCT2_ADDRESS(RCT2_ADDRESS_PEEP_SPAWNS, rct2_peep_spawn); - - *spawn = peepSpawns[0]; - if (peepSpawns[1].x != 0xFFFF) - if (scenario_rand() & 0x80000) - *spawn = peepSpawns[1]; + *spawn = gPeepSpawns[0]; + if (gPeepSpawns[1].x != UINT16_MAX) { + if (scenario_rand() & 0x80000) { + *spawn = gPeepSpawns[1]; + } + } } static rct_peep *park_generate_new_guest()