Moved window_create into window_open and renamed sub_6BED21 to window_staff_peep_disable_widgets to follow the same pattern as window_peep.

This commit is contained in:
hexdec 2014-08-23 19:59:10 +02:00
parent d74b8c6de9
commit 7eff50b819
1 changed files with 27 additions and 47 deletions

View File

@ -144,10 +144,12 @@ uint32 window_staff_peep_page_enabled_widgets[] = {
/** /**
* rct2: 0x006BED21 * rct2: 0x006BED21
* * Disable the staff pickup if not in pickup state.
*/ */
void sub_6BED21(rct_window* w, rct_peep* peep) void window_staff_peep_disable_widgets(rct_window* w)
{ {
rct_peep* peep = &g_sprite_list[w->number].peep;
int eax = 0 | 0x80; int eax = 0 | 0x80;
if (peep->staff_type == 2) { if (peep->staff_type == 2) {
@ -191,13 +193,14 @@ void sub_6BED21(rct_window* w, rct_peep* peep)
} }
/** /**
* Create the window for a specific peep.
* *
* rct2: 0x006BEF1B * rct2: 0x006BEE98
*/ */
rct_window* sub_6BEF1B(rct_peep* peep) void window_staff_peep_open(rct_peep* peep)
{ {
rct_window* w = window_create_auto_pos(190, 180, (uint32*)window_staff_peep_overview_events, WC_PEEP, (uint16)0x400); rct_window* w = window_bring_to_front_by_id(WC_PEEP, peep->sprite_index);
if (w == NULL) {
w = window_create_auto_pos(190, 180, (uint32*)window_staff_peep_overview_events, WC_PEEP, (uint16)0x400);
w->widgets = RCT2_GLOBAL(0x9AF81C, rct_widget*); w->widgets = RCT2_GLOBAL(0x9AF81C, rct_widget*);
w->enabled_widgets = RCT2_GLOBAL(0x9929B0, uint32); w->enabled_widgets = RCT2_GLOBAL(0x9929B0, uint32);
@ -208,7 +211,7 @@ rct_window* sub_6BEF1B(rct_peep* peep)
RCT2_GLOBAL((int*)w + 0x496, uint16) = 0; // missing, var_494 should perhaps be uint16? RCT2_GLOBAL((int*)w + 0x496, uint16) = 0; // missing, var_494 should perhaps be uint16?
sub_6BED21(w, peep); window_staff_peep_disable_widgets(w);
w->min_width = 190; w->min_width = 190;
w->min_height = 180; w->min_height = 180;
@ -220,28 +223,6 @@ rct_window* sub_6BEF1B(rct_peep* peep)
w->colours[0] = 1; w->colours[0] = 1;
w->colours[1] = 4; w->colours[1] = 4;
w->colours[2] = 4; w->colours[2] = 4;
return w;
}
/**
*
* rct2: 0x006BEE98
*/
void window_staff_peep_open(rct_peep* peep)
{
rct_window* w = window_bring_to_front_by_id(WC_PEEP, peep->sprite_index);
if (!w) {
//int eax, ebx, ecx, edx, esi, edi;
//eax = peep->sprite_index;
//ecx = WC_PEEP;
//edx = peep->sprite_index;
//RCT2_CALLFUNC_X(0x006BEF1B, &eax, &ebx, &ecx, &edx, &esi, &edi, (int*)peep);
//w = (rct_window*)esi;
w = sub_6BEF1B(peep);
} }
w->page = 0; w->page = 0;
window_invalidate(w); window_invalidate(w);
@ -251,8 +232,7 @@ void window_staff_peep_open(rct_peep* peep)
w->var_020 = RCT2_GLOBAL(0x9929BC, uint32); w->var_020 = RCT2_GLOBAL(0x9929BC, uint32);
w->event_handlers = window_staff_peep_page_events[0]; w->event_handlers = window_staff_peep_page_events[0];
w->pressed_widgets = 0; w->pressed_widgets = 0;
//RCT2_CALLPROC_X(0x006BED21, 0, 0, 0, 0, (int)w, 0, 0); window_staff_peep_disable_widgets(w);
sub_6BED21(w, peep);
window_init_scroll_widgets(w); window_init_scroll_widgets(w);
RCT2_CALLPROC_X(0x006BEDA3, 0, 0, 0, 0, (int)w, 0, 0); RCT2_CALLPROC_X(0x006BEDA3, 0, 0, 0, 0, (int)w, 0, 0);
if (g_sprite_list[w->number].peep.state == PEEP_STATE_PICKED) { if (g_sprite_list[w->number].peep.state == PEEP_STATE_PICKED) {
@ -321,7 +301,7 @@ void window_staff_peep_set_page(rct_window* w, int page)
w->pressed_widgets = 0; w->pressed_widgets = 0;
w->widgets = window_staff_peep_page_widgets[page]; w->widgets = window_staff_peep_page_widgets[page];
sub_6BED21(w, &g_sprite_list[w->number].peep); window_staff_peep_disable_widgets(w);
window_invalidate(w); window_invalidate(w);
RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0); RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0);