From 719ca2ddd2ea29a458f1371617eba9f12e39e8eb Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Tue, 7 Oct 2014 20:57:02 +0100 Subject: [PATCH 01/13] Added start of window_staff_fire. Refactored some of window_staff_peep --- src/interface/window.h | 1 + src/localisation/string_ids.h | 2 + src/window_staff_fire.c | 144 ++++++++++++++++++++++++++++++++++ src/windows/staff.c | 75 +++--------------- 4 files changed, 157 insertions(+), 65 deletions(-) create mode 100644 src/window_staff_fire.c diff --git a/src/interface/window.h b/src/interface/window.h index 1242215e0d..7a47b7ccc2 100644 --- a/src/interface/window.h +++ b/src/interface/window.h @@ -480,6 +480,7 @@ void window_shortcut_keys_open(); void window_shortcut_change_open(int selected_key); void window_guest_open(rct_peep* peep); void window_staff_open(rct_peep* peep); +void window_staff_fire_open(rct_peep* peep); void window_park_awards_open(); void window_park_entrance_open(); void window_park_guests_open(); diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index ec9639b635..9e8bb66060 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -439,6 +439,8 @@ enum { STR_TOO_MANY_STAFF_IN_GAME = 1707, + STR_YES = 1710, + STR_CANT_RENAME_PARK = 1717, STR_PARK_NAME = 1718, STR_ENTER_PARK_NAME = 1719, diff --git a/src/window_staff_fire.c b/src/window_staff_fire.c new file mode 100644 index 0000000000..fdf729ef47 --- /dev/null +++ b/src/window_staff_fire.c @@ -0,0 +1,144 @@ +/***************************************************************************** +* Copyright (c) 2014 Ted John, Duncan Frost +* OpenRCT2, an open source clone of Roller Coaster Tycoon 2. +* +* This file is part of OpenRCT2. +* +* OpenRCT2 is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. + +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*****************************************************************************/ + +#include "addresses.h" +#include "peep.h" +#include "string_ids.h" +#include "sprite.h" +#include "sprites.h" +#include "widget.h" +#include "window.h" +#include "staff.h" + +#define WW 200 +#define WH 100 + +enum WINDOW_STAFF_FIRE_WIDGET_IDX { + WIDX_BACKGROUND, + WIDX_TITLE, + WIDX_CLOSE, + WIDX_YES, + WIDX_CANCEL +}; + +// 0x9AFB4C +static rct_widget window_staff_fire_widgets[] = { + { WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, STR_NONE, STR_NONE }, + { WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_OPTIONS, STR_WINDOW_TITLE_TIP }, + { WWT_CLOSEBOX, 0, WW-13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, + { WWT_DROPDOWN_BUTTON, 0, 10, 94, WH - 20, WH - 9, STR_YES, STR_NONE }, + { WWT_DROPDOWN_BUTTON, 0, WW - 95, WW - 11, WH - 10, WH - 9, STR_SAVE_PROMPT_CANCEL, STR_NONE }, + { WIDGETS_END } +}; + +static void window_staff_fire_emptysub(){} +static void window_staff_fire_mouseup(); +static void window_staff_fire_paint(); + +//0x9A3F7C +static void* window_staff_fire_events[] = { + window_staff_fire_emptysub, + window_staff_fire_mouseup, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_emptysub, + window_staff_fire_paint, + window_staff_fire_emptysub +}; +/** Based off of rct2: 0x6C0A77 */ +void window_staff_fire_open(rct_peep* peep){ + // Check if the confirm window already exists. + if (window_bring_to_front_by_id(WC_FIRE_PROMPT, peep->sprite_index)) { + return; + } + + // Find center of the screen. + int screen_height = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16); + int screen_width = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16); + int x = screen_width / 2 - WW / 2; + int y = screen_height / 2 - WH / 2; + + rct_window* w = window_create(x, y, WW, WH, (uint32*)0x992C3C, 0x1A, 0); + w->widgets = window_staff_fire_widgets; + w->enabled_widgets |= (1 << WIDX_CLOSE) | (1 << WIDX_YES) | (1 << WIDX_CANCEL); + + window_init_scroll_widgets(w); + + w->flags |= WF_TRANSPARENT; + w->number = peep->sprite_index; + w->colours[0] = 0x9A; +} + + +/** +* +* rct2: 0x006C0B40 +*/ +static void window_shortcut_change_mouseup(){ + short widgetIndex; + rct_window *w; + + window_widget_get_registers(w, widgetIndex); + + switch (widgetIndex){ + case WIDX_YES: + //6c0b5b + break; + case WIDX_CANCEL: + case WIDX_CLOSE: + window_close(w); + } +} + +/** +* +* rct2: 0x006C0AF2 +*/ +static void window_shortcut_change_paint(){ + rct_window *w; + rct_drawpixelinfo *dpi; + + window_paint_get_registers(w, dpi); + + window_draw_widgets(w, dpi); + + //To be finished +} \ No newline at end of file diff --git a/src/windows/staff.c b/src/windows/staff.c index 48f06650cd..dff237d3d3 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -289,47 +289,19 @@ void window_staff_open(rct_peep* peep) void window_staff_disable_widgets(rct_window* w) { rct_peep* peep = &g_sprite_list[w->number].peep; + uint64 disabled_widgets = 0; - int eax = 0 | 0x80; - - if (peep->staff_type == 2) { - eax |= 0x20; - } - - //RCT2_CALLFUNC_X(0x698827, 0, 0, 0, 0, 0, 0, 0); - // sub_698827 - // This is here due to needing the Carry Flag. - - int CF = 0; - int res = RCT2_GLOBAL(0x982004 + peep->state, uint8) & 1; - - if (res == 0) { - CF = 1; - } - else { - eax = eax & eax; - } - - // end sub_698827 - - int a = 0; - - // pop esi - if (CF == 1 && w->page == 0) { - eax |= 0x400; //or eax, 400h - - a = w->disabled_widgets & (1 << 0xA); //bt dword ptr[esi + 10h], 0Ah - - } - - if (a == 0) { - CF = w->disabled_widgets & (1 << 0xA); //bt dword ptr [esi+10h], 0Ah - if (CF == 1) { + if (peep_can_be_picked_up(peep)){ + if (w->disabled_widgets & (1 << WIDX_PICKUP)) + window_invalidate(w); + } + else{ + disabled_widgets = (1 << WIDX_PICKUP); + if (!(w->disabled_widgets & (1 << WIDX_PICKUP))) window_invalidate(w); - } } - w->disabled_widgets = eax; + w->disabled_widgets = disabled_widgets; } /** @@ -349,33 +321,6 @@ void window_staff_overview_close() } } -/** rct2: 0x6C0A77 */ -void window_staff_fire(rct_window* w) -{ - // Check if the confirm window already exists. - if (window_bring_to_front_by_id(0x1A, w->number)) { - return; - } - - // Find center of the screen. - int screen_height = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16); - int screen_width = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16); - int x = screen_width/2 - 100; - int y = screen_height/2 - 50; - - rct_window* window_prompt = window_create(x, y, 200, 100, (uint32*)0x992C3C, 0x1A, 0); - window_prompt->widgets = (rct_widget*)0x9AFB4C; - window_prompt->enabled_widgets |= 0x4; - window_prompt->enabled_widgets |= 0x8; - window_prompt->enabled_widgets |= 0x10; - - window_init_scroll_widgets(window_prompt); - - window_prompt->flags |= 0x10; - window_prompt->number = w->number; - window_prompt->colours[0] = 0x9A; -} - /** * Mostly similar to window_peep_set_page. * rct2: 0x006BE023 @@ -461,7 +406,7 @@ void window_staff_overview_mouseup() RCT2_CALLPROC_X(0x0069A42F, 0, 0, 0, 0, (int)peep, 0, 0); break; case WIDX_FIRE: // 0xE - window_staff_fire(w); + window_staff_fire_open(peep); break; case WIDX_RENAME: // 0xC // 6BE4BC From 3612f7f89d240e78177b183a9746dae6a5eaede0 Mon Sep 17 00:00:00 2001 From: Duncan Date: Wed, 8 Oct 2014 12:39:50 +0100 Subject: [PATCH 02/13] Finished window staff fire paint --- src/window_staff_fire.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/window_staff_fire.c b/src/window_staff_fire.c index fdf729ef47..461c6de7bb 100644 --- a/src/window_staff_fire.c +++ b/src/window_staff_fire.c @@ -112,7 +112,7 @@ void window_staff_fire_open(rct_peep* peep){ * * rct2: 0x006C0B40 */ -static void window_shortcut_change_mouseup(){ +static void window_staff_fire_mouseup(){ short widgetIndex; rct_window *w; @@ -132,7 +132,7 @@ static void window_shortcut_change_mouseup(){ * * rct2: 0x006C0AF2 */ -static void window_shortcut_change_paint(){ +static void window_staff_fire_paint(){ rct_window *w; rct_drawpixelinfo *dpi; @@ -140,5 +140,13 @@ static void window_shortcut_change_paint(){ window_draw_widgets(w, dpi); - //To be finished -} \ No newline at end of file + rct_peep* peep = &g_sprite_list[w->number].peep; + + RCT2_GLOBAL(0x13CE952, uint16) = peep->name_string_idx; + RCT2_GLOBAL(0x13CE954, uint32) = peep->id; + + int x = w->x + WW / 2; + int y = w->y + (WH / 2) - 3; + + gfx_draw_string_centred_wrapped(dpi, (void*)0x13CE952, x, y, 196, STR_FIRE_STAFF_ID, 0); +} From af6926350e02d9dab2fbab977a3139025b27cadc Mon Sep 17 00:00:00 2001 From: Duncan Date: Wed, 8 Oct 2014 12:41:14 +0100 Subject: [PATCH 03/13] Added fire staff id entry --- src/localisation/string_ids.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index 9e8bb66060..2b79f10758 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -440,6 +440,7 @@ enum { STR_TOO_MANY_STAFF_IN_GAME = 1707, STR_YES = 1710, + STR_FIRE_STAFF_ID = 1711, STR_CANT_RENAME_PARK = 1717, STR_PARK_NAME = 1718, From 252d7f798732f5e19e4208d15d5b3bd90ba9b9b7 Mon Sep 17 00:00:00 2001 From: Duncan Date: Wed, 8 Oct 2014 12:50:56 +0100 Subject: [PATCH 04/13] Added fire staff cmd. Fire staff wind complete. --- src/window_staff_fire.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/window_staff_fire.c b/src/window_staff_fire.c index 461c6de7bb..770f64c59a 100644 --- a/src/window_staff_fire.c +++ b/src/window_staff_fire.c @@ -118,9 +118,11 @@ static void window_staff_fire_mouseup(){ window_widget_get_registers(w, widgetIndex); + rct_peep* peep = &g_sprite_list[w->number].peep; + switch (widgetIndex){ case WIDX_YES: - //6c0b5b + game_do_command(peep->x, 1, peep->y, w->number, GAME_COMMAND_31, 0, 0); break; case WIDX_CANCEL: case WIDX_CLOSE: From 2a3989019b7f010e5e0de2c730589345328491f1 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Fri, 10 Oct 2014 11:13:54 +0100 Subject: [PATCH 05/13] Fix merge fails. Renamed a few functions --- projects/openrct2.vcxproj | 1 + projects/openrct2.vcxproj.filters | 3 +++ src/game.h | 4 ++-- src/interface/window.h | 2 +- src/windows/staff.c | 2 +- .../staff_fire_prompt.c} | 23 ++++++++++--------- 6 files changed, 20 insertions(+), 15 deletions(-) rename src/{window_staff_fire.c => windows/staff_fire_prompt.c} (89%) diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 41b6e1cb2f..0bda882703 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -125,6 +125,7 @@ + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index 8e61b709f5..6da5bd311f 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -422,6 +422,9 @@ Source\World + + Source\Windows + diff --git a/src/game.h b/src/game.h index 86c74c3581..9b605fbe73 100644 --- a/src/game.h +++ b/src/game.h @@ -53,8 +53,8 @@ enum GAME_COMMAND { GAME_COMMAND_28, GAME_COMMAND_HIRE_NEW_STAFF_MEMBER, // 29 GAME_COMMAND_30, - GAME_COMMAND_31, - GAME_COMMAND_SET_STAFF_ORDER, + GAME_COMMAND_FIRE_STAFF_MEMBER, // 31 + GAME_COMMAND_SET_STAFF_ORDER, // 32 GAME_COMMAND_33, GAME_COMMAND_SET_PARK_OPEN, // 34 GAME_COMMAND_35, diff --git a/src/interface/window.h b/src/interface/window.h index 7a47b7ccc2..e761fd41bd 100644 --- a/src/interface/window.h +++ b/src/interface/window.h @@ -480,7 +480,7 @@ void window_shortcut_keys_open(); void window_shortcut_change_open(int selected_key); void window_guest_open(rct_peep* peep); void window_staff_open(rct_peep* peep); -void window_staff_fire_open(rct_peep* peep); +void window_staff_fire_prompt_open(rct_peep* peep); void window_park_awards_open(); void window_park_entrance_open(); void window_park_guests_open(); diff --git a/src/windows/staff.c b/src/windows/staff.c index dff237d3d3..a1c2ced7fb 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -406,7 +406,7 @@ void window_staff_overview_mouseup() RCT2_CALLPROC_X(0x0069A42F, 0, 0, 0, 0, (int)peep, 0, 0); break; case WIDX_FIRE: // 0xE - window_staff_fire_open(peep); + window_staff_fire_prompt_open(peep); break; case WIDX_RENAME: // 0xC // 6BE4BC diff --git a/src/window_staff_fire.c b/src/windows/staff_fire_prompt.c similarity index 89% rename from src/window_staff_fire.c rename to src/windows/staff_fire_prompt.c index 770f64c59a..f8c6a5c49b 100644 --- a/src/window_staff_fire.c +++ b/src/windows/staff_fire_prompt.c @@ -18,14 +18,15 @@ * along with this program. If not, see . *****************************************************************************/ -#include "addresses.h" -#include "peep.h" -#include "string_ids.h" -#include "sprite.h" -#include "sprites.h" -#include "widget.h" -#include "window.h" -#include "staff.h" +#include "../addresses.h" +#include "../game.h" +#include "../interface/widget.h" +#include "../interface/window.h" +#include "../localisation/localisation.h" +#include "../peep/peep.h" +#include "../peep/staff.h" +#include "../sprites.h" +#include "../world/sprite.h" #define WW 200 #define WH 100 @@ -84,7 +85,7 @@ static void* window_staff_fire_events[] = { window_staff_fire_emptysub }; /** Based off of rct2: 0x6C0A77 */ -void window_staff_fire_open(rct_peep* peep){ +void window_staff_fire_prompt_open(rct_peep* peep){ // Check if the confirm window already exists. if (window_bring_to_front_by_id(WC_FIRE_PROMPT, peep->sprite_index)) { return; @@ -122,7 +123,7 @@ static void window_staff_fire_mouseup(){ switch (widgetIndex){ case WIDX_YES: - game_do_command(peep->x, 1, peep->y, w->number, GAME_COMMAND_31, 0, 0); + game_do_command(peep->x, 1, peep->y, w->number, GAME_COMMAND_FIRE_STAFF_MEMBER, 0, 0); break; case WIDX_CANCEL: case WIDX_CLOSE: @@ -150,5 +151,5 @@ static void window_staff_fire_paint(){ int x = w->x + WW / 2; int y = w->y + (WH / 2) - 3; - gfx_draw_string_centred_wrapped(dpi, (void*)0x13CE952, x, y, 196, STR_FIRE_STAFF_ID, 0); + gfx_draw_string_centred_wrapped(dpi, (void*)0x13CE952, x, y, WW - 4, STR_FIRE_STAFF_ID, 0); } From 10793011c487f1f9bef5015450d6336786792e02 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Fri, 10 Oct 2014 12:05:43 +0100 Subject: [PATCH 06/13] Fix small mistakes in fire prompt --- src/localisation/string_ids.h | 1 + src/windows/staff_fire_prompt.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index 2b79f10758..ef10b238f5 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -439,6 +439,7 @@ enum { STR_TOO_MANY_STAFF_IN_GAME = 1707, + STR_SACK_STAFF = 1709, STR_YES = 1710, STR_FIRE_STAFF_ID = 1711, diff --git a/src/windows/staff_fire_prompt.c b/src/windows/staff_fire_prompt.c index f8c6a5c49b..0132942ad5 100644 --- a/src/windows/staff_fire_prompt.c +++ b/src/windows/staff_fire_prompt.c @@ -42,10 +42,10 @@ enum WINDOW_STAFF_FIRE_WIDGET_IDX { // 0x9AFB4C static rct_widget window_staff_fire_widgets[] = { { WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, STR_NONE, STR_NONE }, - { WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_OPTIONS, STR_WINDOW_TITLE_TIP }, + { WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_SACK_STAFF, STR_WINDOW_TITLE_TIP }, { WWT_CLOSEBOX, 0, WW-13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, { WWT_DROPDOWN_BUTTON, 0, 10, 94, WH - 20, WH - 9, STR_YES, STR_NONE }, - { WWT_DROPDOWN_BUTTON, 0, WW - 95, WW - 11, WH - 10, WH - 9, STR_SAVE_PROMPT_CANCEL, STR_NONE }, + { WWT_DROPDOWN_BUTTON, 0, WW - 95, WW - 11, WH - 20, WH - 9, STR_SAVE_PROMPT_CANCEL, STR_NONE }, { WIDGETS_END } }; From 950bbccb34e78464ac469dc39707192a91ebed57 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Fri, 10 Oct 2014 12:33:36 +0100 Subject: [PATCH 07/13] Fix bugs introduced by previous commit. --- src/windows/staff.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/windows/staff.c b/src/windows/staff.c index a1c2ced7fb..bcef7d2673 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -90,6 +90,7 @@ rct_widget *window_staff_page_widgets[] = { void window_staff_set_page(rct_window* w, int page); void window_staff_disable_widgets(rct_window* w); +void window_staff_unknown_05(); void window_staff_overview_close(); void window_staff_overview_mouseup(); @@ -144,7 +145,7 @@ static void* window_staff_orders_events[] = { window_staff_stats_resize, (void*)0x6BE802, (void*)0x6BE809, - (void*)0x6BE9DA, + window_staff_unknown_05, window_staff_orders_update, window_staff_emptysub, window_staff_emptysub, @@ -176,7 +177,7 @@ static void* window_staff_stats_events[] = { window_staff_stats_resize, window_staff_emptysub, window_staff_emptysub, - (void*)0x6BEC80, + window_staff_unknown_05, window_staff_stats_update, window_staff_emptysub, window_staff_emptysub, @@ -289,16 +290,22 @@ void window_staff_open(rct_peep* peep) void window_staff_disable_widgets(rct_window* w) { rct_peep* peep = &g_sprite_list[w->number].peep; - uint64 disabled_widgets = 0; + uint64 disabled_widgets = (1 << WIDX_TAB_4); - if (peep_can_be_picked_up(peep)){ - if (w->disabled_widgets & (1 << WIDX_PICKUP)) - window_invalidate(w); + if (peep->staff_type == STAFF_TYPE_SECURITY){ + disabled_widgets |= (1 << WIDX_TAB_2); } - else{ - disabled_widgets = (1 << WIDX_PICKUP); - if (!(w->disabled_widgets & (1 << WIDX_PICKUP))) - window_invalidate(w); + + if (w->page == WINDOW_STAFF_OVERVIEW){ + if (peep_can_be_picked_up(peep)){ + if (w->disabled_widgets & (1 << WIDX_PICKUP)) + window_invalidate(w); + } + else{ + disabled_widgets |= (1 << WIDX_PICKUP); + if (!(w->disabled_widgets & (1 << WIDX_PICKUP))) + window_invalidate(w); + } } w->disabled_widgets = disabled_widgets; @@ -653,4 +660,12 @@ void window_staff_stats_update(rct_window* w) peep->var_45 &= 0xEF; window_invalidate(w); } +} + +/* rct2: 0x6BEC80, 0x6BE9DA */ +void window_staff_unknown_05(){ + rct_window* w; + window_get_register(w); + + widget_invalidate(WC_PEEP, w->number, WIDX_TAB_1); } \ No newline at end of file From 0ba79d70ab46c63f49f43dc149fef02ee99118c9 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Fri, 10 Oct 2014 12:52:40 +0100 Subject: [PATCH 08/13] Added remaining widgets --- src/windows/staff.c | 46 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/src/windows/staff.c b/src/windows/staff.c index bcef7d2673..b915c66b9b 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -53,12 +53,12 @@ enum WINDOW_STAFF_WIDGET_IDX { WIDX_LOCATE, WIDX_FIRE, - WIDX_CHECKBOX_1 = 0x8, + WIDX_CHECKBOX_1 = 8, WIDX_CHECKBOX_2, WIDX_CHECKBOX_3, WIDX_CHECKBOX_4, - - WIDX_COSTUME = 0xD, + WIDX_COSTUME_BOX, + WIDX_COSTUME_BTN, }; void window_staff_emptysub(){}; @@ -66,7 +66,7 @@ void window_staff_emptysub(){}; rct_widget window_staff_overview_widgets[] = { { WWT_FRAME, 0, 0, 189, 0, 179, 0x0FFFFFFFF, STR_NONE }, // Panel / Background { WWT_CAPTION, 0, 1, 188, 1, 14, 0x361, STR_WINDOW_TITLE_TIP }, // Title - { WWT_CLOSEBOX, 0, 177, 187, 2, 13, 0x338, STR_CLOSE_WINDOW_TIP }, // Close x button + { WWT_CLOSEBOX, 0, 177, 187, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // Close x button { WWT_RESIZE, 1, 0, 189, 43, 179, 0x0FFFFFFFF, STR_NONE }, // Resize { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1939 }, // Tab 1 { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1945}, // Tab 2 @@ -82,10 +82,42 @@ rct_widget window_staff_overview_widgets[] = { { WIDGETS_END }, }; +//0x9AF910 +rct_widget window_staff_stats_widgets[] = { + { WWT_FRAME, 0, 0, 189, 0, 179, 0x0FFFFFFFF, STR_NONE }, // Panel / Background + { WWT_CAPTION, 0, 1, 188, 1, 14, 0x361, STR_WINDOW_TITLE_TIP }, // Title + { WWT_CLOSEBOX, 0, 177, 187, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // Close x button + { WWT_RESIZE, 1, 0, 189, 43, 179, 0x0FFFFFFFF, STR_NONE }, // Resize + { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1939 }, // Tab 1 + { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1945}, // Tab 2 + { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2348}, // Tab 3 + { WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, STR_NONE}, // Tab 4 + { WWT_CHECKBOX, 1, 5, 184, 50, 61, 0x0FFFFFFFF, STR_NONE}, // Checkbox 1 + { WWT_CHECKBOX, 1, 5, 184, 67, 78, 0x0FFFFFFFF, STR_NONE }, // Checkbox 2 + { WWT_CHECKBOX, 1, 5, 184, 84, 95, 0x0FFFFFFFF, STR_NONE}, // Checkbox 3 + { WWT_CHECKBOX, 1, 5, 184, 101, 112, 0x0FFFFFFFF, STR_NONE}, // Checkbox 4 + { WWT_DROPDOWN, 1, 5, 184, 50, 61, 0x0FFFFFFFF, STR_NONE}, // Costume Dropdown + { WWT_DROPDOWN_BUTTON, 1, 173, 183, 51, 60, 876, 1946}, // Costume Dropdown Button + { WIDGETS_END }, +}; + +//0x9AF9F4 +rct_widget window_staff_options_widgets[] = { + { WWT_FRAME, 0, 0, 189, 0, 179, 0x0FFFFFFFF, STR_NONE }, // Panel / Background + { WWT_CAPTION, 0, 1, 188, 1, 14, 865, STR_WINDOW_TITLE_TIP }, // Title + { WWT_CLOSEBOX, 0, 177, 187, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // Close x button + { WWT_RESIZE, 1, 0, 189, 43, 179, 0x0FFFFFFFF, STR_NONE }, // Resize + { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1939 }, // Tab 1 + { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1945}, // Tab 2 + { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2348}, // Tab 3 + { WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, STR_NONE}, // Tab 4 + { WIDGETS_END }, +}; + rct_widget *window_staff_page_widgets[] = { window_staff_overview_widgets, - (rct_widget *)0x9AF910, - (rct_widget *)0x9AF9F4 + window_staff_options_widgets, + window_staff_stats_widgets }; void window_staff_set_page(rct_window* w, int page); @@ -227,7 +259,7 @@ uint32 window_staff_page_enabled_widgets[] = { (1 << WIDX_CHECKBOX_2) | (1 << WIDX_CHECKBOX_3) | (1 << WIDX_CHECKBOX_4) | - (1 << WIDX_COSTUME), + (1 << WIDX_COSTUME_BTN), (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | From d02017cb48e4fbaef358c890324c74dc1c3d32d6 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Fri, 10 Oct 2014 13:34:46 +0100 Subject: [PATCH 09/13] Refactored widgets. Added staff stats invalidate --- src/peep/peep.h | 5 +- src/windows/staff.c | 137 +++++++++++++++++++++++++++----------------- 2 files changed, 88 insertions(+), 54 deletions(-) diff --git a/src/peep/peep.h b/src/peep/peep.h index 8642a154ff..7fe9943a2c 100644 --- a/src/peep/peep.h +++ b/src/peep/peep.h @@ -396,7 +396,10 @@ typedef struct { uint8 staff_id; uint8 guest_heading_to_ride_id; }; - uint8 var_C6; + union{ + uint8 staff_orders; // 0xC6 + uint8 var_C6; + }; uint8 photo1_ride_ref; // 0xC7 uint32 flags; // 0xC8 uint32 var_CC; diff --git a/src/windows/staff.c b/src/windows/staff.c index b915c66b9b..eeba5e8f3d 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -30,6 +30,9 @@ #include "../world/sprite.h" #include "dropdown.h" +#define WW 190 +#define WH 180 + enum WINDOW_STAFF_PAGE { WINDOW_STAFF_OVERVIEW, WINDOW_STAFF_OPTIONS, @@ -64,53 +67,53 @@ enum WINDOW_STAFF_WIDGET_IDX { void window_staff_emptysub(){}; rct_widget window_staff_overview_widgets[] = { - { WWT_FRAME, 0, 0, 189, 0, 179, 0x0FFFFFFFF, STR_NONE }, // Panel / Background - { WWT_CAPTION, 0, 1, 188, 1, 14, 0x361, STR_WINDOW_TITLE_TIP }, // Title - { WWT_CLOSEBOX, 0, 177, 187, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // Close x button - { WWT_RESIZE, 1, 0, 189, 43, 179, 0x0FFFFFFFF, STR_NONE }, // Resize - { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1939 }, // Tab 1 - { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1945}, // Tab 2 - { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2348}, // Tab 3 - { WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, STR_NONE}, // Tab 4 - { WWT_VIEWPORT, 1, 3, 164, 47, 166, 0x0FFFFFFFF, STR_NONE}, // Viewport - { WWT_12, 1, 3, 164, 167, 177, 0x0FFFFFFFF, STR_NONE }, // Label at bottom of viewport - { WWT_FLATBTN, 1, 165, 188, 45, 68, 0x1436, 1706}, // Pickup Button - { WWT_FLATBTN, 1, 165, 188, 69, 92, 0x1437, 1708}, // Patrol Button - { WWT_FLATBTN, 1, 165, 188, 93, 116, 0x1430, 1056}, // Rename Button - { WWT_FLATBTN, 1, 165, 188, 117, 140, 0x142F, 1027}, // Locate Button - { WWT_FLATBTN, 1, 165, 188, 141, 164, 0x142D, 1705}, // Fire Button + { WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0x0FFFFFFFF, STR_NONE }, // Panel / Background + { WWT_CAPTION, 0, 1, WW - 2, 1, 14, 0x361, STR_WINDOW_TITLE_TIP }, // Title + { WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // Close x button + { WWT_RESIZE, 1, 0, WW - 1, 43, WH - 1, 0x0FFFFFFFF, STR_NONE }, // Resize + { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1939 }, // Tab 1 + { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1945}, // Tab 2 + { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2348}, // Tab 3 + { WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, STR_NONE}, // Tab 4 + { WWT_VIEWPORT, 1, 3, WW - 26, 47, WH - 14,0x0FFFFFFFF, STR_NONE}, // Viewport + { WWT_12, 1, 3, WW - 26, WH - 13, WH - 3, 0x0FFFFFFFF, STR_NONE }, // Label at bottom of viewport + { WWT_FLATBTN, 1, WW - 25, WW - 2, 45, 68, 0x1436, 1706}, // Pickup Button + { WWT_FLATBTN, 1, WW - 25, WW - 2, 69, 92, 0x1437, 1708}, // Patrol Button + { WWT_FLATBTN, 1, WW - 25, WW - 2, 93, 116, 0x1430, 1056}, // Rename Button + { WWT_FLATBTN, 1, WW - 25, WW - 2, 117, 140, 0x142F, 1027}, // Locate Button + { WWT_FLATBTN, 1, WW - 25, WW - 2, 141, 164, 0x142D, 1705}, // Fire Button { WIDGETS_END }, }; //0x9AF910 -rct_widget window_staff_stats_widgets[] = { - { WWT_FRAME, 0, 0, 189, 0, 179, 0x0FFFFFFFF, STR_NONE }, // Panel / Background - { WWT_CAPTION, 0, 1, 188, 1, 14, 0x361, STR_WINDOW_TITLE_TIP }, // Title - { WWT_CLOSEBOX, 0, 177, 187, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // Close x button - { WWT_RESIZE, 1, 0, 189, 43, 179, 0x0FFFFFFFF, STR_NONE }, // Resize - { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1939 }, // Tab 1 - { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1945}, // Tab 2 - { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2348}, // Tab 3 - { WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, STR_NONE}, // Tab 4 - { WWT_CHECKBOX, 1, 5, 184, 50, 61, 0x0FFFFFFFF, STR_NONE}, // Checkbox 1 - { WWT_CHECKBOX, 1, 5, 184, 67, 78, 0x0FFFFFFFF, STR_NONE }, // Checkbox 2 - { WWT_CHECKBOX, 1, 5, 184, 84, 95, 0x0FFFFFFFF, STR_NONE}, // Checkbox 3 - { WWT_CHECKBOX, 1, 5, 184, 101, 112, 0x0FFFFFFFF, STR_NONE}, // Checkbox 4 - { WWT_DROPDOWN, 1, 5, 184, 50, 61, 0x0FFFFFFFF, STR_NONE}, // Costume Dropdown - { WWT_DROPDOWN_BUTTON, 1, 173, 183, 51, 60, 876, 1946}, // Costume Dropdown Button +rct_widget window_staff_options_widgets[] = { + { WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0x0FFFFFFFF, STR_NONE }, // Panel / Background + { WWT_CAPTION, 0, 1, WW - 2, 1, 14, 0x361, STR_WINDOW_TITLE_TIP }, // Title + { WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // Close x button + { WWT_RESIZE, 1, 0, WW - 1, 43, WH - 1, 0x0FFFFFFFF, STR_NONE }, // Resize + { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1939 }, // Tab 1 + { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1945}, // Tab 2 + { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2348}, // Tab 3 + { WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, STR_NONE}, // Tab 4 + { WWT_CHECKBOX, 1, 5, WW - 6, 50, 61, 0x0FFFFFFFF, STR_NONE}, // Checkbox 1 + { WWT_CHECKBOX, 1, 5, WW - 6, 67, 78, 0x0FFFFFFFF, STR_NONE }, // Checkbox 2 + { WWT_CHECKBOX, 1, 5, WW - 6, 84, 95, 0x0FFFFFFFF, STR_NONE}, // Checkbox 3 + { WWT_CHECKBOX, 1, 5, WW - 6, 101, 112, 0x0FFFFFFFF, STR_NONE}, // Checkbox 4 + { WWT_DROPDOWN, 1, 5, WW - 6, 50, 61, 0x0FFFFFFFF, STR_NONE}, // Costume Dropdown + { WWT_DROPDOWN_BUTTON, 1, WW - 17, WW - 7, 51, 60, 876, 1946}, // Costume Dropdown Button { WIDGETS_END }, }; //0x9AF9F4 -rct_widget window_staff_options_widgets[] = { - { WWT_FRAME, 0, 0, 189, 0, 179, 0x0FFFFFFFF, STR_NONE }, // Panel / Background - { WWT_CAPTION, 0, 1, 188, 1, 14, 865, STR_WINDOW_TITLE_TIP }, // Title - { WWT_CLOSEBOX, 0, 177, 187, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // Close x button - { WWT_RESIZE, 1, 0, 189, 43, 179, 0x0FFFFFFFF, STR_NONE }, // Resize - { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1939 }, // Tab 1 - { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1945}, // Tab 2 - { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2348}, // Tab 3 - { WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, STR_NONE}, // Tab 4 +rct_widget window_staff_stats_widgets[] = { + { WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0x0FFFFFFFF, STR_NONE }, // Panel / Background + { WWT_CAPTION, 0, 1, WW - 2, 1, 14, 0x361, STR_WINDOW_TITLE_TIP }, // Title + { WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // Close x button + { WWT_RESIZE, 1, 0, WW - 1, 43, WH - 1, 0x0FFFFFFFF, STR_NONE }, // Resize + { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1939 }, // Tab 1 + { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1945}, // Tab 2 + { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2348}, // Tab 3 + { WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, STR_NONE}, // Tab 4 { WIDGETS_END }, }; @@ -137,6 +140,7 @@ void window_staff_orders_update(rct_window* w); void window_staff_stats_mouseup(); void window_staff_stats_resize(); void window_staff_stats_update(rct_window* w); +void window_staff_stats_invalidate(); // 0x992AEC static void* window_staff_overview_events[] = { @@ -229,7 +233,7 @@ static void* window_staff_stats_events[] = { window_staff_emptysub, window_staff_emptysub, window_staff_emptysub, - (void*)0x6BE9E9, //Invalidate + window_staff_stats_invalidate, //Invalidate (void*)0x6BEA86, //Paint window_staff_emptysub }; @@ -425,11 +429,10 @@ void window_staff_overview_mouseup() case WIDX_TAB_3: window_staff_set_page(w, widgetIndex - WIDX_TAB_1); break; - case WIDX_LOCATE: // 0xD + case WIDX_LOCATE: window_scroll_to_viewport(w); break; - case WIDX_PICKUP: // 0xA - // 0x6BE236 + case WIDX_PICKUP: if (tool_set(w, widgetIndex, 7)) { return; } @@ -444,11 +447,10 @@ void window_staff_overview_mouseup() peep->state = 9; RCT2_CALLPROC_X(0x0069A42F, 0, 0, 0, 0, (int)peep, 0, 0); break; - case WIDX_FIRE: // 0xE + case WIDX_FIRE: window_staff_fire_prompt_open(peep); break; - case WIDX_RENAME: // 0xC - // 6BE4BC + case WIDX_RENAME: window_show_textinput(w, (int)widgetIndex, 0xBA1, 0xBA2, peep->name_string_idx); break; } @@ -516,8 +518,8 @@ void window_staff_overview_mousedown(int widgetIndex, rct_window* w, rct_widget* } // Dropdown names - gDropdownItemsFormat[0] = 0xD75; - gDropdownItemsFormat[1] = 0xD76; + gDropdownItemsFormat[0] = 3446; + gDropdownItemsFormat[1] = 3447; int x = widget->left + w->x; int y = widget->top + w->y;; @@ -582,17 +584,15 @@ void window_staff_overview_update(rct_window* w) var_496 = 0; } RCT2_GLOBAL((int)w + 0x496, uint16) = var_496; - window_invalidate_by_id(0x497, w->number); + widget_invalidate(WC_PEEP, w->number, WIDX_TAB_1); } /** rct2: 0x006BE814 */ void window_staff_set_order(rct_window* w, int order_id) { - int eax = 1 << order_id; - rct_peep* peep = GET_PEEP(w->number); - int ax = peep->var_C6 ^ eax; + int ax = peep->staff_orders ^ (1 << order_id); int flags = (ax << 8) | 1; game_do_command(peep->x, flags, peep->y, w->number, GAME_COMMAND_SET_STAFF_ORDER, (int)peep, 0); @@ -627,7 +627,7 @@ void window_staff_orders_mouseup() void window_staff_orders_update(rct_window* w) { w->frame_no++; - window_invalidate_by_id(0x597, w->number); + widget_invalidate(WC_PEEP, w->number, WIDX_TAB_2); } /** rct2: 0x006BEBCF */ @@ -700,4 +700,35 @@ void window_staff_unknown_05(){ window_get_register(w); widget_invalidate(WC_PEEP, w->number, WIDX_TAB_1); +} + +/* rct2: 0x006BE9E9 */ +void window_staff_stats_invalidate(){ + rct_window* w; + window_get_register(w); + + if (window_staff_page_widgets[w->page] != w->widgets){ + w->widgets = window_staff_page_widgets[w->page]; + window_init_scroll_widgets(w); + } + + w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1); + + rct_peep* peep = GET_PEEP(w->number); + + RCT2_GLOBAL(0x13CE952, uint16) = peep->name_string_idx; + RCT2_GLOBAL(0x13CE954, uint32) = peep->id; + + window_staff_stats_widgets[WIDX_BACKGROUND].right = w->width - 1; + window_staff_stats_widgets[WIDX_BACKGROUND].bottom = w->height - 1; + + window_staff_stats_widgets[WIDX_RESIZE].right = w->width - 1; + window_staff_stats_widgets[WIDX_RESIZE].bottom = w->height - 1; + + window_staff_stats_widgets[WIDX_TITLE].right = w->width - 2; + + window_staff_stats_widgets[WIDX_CLOSE].left = w->width - 13; + window_staff_stats_widgets[WIDX_CLOSE].right = w->width - 3; + + window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_3); } \ No newline at end of file From 5ee4616685f4b289e2719d8f8480d3ba3a8b2713 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Sat, 11 Oct 2014 11:42:08 +0100 Subject: [PATCH 10/13] Added remaining paint and invalidate functions --- src/peep/peep.h | 6 +- src/sprites.h | 8 + src/windows/staff.c | 348 ++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 346 insertions(+), 16 deletions(-) diff --git a/src/peep/peep.h b/src/peep/peep.h index 7fe9943a2c..e9e665e9bb 100644 --- a/src/peep/peep.h +++ b/src/peep/peep.h @@ -332,9 +332,9 @@ typedef struct { uint8 pad_2C; uint8 sprite_type; // 0x2D uint8 type; // 0x2E - union{ // 0x2F - uint8 staff_type; - uint8 no_of_rides; + union{ + uint8 staff_type; // 0x2F + uint8 no_of_rides; // 0x2F }; uint8 tshirt_colour; // 0x30 uint8 trousers_colour; // 0x31 diff --git a/src/sprites.h b/src/sprites.h index 78116c46d0..0ab9a63981 100644 --- a/src/sprites.h +++ b/src/sprites.h @@ -122,6 +122,14 @@ enum { SPR_PEEP_LARGE_FACE_ANGRY = 5314, + SPR_TAB_STAFF_OPTIONS_0 = 5319, + SPR_TAB_STAFF_OPTIONS_1 = SPR_TAB_STAFF_OPTIONS_0 + 1, + SPR_TAB_STAFF_OPTIONS_2 = SPR_TAB_STAFF_OPTIONS_0 + 2, + SPR_TAB_STAFF_OPTIONS_3 = SPR_TAB_STAFF_OPTIONS_0 + 3, + SPR_TAB_STAFF_OPTIONS_4 = SPR_TAB_STAFF_OPTIONS_0 + 4, + SPR_TAB_STAFF_OPTIONS_5 = SPR_TAB_STAFF_OPTIONS_0 + 5, + SPR_TAB_STAFF_OPTIONS_6 = SPR_TAB_STAFF_OPTIONS_0 + 6, + SPR_TAB_FINANCES_RESEARCH_0 = 5327, SPR_TAB_SHOPS_AND_STALLS_0 = 5351, diff --git a/src/windows/staff.c b/src/windows/staff.c index eeba5e8f3d..1179c8d447 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -133,14 +133,22 @@ void window_staff_overview_resize(); void window_staff_overview_mousedown(int widgetIndex, rct_window* w, rct_widget* widget); void window_staff_overview_dropdown(); void window_staff_overview_update(rct_window* w); +void window_staff_overview_invalidate(); +void window_staff_overview_paint(); +void window_staff_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi); -void window_staff_orders_mouseup(); -void window_staff_orders_update(rct_window* w); +void window_staff_options_mouseup(); +void window_staff_options_update(rct_window* w); +void window_staff_options_invalidate(); +void window_staff_options_paint(); +void window_staff_options_tab_paint(rct_window* w, rct_drawpixelinfo* dpi); void window_staff_stats_mouseup(); void window_staff_stats_resize(); void window_staff_stats_update(rct_window* w); void window_staff_stats_invalidate(); +void window_staff_stats_paint(); +void window_staff_stats_tab_paint(rct_window* w, rct_drawpixelinfo* dpi); // 0x992AEC static void* window_staff_overview_events[] = { @@ -169,20 +177,20 @@ static void* window_staff_overview_events[] = { window_staff_emptysub, window_staff_emptysub, window_staff_emptysub, - (void*)0x6BDD91, //Invalidate - (void*)0x6BDEAF, //Paint + window_staff_overview_invalidate, //Invalidate + window_staff_overview_paint, //Paint window_staff_emptysub }; // 0x992B5C -static void* window_staff_orders_events[] = { +static void* window_staff_options_events[] = { window_staff_emptysub, - window_staff_orders_mouseup, + window_staff_options_mouseup, window_staff_stats_resize, (void*)0x6BE802, (void*)0x6BE809, window_staff_unknown_05, - window_staff_orders_update, + window_staff_options_update, window_staff_emptysub, window_staff_emptysub, window_staff_emptysub, @@ -201,8 +209,8 @@ static void* window_staff_orders_events[] = { window_staff_emptysub, window_staff_emptysub, window_staff_emptysub, - (void*)0x6BE62B, //Invalidate - (void*)0x6BE7C6, //Paint + window_staff_options_invalidate, //Invalidate + window_staff_options_paint, //Paint window_staff_emptysub }; @@ -234,13 +242,13 @@ static void* window_staff_stats_events[] = { window_staff_emptysub, window_staff_emptysub, window_staff_stats_invalidate, //Invalidate - (void*)0x6BEA86, //Paint + window_staff_stats_paint, //Paint window_staff_emptysub }; void* window_staff_page_events[] = { window_staff_overview_events, - window_staff_orders_events, + window_staff_options_events, window_staff_stats_events }; @@ -599,7 +607,7 @@ void window_staff_set_order(rct_window* w, int order_id) } /** rct2: 0x006BE7DB */ -void window_staff_orders_mouseup() +void window_staff_options_mouseup() { short widgetIndex; rct_window* w; @@ -624,7 +632,7 @@ void window_staff_orders_mouseup() } /** rct2: 0x006BE960 */ -void window_staff_orders_update(rct_window* w) +void window_staff_options_update(rct_window* w) { w->frame_no++; widget_invalidate(WC_PEEP, w->number, WIDX_TAB_2); @@ -731,4 +739,318 @@ void window_staff_stats_invalidate(){ window_staff_stats_widgets[WIDX_CLOSE].right = w->width - 3; window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_3); +} + + +/* rct2: 0x006BE62B */ +void window_staff_options_invalidate(){ + rct_window* w; + window_get_register(w); + + if (window_staff_page_widgets[w->page] != w->widgets){ + w->widgets = window_staff_page_widgets[w->page]; + window_init_scroll_widgets(w); + } + + w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1); + + rct_peep* peep = GET_PEEP(w->number); + + RCT2_GLOBAL(0x13CE952, uint16) = peep->name_string_idx; + RCT2_GLOBAL(0x13CE954, uint32) = peep->id; + + switch (peep->staff_type){ + case STAFF_TYPE_ENTERTAINER: + window_staff_options_widgets[WIDX_CHECKBOX_1].type = WWT_EMPTY; + window_staff_options_widgets[WIDX_CHECKBOX_2].type = WWT_EMPTY; + window_staff_options_widgets[WIDX_CHECKBOX_3].type = WWT_EMPTY; + window_staff_options_widgets[WIDX_CHECKBOX_4].type = WWT_EMPTY; + window_staff_options_widgets[WIDX_COSTUME_BOX].type = WWT_DROPDOWN; + window_staff_options_widgets[WIDX_COSTUME_BTN].type = WWT_DROPDOWN_BUTTON; + window_staff_options_widgets[WIDX_COSTUME_BOX].image = 1779 + peep->sprite_type - 4; + break; + case STAFF_TYPE_HANDYMAN: + window_staff_options_widgets[WIDX_CHECKBOX_1].type = WWT_CHECKBOX; + window_staff_options_widgets[WIDX_CHECKBOX_1].image = 1712; + window_staff_options_widgets[WIDX_CHECKBOX_2].type = WWT_CHECKBOX; + window_staff_options_widgets[WIDX_CHECKBOX_2].image = 1713; + window_staff_options_widgets[WIDX_CHECKBOX_3].type = WWT_CHECKBOX; + window_staff_options_widgets[WIDX_CHECKBOX_3].image = 1714; + window_staff_options_widgets[WIDX_CHECKBOX_4].type = WWT_CHECKBOX; + window_staff_options_widgets[WIDX_CHECKBOX_4].image = 1715; + window_staff_options_widgets[WIDX_COSTUME_BOX].type = WWT_EMPTY; + window_staff_options_widgets[WIDX_COSTUME_BTN].type = WWT_EMPTY; + w->pressed_widgets &= ~((1 << WIDX_CHECKBOX_1) | (1 << WIDX_CHECKBOX_2) | (1 << WIDX_CHECKBOX_3) | (1 << WIDX_CHECKBOX_4)); + w->pressed_widgets |= peep->staff_orders << WIDX_CHECKBOX_1; + break; + case STAFF_TYPE_MECHANIC: + window_staff_options_widgets[WIDX_CHECKBOX_1].type = WWT_CHECKBOX; + window_staff_options_widgets[WIDX_CHECKBOX_1].image = 1876; + window_staff_options_widgets[WIDX_CHECKBOX_2].type = WWT_CHECKBOX; + window_staff_options_widgets[WIDX_CHECKBOX_2].image = 1877; + window_staff_options_widgets[WIDX_CHECKBOX_3].type = WWT_EMPTY; + window_staff_options_widgets[WIDX_CHECKBOX_4].type = WWT_EMPTY; + window_staff_options_widgets[WIDX_COSTUME_BOX].type = WWT_EMPTY; + window_staff_options_widgets[WIDX_COSTUME_BTN].type = WWT_EMPTY; + w->pressed_widgets &= ~((1 << WIDX_CHECKBOX_1) | (1 << WIDX_CHECKBOX_2)); + w->pressed_widgets |= peep->staff_orders << WIDX_CHECKBOX_1; + break; + case STAFF_TYPE_SECURITY: + // Security guards don't have an options screen. + break; + } + + window_staff_options_widgets[WIDX_BACKGROUND].right = w->width - 1; + window_staff_options_widgets[WIDX_BACKGROUND].bottom = w->height - 1; + + window_staff_options_widgets[WIDX_RESIZE].right = w->width - 1; + window_staff_options_widgets[WIDX_RESIZE].bottom = w->height - 1; + + window_staff_options_widgets[WIDX_TITLE].right = w->width - 2; + + window_staff_options_widgets[WIDX_CLOSE].left = w->width - 13; + window_staff_options_widgets[WIDX_CLOSE].right = w->width - 3; + + window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_3); +} + +/* rct2: 0x006BDD91 */ +void window_staff_overview_invalidate(){ + rct_window* w; + window_get_register(w); + + if (window_staff_page_widgets[w->page] != w->widgets){ + w->widgets = window_staff_page_widgets[w->page]; + window_init_scroll_widgets(w); + } + + w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1); + + rct_peep* peep = GET_PEEP(w->number); + + RCT2_GLOBAL(0x13CE952, uint16) = peep->name_string_idx; + RCT2_GLOBAL(0x13CE954, uint32) = peep->id; + + window_staff_overview_widgets[WIDX_BACKGROUND].right = w->width - 1; + window_staff_overview_widgets[WIDX_BACKGROUND].bottom = w->height - 1; + + window_staff_overview_widgets[WIDX_RESIZE].right = w->width - 1; + window_staff_overview_widgets[WIDX_RESIZE].bottom = w->height - 1; + + window_staff_overview_widgets[WIDX_TITLE].right = w->width - 2; + + window_staff_overview_widgets[WIDX_VIEWPORT].right = w->width - 26; + window_staff_overview_widgets[WIDX_VIEWPORT].bottom = w->height - 14; + + window_staff_overview_widgets[WIDX_BTM_LABEL].right = w->width - 26; + window_staff_overview_widgets[WIDX_BTM_LABEL].top = w->height - 13; + window_staff_overview_widgets[WIDX_BTM_LABEL].bottom = w->height - 3; + + window_staff_overview_widgets[WIDX_CLOSE].left = w->width - 13; + window_staff_overview_widgets[WIDX_CLOSE].right = w->width - 3; + + window_staff_overview_widgets[WIDX_PICKUP].left = w->width - 25; + window_staff_overview_widgets[WIDX_PICKUP].right = w->width - 2; + + window_staff_overview_widgets[WIDX_PATROL].left = w->width - 25; + window_staff_overview_widgets[WIDX_PATROL].right = w->width - 2; + + window_staff_overview_widgets[WIDX_RENAME].left = w->width - 25; + window_staff_overview_widgets[WIDX_RENAME].right = w->width - 2; + + window_staff_overview_widgets[WIDX_LOCATE].left = w->width - 25; + window_staff_overview_widgets[WIDX_LOCATE].right = w->width - 2; + + window_staff_overview_widgets[WIDX_FIRE].left = w->width - 25; + window_staff_overview_widgets[WIDX_FIRE].right = w->width - 2; + + window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_3); +} + +/* rct2: 0x6BDEAF */ +void window_staff_overview_paint(){ + rct_window *w; + rct_drawpixelinfo *dpi; + + window_paint_get_registers(w, dpi); + + window_draw_widgets(w, dpi); + window_staff_overview_tab_paint(w, dpi); + window_staff_options_tab_paint(w, dpi); + window_staff_stats_tab_paint(w, dpi); + + + // Draw the viewport no sound sprite + if (w->viewport){ + window_draw_viewport(dpi, w); + rct_viewport* viewport = w->viewport; + if (viewport->flags & VIEWPORT_FLAG_SOUND_ON){ + gfx_draw_sprite(dpi, SPR_HEARING_VIEWPORT, w->x + 2, w->y + 2, 0); + } + } + + // Draw the centered label + uint32 argument1, argument2; + rct_peep* peep = GET_PEEP(w->number); + get_arguments_from_action(peep, &argument1, &argument2); + RCT2_GLOBAL(0x13CE952, uint32) = argument1; + RCT2_GLOBAL(0x13CE952 + 4, uint32) = argument2; + rct_widget* widget = &w->widgets[WIDX_BTM_LABEL]; + int x = (widget->left + widget->right) / 2 + w->x; + int y = w->y + widget->top - 1; + int width = widget->right - widget->left; + gfx_draw_string_centred_clipped(dpi, 1191, (void*)0x13CE952, 0, x, y, width); +} + +/* rct2: 0x6BEC8F */ +void window_staff_options_tab_paint(rct_window* w, rct_drawpixelinfo* dpi){ + if (w->disabled_widgets & (1 << WIDX_TAB_2)) return; + + rct_widget* widget = &w->widgets[WIDX_TAB_2]; + int x = widget->left + w->x; + int y = widget->top + w->y; + + int image_id = SPR_TAB_STAFF_OPTIONS_0; + + if (w->page == WINDOW_STAFF_OPTIONS){ + image_id += (w->frame_no / 2) % 7; + } + + gfx_draw_sprite(dpi, image_id, x, y, 0); +} + +/* rct2: 0x6BECD3 */ +void window_staff_stats_tab_paint(rct_window* w, rct_drawpixelinfo* dpi){ + if (w->disabled_widgets & (1 << WIDX_TAB_3)) return; + + rct_widget* widget = &w->widgets[WIDX_TAB_3]; + int x = widget->left + w->x; + int y = widget->top + w->y; + + int image_id = SPR_TAB_STATS_0; + + if (w->page == WINDOW_STAFF_STATISTICS){ + image_id += (w->frame_no / 4) % 7; + } + + gfx_draw_sprite(dpi, image_id, x, y, 0); +} + +/** +* Based on rct2: 0x6983dd in window_guest to be remerged into one when peep file added. +*/ +void window_staff_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi){ + if (w->disabled_widgets & (1 << WIDX_TAB_1)) + return; + + rct_widget* widget = &w->widgets[WIDX_TAB_1]; + int width = widget->right - widget->left - 1; + int height = widget->bottom - widget->top - 1; + int x = widget->left + 1 + w->x; + int y = widget->top + 1 + w->y; + if (w->page == WINDOW_STAFF_OVERVIEW) height++; + + rct_drawpixelinfo* clip_dpi = clip_drawpixelinfo(dpi, x, width, y, height); + if (!clip_dpi) return; + + x = 14; + y = 20; + + rct_peep* peep = GET_PEEP(w->number); + + if (peep->type == PEEP_TYPE_STAFF && peep->staff_type == STAFF_TYPE_ENTERTAINER) + y++; + + int ebx = *(RCT2_ADDRESS(0x982708, uint32*)[peep->sprite_type * 2]) + 1; + + int eax = 0; + + if (w->page == WINDOW_STAFF_OVERVIEW){ + eax = w->var_494 >> 16; + eax &= 0xFFFC; + } + ebx += eax; + + int sprite_id = ebx | (peep->tshirt_colour << 19) | (peep->trousers_colour << 24) | 0xA0000000; + gfx_draw_sprite(clip_dpi, sprite_id, x, y, 0); + + // If holding a balloon + if (ebx >= 0x2A1D && ebx < 0x2A3D){ + ebx += 32; + ebx |= (peep->balloon_colour << 19) | 0x20000000; + gfx_draw_sprite(clip_dpi, ebx, x, y, 0); + } + + // If holding umbrella + if (ebx >= 0x2BBD && ebx < 0x2BDD){ + ebx += 32; + ebx |= (peep->umbrella_colour << 19) | 0x20000000; + gfx_draw_sprite(clip_dpi, ebx, x, y, 0); + } + + // If wearing hat + if (ebx >= 0x29DD && ebx < 0x29FD){ + ebx += 32; + ebx |= (peep->hat_colour << 19) | 0x20000000; + gfx_draw_sprite(clip_dpi, ebx, x, y, 0); + } +} + +/* rct2: 0x6BE7C6 */ +void window_staff_options_paint(){ + rct_window *w; + rct_drawpixelinfo *dpi; + + window_paint_get_registers(w, dpi); + + window_draw_widgets(w, dpi); + window_staff_overview_tab_paint(w, dpi); + window_staff_options_tab_paint(w, dpi); + window_staff_stats_tab_paint(w, dpi); +} + +/* rct2: 0x6BEA86 */ +void window_staff_stats_paint(){ + rct_window *w; + rct_drawpixelinfo *dpi; + + window_paint_get_registers(w, dpi); + + window_draw_widgets(w, dpi); + window_staff_overview_tab_paint(w, dpi); + window_staff_options_tab_paint(w, dpi); + window_staff_stats_tab_paint(w, dpi); + + rct_peep* peep = GET_PEEP(w->number); + + int x = w->x + window_staff_stats_widgets[WIDX_RESIZE].left + 4; + int y = w->y + window_staff_stats_widgets[WIDX_RESIZE].top + 4; + + if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)){ + + RCT2_GLOBAL(0x13CE952,uint32) = RCT2_ADDRESS(0x992A00,uint16)[peep->staff_type]; + gfx_draw_string_left(dpi, 2349, (void*)0x013CE952, 0,x, y); + + y += 10; + } + + gfx_draw_string_left(dpi, 2350, (void*)&peep->time_in_park, 0, x, y); + y += 10; + + switch (peep->staff_type){ + case STAFF_TYPE_HANDYMAN: + gfx_draw_string_left(dpi, 2351, (void*)&peep->paid_to_enter, 0, x, y); + y += 10; + gfx_draw_string_left(dpi, 2352, (void*)&peep->paid_on_rides, 0, x, y); + y += 10; + gfx_draw_string_left(dpi, 2353, (void*)&peep->paid_on_food, 0, x, y); + y += 10; + gfx_draw_string_left(dpi, 2354, (void*)&peep->paid_on_souvenirs, 0, x, y); + break; + case STAFF_TYPE_MECHANIC: + gfx_draw_string_left(dpi, 2356, (void*)&peep->paid_on_rides, 0, x, y); + y += 10; + gfx_draw_string_left(dpi, 2355, (void*)&peep->paid_to_enter, 0, x, y); + break; + } } \ No newline at end of file From 2774c63ebad732737d4fe87c5a470c336d76eada Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Sat, 11 Oct 2014 19:21:37 +0100 Subject: [PATCH 11/13] Added first draft of tool update and down --- src/game.h | 2 +- src/windows/guest.c | 23 --------- src/windows/staff.c | 111 +++++++++++++++++++++++++++++++++++++++++++- src/world/map.c | 23 +++++++++ src/world/map.h | 1 + 5 files changed, 134 insertions(+), 26 deletions(-) diff --git a/src/game.h b/src/game.h index 9b605fbe73..377160d5a1 100644 --- a/src/game.h +++ b/src/game.h @@ -52,7 +52,7 @@ enum GAME_COMMAND { GAME_COMMAND_27, GAME_COMMAND_28, GAME_COMMAND_HIRE_NEW_STAFF_MEMBER, // 29 - GAME_COMMAND_30, + GAME_COMMAND_SET_STAFF_PATROL, //30 GAME_COMMAND_FIRE_STAFF_MEMBER, // 31 GAME_COMMAND_SET_STAFF_ORDER, // 32 GAME_COMMAND_33, diff --git a/src/windows/guest.c b/src/windows/guest.c index e72a39a5d1..c13e473b68 100644 --- a/src/windows/guest.c +++ b/src/windows/guest.c @@ -1178,29 +1178,6 @@ void window_guest_overview_tool_update(){ RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, uint32) = ebx; } -/* rct2: 0x664F72 */ -int sub_664F72(int x, int y, int z){ - if (x > 0x1FFF || y > 0x1FFF){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0x6C1; - return 1; - } - - rct_map_element* map_element = map_get_surface_element_at(x / 32, y / 32); - if (map_element->properties.surface.ownership & 0x20) return 0; - if (!(map_element->properties.surface.ownership & 0x10)){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0x6C1; - return 1; - } - - z >>= 3; - if ((z & 0xFF) < map_element->base_height)return 0; - z = (z & 0xFF) - 2; - if (z > map_element->base_height)return 0; - - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0x6C1; - return 1; -} - /* rct2: 0x696A54 */ void window_guest_overview_tool_down(){ short widgetIndex; diff --git a/src/windows/staff.c b/src/windows/staff.c index 1179c8d447..c2c8285189 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -29,6 +29,7 @@ #include "../sprites.h" #include "../world/sprite.h" #include "dropdown.h" +#include "error.h" #define WW 190 #define WH 180 @@ -136,6 +137,8 @@ void window_staff_overview_update(rct_window* w); void window_staff_overview_invalidate(); void window_staff_overview_paint(); void window_staff_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi); +void window_staff_overview_tool_update(); +void window_staff_overview_tool_down(); void window_staff_options_mouseup(); void window_staff_options_update(rct_window* w); @@ -161,8 +164,8 @@ static void* window_staff_overview_events[] = { window_staff_overview_update, window_staff_emptysub, window_staff_emptysub, - (void*)0x6BDFD8, - (void*)0x6BDFC3, + window_staff_overview_tool_update, + window_staff_overview_tool_down, window_staff_emptysub, window_staff_emptysub, (void*)0x6BDFAE, @@ -1053,4 +1056,108 @@ void window_staff_stats_paint(){ gfx_draw_string_left(dpi, 2355, (void*)&peep->paid_to_enter, 0, x, y); break; } +} + +/* rct2: 0x006BDFD8 */ +void window_staff_overview_tool_update(){ + short widgetIndex; + rct_window* w; + short x, y; + + window_tool_get_registers(w, widgetIndex, x, y); + + if (widgetIndex != WIDX_PICKUP) return; + + RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, sint32) = -1; + + int ebx; + get_map_coordinates_from_pos(x, y, 0, NULL, NULL, &ebx, NULL); + if (ebx == 0) + return; + + x--; + y += 16; + RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_X, uint16) = x; + RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_Y, uint16) = y; + w->var_492++; + if (w->var_492 >= 48)w->var_492 = 0; + + rct_peep* peep; + peep = GET_PEEP(w->number); + int sprite_idx = (RCT2_ADDRESS(0x982708, uint32*)[peep->sprite_type * 2])[22]; + sprite_idx += w->var_492 >> 2; + + sprite_idx |= (peep->tshirt_colour << 19) | (peep->trousers_colour << 24) | 0xA0000000; + RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, uint32) = sprite_idx; +} + +/* rct2: 0x006BDFC3 */ +void window_staff_overview_tool_down(){ + short widgetIndex; + rct_window* w; + short x, y; + + window_tool_get_registers(w, widgetIndex, x, y); + + if (widgetIndex == WIDX_PICKUP){ + + int dest_x = x, dest_y = y, ecx = 0, edx = widgetIndex, edi = 0, esi = (int)w, ebp = 0; + dest_y += 16; + RCT2_CALLFUNC_X(0x689726, &dest_x, &dest_y, &ecx, &edx, &esi, &edi, &ebp); + + if (dest_x == 0x8000)return; + + // Set the coordinate of destination to be exactly + // in the middle of a tile. + dest_x += 16; + dest_y += 16; + // Set the tile coordinate to top left of tile + int tile_y = dest_y & 0xFFE0; + int tile_x = dest_x & 0xFFE0; + + int dest_z = ((uint8*)edx)[2] * 8 + 16; + + if (sub_664F72(tile_x, tile_y, dest_z)){ + window_error_open(0x785, -1); + return; + } + + int _edx = dest_z >> 3; + _edx &= 0xFFFF00FF; + _edx |= dest_z << 8; + _edx += 0x100; + int flags = RCT2_CALLPROC_X(0x68B93A, tile_x, 0xF, tile_y, _edx, (int)w, 0, 0); + + if (flags & 0x100){ + if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) != 0x3A5){ + if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) != 0x49B){ + window_error_open(0x785, -1); + return; + } + } + } + + rct_peep* peep = GET_PEEP(w->number); + RCT2_CALLPROC_X(0x0069E9D3, dest_x, 0, dest_y, dest_z, (int)peep, 0, 0); + RCT2_CALLPROC_X(0x006EC473, 0, 0, 0, 0, (int)peep, 0, 0); + RCT2_CALLPROC_X(0x0069A409, 0, 0, 0, 0, (int)peep, 0, 0); + peep->state = 0; + RCT2_CALLPROC_X(0x0069A42F, 0, 0, 0, 0, (int)peep, 0, 0); + peep->var_71 = 0xFF; + peep->var_6D = 0; + peep->var_70 = 0; + peep->var_6E = 0xFF; + peep->var_C4 = 0; + + tool_cancel(); + RCT2_GLOBAL(0x9DE550, sint32) = -1; + } + else if (widgetIndex == WIDX_PATROL){ + int dest_x = x, dest_y = y, ecx = 0, edx = widgetIndex, edi = 0, esi = (int)w, ebp = 0; + RCT2_CALLFUNC_X(0x689726, &dest_x, &dest_y, &ecx, &edx, &esi, &edi, &ebp); + + if (dest_x == 0x8000)return; + + game_do_command(dest_x, 1, dest_y, w->number, GAME_COMMAND_SET_STAFF_PATROL, 0, 0); + } } \ No newline at end of file diff --git a/src/world/map.c b/src/world/map.c index bcee0c309b..b889a96bd5 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -432,4 +432,27 @@ void sub_6A876D() static void sub_6A87BB(int x, int y) { RCT2_CALLPROC_X(0x006A87BB, x, 0, y, 0, 0, 0, 0); +} + +/* rct2: 0x664F72 */ +int sub_664F72(int x, int y, int z){ + if (x > 0x1FFF || y > 0x1FFF){ + RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0x6C1; + return 1; + } + + rct_map_element* map_element = map_get_surface_element_at(x / 32, y / 32); + if (map_element->properties.surface.ownership & 0x20) return 0; + if (!(map_element->properties.surface.ownership & 0x10)){ + RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0x6C1; + return 1; + } + + z >>= 3; + if ((z & 0xFF) < map_element->base_height)return 0; + z = (z & 0xFF) - 2; + if (z > map_element->base_height)return 0; + + RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0x6C1; + return 1; } \ No newline at end of file diff --git a/src/world/map.h b/src/world/map.h index 416fb22ca1..2d7aca221a 100644 --- a/src/world/map.h +++ b/src/world/map.h @@ -205,6 +205,7 @@ void sub_68B089(); int map_coord_is_connected(uint16 coordinate, uint8 height, uint8 face_direction); void map_invalidate_animations(); void sub_6A876D(); +int sub_664F72(int x, int y, int z); void fountain_update_all(); From bab896ad1e327a32c82ff687488836e64ed9cd4c Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Sun, 12 Oct 2014 11:34:08 +0100 Subject: [PATCH 12/13] Finished staff window. --- src/game.h | 2 +- src/localisation/string_ids.h | 3 + src/windows/staff.c | 245 ++++++++++++++++++++++++++++++++-- src/world/scenery.h | 2 + 4 files changed, 237 insertions(+), 15 deletions(-) diff --git a/src/game.h b/src/game.h index 377160d5a1..7712625cb4 100644 --- a/src/game.h +++ b/src/game.h @@ -44,7 +44,7 @@ enum GAME_COMMAND { GAME_COMMAND_REMOVE_PATH, // 19 GAME_COMMAND_20, GAME_COMMAND_21, - GAME_COMMAND_22, + GAME_COMMAND_22, //To do with text input GAME_COMMAND_23, GAME_COMMAND_24, GAME_COMMAND_25, diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index ef10b238f5..28237bc2b9 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -1172,6 +1172,9 @@ enum { STR_PAGE_4 = STR_PAGE_1 + 3, STR_PAGE_5 = STR_PAGE_1 + 4, + STR_SET_PATROL_AREA = 3445, + STR_CLEAR_PATROL_AREA = 3446, + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768 }; diff --git a/src/windows/staff.c b/src/windows/staff.c index c2c8285189..f00a14bf38 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -28,6 +28,7 @@ #include "../peep/staff.h" #include "../sprites.h" #include "../world/sprite.h" +#include "../world/scenery.h" #include "dropdown.h" #include "error.h" @@ -127,6 +128,7 @@ rct_widget *window_staff_page_widgets[] = { void window_staff_set_page(rct_window* w, int page); void window_staff_disable_widgets(rct_window* w); void window_staff_unknown_05(); +void window_staff_viewport_init(rct_window* w); void window_staff_overview_close(); void window_staff_overview_mouseup(); @@ -139,12 +141,17 @@ void window_staff_overview_paint(); void window_staff_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi); void window_staff_overview_tool_update(); void window_staff_overview_tool_down(); +void window_staff_overview_tool_abort(); +void window_staff_overview_text_input(); +void window_staff_overview_viewport_init_wrapper(); void window_staff_options_mouseup(); void window_staff_options_update(rct_window* w); void window_staff_options_invalidate(); void window_staff_options_paint(); void window_staff_options_tab_paint(rct_window* w, rct_drawpixelinfo* dpi); +void window_staff_options_mousedown(int widgetIndex, rct_window* w, rct_widget* widget); +void window_staff_options_dropdown(); void window_staff_stats_mouseup(); void window_staff_stats_resize(); @@ -168,14 +175,14 @@ static void* window_staff_overview_events[] = { window_staff_overview_tool_down, window_staff_emptysub, window_staff_emptysub, - (void*)0x6BDFAE, + window_staff_overview_tool_abort, window_staff_emptysub, window_staff_emptysub, window_staff_emptysub, window_staff_emptysub, window_staff_emptysub, - (void*)0x6BDFED, - (void*)0x6BE5FC, + window_staff_overview_text_input, + window_staff_overview_viewport_init_wrapper, window_staff_emptysub, window_staff_emptysub, window_staff_emptysub, @@ -190,7 +197,7 @@ static void* window_staff_options_events[] = { window_staff_emptysub, window_staff_options_mouseup, window_staff_stats_resize, - (void*)0x6BE802, + window_staff_options_mousedown, (void*)0x6BE809, window_staff_unknown_05, window_staff_options_update, @@ -324,7 +331,7 @@ void window_staff_open(rct_peep* peep) w->pressed_widgets = 0; window_staff_disable_widgets(w); window_init_scroll_widgets(w); - RCT2_CALLPROC_X(0x006BEDA3, 0, 0, 0, 0, (int)w, 0, 0); + window_staff_viewport_init(w); if (g_sprite_list[w->number].peep.state == PEEP_STATE_PICKED) { RCT2_CALLPROC_X(w->event_handlers[WE_MOUSE_UP], 0, 0, 0, 10, (int)w, 0, 0); } @@ -515,7 +522,7 @@ void window_staff_overview_resize() } } - RCT2_CALLPROC_X(0x006BEDA3, 0, 0, 0, 0, (int)w, 0, 0); + window_staff_viewport_init(w); } /** @@ -529,11 +536,11 @@ void window_staff_overview_mousedown(int widgetIndex, rct_window* w, rct_widget* } // Dropdown names - gDropdownItemsFormat[0] = 3446; - gDropdownItemsFormat[1] = 3447; + gDropdownItemsFormat[0] = STR_SET_PATROL_AREA; + gDropdownItemsFormat[1] = STR_CLEAR_PATROL_AREA; int x = widget->left + w->x; - int y = widget->top + w->y;; + int y = widget->top + w->y; int extray = widget->bottom - widget->top + 1; window_dropdown_show_text(x, y, extray, w->colours[1], 0, 2); RCT2_GLOBAL(0x009DEBA2, sint16) = 0; @@ -1070,9 +1077,9 @@ void window_staff_overview_tool_update(){ RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, sint32) = -1; - int ebx; - get_map_coordinates_from_pos(x, y, 0, NULL, NULL, &ebx, NULL); - if (ebx == 0) + int z; + get_map_coordinates_from_pos(x, y, 0, NULL, NULL, &z, NULL); + if (z == 0) return; x--; @@ -1124,7 +1131,7 @@ void window_staff_overview_tool_down(){ int _edx = dest_z >> 3; _edx &= 0xFFFF00FF; - _edx |= dest_z << 8; + _edx |= (_edx & 0xFF) << 8; _edx += 0x100; int flags = RCT2_CALLPROC_X(0x68B93A, tile_x, 0xF, tile_y, _edx, (int)w, 0, 0); @@ -1146,7 +1153,7 @@ void window_staff_overview_tool_down(){ peep->var_71 = 0xFF; peep->var_6D = 0; peep->var_70 = 0; - peep->var_6E = 0xFF; + peep->var_6E = 0; peep->var_C4 = 0; tool_cancel(); @@ -1160,4 +1167,214 @@ void window_staff_overview_tool_down(){ game_do_command(dest_x, 1, dest_y, w->number, GAME_COMMAND_SET_STAFF_PATROL, 0, 0); } +} + +/* rct2: 0x6BDFAE */ +void window_staff_overview_tool_abort(){ + short widgetIndex; + rct_window* w; + short x, y; + + window_tool_get_registers(w, widgetIndex, x, y); + if (widgetIndex == WIDX_PICKUP){ + + rct_peep* peep = GET_PEEP(w->number); + if (peep->state != PEEP_STATE_PICKED) return; + + RCT2_CALLPROC_X(0x0069E9D3, w->var_48C, 0, peep->y, peep->z + 8, (int)peep, 0, 0); + RCT2_CALLPROC_X(0x006EC473, 0, 0, 0, 0, (int)peep, 0, 0); + + if (peep->x != 0x8000){ + RCT2_CALLPROC_X(0x0069A409, 0, 0, 0, 0, (int)peep, 0, 0); + peep->state = 0; + RCT2_CALLPROC_X(0x0069A42F, 0, 0, 0, 0, (int)peep, 0, 0); + peep->var_71 = 0xFF; + peep->var_6D = 0; + peep->var_70 = 0; + peep->var_6E = 0; + peep->var_C4 = 0; + } + + RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, sint32) = -1; + } + else if (widgetIndex == WIDX_PATROL){ + hide_gridlines(); + RCT2_GLOBAL(0x009DEA50, sint16) = -1; + gfx_invalidate_screen(); + } +} + +/* rct2:0x6BDFED */ +void window_staff_overview_text_input(){ + short widgetIndex; + rct_window *w; + char _cl; + uint32* text; + + window_text_input_get_registers(w, widgetIndex, _cl, text); + + if (widgetIndex != WIDX_RENAME)return; + + if (!_cl) return; + + RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID, uint16) = 2979; + + game_do_command(1, 1, w->number, *text, GAME_COMMAND_22, *(text + 2), *(text + 1)); + game_do_command(2, 1, 0, *(text + 3), GAME_COMMAND_22, *(text + 5), *(text + 4)); + game_do_command(0, 1, 0, *(text + 6), GAME_COMMAND_22, *(text + 8), *(text + 7)); +} + +/* rct2: 0x006BE5FC */ +void window_staff_overview_viewport_init_wrapper(){ + rct_window* w; + window_get_register(w); + + window_staff_viewport_init(w); +} + +/* rct2: 0x006BEDA3 */ +void window_staff_viewport_init(rct_window* w){ + RCT2_CALLPROC_X(0x006BEDA3, 0, 0, 0, 0, (int)w, 0, 0); + + if (w->page != WINDOW_STAFF_OVERVIEW) return; + + sprite_focus focus; + + focus.sprite_id = w->number; + + rct_peep* peep = GET_PEEP(w->number); + + if (peep->state == PEEP_STATE_PICKED){ + focus.sprite_id = -1; + } + else{ + focus.type |= VIEWPORT_FOCUS_TYPE_SPRITE | VIEWPORT_FOCUS_TYPE_COORDINATE; + focus.rotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8); + } + + uint16 viewport_flags; + + if (w->viewport){ + //Check all combos, for now skipping y and rot + if (focus.sprite_id == w->viewport_focus_sprite.sprite_id && + focus.type == w->viewport_focus_sprite.type && + focus.rotation == w->viewport_focus_sprite.rotation) + return; + + viewport_flags = w->viewport->flags; + w->viewport->width = 0; + w->viewport = 0; + + viewport_update_pointers(); + } + else{ + viewport_flags = 0; + if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & 0x1) + viewport_flags |= VIEWPORT_FLAG_GRIDLINES; + } + + RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); + + w->viewport_focus_sprite.sprite_id = focus.sprite_id; + w->viewport_focus_sprite.type = focus.type; + w->viewport_focus_sprite.rotation = focus.rotation; + + if (peep->state != PEEP_STATE_PICKED){ + if (!(w->viewport)){ + rct_widget* view_widget = &w->widgets[WIDX_VIEWPORT]; + + int x = view_widget->left + 1 + w->x; + int y = view_widget->top + 1 + w->y; + int width = view_widget->right - view_widget->left - 1; + int height = view_widget->bottom - view_widget->top - 1; + + viewport_create(w, x, y, width, height, 0, 0, 0, 0, focus.type & VIEWPORT_FOCUS_TYPE_MASK, focus.sprite_id); + w->flags |= WF_2; + window_invalidate(w); + } + } + + if (w->viewport) + w->viewport->flags = viewport_flags; + window_invalidate(w); +} + +/** +* Handle the costume of staff member. +* rct2: 0x006BE802 +*/ +void window_staff_options_mousedown(int widgetIndex, rct_window* w, rct_widget* widget) +{ + if (widgetIndex != WIDX_COSTUME_BTN) { + return; + } + + init_scenery(); + + int ebx = 0; + for (int i = 0; i < 19;++i){ + sint16* ebp = RCT2_ADDRESS(0xF64F2C, sint16*)[i]; + if (*ebp != -1){ + rct_scenery_set_entry* scenery_entry = g_scenerySetEntries[i]; + ebx |= scenery_entry->var_10A; + } + } + + uint8* ebp = RCT2_ADDRESS(0xF4391B, uint8); + uint16 no_entries = 0; + for (uint8 i = 0; i < 32; ++i){ + if (ebx & (1 << i)){ + *ebp++ = i; + no_entries++; + } + } + // Save number of entrys. Not required any more. + RCT2_GLOBAL(0xF43926, uint16) = no_entries; + + rct_peep* peep = GET_PEEP(w->number); + int item_checked = 0; + //This will be moved below where Items Checked is when all + //of dropdown related functions are finished. This prevents + //the dropdown from not working on first click. + for (int i = 0; i < no_entries; ++i){ + int eax = RCT2_ADDRESS(0xF4391B, uint8)[i]; + if (eax == peep->sprite_type){ + item_checked = 1 << i; + } + gDropdownItemsArgs[i] = eax + 1775; + gDropdownItemsFormat[i] = 1142; + } + + //Get the dropdown box widget instead of button. + widget--; + + int x = widget->left + w->x; + int y = widget->top + w->y; + int extray = widget->bottom - widget->top + 1; + int width = widget->right - widget->left - 3; + window_dropdown_show_text_custom_width(x, y, extray, w->colours[1], 0x80, no_entries, width); + + // See above note. + gDropdownItemsChecked = item_checked; +} + +/** rct2: 0x6BE809 */ +void window_staff_options_dropdown() +{ + short widgetIndex, dropdownIndex; + rct_window* w; + + window_dropdown_get_registers(w, widgetIndex, dropdownIndex); + + if (widgetIndex != WIDX_COSTUME_BTN) { + return; + } + + if (dropdownIndex == -1)return; + + rct_peep* peep = GET_PEEP(w->number); + + int costume = (RCT2_ADDRESS(0xF4391B, uint8)[dropdownIndex] - 4) | 0x80; + + game_do_command(peep->x, (costume << 8) | 1, peep->y, w->number, GAME_COMMAND_SET_STAFF_ORDER, (int)peep, 0); } \ No newline at end of file diff --git a/src/world/scenery.h b/src/world/scenery.h index c4294038aa..44f7f27081 100644 --- a/src/world/scenery.h +++ b/src/world/scenery.h @@ -117,6 +117,8 @@ typedef struct { uint8 entry_count; // 0x106 uint8 pad_107; uint8 var_108; // 0x108, order? + uint8 pad_109; + uint32 var_10A; } rct_scenery_set_entry; #define g_smallSceneryEntries RCT2_ADDRESS(RCT2_ADDRESS_SMALL_SCENERY_ENTRIES, rct_scenery_entry*) From 18db536f875b1402770aadd38876c14980d8ad01 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Sun, 12 Oct 2014 15:04:37 +0100 Subject: [PATCH 13/13] Less magic numbers --- src/localisation/string_ids.h | 15 +++++++++--- src/sprites.h | 2 ++ src/windows/staff.c | 46 +++++++++++++++++------------------ 3 files changed, 37 insertions(+), 26 deletions(-) diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index 28237bc2b9..cd288cf13e 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -174,7 +174,8 @@ enum { STR_RIDES_IN_PARK_TIP = 1053, STR_NAME_RIDE_TIP = 1054, - + STR_NAME_GUEST_TIP = 1055, + STR_NAME_STAFF_TIP = 1056, STR_RIDE_ATTRACTION_NAME = 1057, STR_ENTER_NEW_NAME_FOR_THIS_RIDE_ATTRACTION = 1058, STR_CANT_RENAME_RIDE_ATTRACTION = 1059, @@ -436,9 +437,10 @@ enum { STR_HIRE_SECURITY_GUARD = 1702, STR_HIRE_ENTERTAINER = 1703, STR_CANT_HIRE_NEW_STAFF = 1704, - + STR_FIRE_STAFF_TIP = 1705, + STR_PICKUP_TIP = 1706, STR_TOO_MANY_STAFF_IN_GAME = 1707, - + STR_SET_PATROL_TIP = 1708, STR_SACK_STAFF = 1709, STR_YES = 1710, STR_FIRE_STAFF_ID = 1711, @@ -615,6 +617,10 @@ enum { STR_SHOW_SUBJECT_TIP = 1937, + STR_STAFF_OVERVIEW_TIP = 1939, + + STR_STAFF_OPTIONS_TIP = 1945, + STR_SELECT_COSTUME_TIP = 1946, STR_SHOW_PATROL_AREA_TIP = 1947, STR_HIRE_STAFF_TIP = 1948, STR_FINANCIAL_SUMMARY = 1949, @@ -760,6 +766,9 @@ enum { STR_IMPERIAL = 2344, STR_METRIC = 2345, STR_DISPLAY = 2346, + + STR_STAFF_STATS_TIP = 2348, + //STR_UNITS = 2358, STR_REAL_VALUES = 2359, STR_DISPLAY_RESOLUTION = 2360, diff --git a/src/sprites.h b/src/sprites.h index 0ab9a63981..9e0f5d3ae9 100644 --- a/src/sprites.h +++ b/src/sprites.h @@ -51,6 +51,8 @@ enum { SPR_RENAME = 5168, SPR_ROTATE_ARROW = 5169, + SPR_PICKUP_BTN = 5174, + SPR_PATROL_BTN = 5175, SPR_BUY_LAND_RIGHTS = 5176, SPR_BUY_CONSTRUCTION_RIGHTS = 5177, SPR_NO_ENTRY = 5178, diff --git a/src/windows/staff.c b/src/windows/staff.c index f00a14bf38..05b529cb01 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -73,17 +73,17 @@ rct_widget window_staff_overview_widgets[] = { { WWT_CAPTION, 0, 1, WW - 2, 1, 14, 0x361, STR_WINDOW_TITLE_TIP }, // Title { WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // Close x button { WWT_RESIZE, 1, 0, WW - 1, 43, WH - 1, 0x0FFFFFFFF, STR_NONE }, // Resize - { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1939 }, // Tab 1 - { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1945}, // Tab 2 - { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2348}, // Tab 3 + { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, STR_STAFF_OVERVIEW_TIP },// Tab 1 + { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, STR_STAFF_OPTIONS_TIP}, // Tab 2 + { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, STR_STAFF_STATS_TIP}, // Tab 3 { WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, STR_NONE}, // Tab 4 { WWT_VIEWPORT, 1, 3, WW - 26, 47, WH - 14,0x0FFFFFFFF, STR_NONE}, // Viewport { WWT_12, 1, 3, WW - 26, WH - 13, WH - 3, 0x0FFFFFFFF, STR_NONE }, // Label at bottom of viewport - { WWT_FLATBTN, 1, WW - 25, WW - 2, 45, 68, 0x1436, 1706}, // Pickup Button - { WWT_FLATBTN, 1, WW - 25, WW - 2, 69, 92, 0x1437, 1708}, // Patrol Button - { WWT_FLATBTN, 1, WW - 25, WW - 2, 93, 116, 0x1430, 1056}, // Rename Button - { WWT_FLATBTN, 1, WW - 25, WW - 2, 117, 140, 0x142F, 1027}, // Locate Button - { WWT_FLATBTN, 1, WW - 25, WW - 2, 141, 164, 0x142D, 1705}, // Fire Button + { WWT_FLATBTN, 1, WW - 25, WW - 2, 45, 68, SPR_PICKUP_BTN, STR_PICKUP_TIP}, // Pickup Button + { WWT_FLATBTN, 1, WW - 25, WW - 2, 69, 92, SPR_PATROL_BTN, STR_SET_PATROL_TIP}, // Patrol Button + { WWT_FLATBTN, 1, WW - 25, WW - 2, 93, 116, SPR_RENAME, STR_NAME_STAFF_TIP}, // Rename Button + { WWT_FLATBTN, 1, WW - 25, WW - 2, 117, 140, SPR_LOCATE, STR_LOCATE_SUBJECT_TIP},// Locate Button + { WWT_FLATBTN, 1, WW - 25, WW - 2, 141, 164, SPR_DEMOLISH, STR_FIRE_STAFF_TIP}, // Fire Button { WIDGETS_END }, }; @@ -93,16 +93,16 @@ rct_widget window_staff_options_widgets[] = { { WWT_CAPTION, 0, 1, WW - 2, 1, 14, 0x361, STR_WINDOW_TITLE_TIP }, // Title { WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // Close x button { WWT_RESIZE, 1, 0, WW - 1, 43, WH - 1, 0x0FFFFFFFF, STR_NONE }, // Resize - { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1939 }, // Tab 1 - { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1945}, // Tab 2 - { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2348}, // Tab 3 + { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, STR_STAFF_OVERVIEW_TIP },// Tab 1 + { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, STR_STAFF_OPTIONS_TIP}, // Tab 2 + { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, STR_STAFF_STATS_TIP}, // Tab 3 { WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, STR_NONE}, // Tab 4 { WWT_CHECKBOX, 1, 5, WW - 6, 50, 61, 0x0FFFFFFFF, STR_NONE}, // Checkbox 1 { WWT_CHECKBOX, 1, 5, WW - 6, 67, 78, 0x0FFFFFFFF, STR_NONE }, // Checkbox 2 { WWT_CHECKBOX, 1, 5, WW - 6, 84, 95, 0x0FFFFFFFF, STR_NONE}, // Checkbox 3 { WWT_CHECKBOX, 1, 5, WW - 6, 101, 112, 0x0FFFFFFFF, STR_NONE}, // Checkbox 4 { WWT_DROPDOWN, 1, 5, WW - 6, 50, 61, 0x0FFFFFFFF, STR_NONE}, // Costume Dropdown - { WWT_DROPDOWN_BUTTON, 1, WW - 17, WW - 7, 51, 60, 876, 1946}, // Costume Dropdown Button + { WWT_DROPDOWN_BUTTON, 1, WW - 17, WW - 7, 51, 60, 876, STR_SELECT_COSTUME_TIP},// Costume Dropdown Button { WIDGETS_END }, }; @@ -112,9 +112,9 @@ rct_widget window_staff_stats_widgets[] = { { WWT_CAPTION, 0, 1, WW - 2, 1, 14, 0x361, STR_WINDOW_TITLE_TIP }, // Title { WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // Close x button { WWT_RESIZE, 1, 0, WW - 1, 43, WH - 1, 0x0FFFFFFFF, STR_NONE }, // Resize - { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1939 }, // Tab 1 - { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1945}, // Tab 2 - { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2348}, // Tab 3 + { WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, STR_STAFF_OVERVIEW_TIP },// Tab 1 + { WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, STR_STAFF_OPTIONS_TIP}, // Tab 2 + { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, STR_STAFF_STATS_TIP}, // Tab 3 { WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, STR_NONE}, // Tab 4 { WIDGETS_END }, }; @@ -198,7 +198,7 @@ static void* window_staff_options_events[] = { window_staff_options_mouseup, window_staff_stats_resize, window_staff_options_mousedown, - (void*)0x6BE809, + window_staff_options_dropdown, window_staff_unknown_05, window_staff_options_update, window_staff_emptysub, @@ -297,7 +297,7 @@ void window_staff_open(rct_peep* peep) { 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_overview_events, WC_PEEP, (uint16)0x400); + w = window_create_auto_pos(WW, WH, (uint32*)window_staff_overview_events, WC_PEEP, (uint16)0x400); w->widgets = RCT2_GLOBAL(0x9AF81C, rct_widget*); w->enabled_widgets = RCT2_GLOBAL(0x9929B0, uint32); @@ -310,8 +310,8 @@ void window_staff_open(rct_peep* peep) window_staff_disable_widgets(w); - w->min_width = 190; - w->min_height = 180; + w->min_width = WW; + w->min_height = WH; w->max_width = 500; w->max_height = 450; @@ -469,7 +469,7 @@ void window_staff_overview_mouseup() window_staff_fire_prompt_open(peep); break; case WIDX_RENAME: - window_show_textinput(w, (int)widgetIndex, 0xBA1, 0xBA2, peep->name_string_idx); + window_show_textinput(w, (int)widgetIndex, 2977, 2978, peep->name_string_idx); break; } } @@ -482,9 +482,9 @@ void window_staff_overview_resize() window_staff_disable_widgets(w); - w->min_width = 190; + w->min_width = WW; w->max_width = 500; - w->min_height = 180; + w->min_height = WH; w->max_height = 450; if (w->width < w->min_width) { @@ -703,7 +703,7 @@ void window_staff_stats_resize() void window_staff_stats_update(rct_window* w) { w->frame_no++; - window_invalidate_by_id(0x697, w->number); + widget_invalidate(WC_PEEP, w->number, WIDX_TAB_3); rct_peep* peep = GET_PEEP(w->number); if (peep->var_45 & 0x10) {