From 26ab7c7b7e2ee2e7f86e8f3832149149a19eb204 Mon Sep 17 00:00:00 2001 From: zsilencer Date: Sun, 12 Apr 2015 19:06:51 -0600 Subject: [PATCH] #1011 --- src/editor.c | 2 +- src/peep/peep.c | 2 +- src/peep/staff.c | 27 ++++++++++++++++----------- src/peep/staff.h | 2 +- src/windows/staff.c | 11 +++++------ 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/editor.c b/src/editor.c index 1c5bddf084..b51cd723f2 100644 --- a/src/editor.c +++ b/src/editor.c @@ -265,7 +265,7 @@ void sub_6BD3A4() for (int i = 200; i < 204; i++) RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[i] = STAFF_MODE_WALK; - sub_6C0C3F(); + staff_update_greyed_patrol_areas(); } /** diff --git a/src/peep/peep.c b/src/peep/peep.c index 26a63d7c32..68dc5b0901 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -573,7 +573,7 @@ void peep_sprite_remove(rct_peep* peep){ RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[peep->staff_id] = 0; peep->type = 0xFF; - sub_6C0C3F(); + staff_update_greyed_patrol_areas(); peep->type = PEEP_TYPE_STAFF; news_item_disable_news(NEWS_ITEM_PEEP, peep->sprite_index); diff --git a/src/peep/staff.c b/src/peep/staff.c index 01c4e10838..15f15c1fe7 100644 --- a/src/peep/staff.c +++ b/src/peep/staff.c @@ -263,13 +263,13 @@ void game_command_set_staff_patrol(int *eax, int *ebx, int *ecx, int *edx, int * uint32 *patrolBits = (uint32*)(0x013B0E72 + patrolOffset + (base * 4)); *patrolBits ^= mask; - int eax2 = 0; + int ispatrolling = 0; for(int i = 0; i < 128; i++){ - eax2 |= *(uint32*)(0x013B0E72 + patrolOffset + (i * 4)); + ispatrolling |= *(uint32*)(0x013B0E72 + patrolOffset + (i * 4)); } RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[peep->staff_id] &= ~2; - if(eax2){ + if(ispatrolling){ RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[peep->staff_id] |= 2; } @@ -278,6 +278,7 @@ void game_command_set_staff_patrol(int *eax, int *ebx, int *ecx, int *edx, int * map_invalidate_tile_full((x & 0x1F80) + (x2 * 32), (y & 0x1F80) + (y2 * 32)); } } + staff_update_greyed_patrol_areas(); } *ebx = 0; } @@ -327,23 +328,27 @@ uint16 hire_new_staff_member(uint8 staffType) return edi; } -void sub_6C0C3F() +/** + * + * rct2: 0x006C0C3F + */ +void staff_update_greyed_patrol_areas() { - register rct_peep* peep; + rct_peep* peep; - for (register uint8 staff_type = 0; staff_type < STAFF_TYPE_COUNT; ++staff_type) + for (int staff_type = 0; staff_type < STAFF_TYPE_COUNT; ++staff_type) { - for (register uint8 i = 0; i < 128; ++i) - RCT2_ADDRESS(0x13B0E72 + (staff_type + STAFF_MAX_COUNT) * 512, uint32)[i] = 0; + for (int i = 0; i < 128; ++i) + RCT2_ADDRESS(0x13B0E72 + ((staff_type + STAFF_MAX_COUNT) * 512), uint32)[i] = 0; - for (register uint16 sprite_index = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16); sprite_index != SPRITE_INDEX_NULL; sprite_index = peep->next) + for (uint16 sprite_index = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16); sprite_index != SPRITE_INDEX_NULL; sprite_index = peep->next) { peep = GET_PEEP(sprite_index); if (peep->type == PEEP_TYPE_STAFF && staff_type == peep->staff_type) { - for (register uint8 i = 0; i < 128; ++i) - RCT2_ADDRESS(0x13B0E72 + (staff_type + STAFF_MAX_COUNT) * 512, uint32)[i] |= RCT2_ADDRESS(0x13B0E72 + peep->staff_id * 512, uint32)[i]; + for (int i = 0; i < 128; ++i) + RCT2_ADDRESS(0x13B0E72 + ((staff_type + STAFF_MAX_COUNT) * 512), uint32)[i] |= RCT2_ADDRESS(0x13B0E72 + (peep->staff_id * 512), uint32)[i]; } } diff --git a/src/peep/staff.h b/src/peep/staff.h index 9e2ea86876..51467efecc 100644 --- a/src/peep/staff.h +++ b/src/peep/staff.h @@ -57,7 +57,7 @@ void game_command_fire_staff_member(int *eax, int *ebx, int *ecx, int *edx, int void update_staff_colour(uint8 staffType, uint16 color); uint16 hire_new_staff_member(uint8 staffType); -void sub_6C0C3F(); +void staff_update_greyed_patrol_areas(); int mechanic_is_location_in_patrol(rct_peep *mechanic, int x, int y); void staff_reset_stats(); diff --git a/src/windows/staff.c b/src/windows/staff.c index 8dfb1e503a..5a14ff1deb 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -573,19 +573,18 @@ void window_staff_overview_dropdown() for (int i = 0; i < 128; i++) { - RCT2_GLOBAL(0x13B0E72 + ebx + i * 4, uint32) = 0; + RCT2_ADDRESS(0x13B0E72 + (peep->staff_id * 512), uint32)[i] = 0; } - RCT2_GLOBAL(RCT2_ADDRESS_STAFF_MODE_ARRAY + edi, uint16) &= 0xFD; // bug?? + RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[peep->staff_id] &= ~2; - window_invalidate(w); - //RCT2_CALLPROC_EBPSAFE(0x006C0C3F); - sub_6C0C3F(); + gfx_invalidate_screen(); + staff_update_greyed_patrol_areas(); } else { if (!tool_set(w, widgetIndex, 22)) { show_gridlines(); RCT2_GLOBAL(0x009DEA50, sint16) = w->number; - window_invalidate(w); + gfx_invalidate_screen(); } } }