diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj
index f16f2b5e5d..871bc08f08 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 67184363c4..1ec8c58c25 100644
--- a/projects/openrct2.vcxproj.filters
+++ b/projects/openrct2.vcxproj.filters
@@ -418,6 +418,9 @@
Source\World
+
+ Source\Windows
+
Source\Windows
diff --git a/src/game.h b/src/game.h
index 86c74c3581..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,
@@ -52,9 +52,9 @@ enum GAME_COMMAND {
GAME_COMMAND_27,
GAME_COMMAND_28,
GAME_COMMAND_HIRE_NEW_STAFF_MEMBER, // 29
- GAME_COMMAND_30,
- GAME_COMMAND_31,
- GAME_COMMAND_SET_STAFF_ORDER,
+ GAME_COMMAND_SET_STAFF_PATROL, //30
+ 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 ed58a6d0c3..bf86247508 100644
--- a/src/interface/window.h
+++ b/src/interface/window.h
@@ -481,6 +481,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_prompt_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..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,8 +437,13 @@ 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,
STR_CANT_RENAME_PARK = 1717,
STR_PARK_NAME = 1718,
@@ -611,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,
@@ -756,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,
@@ -1168,6 +1181,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/peep/peep.h b/src/peep/peep.h
index 8642a154ff..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
@@ -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/sprites.h b/src/sprites.h
index 78116c46d0..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,
@@ -122,6 +124,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/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 48f06650cd..05b529cb01 100644
--- a/src/windows/staff.c
+++ b/src/windows/staff.c
@@ -28,7 +28,12 @@
#include "../peep/staff.h"
#include "../sprites.h"
#include "../world/sprite.h"
+#include "../world/scenery.h"
#include "dropdown.h"
+#include "error.h"
+
+#define WW 190
+#define WH 180
enum WINDOW_STAFF_PAGE {
WINDOW_STAFF_OVERVIEW,
@@ -53,43 +58,77 @@ 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(){};
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_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, 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, 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 },
+};
+
+//0x9AF910
+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, 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, STR_SELECT_COSTUME_TIP},// Costume Dropdown Button
+ { WIDGETS_END },
+};
+
+//0x9AF9F4
+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, 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 },
};
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);
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();
@@ -97,13 +136,29 @@ 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_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_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_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();
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[] = {
@@ -116,36 +171,36 @@ 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,
+ 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,
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,
- (void*)0x6BE9DA,
- window_staff_orders_update,
+ window_staff_options_mousedown,
+ window_staff_options_dropdown,
+ window_staff_unknown_05,
+ window_staff_options_update,
window_staff_emptysub,
window_staff_emptysub,
window_staff_emptysub,
@@ -164,8 +219,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
};
@@ -176,7 +231,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,
@@ -196,14 +251,14 @@ static void* window_staff_stats_events[] = {
window_staff_emptysub,
window_staff_emptysub,
window_staff_emptysub,
- (void*)0x6BE9E9, //Invalidate
- (void*)0x6BEA86, //Paint
+ window_staff_stats_invalidate, //Invalidate
+ 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
};
@@ -226,7 +281,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) |
@@ -242,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);
@@ -255,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;
@@ -276,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);
}
@@ -289,47 +344,25 @@ 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 = (1 << WIDX_TAB_4);
- int eax = 0 | 0x80;
-
- if (peep->staff_type == 2) {
- eax |= 0x20;
+ if (peep->staff_type == STAFF_TYPE_SECURITY){
+ disabled_widgets |= (1 << WIDX_TAB_2);
}
- //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) {
- 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 = eax;
+ w->disabled_widgets = disabled_widgets;
}
/**
@@ -349,33 +382,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
@@ -441,11 +447,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;
}
@@ -460,12 +465,11 @@ 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
- window_staff_fire(w);
+ case WIDX_FIRE:
+ window_staff_fire_prompt_open(peep);
break;
- case WIDX_RENAME: // 0xC
- // 6BE4BC
- window_show_textinput(w, (int)widgetIndex, 0xBA1, 0xBA2, peep->name_string_idx);
+ case WIDX_RENAME:
+ window_show_textinput(w, (int)widgetIndex, 2977, 2978, peep->name_string_idx);
break;
}
}
@@ -478,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) {
@@ -518,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);
}
/**
@@ -532,11 +536,11 @@ void window_staff_overview_mousedown(int widgetIndex, rct_window* w, rct_widget*
}
// Dropdown names
- gDropdownItemsFormat[0] = 0xD75;
- gDropdownItemsFormat[1] = 0xD76;
+ 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;
@@ -598,24 +602,22 @@ 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);
}
/** rct2: 0x006BE7DB */
-void window_staff_orders_mouseup()
+void window_staff_options_mouseup()
{
short widgetIndex;
rct_window* w;
@@ -640,10 +642,10 @@ 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++;
- window_invalidate_by_id(0x597, w->number);
+ widget_invalidate(WC_PEEP, w->number, WIDX_TAB_2);
}
/** rct2: 0x006BEBCF */
@@ -701,11 +703,678 @@ 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) {
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);
+}
+
+/* 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);
+}
+
+
+/* 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;
+ }
+}
+
+/* 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 z;
+ get_map_coordinates_from_pos(x, y, 0, NULL, NULL, &z, NULL);
+ if (z == 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 |= (_edx & 0xFF) << 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 = 0;
+ 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);
+ }
+}
+
+/* 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/windows/staff_fire_prompt.c b/src/windows/staff_fire_prompt.c
new file mode 100644
index 0000000000..0132942ad5
--- /dev/null
+++ b/src/windows/staff_fire_prompt.c
@@ -0,0 +1,155 @@
+/*****************************************************************************
+* 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 "../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
+
+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_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 - 20, 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_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;
+ }
+
+ // 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_staff_fire_mouseup(){
+ short widgetIndex;
+ rct_window *w;
+
+ window_widget_get_registers(w, widgetIndex);
+
+ rct_peep* peep = &g_sprite_list[w->number].peep;
+
+ switch (widgetIndex){
+ case WIDX_YES:
+ game_do_command(peep->x, 1, peep->y, w->number, GAME_COMMAND_FIRE_STAFF_MEMBER, 0, 0);
+ break;
+ case WIDX_CANCEL:
+ case WIDX_CLOSE:
+ window_close(w);
+ }
+}
+
+/**
+*
+* rct2: 0x006C0AF2
+*/
+static void window_staff_fire_paint(){
+ rct_window *w;
+ rct_drawpixelinfo *dpi;
+
+ window_paint_get_registers(w, dpi);
+
+ window_draw_widgets(w, dpi);
+
+ 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, WW - 4, STR_FIRE_STAFF_ID, 0);
+}
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();
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*)