From bbbf928f500c5b4aff71c17fe610ee225061872f Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Tue, 31 Mar 2015 02:48:26 +0100 Subject: [PATCH] implement duck_remove_all and staff_reset_stats --- src/peep/staff.c | 20 ++++++++++++++++++++ src/peep/staff.h | 1 + src/scenario.c | 5 +++-- src/world/sprite.c | 17 +++++++++++++++++ src/world/sprite.h | 1 + 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/peep/staff.c b/src/peep/staff.c index 3f14a749b1..51581cc23b 100644 --- a/src/peep/staff.c +++ b/src/peep/staff.c @@ -291,4 +291,24 @@ int mechanic_is_location_in_patrol(rct_peep *mechanic, int x, int y) return 1; return staff_is_location_in_patrol_area(mechanic, x, y); +} + +/** + * + * rct2: 0x006C1955 + */ +void staff_reset_stats() +{ + uint16 spriteIndex; + rct_peep *peep; + + FOR_ALL_STAFF(spriteIndex, peep) { + peep->time_in_park = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16); + peep->staff_lawns_mown = 0; + peep->staff_rides_fixed = 0; + peep->staff_gardens_watered = 0; + peep->staff_rides_inspected = 0; + peep->staff_litter_swept = 0; + peep->staff_bins_emptied = 0; + } } \ No newline at end of file diff --git a/src/peep/staff.h b/src/peep/staff.h index 4d5bd4fa66..6db3861dbd 100644 --- a/src/peep/staff.h +++ b/src/peep/staff.h @@ -54,5 +54,6 @@ void update_staff_colour(uint8 staffType, uint16 color); uint16 hire_new_staff_member(uint8 staffType); void sub_6C0C3F(); int mechanic_is_location_in_patrol(rct_peep *mechanic, int x, int y); +void staff_reset_stats(); #endif \ No newline at end of file diff --git a/src/scenario.c b/src/scenario.c index effe8e12a9..ef3f8b6a8c 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -30,6 +30,7 @@ #include "management/research.h" #include "management/news_item.h" #include "object.h" +#include "peep/staff.h" #include "platform/platform.h" #include "ride/ride.h" #include "scenario.h" @@ -323,9 +324,9 @@ int scenario_load_and_play_from_path(const char *path) award_reset(); reset_all_ride_build_dates(); date_reset(); - RCT2_CALLPROC_EBPSAFE(0x00674576); + duck_remove_all(); park_calculate_size(); - RCT2_CALLPROC_EBPSAFE(0x006C1955); + staff_reset_stats(); RCT2_GLOBAL(0x01358840, uint8) = 0; memset((void*)0x001358102, 0, 20); RCT2_GLOBAL(0x00135882E, uint16) = 0; diff --git a/src/world/sprite.c b/src/world/sprite.c index cfccc6c49c..f7be0c409f 100644 --- a/src/world/sprite.c +++ b/src/world/sprite.c @@ -397,6 +397,23 @@ void duck_press(rct_duck *duck) sound_play_panned(SOUND_QUACK, 0x8001, duck->x, duck->y, duck->z); } +/** + * + * rct: 0x00674576 + */ +void duck_remove_all() +{ + rct_unk_sprite* sprite; + uint16 spriteIndex, nextSpriteIndex; + + for (spriteIndex = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_MISC, uint16); spriteIndex != SPRITE_INDEX_NULL; spriteIndex = nextSpriteIndex) { + sprite = &(g_sprite_list[spriteIndex].unknown); + nextSpriteIndex = sprite->next; + if (sprite->misc_identifier == SPRITE_MISC_DUCK) + sprite_remove((rct_sprite*)sprite); + } +} + static const rct_xy16 _moneyEffectMoveOffset[] = { { 1, -1 }, { 1, 1 }, diff --git a/src/world/sprite.h b/src/world/sprite.h index 8f05d7b430..fde176da7e 100644 --- a/src/world/sprite.h +++ b/src/world/sprite.h @@ -234,6 +234,7 @@ void create_balloon(int x, int y, int z, int colour, uint8 bl); void balloon_press(rct_balloon *balloon); void create_duck(int targetX, int targetY); void duck_press(rct_duck *duck); +void duck_remove_all(); rct_sprite *create_sprite(uint8 bl); void reset_sprite_list(); void reset_0x69EBE4();