From de1c69d5d948c0b4dbec47349d51484aca5815de Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sun, 14 Aug 2016 18:05:15 +0200 Subject: [PATCH 1/4] Integrate 0x009929C8 and 0x009929CA --- src/peep/peep.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/peep/peep.c b/src/peep/peep.c index af7085d2c5..5bacde78b7 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -4714,6 +4714,18 @@ static void peep_update_queuing(rct_peep* peep){ } } +/** rct2: 0x009929C8 */ +static const rct_xy16 _9929C8[] = { + { 28, 28 }, + { 28, 4 }, + { 20, 4 }, + { 20, 28 }, + { 12, 28 }, + { 12, 4 }, + { 4, 4 }, + { 4, 28 }, +}; + /** * * rct2: 0x006BF567 @@ -4737,13 +4749,13 @@ static void peep_update_mowing(rct_peep* peep){ sub_693BE5(peep, 2); } - if (RCT2_ADDRESS(0x9929C8, uint16)[peep->var_37 * 2] == 0xFFFF){ + if (peep->var_37 == countof(_9929C8)) { peep_state_reset(peep); return; } - peep->destination_x = RCT2_ADDRESS(0x9929C8, uint16)[peep->var_37 * 2] + peep->next_x; - peep->destination_y = RCT2_ADDRESS(0x9929CA, uint16)[peep->var_37 * 2] + peep->next_y; + peep->destination_x = _9929C8[peep->var_37].x + peep->next_x; + peep->destination_y = _9929C8[peep->var_37].y + peep->next_y; if (peep->var_37 != 7)continue; From a56dae295353e53b7dcb30a2096669563dc85588 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sun, 14 Aug 2016 20:27:12 +0200 Subject: [PATCH 2/4] Integrate data at 0x00992A3C --- src/peep/peep.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/peep/peep.c b/src/peep/peep.c index 5bacde78b7..fc3c96659a 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -4240,6 +4240,14 @@ static bool peep_update_fixing_sub_state_6(bool firstRun, rct_peep *peep, rct_ri return false; } +/** rct2: 0x00992A3C */ +static const rct_xy16 _992A3C[] = { + { -12, 0 }, + { 0, 12 }, + { 12, 0 }, + { 0, -12 }, +}; + /** * rct2: 0x006C1114 */ @@ -4267,7 +4275,7 @@ static bool peep_update_fixing_sub_state_7(bool firstRun, rct_peep *peep, rct_ri } int direction = map_element_get_direction(mapElement); - rct_xy16 offset = RCT2_ADDRESS(0x992A3C, rct_xy16)[direction]; + rct_xy16 offset = _992A3C[direction]; stationX += 16 + offset.x; if (offset.x == 0) { @@ -4366,7 +4374,7 @@ static bool peep_update_fixing_sub_state_9(bool firstRun, rct_peep *peep, rct_ri uint16 destinationY = input.y + 16; uint8 direction = RCT2_GLOBAL(0xF43914, uint32); - rct_xy16 offset = RCT2_ADDRESS(0x992A3C, rct_xy16)[direction]; + rct_xy16 offset = _992A3C[direction]; destinationX -= offset.x; if (offset.x == 0) { From 5acc9f813bd752bf11b4be4c89317cfb3d19a405 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sun, 14 Aug 2016 21:10:21 +0200 Subject: [PATCH 3/4] Integrate 0x00992A4C --- src/peep/peep.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/peep/peep.c b/src/peep/peep.c index fc3c96659a..24a85cf982 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -5205,6 +5205,14 @@ static int peep_update_walking_find_bench(rct_peep* peep){ return 1; } +/** rct2: 0x00992A4C */ +static const rct_xy16 _992A4C[] = { + { 11, 16 }, + { 16, 21 }, + { 21, 16 }, + { 16, 11 }, +}; + static int peep_update_walking_find_bin(rct_peep* peep){ if (!peep_has_empty_container(peep)) return 0; @@ -5260,8 +5268,8 @@ static int peep_update_walking_find_bin(rct_peep* peep){ peep->sub_state = 0; int ebx = peep->var_37 & 0x3; - int x = (peep->x & 0xFFE0) + RCT2_ADDRESS(0x992A4C, uint16)[ebx * 2]; - int y = (peep->y & 0xFFE0) + RCT2_ADDRESS(0x992A4E, uint16)[ebx * 2]; + int x = (peep->x & 0xFFE0) + _992A4C[ebx].x; + int y = (peep->y & 0xFFE0) + _992A4C[ebx].y; peep->destination_x = x; peep->destination_y = y; From 1d883eea2fd91539c9bc3e5794753c832dd078b8 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sun, 14 Aug 2016 21:14:33 +0200 Subject: [PATCH 4/4] Integrate data at 0x00992A5C --- src/peep/peep.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/peep/peep.c b/src/peep/peep.c index 24a85cf982..d9e8ce5980 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -5795,6 +5795,18 @@ static void peep_update_answering(rct_peep* peep){ invalidate_sprite_2((rct_sprite*)peep); } +/** rct2: 0x00992A5C */ +static const rct_xy16 _992A5C[] = { + { 3, 16 }, + { 16, 29 }, + { 29, 16 }, + { 16, 3 }, + { 3, 29 }, + { 29, 29 }, + { 29, 3 }, + { 3, 3 }, +}; + /** * * rct2: 0x006BF483 @@ -5845,8 +5857,8 @@ static int peep_update_patrolling_find_watering(rct_peep* peep){ peep_window_state_update(peep); peep->sub_state = 0; - peep->destination_x = (peep->x & 0xFFE0) + RCT2_ADDRESS(0x992A5C, uint16)[chosen_position * 2]; - peep->destination_y = (peep->y & 0xFFE0) + RCT2_ADDRESS(0x992A5E, uint16)[chosen_position * 2]; + peep->destination_x = (peep->x & 0xFFE0) + _992A5C[chosen_position].x; + peep->destination_y = (peep->y & 0xFFE0) + _992A5C[chosen_position].y; peep->destination_tolerence = 3; return 1;