mirror of https://github.com/OpenRCT2/OpenRCT2.git
organise: refactor peep / staff window names
This commit is contained in:
parent
1d92e3d7ab
commit
1770e82643
|
@ -28,8 +28,18 @@
|
|||
<Text Include="..\data\language\swedish.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\lib\libspeex\resample.c" />
|
||||
<ClCompile Include="..\lib\lodepng\lodepng.c" />
|
||||
<ClInclude Include="..\lib\libspeex\arch.h" />
|
||||
<ClInclude Include="..\lib\libspeex\config.h" />
|
||||
<ClInclude Include="..\lib\libspeex\os_support.h" />
|
||||
<ClInclude Include="..\lib\libspeex\speex\speex_resampler.h" />
|
||||
<ClInclude Include="..\lib\libspeex\speex\speex_types.h" />
|
||||
<ClInclude Include="..\lib\libspeex\stack_alloc.h" />
|
||||
<ClInclude Include="..\lib\lodepng\lodepng.h" />
|
||||
<ClCompile Include="..\lib\libspeex\resample.c;..\lib\lodepng\lodepng.c">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\audio\audio.c" />
|
||||
<ClCompile Include="..\src\audio\mixer.cpp" />
|
||||
<ClCompile Include="..\src\config.c" />
|
||||
|
@ -99,15 +109,15 @@
|
|||
<ClCompile Include="..\src\windows\new_ride.c" />
|
||||
<ClCompile Include="..\src\windows\options.c" />
|
||||
<ClCompile Include="..\src\windows\park.c" />
|
||||
<ClCompile Include="..\src\windows\peep.c" />
|
||||
<ClCompile Include="..\src\windows\guest.c" />
|
||||
<ClCompile Include="..\src\windows\publisher_credits.c" />
|
||||
<ClCompile Include="..\src\windows\research.c" />
|
||||
<ClCompile Include="..\src\windows\ride.c" />
|
||||
<ClCompile Include="..\src\windows\ride_list.c" />
|
||||
<ClCompile Include="..\src\windows\save_prompt.c" />
|
||||
<ClCompile Include="..\src\windows\scenery.c" />
|
||||
<ClCompile Include="..\src\windows\staff_list.c" />
|
||||
<ClCompile Include="..\src\windows\staff.c" />
|
||||
<ClCompile Include="..\src\windows\staff_peep.c" />
|
||||
<ClCompile Include="..\src\windows\title_exit.c" />
|
||||
<ClCompile Include="..\src\windows\title_logo.c" />
|
||||
<ClCompile Include="..\src\windows\title_menu.c" />
|
||||
|
@ -123,13 +133,6 @@
|
|||
<ClCompile Include="..\src\world\sprite.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\lib\libspeex\arch.h" />
|
||||
<ClInclude Include="..\lib\libspeex\config.h" />
|
||||
<ClInclude Include="..\lib\libspeex\os_support.h" />
|
||||
<ClInclude Include="..\lib\libspeex\speex\speex_resampler.h" />
|
||||
<ClInclude Include="..\lib\libspeex\speex\speex_types.h" />
|
||||
<ClInclude Include="..\lib\libspeex\stack_alloc.h" />
|
||||
<ClInclude Include="..\lib\lodepng\lodepng.h" />
|
||||
<ClInclude Include="..\src\addresses.h" />
|
||||
<ClInclude Include="..\src\audio\audio.h" />
|
||||
<ClInclude Include="..\src\audio\mixer.h" />
|
||||
|
|
|
@ -197,9 +197,6 @@
|
|||
<ClCompile Include="..\src\windows\park.c">
|
||||
<Filter>Source\Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\windows\peep.c">
|
||||
<Filter>Source\Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\windows\publisher_credits.c">
|
||||
<Filter>Source\Windows</Filter>
|
||||
</ClCompile>
|
||||
|
@ -218,12 +215,6 @@
|
|||
<ClCompile Include="..\src\windows\scenery.c">
|
||||
<Filter>Source\Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\windows\staff.c">
|
||||
<Filter>Source\Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\windows\staff_peep.c">
|
||||
<Filter>Source\Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\windows\title_exit.c">
|
||||
<Filter>Source\Windows</Filter>
|
||||
</ClCompile>
|
||||
|
@ -356,12 +347,6 @@
|
|||
<ClCompile Include="..\src\localisation\localisation.c">
|
||||
<Filter>Source\Localisation</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\lib\lodepng\lodepng.c">
|
||||
<Filter>Libraries\lodepng</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\lib\libspeex\resample.c">
|
||||
<Filter>Libraries\libspeex</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\peep\peep.c">
|
||||
<Filter>Source\Peep</Filter>
|
||||
</ClCompile>
|
||||
|
@ -371,6 +356,25 @@
|
|||
<ClCompile Include="..\src\management\research.c">
|
||||
<Filter>Source\Management</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\lib\lodepng\lodepng.c" />
|
||||
<ClCompile Include="..\lib\lodepng\lodepng.c" />
|
||||
<ClCompile Include="..\lib\libspeex\resample.c">
|
||||
<Filter>Libraries\lodepng</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\lib\lodepng\lodepng.c" />
|
||||
<ClCompile Include="..\lib\libspeex\resample.c">
|
||||
<Filter>Libraries\libspeex</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\lib\lodepng\lodepng.c" />
|
||||
<ClCompile Include="..\src\windows\staff_list.c">
|
||||
<Filter>Source\Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\windows\staff.c">
|
||||
<Filter>Source\Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\windows\guest.c">
|
||||
<Filter>Source\Windows</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\management\award.h">
|
||||
|
|
|
@ -63,7 +63,7 @@ void editor_load()
|
|||
finance_init();
|
||||
date_reset();
|
||||
window_guest_list_init_vars_b();
|
||||
window_staff_init_vars();
|
||||
window_staff_list_init_vars();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_SCENARIO_EDITOR;
|
||||
RCT2_GLOBAL(0x0141F570, uint8) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
|
||||
|
@ -112,7 +112,7 @@ void trackdesigner_load()
|
|||
finance_init();
|
||||
date_reset();
|
||||
window_guest_list_init_vars_b();
|
||||
window_staff_init_vars();
|
||||
window_staff_list_init_vars();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TRACK_DESIGNER;
|
||||
RCT2_GLOBAL(0x0141F570, uint8) = 0;
|
||||
window_new_ride_init_vars();
|
||||
|
@ -150,7 +150,7 @@ void trackmanager_load()
|
|||
finance_init();
|
||||
date_reset();
|
||||
window_guest_list_init_vars_b();
|
||||
window_staff_init_vars();
|
||||
window_staff_list_init_vars();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TRACK_MANAGER;
|
||||
RCT2_GLOBAL(0x0141F570, uint8) = 0;
|
||||
window_new_ride_init_vars();
|
||||
|
|
|
@ -919,7 +919,7 @@ static void game_handle_input_mouse(int x, int y, int state)
|
|||
RCT2_CALLPROC_X(0x6ACAC2, eax, ebx, ecx, (int)spr, esi, edi, ebp);
|
||||
}
|
||||
else if (spr->unknown.sprite_identifier == SPRITE_IDENTIFIER_PEEP){
|
||||
window_peep_open(&spr->peep);
|
||||
window_guest_open(&spr->peep);
|
||||
}
|
||||
else if (spr->unknown.sprite_identifier == SPRITE_IDENTIFIER_FLOATING_TEXT){
|
||||
//Unknown for now
|
||||
|
|
|
@ -472,12 +472,12 @@ void window_track_list_open(ride_list_item item);
|
|||
void window_clear_scenery_open();
|
||||
void window_land_open();
|
||||
void window_water_open();
|
||||
void window_staff_open();
|
||||
void window_staff_list_open();
|
||||
void window_guest_list_open();
|
||||
void window_map_open();
|
||||
void window_options_open();
|
||||
void window_peep_open(rct_peep* peep);
|
||||
void window_staff_peep_open(rct_peep* peep);
|
||||
void window_guest_open(rct_peep* peep);
|
||||
void window_staff_open(rct_peep* peep);
|
||||
void window_park_awards_open();
|
||||
void window_park_entrance_open();
|
||||
void window_park_guests_open();
|
||||
|
@ -506,7 +506,7 @@ void window_align_tabs( rct_window *w, uint8 start_tab_id, uint8 end_tab_id );
|
|||
|
||||
void window_new_ride_init_vars();
|
||||
|
||||
void window_staff_init_vars();
|
||||
void window_staff_list_init_vars();
|
||||
|
||||
void window_event_helper(rct_window* w, short widgetIndex, WINDOW_EVENTS event);
|
||||
void RCT2_CALLPROC_WE_MOUSE_DOWN(int address, int widgetIndex, rct_window*w, rct_widget* widget);
|
||||
|
|
|
@ -181,7 +181,7 @@ void rct2_init()
|
|||
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
|
||||
window_new_ride_init_vars();
|
||||
window_guest_list_init_vars_b();
|
||||
window_staff_init_vars();
|
||||
window_staff_list_init_vars();
|
||||
|
||||
title_load();
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ void title_load()
|
|||
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
|
||||
window_new_ride_init_vars();
|
||||
window_guest_list_init_vars_b();
|
||||
window_staff_init_vars();
|
||||
window_staff_list_init_vars();
|
||||
map_update_tile_pointers(); //RCT2_CALLPROC_EBPSAFE(0x0068AFFD);
|
||||
reset_0x69EBE4();// RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
|
||||
viewport_init_all();
|
||||
|
|
|
@ -281,7 +281,7 @@ static void window_game_top_toolbar_mouseup()
|
|||
window_park_entrance_open();
|
||||
break;
|
||||
case WIDX_STAFF:
|
||||
window_staff_open();
|
||||
window_staff_list_open();
|
||||
break;
|
||||
case WIDX_GUESTS:
|
||||
window_guest_list_open();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -426,7 +426,7 @@ static void window_guest_list_scrollmousedown()
|
|||
|
||||
if (i == 0) {
|
||||
// Open guest window
|
||||
window_peep_open(peep);
|
||||
window_guest_open(peep);
|
||||
|
||||
break;
|
||||
} else {
|
||||
|
|
|
@ -3074,7 +3074,7 @@ static void window_ride_locate_mechanic(rct_window *w)
|
|||
|
||||
peep = ride_get_assigned_mechanic(ride);
|
||||
if (peep != NULL) {
|
||||
window_staff_peep_open(peep);
|
||||
window_staff_open(peep);
|
||||
} else {
|
||||
// Presumebly looks for the closest mechanic
|
||||
RCT2_CALLPROC_X(0x006B1B3E, 0, w->number * 0x260, 0, 0, (int)w, 0, 0);
|
||||
|
|
1135
src/windows/staff.c
1135
src/windows/staff.c
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,654 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (c) 2014 Maciek Baron, Dániel Tar
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include "../addresses.h"
|
||||
#include "../game.h"
|
||||
#include "../drawing/drawing.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../interface/widget.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../peep/peep.h"
|
||||
#include "../peep/staff.h"
|
||||
#include "../world/sprite.h"
|
||||
#include "dropdown.h"
|
||||
|
||||
enum {
|
||||
WINDOW_STAFF_LIST_TAB_HANDYMEN,
|
||||
WINDOW_STAFF_LIST_TAB_MECHANICS,
|
||||
WINDOW_STAFF_LIST_TAB_SECURITY,
|
||||
WINDOW_STAFF_LIST_TAB_ENTERTAINERS
|
||||
} WINDOW_STAFF_LIST_TAB;
|
||||
|
||||
static void window_staff_list_emptysub() { }
|
||||
static void window_staff_list_close();
|
||||
static void window_staff_list_mouseup();
|
||||
static void window_staff_list_resize();
|
||||
static void window_staff_list_mousedown(int widgetIndex, rct_window*w, rct_widget* widget);
|
||||
static void window_staff_list_dropdown();
|
||||
static void window_staff_list_update(rct_window *w);
|
||||
static void window_staff_list_tooldown();
|
||||
static void window_staff_list_toolabort();
|
||||
static void window_staff_list_scrollgetsize();
|
||||
static void window_staff_list_scrollmousedown();
|
||||
static void window_staff_list_scrollmouseover();
|
||||
static void window_staff_list_tooltip();
|
||||
static void window_staff_list_invalidate();
|
||||
static void window_staff_list_paint();
|
||||
static void window_staff_list_scrollpaint();
|
||||
|
||||
static void* window_staff_list_events[] = {
|
||||
window_staff_list_close,
|
||||
window_staff_list_mouseup,
|
||||
window_staff_list_resize,
|
||||
window_staff_list_mousedown,
|
||||
window_staff_list_dropdown,
|
||||
window_staff_list_emptysub,
|
||||
window_staff_list_update,
|
||||
window_staff_list_emptysub,
|
||||
window_staff_list_emptysub,
|
||||
window_staff_list_emptysub,
|
||||
(void*)0x006BD990, // window_staff_list_tooldown
|
||||
window_staff_list_emptysub,
|
||||
window_staff_list_emptysub,
|
||||
window_staff_list_toolabort,
|
||||
window_staff_list_emptysub,
|
||||
window_staff_list_scrollgetsize,
|
||||
window_staff_list_scrollmousedown,
|
||||
window_staff_list_emptysub,
|
||||
window_staff_list_scrollmouseover,
|
||||
window_staff_list_emptysub,
|
||||
window_staff_list_emptysub,
|
||||
window_staff_list_emptysub,
|
||||
window_staff_list_tooltip,
|
||||
window_staff_list_emptysub,
|
||||
window_staff_list_emptysub,
|
||||
window_staff_list_invalidate,
|
||||
window_staff_list_paint,
|
||||
window_staff_list_scrollpaint,
|
||||
};
|
||||
|
||||
enum WINDOW_STAFF_LIST_WIDGET_IDX {
|
||||
WIDX_STAFF_LIST_BACKGROUND,
|
||||
WIDX_STAFF_LIST_TITLE,
|
||||
WIDX_STAFF_LIST_CLOSE,
|
||||
WIDX_STAFF_LIST_TAB_CONTENT_PANEL,
|
||||
WIDX_STAFF_LIST_HANDYMEN_TAB,
|
||||
WIDX_STAFF_LIST_MECHANICS_TAB,
|
||||
WIDX_STAFF_LIST_SECURITY_TAB,
|
||||
WIDX_STAFF_LIST_ENTERTAINERS_TAB,
|
||||
WIDX_STAFF_LIST_LIST,
|
||||
WIDX_STAFF_LIST_UNIFORM_COLOR_PICKER,
|
||||
WIDX_STAFF_LIST_HIRE_BUTTON,
|
||||
WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON,
|
||||
WIDX_STAFF_LIST_MAP,
|
||||
};
|
||||
|
||||
static rct_widget window_staff_list_widgets[] = {
|
||||
{ WWT_FRAME, 0, 0, 319, 0, 269, 0x0FFFFFFFF, STR_NONE }, // panel / background
|
||||
{ WWT_CAPTION, 0, 1, 318, 1, 14, STR_STAFF, STR_WINDOW_TITLE_TIP }, // title bar
|
||||
{ WWT_CLOSEBOX, 0, 307, 317, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close button
|
||||
{ WWT_RESIZE, 1, 0, 319, 43, 269, 0x0FFFFFFFF, STR_NONE }, // tab content panel
|
||||
{ WWT_TAB, 1, 3, 33, 17, 43, 0x02000144E, STR_STAFF_HANDYMEN_TAB_TIP }, // handymen tab
|
||||
{ WWT_TAB, 1, 34, 64, 17, 43, 0x02000144E, STR_STAFF_MECHANICS_TAB_TIP }, // mechanics tab
|
||||
{ WWT_TAB, 1, 65, 95, 17, 43, 0x02000144E, STR_STAFF_SECURITY_TAB_TIP }, // security guards tab
|
||||
{ WWT_TAB, 1, 96, 126, 17, 43, 0x02000144E, STR_STAFF_ENTERTAINERS_TAB_TIP }, // entertainers tab
|
||||
{ WWT_SCROLL, 1, 3, 316, 72, 266, 3, STR_NONE }, // staff list
|
||||
{ WWT_COLORBTN, 1, 130, 141, 58, 69, STR_NONE, STR_UNIFORM_COLOUR_TIP }, // uniform color picker
|
||||
{ WWT_DROPDOWN_BUTTON, 0, 165, 309, 17, 29, STR_NONE, STR_HIRE_STAFF_TIP }, // hire button
|
||||
{ WWT_FLATBTN, 1, 267, 290, 46, 69, 5175, STR_SHOW_PATROL_AREA_TIP }, // show staff patrol area tool
|
||||
{ WWT_FLATBTN, 1, 291, 314, 46, 69, 5192, STR_SHOW_STAFF_ON_MAP_TIP }, // show staff on map button
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
static uint16 _window_staff_list_selected_type_count = 0;
|
||||
// TODO: These are still referenced in non-decompiled code
|
||||
//static int _window_staff_list_highlighted_index;
|
||||
//static int _window_staff_list_selected_tab;
|
||||
|
||||
/*
|
||||
* rct2: 0x006BD39C
|
||||
**/
|
||||
void window_staff_list_init_vars()
|
||||
{
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) = WINDOW_STAFF_LIST_TAB_HANDYMEN;
|
||||
}
|
||||
|
||||
/*
|
||||
* rct2: 0x006BD3CC
|
||||
**/
|
||||
void window_staff_list_open()
|
||||
{
|
||||
rct_window* window;
|
||||
|
||||
// Check if window is already open
|
||||
window = window_bring_to_front_by_id(WC_STAFF_LIST, 0);
|
||||
if (window != NULL)
|
||||
return;
|
||||
|
||||
window = window_create_auto_pos(320, 270, (uint32*)window_staff_list_events, WC_STAFF_LIST, 0x0400);
|
||||
window->widgets = window_staff_list_widgets;
|
||||
window->enabled_widgets =
|
||||
(1 << WIDX_STAFF_LIST_CLOSE) |
|
||||
(1 << WIDX_STAFF_LIST_HANDYMEN_TAB) |
|
||||
(1 << WIDX_STAFF_LIST_MECHANICS_TAB) |
|
||||
(1 << WIDX_STAFF_LIST_SECURITY_TAB) |
|
||||
(1 << WIDX_STAFF_LIST_ENTERTAINERS_TAB) |
|
||||
(1 << WIDX_STAFF_LIST_HIRE_BUTTON) |
|
||||
(1 << WIDX_STAFF_LIST_UNIFORM_COLOR_PICKER) |
|
||||
(1 << WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON) |
|
||||
(1 << WIDX_STAFF_LIST_MAP);
|
||||
|
||||
window_init_scroll_widgets(window);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_STAFF_HIGHLIGHTED_INDEX, short) = -1;
|
||||
window->list_information_type = 0;
|
||||
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_UNIFORM_COLOR_PICKER].type = WWT_EMPTY;
|
||||
window->min_width = 320;
|
||||
window->min_height = 270;
|
||||
window->max_width = 500;
|
||||
window->max_height = 450;
|
||||
window->flags |= WF_RESIZABLE;
|
||||
window->colours[0] = 1;
|
||||
window->colours[1] = 4;
|
||||
window->colours[2] = 4;
|
||||
}
|
||||
|
||||
void window_staff_list_cancel_tools(rct_window *w) {
|
||||
int toolWindowClassification = RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass);
|
||||
int toolWindowNumber = RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber);
|
||||
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
|
||||
if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
|
||||
tool_cancel();
|
||||
}
|
||||
|
||||
/*
|
||||
* rct2: 0x006BD9B1
|
||||
**/
|
||||
void window_staff_list_close() {
|
||||
rct_window *w;
|
||||
|
||||
window_get_register(w);
|
||||
|
||||
window_staff_list_cancel_tools(w);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BD94C
|
||||
*/
|
||||
static void window_staff_list_mouseup()
|
||||
{
|
||||
short widgetIndex;
|
||||
rct_window *w;
|
||||
uint16 newStaffId;
|
||||
|
||||
window_widget_get_registers(w, widgetIndex);
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_STAFF_LIST_CLOSE:
|
||||
window_close(w);
|
||||
break;
|
||||
case WIDX_STAFF_LIST_HIRE_BUTTON:
|
||||
newStaffId = hire_new_staff_member(RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8));
|
||||
|
||||
if (newStaffId == 0xFFFF) {
|
||||
rct_window* window = window_find_by_id(WC_STAFF_LIST, 0);
|
||||
window_invalidate(window);
|
||||
} else {
|
||||
window_staff_open(&g_sprite_list[newStaffId].peep);
|
||||
}
|
||||
|
||||
break;
|
||||
case WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON:
|
||||
RCT2_CALLPROC_X(0x006BD9FF, 0, 0, 0, widgetIndex, (int)w, 0, 0);
|
||||
|
||||
// TODO: The code below works, but due to some funny things, when clicking again on the show patrol area button to disable the tool,
|
||||
// the mouseup event is getting called when it should not be
|
||||
//tool_set(w, WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON, 0x0C);
|
||||
//show_gridlines();
|
||||
//RCT2_GLOBAL(0x009DEA50, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) | 0x8000;
|
||||
//gfx_invalidate_screen();
|
||||
break;
|
||||
case WIDX_STAFF_LIST_MAP:
|
||||
window_map_open();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BDD5D
|
||||
*/
|
||||
static void window_staff_list_resize()
|
||||
{
|
||||
rct_window *w;
|
||||
|
||||
window_get_register(w);
|
||||
|
||||
w->min_width = 320;
|
||||
w->min_height = 270;
|
||||
if (w->width < w->min_width) {
|
||||
w->width = w->min_width;
|
||||
window_invalidate(w);
|
||||
}
|
||||
if (w->height < w->min_height) {
|
||||
w->height = w->min_height;
|
||||
window_invalidate(w);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BD971
|
||||
*/
|
||||
static void window_staff_list_mousedown(int widgetIndex, rct_window* w, rct_widget* widget)
|
||||
{
|
||||
short newSelectedTab;
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_STAFF_LIST_HANDYMEN_TAB:
|
||||
case WIDX_STAFF_LIST_MECHANICS_TAB:
|
||||
case WIDX_STAFF_LIST_SECURITY_TAB:
|
||||
case WIDX_STAFF_LIST_ENTERTAINERS_TAB:
|
||||
newSelectedTab = widgetIndex - WIDX_STAFF_LIST_HANDYMEN_TAB;;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) == newSelectedTab)
|
||||
break;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) = (uint8)newSelectedTab;
|
||||
window_invalidate(w);
|
||||
w->scrolls[0].v_top = 0;
|
||||
window_staff_list_cancel_tools(w);
|
||||
break;
|
||||
case WIDX_STAFF_LIST_UNIFORM_COLOR_PICKER:
|
||||
window_dropdown_show_colour(w, widget, w->colours[1], RCT2_ADDRESS(RCT2_ADDRESS_HANDYMAN_COLOUR, uint8)[RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8)]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BD9A6
|
||||
*/
|
||||
static void window_staff_list_dropdown()
|
||||
{
|
||||
rct_window* w;
|
||||
short widgetIndex, dropdownIndex;
|
||||
window_dropdown_get_registers(w, widgetIndex, dropdownIndex);
|
||||
|
||||
if (widgetIndex == WIDX_STAFF_LIST_UNIFORM_COLOR_PICKER && dropdownIndex != -1) {
|
||||
update_staff_colour(RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8), dropdownIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BDCEA
|
||||
*/
|
||||
void window_staff_list_update(rct_window *w)
|
||||
{
|
||||
int spriteIndex;
|
||||
rct_peep *peep;
|
||||
|
||||
w->list_information_type++;
|
||||
if (w->list_information_type >= 24) {
|
||||
w->list_information_type = 0;
|
||||
} else {
|
||||
widget_invalidate(WC_GUEST_LIST, 0, WIDX_STAFF_LIST_HANDYMEN_TAB + RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8));
|
||||
RCT2_GLOBAL(0x009AC861, uint16) |= 2;
|
||||
FOR_ALL_PEEPS(spriteIndex, peep) {
|
||||
if (peep->type == PEEP_TYPE_STAFF) {
|
||||
peep->var_0C &= 0xFDFF;
|
||||
|
||||
if (peep->staff_type == RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8)) {
|
||||
peep->var_0C &= 0x200;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BD99B
|
||||
*/
|
||||
void window_staff_list_toolabort() {
|
||||
short widgetIndex;
|
||||
rct_window *w;
|
||||
|
||||
window_widget_get_registers(w, widgetIndex);
|
||||
|
||||
if (widgetIndex == WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON) {
|
||||
hide_gridlines();
|
||||
tool_cancel();
|
||||
RCT2_GLOBAL(0x009DEA50, sint16) = 0xFFFF;
|
||||
gfx_invalidate_screen();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BDBE6
|
||||
*/
|
||||
void window_staff_list_scrollgetsize() {
|
||||
int spriteIndex;
|
||||
rct_peep *peep;
|
||||
rct_window *w;
|
||||
|
||||
window_get_register(w);
|
||||
|
||||
uint16 staffCount = 0;
|
||||
FOR_ALL_PEEPS(spriteIndex, peep) {
|
||||
if (peep->type == PEEP_TYPE_STAFF && peep->staff_type == RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8))
|
||||
staffCount++;
|
||||
}
|
||||
|
||||
_window_staff_list_selected_type_count = staffCount;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_STAFF_HIGHLIGHTED_INDEX, short) != -1) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_STAFF_HIGHLIGHTED_INDEX, short) = -1;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
int scrollHeight = staffCount * 10;
|
||||
int i = scrollHeight - window_staff_list_widgets[WIDX_STAFF_LIST_LIST].bottom + window_staff_list_widgets[WIDX_STAFF_LIST_LIST].top + 21;
|
||||
if (i < 0)
|
||||
i = 0;
|
||||
if (i < w->scrolls[0].v_top) {
|
||||
w->scrolls[0].v_top = i;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
__asm mov ecx, 420
|
||||
#else
|
||||
__asm__("mov ecx, 420 ");
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
__asm mov edx, scrollHeight
|
||||
#else
|
||||
__asm__("mov edx, %[scrollHeight] " : [scrollHeight] "+m" (scrollHeight));
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BDC9A
|
||||
*/
|
||||
void window_staff_list_scrollmousedown() {
|
||||
int i, spriteIndex;
|
||||
short x, y;
|
||||
rct_window *w;
|
||||
rct_peep *peep;
|
||||
|
||||
window_scrollmouse_get_registers(w, x, y);
|
||||
|
||||
i = y / 10;
|
||||
FOR_ALL_PEEPS(spriteIndex, peep) {
|
||||
if (peep->type != PEEP_TYPE_STAFF)
|
||||
continue;
|
||||
|
||||
if (peep->staff_type != RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8))
|
||||
continue;
|
||||
|
||||
if (i == 0) {
|
||||
window_staff_open(peep);
|
||||
break;
|
||||
}
|
||||
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BDC6B
|
||||
*/
|
||||
void window_staff_list_scrollmouseover() {
|
||||
int i;
|
||||
short x, y;
|
||||
rct_window *w;
|
||||
|
||||
window_scrollmouse_get_registers(w, x, y);
|
||||
|
||||
i = y / 10;
|
||||
if (i != RCT2_GLOBAL(RCT2_ADDRESS_STAFF_HIGHLIGHTED_INDEX, short)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_STAFF_HIGHLIGHTED_INDEX, short) = i;
|
||||
window_invalidate(w);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BDC90
|
||||
*/
|
||||
void window_staff_list_tooltip()
|
||||
{
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = STR_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BD477
|
||||
*/
|
||||
void window_staff_list_invalidate()
|
||||
{
|
||||
rct_window *w;
|
||||
|
||||
window_get_register(w);
|
||||
|
||||
int pressed_widgets = w->pressed_widgets & 0xFFFFFF0F;
|
||||
uint8 tabIndex = RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8);
|
||||
uint8 widgetIndex = tabIndex + 4;
|
||||
|
||||
w->pressed_widgets = pressed_widgets | (1 << widgetIndex);
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_HIRE_BUTTON].image = STR_HIRE_HANDYMAN + tabIndex;
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_UNIFORM_COLOR_PICKER].type = WWT_EMPTY;
|
||||
|
||||
if (tabIndex < 3) {
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_UNIFORM_COLOR_PICKER].type = WWT_COLORBTN;
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_UNIFORM_COLOR_PICKER].image =
|
||||
((uint32)RCT2_ADDRESS(RCT2_ADDRESS_HANDYMAN_COLOUR, uint8)[tabIndex] << 19) +
|
||||
0x600013C3;
|
||||
}
|
||||
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_BACKGROUND].right = w->width - 1;
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_BACKGROUND].bottom = w->height - 1;
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_TAB_CONTENT_PANEL].right = w->width - 1;
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_TAB_CONTENT_PANEL].bottom = w->height - 1;
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_TITLE].right = w->width - 2;
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_CLOSE].left = w->width - 2 - 0x0B;
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_CLOSE].right = w->width - 2 - 0x0B + 0x0A;
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_LIST].right = w->width - 4;
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_LIST].bottom = w->height - 0x0F;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BD533
|
||||
*/
|
||||
void window_staff_list_paint() {
|
||||
int i;
|
||||
uint8 selectedTab;
|
||||
rct_window *w;
|
||||
rct_drawpixelinfo *dpi;
|
||||
|
||||
window_paint_get_registers(w, dpi);
|
||||
|
||||
// Widgets
|
||||
window_draw_widgets(w, dpi);
|
||||
|
||||
selectedTab = RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8);
|
||||
|
||||
// Handymen tab image
|
||||
i = (selectedTab == 0 ? w->list_information_type & 0x0FFFFFFFC : 0);
|
||||
i += RCT2_ADDRESS(RCT2_GLOBAL(0x00982710, int), int)[0] + 1;
|
||||
i |= 0x20000000;
|
||||
i |= RCT2_GLOBAL(RCT2_ADDRESS_HANDYMAN_COLOUR, uint8) << 19;
|
||||
gfx_draw_sprite(
|
||||
dpi,
|
||||
i,
|
||||
(window_staff_list_widgets[WIDX_STAFF_LIST_HANDYMEN_TAB].left + window_staff_list_widgets[WIDX_STAFF_LIST_HANDYMEN_TAB].right) / 2 + w->x,
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_HANDYMEN_TAB].bottom - 6 + w->y, 0
|
||||
);
|
||||
|
||||
// Handymen tab image
|
||||
i = (selectedTab == 1 ? w->list_information_type & 0x0FFFFFFFC : 0);
|
||||
i += RCT2_ADDRESS(RCT2_GLOBAL(0x00982718, int), int)[0] + 1;
|
||||
i |= 0x20000000;
|
||||
i |= RCT2_GLOBAL(RCT2_ADDRESS_MECHANIC_COLOUR, uint8) << 19;
|
||||
gfx_draw_sprite(
|
||||
dpi,
|
||||
i,
|
||||
(window_staff_list_widgets[WIDX_STAFF_LIST_MECHANICS_TAB].left + window_staff_list_widgets[WIDX_STAFF_LIST_MECHANICS_TAB].right) / 2 + w->x,
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_MECHANICS_TAB].bottom - 6 + w->y, 0
|
||||
);
|
||||
|
||||
// Security tab image
|
||||
i = (selectedTab == 2 ? w->list_information_type & 0x0FFFFFFFC : 0);
|
||||
i += RCT2_ADDRESS(RCT2_GLOBAL(0x00982720, int), int)[0] + 1;
|
||||
i |= 0x20000000;
|
||||
i |= RCT2_GLOBAL(RCT2_ADDRESS_SECURITY_COLOUR, uint8) << 19;
|
||||
gfx_draw_sprite(
|
||||
dpi,
|
||||
i,
|
||||
(window_staff_list_widgets[WIDX_STAFF_LIST_SECURITY_TAB].left + window_staff_list_widgets[WIDX_STAFF_LIST_SECURITY_TAB].right) / 2 + w->x,
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_SECURITY_TAB].bottom - 6 + w->y, 0
|
||||
);
|
||||
|
||||
rct_drawpixelinfo* sprite_dpi = clip_drawpixelinfo(
|
||||
dpi,
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].left + w->x + 1,
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].right - window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].left - 1,
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].top + w->y + 1,
|
||||
window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].bottom - window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].top - 1
|
||||
);
|
||||
|
||||
|
||||
|
||||
if (sprite_dpi != NULL) {
|
||||
// Entertainers tab image
|
||||
i = (selectedTab == 3 ? w->list_information_type & 0x0FFFFFFFC : 0);
|
||||
i += RCT2_ADDRESS(RCT2_GLOBAL(0x00982738, int), int)[0] + 1;
|
||||
gfx_draw_sprite(
|
||||
sprite_dpi,
|
||||
i,
|
||||
0x0F,
|
||||
0x17, 0
|
||||
);
|
||||
rct2_free(sprite_dpi);
|
||||
}
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)) {
|
||||
RCT2_GLOBAL(0x013CE952, uint32) = RCT2_ADDRESS(0x00992A00, uint16)[selectedTab];
|
||||
gfx_draw_string_left(dpi, 1858, (void*)0x013CE952, 0, w->x + 0xA5, w->y + 0x20);
|
||||
}
|
||||
|
||||
if (selectedTab < 3) {
|
||||
gfx_draw_string_left(dpi, STR_UNIFORM_COLOUR, w, 0, w->x + 6, window_staff_list_widgets[WIDX_STAFF_LIST_UNIFORM_COLOR_PICKER].top + w->y + 1);
|
||||
}
|
||||
|
||||
int staffTypeStringId = 1859 + selectedTab;
|
||||
// If the number of staff for a given type is 1, we use the singular forms of the names
|
||||
if (_window_staff_list_selected_type_count == 1) {
|
||||
staffTypeStringId += 4;
|
||||
}
|
||||
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = _window_staff_list_selected_type_count;
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint16) = staffTypeStringId;
|
||||
|
||||
gfx_draw_string_left(dpi, STR_STAFF_LIST_COUNTER, (void*)0x013CE952, 0, w->x + 4, window_staff_list_widgets[WIDX_STAFF_LIST_LIST].bottom + w->y + 2);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BD785
|
||||
*/
|
||||
void window_staff_list_scrollpaint()
|
||||
{
|
||||
int spriteIndex, y, i, staffOrderIcon_x, staffOrders, staffOrderSprite;
|
||||
uint32 argument_1, argument_2;
|
||||
uint8 selectedTab;
|
||||
rct_window *w;
|
||||
rct_drawpixelinfo *dpi;
|
||||
rct_peep *peep;
|
||||
|
||||
window_paint_get_registers(w, dpi);
|
||||
|
||||
gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, ((char*)0x0141FC48)[w->colours[1] * 8]);
|
||||
|
||||
y = 0;
|
||||
i = 0;
|
||||
selectedTab = RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8);
|
||||
FOR_ALL_PEEPS(spriteIndex, peep) {
|
||||
if (peep->type == PEEP_TYPE_STAFF && peep->staff_type == selectedTab) {
|
||||
if (y > dpi->y + dpi->height) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (y + 11 >= dpi->y) {
|
||||
int format = 0x4A7;
|
||||
|
||||
if (i == RCT2_GLOBAL(RCT2_ADDRESS_STAFF_HIGHLIGHTED_INDEX, short)) {
|
||||
gfx_fill_rect(dpi, 0, y, 800, y + 9, 0x2000031);
|
||||
format = 0x4A9;
|
||||
}
|
||||
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = peep->name_string_idx;
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint32) = peep->id;
|
||||
gfx_draw_string_left_clipped(dpi, format, (void*)0x013CE952, 0, 0, y - 1, 107);
|
||||
|
||||
get_arguments_from_action(peep, &argument_1, &argument_2);
|
||||
RCT2_GLOBAL(0x013CE952, uint32) = argument_1;
|
||||
RCT2_GLOBAL(0x013CE952 + 4, uint32) = argument_2;
|
||||
gfx_draw_string_left_clipped(dpi, format, (void*)0x013CE952, 0, 175, y - 1, 305);
|
||||
|
||||
// True if a patrol path is set for the worker
|
||||
if (RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[peep->staff_id] & 2) {
|
||||
gfx_draw_sprite(dpi, 0x13FD, 110, y - 1, 0);
|
||||
}
|
||||
|
||||
staffOrderIcon_x = 0x7D;
|
||||
if (peep->staff_type != 3) {
|
||||
staffOrders = peep->var_C6;
|
||||
staffOrderSprite = RCT2_ADDRESS(0x00992A08, uint32)[selectedTab];
|
||||
|
||||
while (staffOrders != 0) {
|
||||
if (staffOrders & 1) {
|
||||
gfx_draw_sprite(dpi, staffOrderSprite, staffOrderIcon_x, y - 1, 0);
|
||||
}
|
||||
staffOrders = staffOrders >> 1;
|
||||
staffOrderIcon_x += 9;
|
||||
staffOrderSprite++;
|
||||
}
|
||||
} else {
|
||||
gfx_draw_sprite(dpi, peep->sprite_type - 4 + 0x13FE, staffOrderIcon_x, y - 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
y += 10;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,711 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../addresses.h"
|
||||
#include "../game.h"
|
||||
#include "../interface/viewport.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"
|
||||
#include "dropdown.h"
|
||||
|
||||
enum WINDOW_STAFF_PEEP_PAGE {
|
||||
WINDOW_STAFF_PEEP_OVERVIEW,
|
||||
WINDOW_STAFF_PEEP_OPTIONS,
|
||||
WINDOW_STAFF_PEEP_STATISTICS,
|
||||
};
|
||||
|
||||
enum WINDOW_STAFF_PEEP_WIDGET_IDX {
|
||||
WIDX_BACKGROUND,
|
||||
WIDX_TITLE,
|
||||
WIDX_CLOSE,
|
||||
WIDX_RESIZE,
|
||||
WIDX_TAB_1,
|
||||
WIDX_TAB_2,
|
||||
WIDX_TAB_3,
|
||||
WIDX_TAB_4,
|
||||
WIDX_VIEWPORT,
|
||||
WIDX_BTM_LABEL,
|
||||
WIDX_PICKUP,
|
||||
WIDX_PATROL,
|
||||
WIDX_RENAME,
|
||||
WIDX_LOCATE,
|
||||
WIDX_FIRE,
|
||||
|
||||
WIDX_CHECKBOX_1 = 0x8,
|
||||
WIDX_CHECKBOX_2,
|
||||
WIDX_CHECKBOX_3,
|
||||
WIDX_CHECKBOX_4,
|
||||
|
||||
WIDX_COSTUME = 0xD,
|
||||
};
|
||||
|
||||
void window_staff_peep_emptysub(){};
|
||||
|
||||
rct_widget window_staff_peep_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
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
rct_widget *window_staff_peep_page_widgets[] = {
|
||||
window_staff_peep_overview_widgets,
|
||||
(rct_widget *)0x9AF910,
|
||||
(rct_widget *)0x9AF9F4
|
||||
};
|
||||
|
||||
void window_staff_peep_set_page(rct_window* w, int page);
|
||||
void window_staff_peep_disable_widgets(rct_window* w);
|
||||
|
||||
void window_staff_peep_overview_close();
|
||||
void window_staff_peep_overview_mouseup();
|
||||
void window_staff_peep_overview_resize();
|
||||
void window_staff_peep_overview_mousedown(int widgetIndex, rct_window* w, rct_widget* widget);
|
||||
void window_staff_peep_overview_dropdown();
|
||||
void window_staff_peep_overview_update(rct_window* w);
|
||||
|
||||
void window_staff_peep_orders_mouseup();
|
||||
void window_staff_peep_orders_update(rct_window* w);
|
||||
|
||||
void window_staff_peep_stats_mouseup();
|
||||
void window_staff_peep_stats_resize();
|
||||
void window_staff_peep_stats_update(rct_window* w);
|
||||
|
||||
// 0x992AEC
|
||||
static void* window_staff_peep_overview_events[] = {
|
||||
window_staff_peep_overview_close,
|
||||
window_staff_peep_overview_mouseup,
|
||||
window_staff_peep_overview_resize,
|
||||
window_staff_peep_overview_mousedown,
|
||||
window_staff_peep_overview_dropdown,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_overview_update,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
(void*)0x6BDFD8,
|
||||
(void*)0x6BDFC3,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
(void*)0x6BDFAE,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
(void*)0x6BDFED,
|
||||
(void*)0x6BE5FC,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
(void*)0x6BDD91, //Invalidate
|
||||
(void*)0x6BDEAF, //Paint
|
||||
window_staff_peep_emptysub
|
||||
};
|
||||
|
||||
// 0x992B5C
|
||||
static void* window_staff_peep_orders_events[] = {
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_orders_mouseup,
|
||||
window_staff_peep_stats_resize,
|
||||
(void*)0x6BE802,
|
||||
(void*)0x6BE809,
|
||||
(void*)0x6BE9DA,
|
||||
window_staff_peep_orders_update,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
(void*)0x6BE62B, //Invalidate
|
||||
(void*)0x6BE7C6, //Paint
|
||||
window_staff_peep_emptysub
|
||||
};
|
||||
|
||||
// 0x992BCC
|
||||
static void* window_staff_peep_stats_events[] = {
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_stats_mouseup,
|
||||
window_staff_peep_stats_resize,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
(void*)0x6BEC80,
|
||||
window_staff_peep_stats_update,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
(void*)0x6BE9E9, //Invalidate
|
||||
(void*)0x6BEA86, //Paint
|
||||
window_staff_peep_emptysub
|
||||
};
|
||||
|
||||
void* window_staff_peep_page_events[] = {
|
||||
window_staff_peep_overview_events,
|
||||
window_staff_peep_orders_events,
|
||||
window_staff_peep_stats_events
|
||||
};
|
||||
|
||||
uint32 window_staff_peep_page_enabled_widgets[] = {
|
||||
(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),
|
||||
|
||||
(1 << WIDX_CLOSE) |
|
||||
(1 << WIDX_TAB_1) |
|
||||
(1 << WIDX_TAB_2) |
|
||||
(1 << WIDX_TAB_3)
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BEE98
|
||||
*/
|
||||
void window_staff_peep_open(rct_peep* peep)
|
||||
{
|
||||
rct_window* w = window_bring_to_front_by_id(WC_PEEP, peep->sprite_index);
|
||||
if (w == NULL) {
|
||||
w = window_create_auto_pos(190, 180, (uint32*)window_staff_peep_overview_events, WC_PEEP, (uint16)0x400);
|
||||
|
||||
w->widgets = RCT2_GLOBAL(0x9AF81C, rct_widget*);
|
||||
w->enabled_widgets = RCT2_GLOBAL(0x9929B0, uint32);
|
||||
w->number = peep->sprite_index;
|
||||
w->page = 0;
|
||||
w->viewport_focus_coordinates.y = 0;
|
||||
w->frame_no = 0;
|
||||
|
||||
RCT2_GLOBAL((int*)w + 0x496, uint16) = 0; // missing, var_494 should perhaps be uint16?
|
||||
|
||||
window_staff_peep_disable_widgets(w);
|
||||
|
||||
w->min_width = 190;
|
||||
w->min_height = 180;
|
||||
w->max_width = 500;
|
||||
w->max_height = 450;
|
||||
|
||||
w->flags = 1 << 8;
|
||||
|
||||
w->colours[0] = 1;
|
||||
w->colours[1] = 4;
|
||||
w->colours[2] = 4;
|
||||
}
|
||||
w->page = 0;
|
||||
window_invalidate(w);
|
||||
|
||||
w->widgets = window_staff_peep_overview_widgets;
|
||||
w->enabled_widgets = window_staff_peep_page_enabled_widgets[0];
|
||||
w->var_020 = RCT2_GLOBAL(0x9929BC, uint32);
|
||||
w->event_handlers = window_staff_peep_page_events[0];
|
||||
w->pressed_widgets = 0;
|
||||
window_staff_peep_disable_widgets(w);
|
||||
window_init_scroll_widgets(w);
|
||||
RCT2_CALLPROC_X(0x006BEDA3, 0, 0, 0, 0, (int)w, 0, 0);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* rct2: 0x006BED21
|
||||
* Disable the staff pickup if not in pickup state.
|
||||
*/
|
||||
void window_staff_peep_disable_widgets(rct_window* w)
|
||||
{
|
||||
rct_peep* peep = &g_sprite_list[w->number].peep;
|
||||
|
||||
int eax = 0 | 0x80;
|
||||
|
||||
if (peep->staff_type == 2) {
|
||||
eax |= 0x20;
|
||||
}
|
||||
|
||||
//RCT2_CALLFUNC_X(0x698827, 0, 0, 0, 0, 0, 0, 0);
|
||||
// sub_698827
|
||||
// This is here due to needing the Carry Flag.
|
||||
|
||||
int CF = 0;
|
||||
int res = RCT2_GLOBAL(0x982004 + peep->state, uint8) & 1;
|
||||
|
||||
if (res == 0) {
|
||||
CF = 1;
|
||||
}
|
||||
else {
|
||||
eax = eax & eax;
|
||||
}
|
||||
|
||||
// end sub_698827
|
||||
|
||||
int a = 0;
|
||||
|
||||
// pop esi
|
||||
if (CF == 1 && w->page == 0) {
|
||||
eax |= 0x400; //or eax, 400h
|
||||
|
||||
a = w->disabled_widgets & (1 << 0xA); //bt dword ptr[esi + 10h], 0Ah
|
||||
|
||||
}
|
||||
|
||||
if (a == 0) {
|
||||
CF = w->disabled_widgets & (1 << 0xA); //bt dword ptr [esi+10h], 0Ah
|
||||
if (CF == 1) {
|
||||
window_invalidate(w);
|
||||
}
|
||||
}
|
||||
|
||||
w->disabled_widgets = eax;
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as window_peep_overview_close.
|
||||
* rct2: 0x006BDFF8
|
||||
*/
|
||||
void window_staff_peep_overview_close()
|
||||
{
|
||||
rct_window* w;
|
||||
|
||||
window_get_register(w);
|
||||
|
||||
if (RCT2_GLOBAL(0x9DE518, uint32) & (1 << 3)){
|
||||
if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) &&
|
||||
w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
|
||||
tool_cancel();
|
||||
}
|
||||
}
|
||||
|
||||
/** rct2: 0x6C0A77 */
|
||||
void window_staff_peep_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
|
||||
*/
|
||||
void window_staff_peep_set_page(rct_window* w, int page)
|
||||
{
|
||||
if (RCT2_GLOBAL(0x9DE518,uint32) & (1 << 3))
|
||||
{
|
||||
if(w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber) &&
|
||||
w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass))
|
||||
tool_cancel();
|
||||
|
||||
}
|
||||
|
||||
int listen = 0;
|
||||
if (page == WINDOW_STAFF_PEEP_OVERVIEW && w->page == WINDOW_STAFF_PEEP_OVERVIEW && w->viewport){
|
||||
if (!(w->viewport->flags & VIEWPORT_FLAG_SOUND_ON))
|
||||
listen = 1;
|
||||
}
|
||||
|
||||
|
||||
w->page = page;
|
||||
w->frame_no = 0;
|
||||
|
||||
rct_viewport* viewport = w->viewport;
|
||||
w->viewport = 0;
|
||||
if (viewport){
|
||||
viewport->width = 0;
|
||||
}
|
||||
|
||||
w->enabled_widgets = window_staff_peep_page_enabled_widgets[page];
|
||||
w->var_020 = RCT2_ADDRESS(0x9929BC, uint32)[page];
|
||||
w->event_handlers = window_staff_peep_page_events[page];
|
||||
w->pressed_widgets = 0;
|
||||
w->widgets = window_staff_peep_page_widgets[page];
|
||||
|
||||
window_staff_peep_disable_widgets(w);
|
||||
window_invalidate(w);
|
||||
|
||||
RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0);
|
||||
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0);
|
||||
|
||||
window_init_scroll_widgets(w);
|
||||
window_invalidate(w);
|
||||
|
||||
if (listen && w->viewport) w->viewport->flags |= VIEWPORT_FLAG_SOUND_ON;
|
||||
}
|
||||
|
||||
/** rct2: 0x006BDF55 */
|
||||
void window_staff_peep_overview_mouseup()
|
||||
{
|
||||
short widgetIndex;
|
||||
rct_window* w;
|
||||
window_widget_get_registers(w, widgetIndex);
|
||||
rct_peep* peep = GET_PEEP(w->number);
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_CLOSE:
|
||||
window_close(w);
|
||||
break;
|
||||
case WIDX_TAB_1:
|
||||
case WIDX_TAB_2:
|
||||
case WIDX_TAB_3:
|
||||
window_staff_peep_set_page(w, widgetIndex - WIDX_TAB_1);
|
||||
break;
|
||||
case WIDX_LOCATE: // 0xD
|
||||
window_scroll_to_viewport(w);
|
||||
break;
|
||||
case WIDX_PICKUP: // 0xA
|
||||
// 0x6BE236
|
||||
if (tool_set(w, widgetIndex, 7)) {
|
||||
return;
|
||||
}
|
||||
|
||||
w->var_48C = peep->sprite_identifier;
|
||||
|
||||
RCT2_CALLPROC_X(0x0069A512, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
RCT2_CALLPROC_X(0x006EC473, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
|
||||
RCT2_CALLPROC_X(0x0069E9D3, 0x8000, 0, peep->y, peep->z, (int)peep, 0, 0);
|
||||
RCT2_CALLPROC_X(0x0069A409, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
peep->state = 9;
|
||||
RCT2_CALLPROC_X(0x0069A42F, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case WIDX_FIRE: // 0xE
|
||||
window_staff_peep_fire(w);
|
||||
break;
|
||||
case WIDX_RENAME: // 0xC
|
||||
// 6BE4BC
|
||||
window_show_textinput(w, (int)widgetIndex, 0xBA1, 0xBA2, peep->name_string_idx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** rct2: 0x006BE558 */
|
||||
void window_staff_peep_overview_resize()
|
||||
{
|
||||
rct_window* w;
|
||||
window_get_register(w);
|
||||
|
||||
window_staff_peep_disable_widgets(w);
|
||||
|
||||
w->min_width = 190;
|
||||
w->max_width = 500;
|
||||
w->min_height = 180;
|
||||
w->max_height = 450;
|
||||
|
||||
if (w->width < w->min_width) {
|
||||
w->width = w->min_width;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
if (w->width > w->max_width) {
|
||||
window_invalidate(w);
|
||||
w->width = w->max_width;
|
||||
}
|
||||
|
||||
if (w->height < w->min_height) {
|
||||
w->height = w->min_height;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
if (w->height > w->max_height) {
|
||||
window_invalidate(w);
|
||||
w->height = w->max_height;
|
||||
}
|
||||
|
||||
rct_viewport* viewport = w->viewport;
|
||||
|
||||
if (viewport) {
|
||||
int new_width = w->width - 30;
|
||||
int new_height = w->height - 62;
|
||||
|
||||
// Update the viewport size
|
||||
if (viewport->width != new_width || viewport->height != new_height) {
|
||||
viewport->width = new_width;
|
||||
viewport->height = new_height;
|
||||
viewport->view_width = new_width << viewport->zoom;
|
||||
viewport->view_height = new_height << viewport->zoom;
|
||||
}
|
||||
}
|
||||
|
||||
RCT2_CALLPROC_X(0x006BEDA3, 0, 0, 0, 0, (int)w, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the dropdown of patrol button.
|
||||
* rct2: 0x006BDF98
|
||||
*/
|
||||
void window_staff_peep_overview_mousedown(int widgetIndex, rct_window* w, rct_widget* widget)
|
||||
{
|
||||
if (widgetIndex != WIDX_PATROL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Dropdown names
|
||||
gDropdownItemsFormat[0] = 0xD75;
|
||||
gDropdownItemsFormat[1] = 0xD76;
|
||||
|
||||
int x = widget->left + w->x;
|
||||
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;
|
||||
|
||||
rct_peep* peep = GET_PEEP(w->number);
|
||||
|
||||
// Disable clear patrol area if no area is set.
|
||||
if (!(RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[peep->staff_id] & 2)) {
|
||||
RCT2_GLOBAL(0x009DED34, sint32) |= 1 << 1;
|
||||
}
|
||||
}
|
||||
|
||||
/** rct2: 0x006BDFA3 */
|
||||
void window_staff_peep_overview_dropdown()
|
||||
{
|
||||
short widgetIndex, dropdownIndex;
|
||||
rct_window* w;
|
||||
|
||||
window_dropdown_get_registers(w, widgetIndex, dropdownIndex);
|
||||
|
||||
if (widgetIndex != WIDX_PATROL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear patrol
|
||||
if (dropdownIndex == 1) {
|
||||
rct_peep* peep = GET_PEEP(w->number);
|
||||
int edi = peep->staff_id;
|
||||
int ebx = edi << 9;
|
||||
|
||||
for (int i = 0; i < 128; i++)
|
||||
{
|
||||
RCT2_GLOBAL(0x13B0E72 + ebx + i * 4, uint32) = 0;
|
||||
}
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_STAFF_MODE_ARRAY + edi, uint16) &= 0xFD; // bug??
|
||||
|
||||
window_invalidate(w);
|
||||
//RCT2_CALLPROC_EBPSAFE(0x006C0C3F);
|
||||
sub_6C0C3F();
|
||||
}
|
||||
else {
|
||||
if (!tool_set(w, widgetIndex, 22)) {
|
||||
show_gridlines();
|
||||
RCT2_GLOBAL(0x009DEA50, sint16) = w->number;
|
||||
window_invalidate(w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the animation frame of the tab icon.
|
||||
* rct2: 0x6BE602
|
||||
*/
|
||||
void window_staff_peep_overview_update(rct_window* w)
|
||||
{
|
||||
int var_496 = RCT2_GLOBAL((int)w + 0x496, uint16);
|
||||
var_496++;
|
||||
if (var_496 >= 24) {
|
||||
var_496 = 0;
|
||||
}
|
||||
RCT2_GLOBAL((int)w + 0x496, uint16) = var_496;
|
||||
window_invalidate_by_id(0x497, w->number);
|
||||
}
|
||||
|
||||
/** rct2: 0x006BE814 */
|
||||
void window_staff_peep_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 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_peep_orders_mouseup()
|
||||
{
|
||||
short widgetIndex;
|
||||
rct_window* w;
|
||||
window_widget_get_registers(w, widgetIndex);
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_CLOSE:
|
||||
window_close(w);
|
||||
break;
|
||||
case WIDX_TAB_1:
|
||||
case WIDX_TAB_2:
|
||||
case WIDX_TAB_3:
|
||||
window_staff_peep_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_peep_set_order(w, widgetIndex - WIDX_CHECKBOX_1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** rct2: 0x006BE960 */
|
||||
void window_staff_peep_orders_update(rct_window* w)
|
||||
{
|
||||
w->frame_no++;
|
||||
window_invalidate_by_id(0x597, w->number);
|
||||
}
|
||||
|
||||
/** rct2: 0x006BEBCF */
|
||||
void window_staff_peep_stats_mouseup()
|
||||
{
|
||||
short widgetIndex;
|
||||
rct_window* w;
|
||||
window_widget_get_registers(w, widgetIndex);
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_CLOSE:
|
||||
window_close(w);
|
||||
break;
|
||||
case WIDX_TAB_1:
|
||||
case WIDX_TAB_2:
|
||||
case WIDX_TAB_3:
|
||||
window_staff_peep_set_page(w, widgetIndex - WIDX_TAB_1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** rct2: 0x006BEC1B and rct2: 0x006BE975 */
|
||||
void window_staff_peep_stats_resize()
|
||||
{
|
||||
rct_window* w;
|
||||
window_get_register(w);
|
||||
|
||||
w->min_width = 190;
|
||||
w->max_width = 190;
|
||||
w->min_height = 119;
|
||||
w->max_height = 119;
|
||||
|
||||
if (w->width < w->min_width) {
|
||||
w->width = w->min_width;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
if (w->width > w->max_width) {
|
||||
window_invalidate(w);
|
||||
w->width = w->max_width;
|
||||
}
|
||||
|
||||
if (w->height < w->min_height) {
|
||||
w->height = w->min_height;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
if (w->height > w->max_height) {
|
||||
window_invalidate(w);
|
||||
w->height = w->max_height;
|
||||
}
|
||||
}
|
||||
|
||||
/** rct2: 0x006BEBEA */
|
||||
void window_staff_peep_stats_update(rct_window* w)
|
||||
{
|
||||
w->frame_no++;
|
||||
window_invalidate_by_id(0x697, w->number);
|
||||
|
||||
rct_peep* peep = GET_PEEP(w->number);
|
||||
if (peep->var_45 & 0x10) {
|
||||
peep->var_45 &= 0xEF;
|
||||
window_invalidate(w);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue