2014-10-07 20:39:52 +02:00
|
|
|
/*****************************************************************************
|
2020-07-21 15:04:34 +02:00
|
|
|
* Copyright (c) 2014-2020 OpenRCT2 developers
|
2016-05-04 19:24:41 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
2016-05-04 19:24:41 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2016-05-04 19:24:41 +02:00
|
|
|
*****************************************************************************/
|
2014-05-08 22:48:31 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
#include "../interface/Theme.h"
|
2017-10-06 23:21:00 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2-ui/interface/Dropdown.h>
|
2018-01-03 00:13:37 +01:00
|
|
|
#include <openrct2-ui/interface/Viewport.h>
|
|
|
|
#include <openrct2-ui/interface/Widget.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2-ui/windows/Window.h>
|
|
|
|
#include <openrct2/Context.h>
|
|
|
|
#include <openrct2/Game.h>
|
|
|
|
#include <openrct2/Input.h>
|
2019-06-09 17:54:12 +02:00
|
|
|
#include <openrct2/actions/PeepPickupAction.hpp>
|
2019-02-05 08:36:39 +01:00
|
|
|
#include <openrct2/actions/StaffSetCostumeAction.hpp>
|
|
|
|
#include <openrct2/actions/StaffSetOrdersAction.hpp>
|
2019-03-16 21:45:52 +01:00
|
|
|
#include <openrct2/actions/StaffSetPatrolAreaAction.hpp>
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2/config/Config.h>
|
2018-01-06 18:32:25 +01:00
|
|
|
#include <openrct2/localisation/Localisation.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2/management/Finance.h>
|
2018-09-13 09:25:12 +02:00
|
|
|
#include <openrct2/network/network.h>
|
2017-10-13 10:06:36 +02:00
|
|
|
#include <openrct2/peep/Staff.h>
|
2017-10-06 23:21:00 +02:00
|
|
|
#include <openrct2/sprites.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2/windows/Intent.h>
|
2018-01-11 10:59:26 +01:00
|
|
|
#include <openrct2/world/Footpath.h>
|
2018-03-19 23:28:40 +01:00
|
|
|
#include <openrct2/world/Park.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2/world/Sprite.h>
|
2014-05-08 22:48:31 +02:00
|
|
|
|
2020-05-05 22:26:14 +02:00
|
|
|
static constexpr const rct_string_id WINDOW_TITLE = STR_STRINGID;
|
2020-05-09 17:05:01 +02:00
|
|
|
static constexpr const int32_t WW = 190;
|
|
|
|
static constexpr const int32_t WH = 180;
|
2014-10-10 14:34:46 +02:00
|
|
|
|
2018-05-16 20:41:29 +02:00
|
|
|
// clang-format off
|
2014-10-07 20:39:52 +02:00
|
|
|
enum WINDOW_STAFF_PAGE {
|
2017-06-06 23:24:18 +02:00
|
|
|
WINDOW_STAFF_OVERVIEW,
|
|
|
|
WINDOW_STAFF_OPTIONS,
|
|
|
|
WINDOW_STAFF_STATISTICS,
|
2014-10-07 20:39:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum WINDOW_STAFF_WIDGET_IDX {
|
2017-06-06 23:24:18 +02:00
|
|
|
WIDX_BACKGROUND,
|
|
|
|
WIDX_TITLE,
|
|
|
|
WIDX_CLOSE,
|
|
|
|
WIDX_RESIZE,
|
|
|
|
WIDX_TAB_1,
|
|
|
|
WIDX_TAB_2,
|
|
|
|
WIDX_TAB_3,
|
2020-08-17 20:21:46 +02:00
|
|
|
|
|
|
|
WIDX_VIEWPORT = 7,
|
2017-06-06 23:24:18 +02:00
|
|
|
WIDX_BTM_LABEL,
|
|
|
|
WIDX_PICKUP,
|
|
|
|
WIDX_PATROL,
|
|
|
|
WIDX_RENAME,
|
|
|
|
WIDX_LOCATE,
|
|
|
|
WIDX_FIRE,
|
|
|
|
|
2020-08-17 20:21:46 +02:00
|
|
|
WIDX_CHECKBOX_1 = 7,
|
2017-06-06 23:24:18 +02:00
|
|
|
WIDX_CHECKBOX_2,
|
|
|
|
WIDX_CHECKBOX_3,
|
|
|
|
WIDX_CHECKBOX_4,
|
|
|
|
WIDX_COSTUME_BOX,
|
|
|
|
WIDX_COSTUME_BTN,
|
2014-10-07 20:39:52 +02:00
|
|
|
};
|
|
|
|
|
2017-05-02 02:01:29 +02:00
|
|
|
validate_global_widx(WC_PEEP, WIDX_PATROL);
|
2017-10-06 23:21:00 +02:00
|
|
|
validate_global_widx(WC_STAFF, WIDX_PICKUP);
|
2017-05-02 02:01:29 +02:00
|
|
|
|
2020-07-30 22:45:40 +02:00
|
|
|
#define MAIN_STAFF_WIDGETS \
|
|
|
|
WINDOW_SHIM(WINDOW_TITLE, WW, WH), \
|
|
|
|
MakeWidget ({ 0, 43}, {190, 137}, WWT_RESIZE, 1 ), /* Resize */ \
|
|
|
|
MakeRemapWidget({ 3, 17}, { 31, 27}, WWT_TAB, 1, SPR_TAB, STR_STAFF_OVERVIEW_TIP), /* Tab 1 */ \
|
|
|
|
MakeRemapWidget({ 34, 17}, { 31, 27}, WWT_TAB, 1, SPR_TAB, STR_STAFF_OPTIONS_TIP ), /* Tab 2 */ \
|
2020-08-17 20:21:46 +02:00
|
|
|
MakeRemapWidget({ 65, 17}, { 31, 27}, WWT_TAB, 1, SPR_TAB, STR_STAFF_STATS_TIP ) /* Tab 3 */
|
2020-07-30 22:45:40 +02:00
|
|
|
|
2017-08-06 14:41:13 +02:00
|
|
|
static rct_widget window_staff_overview_widgets[] = {
|
2020-07-30 22:45:40 +02:00
|
|
|
MAIN_STAFF_WIDGETS,
|
|
|
|
MakeWidget ({ 3, 47}, {162, 120}, WWT_VIEWPORT, 1 ), // Viewport
|
|
|
|
MakeWidget ({ 3, WH - 13}, {162, 11}, WWT_LABEL_CENTRED, 1 ), // Label at bottom of viewport
|
|
|
|
MakeWidget ({WW - 25, 45}, { 24, 24}, WWT_FLATBTN, 1, SPR_PICKUP_BTN, STR_PICKUP_TIP ), // Pickup Button
|
|
|
|
MakeWidget ({WW - 25, 69}, { 24, 24}, WWT_FLATBTN, 1, SPR_PATROL_BTN, STR_SET_PATROL_TIP ), // Patrol Button
|
|
|
|
MakeWidget ({WW - 25, 93}, { 24, 24}, WWT_FLATBTN, 1, SPR_RENAME, STR_NAME_STAFF_TIP ), // Rename Button
|
|
|
|
MakeWidget ({WW - 25, 117}, { 24, 24}, WWT_FLATBTN, 1, SPR_LOCATE, STR_LOCATE_SUBJECT_TIP), // Locate Button
|
|
|
|
MakeWidget ({WW - 25, 141}, { 24, 24}, WWT_FLATBTN, 1, SPR_DEMOLISH, STR_FIRE_STAFF_TIP ), // Fire Button
|
2017-06-06 23:24:18 +02:00
|
|
|
{ WIDGETS_END },
|
2014-10-07 20:39:52 +02:00
|
|
|
};
|
2014-05-08 22:48:31 +02:00
|
|
|
|
2014-10-10 13:52:40 +02:00
|
|
|
//0x9AF910
|
2017-08-06 14:41:13 +02:00
|
|
|
static rct_widget window_staff_options_widgets[] = {
|
2020-07-30 22:45:40 +02:00
|
|
|
MAIN_STAFF_WIDGETS,
|
|
|
|
MakeWidget ({ 5, 50}, {180, 12}, WWT_CHECKBOX, 1 ), // Checkbox 1
|
|
|
|
MakeWidget ({ 5, 67}, {180, 12}, WWT_CHECKBOX, 1 ), // Checkbox 2
|
|
|
|
MakeWidget ({ 5, 84}, {180, 12}, WWT_CHECKBOX, 1 ), // Checkbox 3
|
|
|
|
MakeWidget ({ 5, 101}, {180, 12}, WWT_CHECKBOX, 1 ), // Checkbox 4
|
|
|
|
MakeWidget ({ 5, 50}, {180, 12}, WWT_DROPDOWN, 1 ), // Costume Dropdown
|
|
|
|
MakeWidget ({WW - 17, 51}, { 11, 10}, WWT_BUTTON, 1, STR_DROPDOWN_GLYPH, STR_SELECT_COSTUME_TIP), // Costume Dropdown Button
|
2017-06-06 23:24:18 +02:00
|
|
|
{ WIDGETS_END },
|
2014-10-10 13:52:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//0x9AF9F4
|
2017-08-06 14:41:13 +02:00
|
|
|
static rct_widget window_staff_stats_widgets[] = {
|
2020-07-30 22:45:40 +02:00
|
|
|
MAIN_STAFF_WIDGETS,
|
2017-06-06 23:24:18 +02:00
|
|
|
{ WIDGETS_END },
|
2014-10-10 13:52:40 +02:00
|
|
|
};
|
|
|
|
|
2017-08-06 14:41:13 +02:00
|
|
|
static rct_widget *window_staff_page_widgets[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_widgets,
|
|
|
|
window_staff_options_widgets,
|
|
|
|
window_staff_stats_widgets
|
2014-10-07 20:39:52 +02:00
|
|
|
};
|
2014-08-05 19:15:28 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
static void window_staff_set_page(rct_window* w, int32_t page);
|
2017-08-06 14:41:13 +02:00
|
|
|
static void window_staff_disable_widgets(rct_window* w);
|
|
|
|
static void window_staff_unknown_05(rct_window *w);
|
|
|
|
static void window_staff_viewport_init(rct_window* w);
|
|
|
|
|
|
|
|
static void window_staff_overview_close(rct_window *w);
|
|
|
|
static void window_staff_overview_mouseup(rct_window *w, rct_widgetindex widgetIndex);
|
|
|
|
static void window_staff_overview_resize(rct_window *w);
|
|
|
|
static void window_staff_overview_mousedown(rct_window *w, rct_widgetindex widgetIndex, rct_widget* widget);
|
2018-06-20 17:28:51 +02:00
|
|
|
static void window_staff_overview_dropdown(rct_window *w, rct_widgetindex widgetIndex, int32_t dropdownIndex);
|
2017-08-06 14:41:13 +02:00
|
|
|
static void window_staff_overview_update(rct_window* w);
|
|
|
|
static void window_staff_overview_invalidate(rct_window *w);
|
|
|
|
static void window_staff_overview_paint(rct_window *w, rct_drawpixelinfo *dpi);
|
|
|
|
static void window_staff_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi);
|
2020-02-29 03:43:29 +01:00
|
|
|
static void window_staff_overview_tool_update(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords);
|
|
|
|
static void window_staff_overview_tool_down(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords);
|
|
|
|
static void window_staff_overview_tool_drag(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords);
|
|
|
|
static void window_staff_overview_tool_up(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords);
|
2017-08-06 14:41:13 +02:00
|
|
|
static void window_staff_overview_tool_abort(rct_window *w, rct_widgetindex widgetIndex);
|
|
|
|
static void window_staff_overview_text_input(rct_window *w, rct_widgetindex widgetIndex, char *text);
|
|
|
|
static void window_staff_overview_viewport_rotate(rct_window *w);
|
|
|
|
|
|
|
|
static void window_staff_options_mouseup(rct_window *w, rct_widgetindex widgetIndex);
|
|
|
|
static void window_staff_options_update(rct_window* w);
|
|
|
|
static void window_staff_options_invalidate(rct_window *w);
|
|
|
|
static void window_staff_options_paint(rct_window *w, rct_drawpixelinfo *dpi);
|
|
|
|
static void window_staff_options_tab_paint(rct_window* w, rct_drawpixelinfo* dpi);
|
|
|
|
static void window_staff_options_mousedown(rct_window *w, rct_widgetindex widgetIndex, rct_widget* widget);
|
2018-06-20 17:28:51 +02:00
|
|
|
static void window_staff_options_dropdown(rct_window *w, rct_widgetindex widgetIndex, int32_t dropdownIndex);
|
2017-08-06 14:41:13 +02:00
|
|
|
|
|
|
|
static void window_staff_stats_mouseup(rct_window *w, rct_widgetindex widgetIndex);
|
|
|
|
static void window_staff_stats_resize(rct_window *w);
|
|
|
|
static void window_staff_stats_update(rct_window* w);
|
|
|
|
static void window_staff_stats_invalidate(rct_window *w);
|
|
|
|
static void window_staff_stats_paint(rct_window *w, rct_drawpixelinfo *dpi);
|
|
|
|
static void window_staff_stats_tab_paint(rct_window* w, rct_drawpixelinfo* dpi);
|
2014-10-07 20:39:52 +02:00
|
|
|
|
2015-05-21 12:28:51 +02:00
|
|
|
void window_staff_set_colours();
|
|
|
|
|
2014-10-07 20:39:52 +02:00
|
|
|
// 0x992AEC
|
2015-07-10 02:39:16 +02:00
|
|
|
static rct_window_event_list window_staff_overview_events = {
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_close,
|
|
|
|
window_staff_overview_mouseup,
|
|
|
|
window_staff_overview_resize,
|
|
|
|
window_staff_overview_mousedown,
|
|
|
|
window_staff_overview_dropdown,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_update,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_tool_update,
|
|
|
|
window_staff_overview_tool_down,
|
2018-09-13 09:25:12 +02:00
|
|
|
window_staff_overview_tool_drag,
|
|
|
|
window_staff_overview_tool_up,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_tool_abort,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_text_input,
|
2017-06-26 09:56:41 +02:00
|
|
|
window_staff_overview_viewport_rotate,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_invalidate, //Invalidate
|
|
|
|
window_staff_overview_paint, //Paint
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr
|
2014-08-05 19:15:28 +02:00
|
|
|
};
|
|
|
|
|
2014-10-07 20:39:52 +02:00
|
|
|
// 0x992B5C
|
2015-07-10 02:39:16 +02:00
|
|
|
static rct_window_event_list window_staff_options_events = {
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_options_mouseup,
|
|
|
|
window_staff_stats_resize,
|
|
|
|
window_staff_options_mousedown,
|
|
|
|
window_staff_options_dropdown,
|
|
|
|
window_staff_unknown_05,
|
|
|
|
window_staff_options_update,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_options_invalidate, //Invalidate
|
|
|
|
window_staff_options_paint, //Paint
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr
|
2014-08-05 19:15:28 +02:00
|
|
|
};
|
|
|
|
|
2014-10-07 20:39:52 +02:00
|
|
|
// 0x992BCC
|
2015-07-10 02:39:16 +02:00
|
|
|
static rct_window_event_list window_staff_stats_events = {
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_stats_mouseup,
|
|
|
|
window_staff_stats_resize,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_unknown_05,
|
|
|
|
window_staff_stats_update,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_stats_invalidate, //Invalidate
|
|
|
|
window_staff_stats_paint, //Paint
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr
|
2014-10-07 20:39:52 +02:00
|
|
|
};
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static rct_window_event_list *window_staff_page_events[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
&window_staff_overview_events,
|
|
|
|
&window_staff_options_events,
|
|
|
|
&window_staff_stats_events
|
2014-08-05 19:15:28 +02:00
|
|
|
};
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
static constexpr const uint32_t window_staff_page_enabled_widgets[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
(1 << WIDX_CLOSE) |
|
|
|
|
(1 << WIDX_TAB_1) |
|
|
|
|
(1 << WIDX_TAB_2) |
|
|
|
|
(1 << WIDX_TAB_3) |
|
|
|
|
(1 << WIDX_PICKUP) |
|
|
|
|
(1 << WIDX_PATROL) |
|
|
|
|
(1 << WIDX_RENAME) |
|
|
|
|
(1 << WIDX_LOCATE) |
|
|
|
|
(1 << WIDX_FIRE),
|
|
|
|
|
|
|
|
(1 << WIDX_CLOSE) |
|
|
|
|
(1 << WIDX_TAB_1) |
|
|
|
|
(1 << WIDX_TAB_2) |
|
|
|
|
(1 << WIDX_TAB_3) |
|
|
|
|
(1 << WIDX_CHECKBOX_1) |
|
|
|
|
(1 << WIDX_CHECKBOX_2) |
|
|
|
|
(1 << WIDX_CHECKBOX_3) |
|
|
|
|
(1 << WIDX_CHECKBOX_4) |
|
|
|
|
(1 << WIDX_COSTUME_BTN),
|
|
|
|
|
|
|
|
(1 << WIDX_CLOSE) |
|
|
|
|
(1 << WIDX_TAB_1) |
|
|
|
|
(1 << WIDX_TAB_2) |
|
|
|
|
(1 << WIDX_TAB_3)
|
2014-10-07 20:39:52 +02:00
|
|
|
};
|
2018-05-16 20:41:29 +02:00
|
|
|
// clang-format on
|
2014-05-08 22:48:31 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
static uint8_t _availableCostumes[ENTERTAINER_COSTUME_COUNT];
|
2016-09-11 01:40:51 +02:00
|
|
|
|
2018-09-13 09:25:12 +02:00
|
|
|
enum class PatrolAreaValue
|
|
|
|
{
|
|
|
|
UNSET = 0,
|
|
|
|
SET = 1,
|
|
|
|
NONE = -1,
|
|
|
|
};
|
|
|
|
|
|
|
|
static PatrolAreaValue _staffPatrolAreaPaintValue = PatrolAreaValue::NONE;
|
|
|
|
|
2020-07-26 18:42:02 +02:00
|
|
|
static Staff* GetStaff(rct_window* w)
|
|
|
|
{
|
|
|
|
auto staff = GetEntity<Staff>(w->number);
|
|
|
|
if (staff == nullptr)
|
|
|
|
{
|
|
|
|
window_close(w);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return staff;
|
|
|
|
}
|
|
|
|
|
2014-10-07 20:39:52 +02:00
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
*
|
|
|
|
* rct2: 0x006BEE98
|
|
|
|
*/
|
2019-02-28 20:28:58 +01:00
|
|
|
rct_window* window_staff_open(Peep* peep)
|
2014-08-05 19:15:28 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window* w = window_bring_to_front_by_number(WC_PEEP, peep->sprite_index);
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w == nullptr)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w = window_create_auto_pos(WW, WH, &window_staff_overview_events, WC_PEEP, WF_10 | WF_RESIZABLE);
|
|
|
|
|
|
|
|
w->number = peep->sprite_index;
|
|
|
|
w->page = 0;
|
|
|
|
w->viewport_focus_coordinates.y = 0;
|
|
|
|
w->frame_no = 0;
|
|
|
|
w->highlighted_item = 0;
|
|
|
|
|
|
|
|
window_staff_disable_widgets(w);
|
|
|
|
|
|
|
|
w->min_width = WW;
|
|
|
|
w->min_height = WH;
|
|
|
|
w->max_width = 500;
|
|
|
|
w->max_height = 450;
|
|
|
|
}
|
|
|
|
w->page = 0;
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
w->widgets = window_staff_overview_widgets;
|
|
|
|
w->enabled_widgets = window_staff_page_enabled_widgets[0];
|
|
|
|
w->hold_down_widgets = 0;
|
|
|
|
w->event_handlers = window_staff_page_events[0];
|
|
|
|
w->pressed_widgets = 0;
|
|
|
|
window_staff_disable_widgets(w);
|
|
|
|
window_init_scroll_widgets(w);
|
|
|
|
window_staff_viewport_init(w);
|
2020-06-06 12:32:37 +02:00
|
|
|
|
2020-07-09 23:52:14 +02:00
|
|
|
if (peep->State == PEEP_STATE_PICKED)
|
2017-06-06 23:24:18 +02:00
|
|
|
window_event_mouse_up_call(w, WIDX_CHECKBOX_3);
|
|
|
|
|
|
|
|
return w;
|
2014-08-05 19:15:28 +02:00
|
|
|
}
|
|
|
|
|
2014-10-07 20:39:52 +02:00
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
* rct2: 0x006BED21
|
|
|
|
* Disable the staff pickup if not in pickup state.
|
|
|
|
*/
|
2014-10-07 20:39:52 +02:00
|
|
|
void window_staff_disable_widgets(rct_window* w)
|
2014-08-05 19:15:28 +02:00
|
|
|
{
|
2020-07-26 18:42:02 +02:00
|
|
|
const auto peep = GetStaff(w);
|
|
|
|
if (peep == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2020-08-17 20:21:46 +02:00
|
|
|
uint64_t disabled_widgets = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2020-07-09 23:52:14 +02:00
|
|
|
if (peep != nullptr && peep->StaffType == STAFF_TYPE_SECURITY)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
disabled_widgets |= (1 << WIDX_TAB_2);
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->page == WINDOW_STAFF_OVERVIEW)
|
|
|
|
{
|
|
|
|
if (peep_can_be_picked_up(peep))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (w->disabled_widgets & (1 << WIDX_PICKUP))
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
else
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
disabled_widgets |= (1 << WIDX_PICKUP);
|
|
|
|
if (!(w->disabled_widgets & (1 << WIDX_PICKUP)))
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
w->disabled_widgets = disabled_widgets;
|
2014-08-05 19:15:28 +02:00
|
|
|
}
|
|
|
|
|
2014-10-07 20:39:52 +02:00
|
|
|
/**
|
|
|
|
* Same as window_peep_overview_close.
|
2015-12-11 16:38:37 +01:00
|
|
|
* rct2: 0x006BDFF8
|
2014-10-07 20:39:52 +02:00
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_overview_close(rct_window* w)
|
2014-10-07 20:39:52 +02:00
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE))
|
|
|
|
{
|
|
|
|
if (w->classification == gCurrentToolWidget.window_classification && w->number == gCurrentToolWidget.window_number)
|
2017-06-06 23:24:18 +02:00
|
|
|
tool_cancel();
|
|
|
|
}
|
2014-08-05 19:15:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-10-07 20:39:52 +02:00
|
|
|
* Mostly similar to window_peep_set_page.
|
2015-12-11 16:38:37 +01:00
|
|
|
* rct2: 0x006BE023
|
2014-10-07 20:39:52 +02:00
|
|
|
*/
|
2018-06-20 17:28:51 +02:00
|
|
|
void window_staff_set_page(rct_window* w, int32_t page)
|
2014-08-05 19:15:28 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE))
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->number == gCurrentToolWidget.window_number && w->classification == gCurrentToolWidget.window_classification)
|
2017-06-06 23:24:18 +02:00
|
|
|
tool_cancel();
|
|
|
|
}
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t listen = 0;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (page == WINDOW_STAFF_OVERVIEW && w->page == WINDOW_STAFF_OVERVIEW && w->viewport)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(w->viewport->flags & VIEWPORT_FLAG_SOUND_ON))
|
|
|
|
listen = 1;
|
|
|
|
}
|
2014-10-07 20:39:52 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
w->page = page;
|
|
|
|
w->frame_no = 0;
|
2014-10-07 20:39:52 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_viewport* viewport = w->viewport;
|
2017-10-03 00:00:32 +02:00
|
|
|
w->viewport = nullptr;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (viewport)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
viewport->width = 0;
|
|
|
|
}
|
2014-10-07 20:39:52 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
w->enabled_widgets = window_staff_page_enabled_widgets[page];
|
|
|
|
w->hold_down_widgets = 0;
|
|
|
|
w->event_handlers = window_staff_page_events[page];
|
|
|
|
w->pressed_widgets = 0;
|
|
|
|
w->widgets = window_staff_page_widgets[page];
|
2014-08-05 19:15:28 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_disable_widgets(w);
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2014-10-07 20:39:52 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_event_resize_call(w);
|
|
|
|
window_event_invalidate_call(w);
|
2014-10-07 20:39:52 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_init_scroll_widgets(w);
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2014-10-07 20:39:52 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (listen && w->viewport)
|
|
|
|
w->viewport->flags |= VIEWPORT_FLAG_SOUND_ON;
|
2014-10-07 20:39:52 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BDF55
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_overview_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
2014-10-07 20:39:52 +02:00
|
|
|
{
|
2020-07-26 18:42:02 +02:00
|
|
|
const auto peep = GetStaff(w);
|
|
|
|
if (peep == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
switch (widgetIndex)
|
|
|
|
{
|
|
|
|
case WIDX_CLOSE:
|
|
|
|
window_close(w);
|
|
|
|
break;
|
|
|
|
case WIDX_TAB_1:
|
|
|
|
case WIDX_TAB_2:
|
|
|
|
case WIDX_TAB_3:
|
|
|
|
window_staff_set_page(w, widgetIndex - WIDX_TAB_1);
|
|
|
|
break;
|
|
|
|
case WIDX_LOCATE:
|
2019-06-15 17:12:14 +02:00
|
|
|
w->ScrollToViewport();
|
2018-06-22 23:21:44 +02:00
|
|
|
break;
|
|
|
|
case WIDX_PICKUP:
|
2017-06-06 23:24:18 +02:00
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
w->picked_peep_old_x = peep->x;
|
2020-06-17 22:11:50 +02:00
|
|
|
CoordsXYZ nullLoc{};
|
|
|
|
nullLoc.setNull();
|
|
|
|
PeepPickupAction pickupAction{ PeepPickupType::Pickup, w->number, nullLoc, network_get_current_player_id() };
|
2019-06-09 17:54:12 +02:00
|
|
|
pickupAction.SetCallback([peepnum = w->number](const GameAction* ga, const GameActionResult* result) {
|
|
|
|
if (result->Error != GA_ERROR::OK)
|
|
|
|
return;
|
|
|
|
rct_window* wind = window_find_by_number(WC_PEEP, peepnum);
|
|
|
|
if (wind)
|
|
|
|
{
|
|
|
|
tool_set(wind, WC_STAFF__WIDX_PICKUP, TOOL_PICKER);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
GameActions::Execute(&pickupAction);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
break;
|
2018-06-22 23:21:44 +02:00
|
|
|
case WIDX_FIRE:
|
|
|
|
{
|
|
|
|
auto intent = Intent(WC_FIRE_PROMPT);
|
|
|
|
intent.putExtra(INTENT_EXTRA_PEEP, peep);
|
|
|
|
context_open_intent(&intent);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case WIDX_RENAME:
|
2019-07-21 21:44:19 +02:00
|
|
|
{
|
|
|
|
auto peepName = peep->GetName();
|
|
|
|
window_text_input_raw_open(
|
|
|
|
w, widgetIndex, STR_STAFF_TITLE_STAFF_MEMBER_NAME, STR_STAFF_PROMPT_ENTER_NAME, peepName.c_str(), 32);
|
2018-06-22 23:21:44 +02:00
|
|
|
break;
|
2019-07-21 21:44:19 +02:00
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-08-05 19:15:28 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BE558
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_overview_resize(rct_window* w)
|
2014-08-05 19:15:28 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_disable_widgets(w);
|
|
|
|
|
|
|
|
w->min_width = WW;
|
|
|
|
w->max_width = 500;
|
|
|
|
w->min_height = WH;
|
|
|
|
w->max_height = 450;
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->width < w->min_width)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->width = w->min_width;
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->width > w->max_width)
|
|
|
|
{
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
w->width = w->max_width;
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->height < w->min_height)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->height = w->min_height;
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->height > w->max_height)
|
|
|
|
{
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
w->height = w->max_height;
|
|
|
|
}
|
|
|
|
|
|
|
|
rct_viewport* viewport = w->viewport;
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (viewport)
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t new_width = w->width - 30;
|
|
|
|
int32_t new_height = w->height - 62;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// Update the viewport size
|
2018-06-22 23:21:44 +02:00
|
|
|
if (viewport->width != new_width || viewport->height != new_height)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
viewport->width = new_width;
|
|
|
|
viewport->height = new_height;
|
2020-02-20 01:18:05 +01:00
|
|
|
viewport->view_width = new_width * viewport->zoom;
|
|
|
|
viewport->view_height = new_height * viewport->zoom;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
window_staff_viewport_init(w);
|
2014-08-05 19:15:28 +02:00
|
|
|
}
|
|
|
|
|
2015-10-20 20:16:30 +02:00
|
|
|
/**
|
2014-10-07 20:39:52 +02:00
|
|
|
* Handle the dropdown of patrol button.
|
2015-12-11 16:38:37 +01:00
|
|
|
* rct2: 0x006BDF98
|
2014-10-07 20:39:52 +02:00
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_overview_mousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget)
|
2014-08-05 19:15:28 +02:00
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
if (widgetIndex != WIDX_PATROL)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Dropdown names
|
|
|
|
gDropdownItemsFormat[0] = STR_SET_PATROL_AREA;
|
|
|
|
gDropdownItemsFormat[1] = STR_CLEAR_PATROL_AREA;
|
|
|
|
|
2020-05-01 21:03:21 +02:00
|
|
|
auto dropdownPos = ScreenCoordsXY{ widget->left + w->windowPos.x, widget->top + w->windowPos.y };
|
2020-06-25 03:44:00 +02:00
|
|
|
int32_t extray = widget->height() + 1;
|
2020-05-01 21:03:21 +02:00
|
|
|
window_dropdown_show_text(dropdownPos, extray, w->colours[1], 0, 2);
|
2017-06-06 23:24:18 +02:00
|
|
|
gDropdownDefaultIndex = 0;
|
|
|
|
|
2020-07-26 18:42:02 +02:00
|
|
|
const auto peep = GetStaff(w);
|
|
|
|
if (peep == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// Disable clear patrol area if no area is set.
|
2020-05-31 23:21:57 +02:00
|
|
|
if (!(gStaffModes[peep->StaffId] & 2))
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2017-07-24 11:24:23 +02:00
|
|
|
dropdown_set_disabled(1, true);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-08-05 19:15:28 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BDFA3
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_overview_dropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex)
|
2014-10-07 20:39:52 +02:00
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
if (widgetIndex != WIDX_PATROL)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Clear patrol
|
2018-06-22 23:21:44 +02:00
|
|
|
if (dropdownIndex == 1)
|
|
|
|
{
|
2020-07-26 18:42:02 +02:00
|
|
|
const auto peep = GetStaff(w);
|
|
|
|
if (peep == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
for (int32_t i = 0; i < STAFF_PATROL_AREA_SIZE; i++)
|
|
|
|
{
|
2020-05-31 23:21:57 +02:00
|
|
|
gStaffPatrolAreas[peep->StaffId * STAFF_PATROL_AREA_SIZE + i] = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2020-05-31 23:21:57 +02:00
|
|
|
gStaffModes[peep->StaffId] &= ~2;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gfx_invalidate_screen();
|
|
|
|
staff_update_greyed_patrol_areas();
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!tool_set(w, widgetIndex, TOOL_WALK_DOWN))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
show_gridlines();
|
|
|
|
gStaffDrawPatrolAreas = w->number;
|
|
|
|
gfx_invalidate_screen();
|
|
|
|
}
|
|
|
|
}
|
2014-08-05 19:15:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-10-07 20:39:52 +02:00
|
|
|
* Update the animation frame of the tab icon.
|
2015-12-11 16:38:37 +01:00
|
|
|
* rct2: 0x6BE602
|
2014-10-07 20:39:52 +02:00
|
|
|
*/
|
|
|
|
void window_staff_overview_update(rct_window* w)
|
|
|
|
{
|
2020-03-01 21:51:29 +01:00
|
|
|
int32_t newAnimationFrame = w->var_496;
|
|
|
|
newAnimationFrame++;
|
|
|
|
if (newAnimationFrame >= 24)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2020-03-01 21:51:29 +01:00
|
|
|
newAnimationFrame = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2020-03-01 21:51:29 +01:00
|
|
|
w->var_496 = newAnimationFrame;
|
2017-06-06 23:24:18 +02:00
|
|
|
widget_invalidate(w, WIDX_TAB_1);
|
2014-10-07 20:39:52 +02:00
|
|
|
}
|
2014-08-05 19:15:28 +02:00
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BE814
|
|
|
|
*/
|
2018-06-20 17:28:51 +02:00
|
|
|
static void window_staff_set_order(rct_window* w, int32_t order_id)
|
2014-10-07 20:39:52 +02:00
|
|
|
{
|
2020-07-26 18:42:02 +02:00
|
|
|
const auto peep = GetStaff(w);
|
|
|
|
if (peep == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-08-05 19:15:28 +02:00
|
|
|
|
2020-05-31 23:00:23 +02:00
|
|
|
uint8_t newOrders = peep->StaffOrders ^ (1 << order_id);
|
2019-02-05 08:36:39 +01:00
|
|
|
auto staffSetOrdersAction = StaffSetOrdersAction(w->number, newOrders);
|
|
|
|
GameActions::Execute(&staffSetOrdersAction);
|
2014-08-05 19:15:28 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BE7DB
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_options_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
2014-10-07 20:39:52 +02:00
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
switch (widgetIndex)
|
|
|
|
{
|
|
|
|
case WIDX_CLOSE:
|
|
|
|
window_close(w);
|
|
|
|
break;
|
|
|
|
case WIDX_TAB_1:
|
|
|
|
case WIDX_TAB_2:
|
|
|
|
case WIDX_TAB_3:
|
|
|
|
window_staff_set_page(w, widgetIndex - WIDX_TAB_1);
|
|
|
|
break;
|
|
|
|
case WIDX_CHECKBOX_1:
|
|
|
|
case WIDX_CHECKBOX_2:
|
|
|
|
case WIDX_CHECKBOX_3:
|
|
|
|
case WIDX_CHECKBOX_4:
|
|
|
|
window_staff_set_order(w, widgetIndex - WIDX_CHECKBOX_1);
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-08-05 19:15:28 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BE960
|
|
|
|
*/
|
2014-10-11 12:42:08 +02:00
|
|
|
void window_staff_options_update(rct_window* w)
|
2014-08-05 19:15:28 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->frame_no++;
|
|
|
|
widget_invalidate(w, WIDX_TAB_2);
|
2014-08-05 19:15:28 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BEBCF
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_stats_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
2014-08-05 19:15:28 +02:00
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
switch (widgetIndex)
|
|
|
|
{
|
|
|
|
case WIDX_CLOSE:
|
|
|
|
window_close(w);
|
|
|
|
break;
|
|
|
|
case WIDX_TAB_1:
|
|
|
|
case WIDX_TAB_2:
|
|
|
|
case WIDX_TAB_3:
|
|
|
|
window_staff_set_page(w, widgetIndex - WIDX_TAB_1);
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-08-05 19:15:28 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BEC1B, 0x006BE975
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_stats_resize(rct_window* w)
|
2014-10-07 20:39:52 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->min_width = 190;
|
|
|
|
w->max_width = 190;
|
2017-12-18 15:53:49 +01:00
|
|
|
w->min_height = 126;
|
|
|
|
w->max_height = 126;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->width < w->min_width)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->width = w->min_width;
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->width > w->max_width)
|
|
|
|
{
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
w->width = w->max_width;
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->height < w->min_height)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->height = w->min_height;
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->height > w->max_height)
|
|
|
|
{
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
w->height = w->max_height;
|
|
|
|
}
|
2014-08-05 19:15:28 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BEBEA
|
|
|
|
*/
|
2014-10-07 20:39:52 +02:00
|
|
|
void window_staff_stats_update(rct_window* w)
|
2014-08-05 19:15:28 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->frame_no++;
|
|
|
|
widget_invalidate(w, WIDX_TAB_3);
|
|
|
|
|
2020-07-26 18:42:02 +02:00
|
|
|
auto peep = GetStaff(w);
|
|
|
|
if (peep == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2020-06-09 03:25:54 +02:00
|
|
|
if (peep->WindowInvalidateFlags & PEEP_INVALIDATE_STAFF_STATS)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2020-06-09 03:25:54 +02:00
|
|
|
peep->WindowInvalidateFlags &= ~PEEP_INVALIDATE_STAFF_STATS;
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-10-10 13:33:36 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x6BEC80, 0x6BE9DA
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_unknown_05(rct_window* w)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
widget_invalidate(w, WIDX_TAB_1);
|
2014-10-10 14:34:46 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BE9E9
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_stats_invalidate(rct_window* w)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2020-04-18 13:32:48 +02:00
|
|
|
colour_scheme_update_by_class(w, static_cast<rct_windowclass>(WC_STAFF));
|
2015-05-21 12:28:51 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (window_staff_page_widgets[w->page] != w->widgets)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->widgets = window_staff_page_widgets[w->page];
|
|
|
|
window_init_scroll_widgets(w);
|
|
|
|
}
|
2014-10-10 14:34:46 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1);
|
2014-10-10 14:34:46 +02:00
|
|
|
|
2020-07-26 18:42:02 +02:00
|
|
|
const auto peep = GetStaff(w);
|
|
|
|
if (peep == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-10-10 14:34:46 +02:00
|
|
|
|
2020-06-23 15:52:08 +02:00
|
|
|
auto ft = Formatter::Common();
|
|
|
|
peep->FormatNameTo(ft);
|
2014-10-10 14:34:46 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_stats_widgets[WIDX_BACKGROUND].right = w->width - 1;
|
|
|
|
window_staff_stats_widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
2014-10-10 14:34:46 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_stats_widgets[WIDX_RESIZE].right = w->width - 1;
|
|
|
|
window_staff_stats_widgets[WIDX_RESIZE].bottom = w->height - 1;
|
2014-10-10 14:34:46 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_stats_widgets[WIDX_TITLE].right = w->width - 2;
|
2014-10-10 14:34:46 +02:00
|
|
|
|
2020-05-05 22:31:04 +02:00
|
|
|
window_staff_stats_widgets[WIDX_CLOSE].left = w->width - 13;
|
|
|
|
window_staff_stats_widgets[WIDX_CLOSE].right = w->width - 3;
|
2014-10-10 14:34:46 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_3);
|
2014-10-11 12:42:08 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BE62B
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_options_invalidate(rct_window* w)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2020-04-18 13:32:48 +02:00
|
|
|
colour_scheme_update_by_class(w, static_cast<rct_windowclass>(WC_STAFF));
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (window_staff_page_widgets[w->page] != w->widgets)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->widgets = window_staff_page_widgets[w->page];
|
|
|
|
window_init_scroll_widgets(w);
|
|
|
|
}
|
|
|
|
|
|
|
|
w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1);
|
|
|
|
|
2020-07-26 18:42:02 +02:00
|
|
|
const auto peep = GetStaff(w);
|
|
|
|
if (peep == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2020-06-23 15:52:08 +02:00
|
|
|
auto ft = Formatter::Common();
|
|
|
|
peep->FormatNameTo(ft);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2020-06-14 07:31:08 +02:00
|
|
|
switch (peep->StaffType)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
|
|
|
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_BUTTON;
|
2020-06-14 07:31:08 +02:00
|
|
|
window_staff_options_widgets[WIDX_COSTUME_BOX].text = StaffCostumeNames[peep->SpriteType - 4];
|
2018-06-22 23:21:44 +02:00
|
|
|
break;
|
|
|
|
case STAFF_TYPE_HANDYMAN:
|
|
|
|
window_staff_options_widgets[WIDX_CHECKBOX_1].type = WWT_CHECKBOX;
|
|
|
|
window_staff_options_widgets[WIDX_CHECKBOX_1].text = STR_STAFF_OPTION_SWEEP_FOOTPATHS;
|
|
|
|
window_staff_options_widgets[WIDX_CHECKBOX_2].type = WWT_CHECKBOX;
|
|
|
|
window_staff_options_widgets[WIDX_CHECKBOX_2].text = STR_STAFF_OPTION_WATER_GARDENS;
|
|
|
|
window_staff_options_widgets[WIDX_CHECKBOX_3].type = WWT_CHECKBOX;
|
|
|
|
window_staff_options_widgets[WIDX_CHECKBOX_3].text = STR_STAFF_OPTION_EMPTY_LITTER;
|
|
|
|
window_staff_options_widgets[WIDX_CHECKBOX_4].type = WWT_CHECKBOX;
|
|
|
|
window_staff_options_widgets[WIDX_CHECKBOX_4].text = STR_STAFF_OPTION_MOW_GRASS;
|
|
|
|
window_staff_options_widgets[WIDX_COSTUME_BOX].type = WWT_EMPTY;
|
|
|
|
window_staff_options_widgets[WIDX_COSTUME_BTN].type = WWT_EMPTY;
|
2018-07-21 11:50:45 +02:00
|
|
|
w->pressed_widgets &= ~(
|
|
|
|
(1 << WIDX_CHECKBOX_1) | (1 << WIDX_CHECKBOX_2) | (1 << WIDX_CHECKBOX_3) | (1 << WIDX_CHECKBOX_4));
|
2020-05-31 23:00:23 +02:00
|
|
|
w->pressed_widgets |= peep->StaffOrders << WIDX_CHECKBOX_1;
|
2018-06-22 23:21:44 +02:00
|
|
|
break;
|
|
|
|
case STAFF_TYPE_MECHANIC:
|
|
|
|
window_staff_options_widgets[WIDX_CHECKBOX_1].type = WWT_CHECKBOX;
|
|
|
|
window_staff_options_widgets[WIDX_CHECKBOX_1].text = STR_INSPECT_RIDES;
|
|
|
|
window_staff_options_widgets[WIDX_CHECKBOX_2].type = WWT_CHECKBOX;
|
|
|
|
window_staff_options_widgets[WIDX_CHECKBOX_2].text = STR_FIX_RIDES;
|
|
|
|
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));
|
2020-05-31 23:00:23 +02:00
|
|
|
w->pressed_widgets |= peep->StaffOrders << WIDX_CHECKBOX_1;
|
2018-06-22 23:21:44 +02:00
|
|
|
break;
|
|
|
|
case STAFF_TYPE_SECURITY:
|
|
|
|
// Security guards don't have an options screen.
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2020-05-05 22:31:04 +02:00
|
|
|
window_staff_options_widgets[WIDX_CLOSE].left = w->width - 13;
|
|
|
|
window_staff_options_widgets[WIDX_CLOSE].right = w->width - 3;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_3);
|
2014-10-11 12:42:08 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BDD91
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_overview_invalidate(rct_window* w)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2020-04-18 13:32:48 +02:00
|
|
|
colour_scheme_update_by_class(w, static_cast<rct_windowclass>(WC_STAFF));
|
2015-05-21 12:28:51 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (window_staff_page_widgets[w->page] != w->widgets)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->widgets = window_staff_page_widgets[w->page];
|
|
|
|
window_init_scroll_widgets(w);
|
|
|
|
}
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1);
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2020-07-26 18:42:02 +02:00
|
|
|
const auto peep = GetStaff(w);
|
|
|
|
if (peep == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2020-06-23 15:52:08 +02:00
|
|
|
auto ft = Formatter::Common();
|
|
|
|
peep->FormatNameTo(ft);
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_widgets[WIDX_BACKGROUND].right = w->width - 1;
|
|
|
|
window_staff_overview_widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_widgets[WIDX_RESIZE].right = w->width - 1;
|
|
|
|
window_staff_overview_widgets[WIDX_RESIZE].bottom = w->height - 1;
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_widgets[WIDX_TITLE].right = w->width - 2;
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_widgets[WIDX_VIEWPORT].right = w->width - 26;
|
|
|
|
window_staff_overview_widgets[WIDX_VIEWPORT].bottom = w->height - 14;
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
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;
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2020-05-05 22:31:04 +02:00
|
|
|
window_staff_overview_widgets[WIDX_CLOSE].left = w->width - 13;
|
|
|
|
window_staff_overview_widgets[WIDX_CLOSE].right = w->width - 3;
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_widgets[WIDX_PICKUP].left = w->width - 25;
|
|
|
|
window_staff_overview_widgets[WIDX_PICKUP].right = w->width - 2;
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_widgets[WIDX_PATROL].left = w->width - 25;
|
|
|
|
window_staff_overview_widgets[WIDX_PATROL].right = w->width - 2;
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_widgets[WIDX_RENAME].left = w->width - 25;
|
|
|
|
window_staff_overview_widgets[WIDX_RENAME].right = w->width - 2;
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_widgets[WIDX_LOCATE].left = w->width - 25;
|
|
|
|
window_staff_overview_widgets[WIDX_LOCATE].right = w->width - 2;
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_overview_widgets[WIDX_FIRE].left = w->width - 25;
|
|
|
|
window_staff_overview_widgets[WIDX_FIRE].right = w->width - 2;
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_3);
|
2014-10-11 12:42:08 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x6BDEAF
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_overview_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
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
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->viewport)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_draw_viewport(dpi, w);
|
|
|
|
rct_viewport* viewport = w->viewport;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (viewport->flags & VIEWPORT_FLAG_SOUND_ON)
|
|
|
|
{
|
2020-06-24 17:48:17 +02:00
|
|
|
gfx_draw_sprite(dpi, SPR_HEARING_VIEWPORT, w->windowPos + ScreenCoordsXY{ 2, 2 }, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-01 00:11:28 +02:00
|
|
|
// Draw the centred label
|
2020-07-26 18:42:02 +02:00
|
|
|
const auto peep = GetStaff(w);
|
|
|
|
if (peep == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2020-06-23 15:52:08 +02:00
|
|
|
auto ft = Formatter::Common();
|
|
|
|
peep->FormatActionTo(ft);
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_widget* widget = &w->widgets[WIDX_BTM_LABEL];
|
2020-06-25 10:31:15 +02:00
|
|
|
auto screenPos = w->windowPos + ScreenCoordsXY{ widget->midX(), widget->top };
|
2020-06-25 03:44:00 +02:00
|
|
|
int32_t width = widget->width();
|
2020-06-11 23:04:57 +02:00
|
|
|
gfx_draw_string_centred_clipped(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, screenPos, width);
|
2014-10-11 12:42:08 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x6BEC8F
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
void window_staff_options_tab_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->disabled_widgets & (1 << WIDX_TAB_2))
|
|
|
|
return;
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_widget* widget = &w->widgets[WIDX_TAB_2];
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t image_id = SPR_TAB_STAFF_OPTIONS_0;
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->page == WINDOW_STAFF_OPTIONS)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
image_id += (w->frame_no / 2) % 7;
|
|
|
|
}
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2020-06-24 17:48:17 +02:00
|
|
|
auto screenCoords = w->windowPos + ScreenCoordsXY{ widget->left, widget->top };
|
|
|
|
gfx_draw_sprite(dpi, image_id, screenCoords, 0);
|
2014-10-11 12:42:08 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x6BECD3
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
void window_staff_stats_tab_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->disabled_widgets & (1 << WIDX_TAB_3))
|
|
|
|
return;
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_widget* widget = &w->widgets[WIDX_TAB_3];
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t image_id = SPR_TAB_STATS_0;
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->page == WINDOW_STAFF_STATISTICS)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
image_id += (w->frame_no / 4) % 7;
|
|
|
|
}
|
2014-10-11 12:42:08 +02:00
|
|
|
|
2020-06-24 17:48:17 +02:00
|
|
|
auto screenCoords = w->windowPos + ScreenCoordsXY{ widget->left, widget->top };
|
|
|
|
gfx_draw_sprite(dpi, image_id, screenCoords, 0);
|
2014-10-11 12:42:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
* Based on rct2: 0x6983dd in window_guest to be remerged into one when peep file added.
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
void window_staff_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (w->disabled_widgets & (1 << WIDX_TAB_1))
|
|
|
|
return;
|
|
|
|
|
|
|
|
rct_widget* widget = &w->widgets[WIDX_TAB_1];
|
2020-06-25 03:44:00 +02:00
|
|
|
int32_t width = widget->width() - 1;
|
|
|
|
int32_t height = widget->height() - 1;
|
2020-06-24 17:48:17 +02:00
|
|
|
auto screenCoords = w->windowPos + ScreenCoordsXY{ widget->left + 1, widget->top + 1 };
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->page == WINDOW_STAFF_OVERVIEW)
|
|
|
|
height++;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
rct_drawpixelinfo clip_dpi;
|
2020-07-02 19:06:28 +02:00
|
|
|
if (!clip_drawpixelinfo(&clip_dpi, dpi, screenCoords, width, height))
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-07-02 14:19:19 +02:00
|
|
|
screenCoords = ScreenCoordsXY{ 14, 20 };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2020-07-26 18:42:02 +02:00
|
|
|
const auto peep = GetStaff(w);
|
|
|
|
if (peep == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2020-07-25 11:46:06 +02:00
|
|
|
if (peep->AssignedPeepType == PeepType::Staff && peep->StaffType == STAFF_TYPE_ENTERTAINER)
|
2020-06-24 17:48:17 +02:00
|
|
|
screenCoords.y++;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2020-06-14 07:31:08 +02:00
|
|
|
int32_t ebx = g_peep_animation_entries[peep->SpriteType].sprite_animation->base_image + 1;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t eax = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->page == WINDOW_STAFF_OVERVIEW)
|
|
|
|
{
|
2020-07-02 14:19:19 +02:00
|
|
|
eax = w->var_496;
|
2017-06-06 23:24:18 +02:00
|
|
|
eax &= 0xFFFC;
|
|
|
|
}
|
|
|
|
ebx += eax;
|
|
|
|
|
2020-06-14 07:31:08 +02:00
|
|
|
int32_t sprite_id = ebx | SPRITE_ID_PALETTE_COLOUR_2(peep->TshirtColour, peep->TrousersColour);
|
2020-06-24 17:48:17 +02:00
|
|
|
gfx_draw_sprite(&clip_dpi, sprite_id, screenCoords, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// If holding a balloon
|
2018-06-22 23:21:44 +02:00
|
|
|
if (ebx >= 0x2A1D && ebx < 0x2A3D)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
ebx += 32;
|
2020-05-14 04:16:43 +02:00
|
|
|
ebx |= SPRITE_ID_PALETTE_COLOUR_1(peep->BalloonColour);
|
2020-06-24 17:48:17 +02:00
|
|
|
gfx_draw_sprite(&clip_dpi, ebx, screenCoords, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// If holding umbrella
|
2018-06-22 23:21:44 +02:00
|
|
|
if (ebx >= 0x2BBD && ebx < 0x2BDD)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
ebx += 32;
|
2020-05-14 04:14:45 +02:00
|
|
|
ebx |= SPRITE_ID_PALETTE_COLOUR_1(peep->UmbrellaColour);
|
2020-06-24 17:48:17 +02:00
|
|
|
gfx_draw_sprite(&clip_dpi, ebx, screenCoords, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// If wearing hat
|
2018-06-22 23:21:44 +02:00
|
|
|
if (ebx >= 0x29DD && ebx < 0x29FD)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
ebx += 32;
|
2020-05-14 04:11:28 +02:00
|
|
|
ebx |= SPRITE_ID_PALETTE_COLOUR_1(peep->HatColour);
|
2020-06-24 17:48:17 +02:00
|
|
|
gfx_draw_sprite(&clip_dpi, ebx, screenCoords, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-10-11 12:42:08 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x6BE7C6
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_options_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
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);
|
2014-10-11 12:42:08 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x6BEA86
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_stats_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
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);
|
|
|
|
|
2020-07-26 18:42:02 +02:00
|
|
|
const auto peep = GetStaff(w);
|
|
|
|
if (peep == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2020-06-20 21:09:45 +02:00
|
|
|
auto screenCoords = w->windowPos
|
|
|
|
+ ScreenCoordsXY{ window_staff_stats_widgets[WIDX_RESIZE].left + 4, window_staff_stats_widgets[WIDX_RESIZE].top + 4 };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (!(gParkFlags & PARK_FLAGS_NO_MONEY))
|
|
|
|
{
|
2020-06-14 07:31:08 +02:00
|
|
|
Formatter::Common().Add<money32>(gStaffWageTable[peep->StaffType]);
|
2020-06-20 21:09:45 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_STAFF_STAT_WAGES, gCommonFormatArgs, COLOUR_BLACK, screenCoords);
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2020-06-20 21:09:45 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_STAFF_STAT_EMPLOYED_FOR, static_cast<void*>(&peep->TimeInPark), COLOUR_BLACK, screenCoords);
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2020-06-14 07:31:08 +02:00
|
|
|
switch (peep->StaffType)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
|
|
|
case STAFF_TYPE_HANDYMAN:
|
2020-04-18 13:32:48 +02:00
|
|
|
gfx_draw_string_left(
|
2020-06-20 21:09:45 +02:00
|
|
|
dpi, STR_STAFF_STAT_LAWNS_MOWN, static_cast<void*>(&peep->StaffLawnsMown), COLOUR_BLACK, screenCoords);
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2020-04-18 13:32:48 +02:00
|
|
|
gfx_draw_string_left(
|
2020-06-20 21:09:45 +02:00
|
|
|
dpi, STR_STAFF_STAT_GARDENS_WATERED, static_cast<void*>(&peep->StaffGardensWatered), COLOUR_BLACK,
|
|
|
|
screenCoords);
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2020-04-18 13:32:48 +02:00
|
|
|
gfx_draw_string_left(
|
2020-06-20 21:09:45 +02:00
|
|
|
dpi, STR_STAFF_STAT_LITTER_SWEPT, static_cast<void*>(&peep->StaffLitterSwept), COLOUR_BLACK, screenCoords);
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
|
|
|
gfx_draw_string_left(
|
|
|
|
dpi, STR_STAFF_STAT_BINS_EMPTIED, static_cast<void*>(&peep->StaffBinsEmptied), COLOUR_BLACK, screenCoords);
|
2018-06-22 23:21:44 +02:00
|
|
|
break;
|
|
|
|
case STAFF_TYPE_MECHANIC:
|
2020-04-18 13:32:48 +02:00
|
|
|
gfx_draw_string_left(
|
2020-06-20 21:09:45 +02:00
|
|
|
dpi, STR_STAFF_STAT_RIDES_INSPECTED, static_cast<void*>(&peep->StaffRidesInspected), COLOUR_BLACK,
|
|
|
|
screenCoords);
|
|
|
|
screenCoords.y += LIST_ROW_HEIGHT;
|
2020-04-18 13:32:48 +02:00
|
|
|
gfx_draw_string_left(
|
2020-06-20 21:09:45 +02:00
|
|
|
dpi, STR_STAFF_STAT_RIDES_FIXED, static_cast<void*>(&peep->StaffRidesFixed), COLOUR_BLACK, screenCoords);
|
2018-06-22 23:21:44 +02:00
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-10-11 20:21:37 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BDFD8
|
|
|
|
*/
|
2020-02-29 03:43:29 +01:00
|
|
|
void window_staff_overview_tool_update(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (widgetIndex != WIDX_PICKUP)
|
|
|
|
return;
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
|
|
|
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
|
|
|
|
2020-01-13 02:20:29 +01:00
|
|
|
auto mapCoords = footpath_get_coordinates_from_pos({ screenCoords.x, screenCoords.y + 16 }, nullptr, nullptr);
|
|
|
|
if (!mapCoords.isNull())
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
|
|
|
gMapSelectType = MAP_SELECT_TYPE_FULL;
|
2020-01-13 02:20:29 +01:00
|
|
|
gMapSelectPositionA = mapCoords;
|
|
|
|
gMapSelectPositionB = mapCoords;
|
2017-06-06 23:24:18 +02:00
|
|
|
map_invalidate_selection_rect();
|
|
|
|
}
|
|
|
|
|
|
|
|
gPickupPeepImage = UINT32_MAX;
|
|
|
|
|
2020-08-02 09:32:59 +02:00
|
|
|
auto info = get_map_coordinates_from_pos(screenCoords, VIEWPORT_INTERACTION_MASK_NONE);
|
|
|
|
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_NONE)
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
|
2020-02-29 03:43:29 +01:00
|
|
|
gPickupPeepX = screenCoords.x - 1;
|
|
|
|
gPickupPeepY = screenCoords.y + 16;
|
2017-06-06 23:24:18 +02:00
|
|
|
w->picked_peep_frame++;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->picked_peep_frame >= 48)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->picked_peep_frame = 0;
|
|
|
|
}
|
|
|
|
|
2020-07-26 18:42:02 +02:00
|
|
|
const auto peep = GetStaff(w);
|
|
|
|
if (peep == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2020-06-14 07:31:08 +02:00
|
|
|
uint32_t imageId = g_peep_animation_entries[peep->SpriteType].sprite_animation[PEEP_ACTION_SPRITE_TYPE_UI].base_image;
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId += w->picked_peep_frame >> 2;
|
|
|
|
|
2020-06-14 07:31:08 +02:00
|
|
|
imageId |= (peep->TshirtColour << 19) | (peep->TrousersColour << 24) | IMAGE_TYPE_REMAP | IMAGE_TYPE_REMAP_2_PLUS;
|
2017-06-06 23:24:18 +02:00
|
|
|
gPickupPeepImage = imageId;
|
2014-10-11 20:21:37 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BDFC3
|
|
|
|
*/
|
2020-02-29 03:43:29 +01:00
|
|
|
void window_staff_overview_tool_down(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
if (widgetIndex == WIDX_PICKUP)
|
|
|
|
{
|
2018-11-01 13:53:50 +01:00
|
|
|
TileElement* tileElement;
|
2020-01-13 02:20:29 +01:00
|
|
|
auto destCoords = footpath_get_coordinates_from_pos({ screenCoords.x, screenCoords.y + 16 }, nullptr, &tileElement);
|
2016-10-18 21:33:43 +02:00
|
|
|
|
2020-01-13 02:20:29 +01:00
|
|
|
if (destCoords.isNull())
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
2016-10-18 21:33:43 +02:00
|
|
|
|
2019-06-09 17:54:12 +02:00
|
|
|
PeepPickupAction pickupAction{
|
2020-03-07 21:34:04 +01:00
|
|
|
PeepPickupType::Place, w->number, { destCoords, tileElement->GetBaseZ() }, network_get_current_player_id()
|
2019-06-09 17:54:12 +02:00
|
|
|
};
|
|
|
|
pickupAction.SetCallback([](const GameAction* ga, const GameActionResult* result) {
|
|
|
|
if (result->Error != GA_ERROR::OK)
|
|
|
|
return;
|
|
|
|
tool_cancel();
|
|
|
|
gPickupPeepImage = UINT32_MAX;
|
|
|
|
});
|
|
|
|
GameActions::Execute(&pickupAction);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
else if (widgetIndex == WIDX_PATROL)
|
|
|
|
{
|
2020-01-13 02:20:29 +01:00
|
|
|
auto destCoords = footpath_get_coordinates_from_pos(screenCoords, nullptr, nullptr);
|
2014-10-11 20:21:37 +02:00
|
|
|
|
2020-01-13 02:20:29 +01:00
|
|
|
if (destCoords.isNull())
|
2018-06-22 23:21:44 +02:00
|
|
|
return;
|
2014-10-11 20:21:37 +02:00
|
|
|
|
2020-07-07 18:13:22 +02:00
|
|
|
auto staff = TryGetEntity<Staff>(w->number);
|
|
|
|
if (staff == nullptr)
|
2018-09-13 09:25:12 +02:00
|
|
|
return;
|
|
|
|
|
2020-01-13 02:20:29 +01:00
|
|
|
if (staff->IsPatrolAreaSet(destCoords))
|
2018-09-13 09:25:12 +02:00
|
|
|
{
|
|
|
|
_staffPatrolAreaPaintValue = PatrolAreaValue::UNSET;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_staffPatrolAreaPaintValue = PatrolAreaValue::SET;
|
|
|
|
}
|
2020-01-13 02:20:29 +01:00
|
|
|
auto staffSetPatrolAreaAction = StaffSetPatrolAreaAction(w->number, destCoords);
|
2019-03-16 21:45:52 +01:00
|
|
|
GameActions::Execute(&staffSetPatrolAreaAction);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-10-12 12:34:08 +02:00
|
|
|
}
|
|
|
|
|
2020-02-29 03:43:29 +01:00
|
|
|
void window_staff_overview_tool_drag(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords)
|
2018-09-13 09:25:12 +02:00
|
|
|
{
|
|
|
|
if (widgetIndex != WIDX_PATROL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (network_get_mode() != NETWORK_MODE_NONE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// This works only for singleplayer if the game_do_command can not be prevented
|
|
|
|
// to send packets more often than patrol area is updated.
|
|
|
|
|
|
|
|
if (_staffPatrolAreaPaintValue == PatrolAreaValue::NONE)
|
|
|
|
return; // Do nothing if we do not have a paintvalue(this should never happen)
|
|
|
|
|
2020-01-13 02:20:29 +01:00
|
|
|
auto destCoords = footpath_get_coordinates_from_pos(screenCoords, nullptr, nullptr);
|
2018-09-13 09:25:12 +02:00
|
|
|
|
2020-01-13 02:20:29 +01:00
|
|
|
if (destCoords.isNull())
|
2018-09-13 09:25:12 +02:00
|
|
|
return;
|
|
|
|
|
2020-07-07 18:13:22 +02:00
|
|
|
auto staff = TryGetEntity<Staff>(w->number);
|
|
|
|
if (staff == nullptr)
|
2018-09-13 09:25:12 +02:00
|
|
|
return;
|
|
|
|
|
2020-07-07 18:13:22 +02:00
|
|
|
bool patrolAreaValue = staff->IsPatrolAreaSet(destCoords);
|
2019-04-20 20:39:47 +02:00
|
|
|
if (_staffPatrolAreaPaintValue == PatrolAreaValue::SET && patrolAreaValue)
|
2018-09-13 09:25:12 +02:00
|
|
|
return; // Since area is already the value we want, skip...
|
2019-05-10 22:00:38 +02:00
|
|
|
if (_staffPatrolAreaPaintValue == PatrolAreaValue::UNSET && !patrolAreaValue)
|
2018-09-13 09:25:12 +02:00
|
|
|
return; // Since area is already the value we want, skip...
|
|
|
|
|
2020-01-13 02:20:29 +01:00
|
|
|
auto staffSetPatrolAreaAction = StaffSetPatrolAreaAction(w->number, destCoords);
|
2019-03-16 21:45:52 +01:00
|
|
|
GameActions::Execute(&staffSetPatrolAreaAction);
|
2018-09-13 09:25:12 +02:00
|
|
|
}
|
|
|
|
|
2020-02-29 03:43:29 +01:00
|
|
|
void window_staff_overview_tool_up(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords)
|
2018-09-13 09:25:12 +02:00
|
|
|
{
|
|
|
|
if (widgetIndex != WIDX_PATROL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
_staffPatrolAreaPaintValue = PatrolAreaValue::NONE;
|
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x6BDFAE
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_overview_tool_abort(rct_window* w, rct_widgetindex widgetIndex)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
if (widgetIndex == WIDX_PICKUP)
|
|
|
|
{
|
2019-06-09 17:54:12 +02:00
|
|
|
PeepPickupAction pickupAction{
|
|
|
|
PeepPickupType::Cancel, w->number, { w->picked_peep_old_x, 0, 0 }, network_get_current_player_id()
|
|
|
|
};
|
|
|
|
GameActions::Execute(&pickupAction);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
else if (widgetIndex == WIDX_PATROL)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
hide_gridlines();
|
|
|
|
gStaffDrawPatrolAreas = 0xFFFF;
|
|
|
|
gfx_invalidate_screen();
|
|
|
|
}
|
2014-10-12 12:34:08 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/* rct2: 0x6BDFED */
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_overview_text_input(rct_window* w, rct_widgetindex widgetIndex, char* text)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (widgetIndex != WIDX_RENAME)
|
|
|
|
return;
|
2014-10-12 12:34:08 +02:00
|
|
|
|
2017-08-15 10:07:44 +02:00
|
|
|
if (text == nullptr)
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
2017-10-04 15:51:45 +02:00
|
|
|
staff_set_name(w->number, text);
|
2014-10-12 12:34:08 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BE5FC
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_overview_viewport_rotate(rct_window* w)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_viewport_init(w);
|
2014-10-12 12:34:08 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006BEDA3
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_viewport_init(rct_window* w)
|
|
|
|
{
|
|
|
|
if (w->page != WINDOW_STAFF_OVERVIEW)
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-05 14:37:24 +02:00
|
|
|
sprite_focus focus = {};
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
focus.sprite_id = w->number;
|
|
|
|
|
2020-07-26 18:42:02 +02:00
|
|
|
const auto peep = GetStaff(w);
|
|
|
|
if (peep == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2020-06-14 07:31:08 +02:00
|
|
|
if (peep->State == PEEP_STATE_PICKED)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2017-06-25 22:44:58 +02:00
|
|
|
focus.sprite_id = SPRITE_INDEX_NULL;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
else
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
focus.type |= VIEWPORT_FOCUS_TYPE_SPRITE | VIEWPORT_FOCUS_TYPE_COORDINATE;
|
|
|
|
focus.rotation = get_current_rotation();
|
|
|
|
}
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
uint16_t viewport_flags;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
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)
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
viewport_flags = w->viewport->flags;
|
|
|
|
w->viewport->width = 0;
|
2017-10-03 00:00:32 +02:00
|
|
|
w->viewport = nullptr;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
else
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
viewport_flags = 0;
|
|
|
|
if (gConfigGeneral.always_show_gridlines)
|
|
|
|
viewport_flags |= VIEWPORT_FLAG_GRIDLINES;
|
|
|
|
}
|
|
|
|
|
|
|
|
window_event_invalidate_call(w);
|
|
|
|
|
|
|
|
w->viewport_focus_sprite.sprite_id = focus.sprite_id;
|
|
|
|
w->viewport_focus_sprite.type = focus.type;
|
|
|
|
w->viewport_focus_sprite.rotation = focus.rotation;
|
|
|
|
|
2020-06-14 07:31:08 +02:00
|
|
|
if (peep->State != PEEP_STATE_PICKED)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
|
|
|
if (!(w->viewport))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_widget* view_widget = &w->widgets[WIDX_VIEWPORT];
|
|
|
|
|
2020-03-01 20:32:35 +01:00
|
|
|
auto screenPos = ScreenCoordsXY{ view_widget->left + 1 + w->windowPos.x, view_widget->top + 1 + w->windowPos.y };
|
2020-06-25 03:44:00 +02:00
|
|
|
int32_t width = view_widget->width() - 1;
|
|
|
|
int32_t height = view_widget->height() - 1;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2020-03-01 05:53:21 +01:00
|
|
|
viewport_create(
|
|
|
|
w, screenPos, width, height, 0, { 0, 0, 0 }, focus.type & VIEWPORT_FOCUS_TYPE_MASK, focus.sprite_id);
|
2017-06-06 23:24:18 +02:00
|
|
|
w->flags |= WF_NO_SCROLLING;
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (w->viewport)
|
|
|
|
w->viewport->flags = viewport_flags;
|
2019-06-15 17:20:16 +02:00
|
|
|
w->Invalidate();
|
2014-10-12 12:34:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
* Handle the costume of staff member.
|
|
|
|
* rct2: 0x006BE802
|
|
|
|
*/
|
|
|
|
void window_staff_options_mousedown(rct_window* w, rct_widgetindex widgetIndex, rct_widget* widget)
|
2014-10-12 12:34:08 +02:00
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
if (widgetIndex != WIDX_COSTUME_BTN)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-07-26 18:42:02 +02:00
|
|
|
const auto peep = GetStaff(w);
|
|
|
|
if (peep == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t checkedIndex = -1;
|
2018-06-22 23:21:44 +02:00
|
|
|
// 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.
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t numCostumes = staff_get_available_entertainer_costume_list(_availableCostumes);
|
2018-06-22 23:21:44 +02:00
|
|
|
for (int32_t i = 0; i < numCostumes; i++)
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
uint8_t costume = _availableCostumes[i];
|
2020-06-14 07:31:08 +02:00
|
|
|
if (peep->SpriteType == PEEP_SPRITE_TYPE_ENTERTAINER_PANDA + costume)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2017-07-24 11:24:23 +02:00
|
|
|
checkedIndex = i;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
gDropdownItemsArgs[i] = StaffCostumeNames[costume];
|
|
|
|
gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL;
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
// Get the dropdown box widget instead of button.
|
2017-06-06 23:24:18 +02:00
|
|
|
widget--;
|
|
|
|
|
2020-05-01 21:03:21 +02:00
|
|
|
auto dropdownPos = ScreenCoordsXY{ widget->left + w->windowPos.x, widget->top + w->windowPos.y };
|
2020-06-25 03:44:00 +02:00
|
|
|
int32_t extray = widget->height() + 1;
|
|
|
|
int32_t width = widget->width() - 3;
|
2020-05-01 21:03:21 +02:00
|
|
|
window_dropdown_show_text_custom_width(dropdownPos, extray, w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, numCostumes, width);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// See above note.
|
2017-07-24 11:24:23 +02:00
|
|
|
if (checkedIndex != -1)
|
|
|
|
{
|
|
|
|
dropdown_set_checked(checkedIndex, true);
|
|
|
|
}
|
2014-10-12 12:34:08 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x6BE809
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_staff_options_dropdown(rct_window* w, rct_widgetindex widgetIndex, int32_t dropdownIndex)
|
2014-10-12 12:34:08 +02:00
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
if (widgetIndex != WIDX_COSTUME_BTN)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
2014-10-12 12:34:08 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (dropdownIndex == -1)
|
|
|
|
return;
|
2014-10-12 12:34:08 +02:00
|
|
|
|
2019-02-05 08:36:39 +01:00
|
|
|
uint8_t costume = _availableCostumes[dropdownIndex];
|
|
|
|
auto staffSetCostumeAction = StaffSetCostumeAction(w->number, costume);
|
|
|
|
GameActions::Execute(&staffSetCostumeAction);
|
2015-05-12 16:13:30 +02:00
|
|
|
}
|