use gPeepSpawns for remaining non-refactored usages

This commit is contained in:
Ted John 2016-04-24 11:01:19 +01:00
parent 6c25c85363
commit 0ffca3a4fc
4 changed files with 14 additions and 13 deletions

View File

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

View File

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

View File

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

View File

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