From ab9e250abedb199cb8dc5a1a04852e3b67aaaa3b Mon Sep 17 00:00:00 2001 From: zsilencer Date: Sun, 12 Apr 2015 12:27:39 -0600 Subject: [PATCH] game_command_set_staff_order --- src/game.c | 6 +++--- src/peep/staff.c | 34 ++++++++++++++++++++++++++++++++++ src/peep/staff.h | 1 + 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/game.c b/src/game.c index 6ad9ba2780..5d67d5e56f 100644 --- a/src/game.c +++ b/src/game.c @@ -906,8 +906,8 @@ static uint32 game_do_command_table[58] = { 0, // use new_game_command_table, original: 0x006BEFA1, 29 0x006C09D1, // 30 0x006C0B83, - 0x006C0BB5, - 0x00669C6D, + 0, + 0, 0, 0x006649BD, 0x006666E7, @@ -969,7 +969,7 @@ static GAME_COMMAND_POINTER* new_game_command_table[58] = { game_command_hire_new_staff_member, //game_command_emptysub, game_command_emptysub, // 30 game_command_emptysub, - game_command_emptysub, + game_command_set_staff_order, game_command_set_park_name, game_command_set_park_open, game_command_emptysub, diff --git a/src/peep/staff.c b/src/peep/staff.c index 7d6300d1f3..378672c353 100644 --- a/src/peep/staff.c +++ b/src/peep/staff.c @@ -211,6 +211,40 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx, *edi = newPeep->sprite_index; } +/** + * + * rct2: 0x006C0BB5 + */ +void game_command_set_staff_order(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp) +{ + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 40; + uint8 bl = *ebx; + uint8 order_id = *ebx >> 8; + uint16 sprite_id = *edx; + if(bl & 1){ + rct_peep *peep = &g_sprite_list[sprite_id].peep; + if(order_id & 0x80){ // change costume + uint8 sprite_type = order_id & ~0x80; + sprite_type += 4; + peep->sprite_type = sprite_type; + peep->flags &= ~PEEP_FLAGS_SLOW_WALK; + if(RCT2_ADDRESS(0x00982134, uint8)[sprite_type] & 1){ + peep->flags |= PEEP_FLAGS_SLOW_WALK; + } + peep->action_frame = 0; + sub_693B58(peep); + invalidate_sprite((rct_sprite*)peep); + window_invalidate_by_number(WC_PEEP, sprite_id); + window_invalidate_by_class(WC_STAFF_LIST); + }else{ + peep->staff_orders = order_id; + window_invalidate_by_number(WC_PEEP, sprite_id); + window_invalidate_by_class(WC_STAFF_LIST); + } + } + *ebx = 0; +} + /* * Updates the colour of the given staff type. */ diff --git a/src/peep/staff.h b/src/peep/staff.h index 18dff988dc..9eca6d33d9 100644 --- a/src/peep/staff.h +++ b/src/peep/staff.h @@ -51,6 +51,7 @@ enum STAFF_ORDERS{ void game_command_update_staff_colour(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp); void game_command_hire_new_staff_member(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp); +void game_command_set_staff_order(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp); void update_staff_colour(uint8 staffType, uint16 color); uint16 hire_new_staff_member(uint8 staffType);