mirror of https://github.com/OpenRCT2/OpenRCT2.git
Move staff and guest windows
This commit is contained in:
parent
8569a7fe2f
commit
eef3bd9af5
|
@ -161,6 +161,8 @@ public:
|
|||
rct_window * OpenIntent(Intent * intent) override
|
||||
{
|
||||
switch(intent->GetWindowClass()) {
|
||||
case WC_PEEP:
|
||||
return window_guest_open((rct_peep*)intent->GetPointerExtra(INTENT_EXTRA_PEEP));
|
||||
case WC_FIRE_PROMPT:
|
||||
return window_staff_fire_prompt_open((rct_peep*)intent->GetPointerExtra(INTENT_EXTRA_PEEP));
|
||||
case WC_INSTALL_TRACK:
|
||||
|
|
|
@ -14,20 +14,21 @@
|
|||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include "../config/Config.h"
|
||||
#include "../network/network.h"
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
|
||||
#include "../game.h"
|
||||
#include "../input.h"
|
||||
#include "../management/marketing.h"
|
||||
#include "../peep/staff.h"
|
||||
#include "../ride/ride_data.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../sprites.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../interface/widget.h"
|
||||
#include "../util/util.h"
|
||||
#include "../world/footpath.h"
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/game.h>
|
||||
#include <openrct2/input.h>
|
||||
#include <openrct2/management/marketing.h>
|
||||
#include <openrct2/peep/staff.h>
|
||||
#include <openrct2/ride/ride_data.h>
|
||||
#include <openrct2/localisation/localisation.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/interface/viewport.h>
|
||||
#include <openrct2/interface/widget.h>
|
||||
#include <openrct2/util/util.h>
|
||||
#include <openrct2/world/footpath.h>
|
||||
|
||||
enum WINDOW_GUEST_PAGE {
|
||||
WINDOW_GUEST_OVERVIEW,
|
||||
|
@ -62,6 +63,7 @@ enum WINDOW_GUEST_WIDGET_IDX {
|
|||
};
|
||||
|
||||
validate_global_widx(WC_PEEP, WIDX_ACTION_LBL);
|
||||
validate_global_widx(WC_PEEP, WIDX_PICKUP);
|
||||
|
||||
static rct_widget window_guest_overview_widgets[] = {
|
||||
{WWT_FRAME, 0, 0, 191, 0, 156, 0xFFFFFFFF, STR_NONE}, // Panel / Background
|
||||
|
@ -473,11 +475,10 @@ static const uint32 window_guest_page_enabled_widgets[] = {
|
|||
* rct2: 0x006989E9
|
||||
*
|
||||
*/
|
||||
void window_guest_open(rct_peep* peep){
|
||||
rct_window * window_guest_open(rct_peep* peep){
|
||||
|
||||
if (peep->type == PEEP_TYPE_STAFF){
|
||||
window_staff_open(peep);
|
||||
return;
|
||||
return window_staff_open(peep);
|
||||
}
|
||||
|
||||
rct_window* window;
|
||||
|
@ -517,6 +518,8 @@ void window_guest_open(rct_peep* peep){
|
|||
window_guest_disable_widgets(window);
|
||||
window_init_scroll_widgets(window);
|
||||
window_guest_viewport_init(window);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -586,25 +589,6 @@ void window_guest_overview_resize(rct_window *w){
|
|||
window_guest_viewport_init(w);
|
||||
}
|
||||
|
||||
void game_command_callback_pickup_guest(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp)
|
||||
{
|
||||
switch(ecx){
|
||||
case 0:{
|
||||
sint32 peepnum = eax;
|
||||
rct_window* w = window_find_by_number(WC_PEEP, peepnum);
|
||||
if (w) {
|
||||
tool_set(w, WIDX_PICKUP, TOOL_PICKER);
|
||||
}
|
||||
}break;
|
||||
case 2:
|
||||
if (ebx == 0) {
|
||||
tool_cancel();
|
||||
gPickupPeepImage = UINT32_MAX;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00696A06
|
|
@ -14,20 +14,22 @@
|
|||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include "../config/Config.h"
|
||||
#include "Intent.h"
|
||||
#include "../Context.h"
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
|
||||
#include "../game.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../interface/widget.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../peep/staff.h"
|
||||
#include "../sprites.h"
|
||||
#include "../world/footpath.h"
|
||||
#include "../input.h"
|
||||
#include "dropdown.h"
|
||||
#include "../interface/themes.h"
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/Context.h>
|
||||
|
||||
#include <openrct2/game.h>
|
||||
#include <openrct2/interface/viewport.h>
|
||||
#include <openrct2/interface/widget.h>
|
||||
#include <openrct2/localisation/localisation.h>
|
||||
#include <openrct2/peep/staff.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/world/footpath.h>
|
||||
#include <openrct2/input.h>
|
||||
#include <openrct2/windows/dropdown.h>
|
||||
#include <openrct2/interface/themes.h>
|
||||
|
||||
#define WW 190
|
||||
#define WH 180
|
||||
|
@ -64,6 +66,7 @@ enum WINDOW_STAFF_WIDGET_IDX {
|
|||
};
|
||||
|
||||
validate_global_widx(WC_PEEP, WIDX_PATROL);
|
||||
validate_global_widx(WC_STAFF, WIDX_PICKUP);
|
||||
|
||||
static rct_widget window_staff_overview_widgets[] = {
|
||||
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0xFFFFFFFF, STR_NONE }, // Panel / Background
|
||||
|
@ -419,25 +422,6 @@ void window_staff_set_page(rct_window* w, sint32 page)
|
|||
if (listen && w->viewport) w->viewport->flags |= VIEWPORT_FLAG_SOUND_ON;
|
||||
}
|
||||
|
||||
void game_command_callback_pickup_staff(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp)
|
||||
{
|
||||
switch(ecx){
|
||||
case 0:{
|
||||
sint32 peepnum = eax;
|
||||
rct_window* w = window_find_by_number(WC_PEEP, peepnum);
|
||||
if (w) {
|
||||
tool_set(w, WIDX_PICKUP, TOOL_PICKER);
|
||||
}
|
||||
}break;
|
||||
case 2:
|
||||
if (ebx == 0) {
|
||||
tool_cancel();
|
||||
gPickupPeepImage = UINT32_MAX;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BDF55
|
|
@ -446,7 +446,11 @@ void window_staff_list_scrollmousedown(rct_window *w, sint32 scrollIndex, sint32
|
|||
if (_quick_fire_mode)
|
||||
game_do_command(peep->x, 1, peep->y, spriteIndex, GAME_COMMAND_FIRE_STAFF_MEMBER, 0, 0);
|
||||
else
|
||||
window_staff_open(peep);
|
||||
{
|
||||
auto intent = Intent(WC_PEEP);
|
||||
intent.putExtra(INTENT_EXTRA_PEEP, peep);
|
||||
context_open_intent(&intent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ rct_window * window_editor_inventions_list_open();
|
|||
rct_window * window_editor_objective_options_open();
|
||||
rct_window * window_editor_scenario_options_open();
|
||||
rct_window * window_footpath_open();
|
||||
rct_window * window_guest_open(rct_peep* peep);
|
||||
rct_window * window_land_open();
|
||||
rct_window * window_land_rights_open();
|
||||
rct_window * window_main_open();
|
||||
|
@ -48,6 +49,7 @@ rct_window * window_server_start_open();
|
|||
rct_window * window_shortcut_change_open(sint32 selected_key);
|
||||
rct_window * window_shortcut_keys_open();
|
||||
rct_window * window_staff_list_open();
|
||||
rct_window * window_staff_open(rct_peep* peep);
|
||||
rct_window * window_themes_open();
|
||||
rct_window * window_title_exit_open();
|
||||
rct_window * window_title_logo_open();
|
||||
|
|
|
@ -131,8 +131,13 @@ sint32 viewport_interaction_left_click(sint32 x, sint32 y)
|
|||
window_ride_open_vehicle(info.vehicle);
|
||||
break;
|
||||
case SPRITE_IDENTIFIER_PEEP:
|
||||
window_guest_open(info.peep);
|
||||
{
|
||||
Intent * intent = intent_create(WC_PEEP);
|
||||
intent_set_pointer(intent, INTENT_EXTRA_PEEP, info.peep);
|
||||
context_open_intent(intent);
|
||||
intent_release(intent);
|
||||
break;
|
||||
}
|
||||
case SPRITE_IDENTIFIER_MISC:
|
||||
if (game_is_not_paused()) {
|
||||
switch (info.sprite->unknown.misc_identifier) {
|
||||
|
|
|
@ -533,6 +533,7 @@ enum {
|
|||
#define WC_WATER__WIDX_PREVIEW 3
|
||||
#define WC_PEEP__WIDX_PATROL 11
|
||||
#define WC_PEEP__WIDX_ACTION_LBL 12
|
||||
#define WC_PEEP__WIDX_PICKUP 13
|
||||
#define WC_TRACK_DESIGN_LIST__WIDX_ROTATE 5
|
||||
#define WC_TRACK_DESIGN_PLACE__WIDX_ROTATE 3
|
||||
#define WC_MAP__WIDX_LAND_TOOL 13
|
||||
|
@ -540,6 +541,7 @@ enum {
|
|||
#define WC_EDITOR_OBJECT_SELECTION__WIDX_TAB_1 4
|
||||
#define WC_CLEAR_SCENERY__WIDX_PREVIEW 3
|
||||
#define WC_LAND_RIGHTS__WIDX_PREVIEW 3
|
||||
#define WC_STAFF__WIDX_PICKUP 10
|
||||
|
||||
enum PROMPT_MODE {
|
||||
PM_SAVE_BEFORE_LOAD = 0,
|
||||
|
@ -708,8 +710,6 @@ void window_top_toolbar_open();
|
|||
void window_game_bottom_toolbar_open();
|
||||
void window_game_bottom_toolbar_invalidate_news_item();
|
||||
void window_track_list_open(ride_list_item item);
|
||||
void window_guest_open(rct_peep* peep);
|
||||
rct_window *window_staff_open(rct_peep* peep);
|
||||
rct_window *window_ride_main_open(sint32 rideIndex);
|
||||
rct_window *window_ride_open_station(sint32 rideIndex, sint32 stationIndex);
|
||||
rct_window *window_ride_open_track(rct_map_element *mapElement);
|
||||
|
|
|
@ -331,9 +331,15 @@ void news_item_open_subject(sint32 type, sint32 subject)
|
|||
break;
|
||||
case NEWS_ITEM_PEEP_ON_RIDE:
|
||||
case NEWS_ITEM_PEEP:
|
||||
{
|
||||
peep = GET_PEEP(subject);
|
||||
window_guest_open(peep);
|
||||
|
||||
Intent * intent = intent_create(WC_PEEP);
|
||||
intent_set_pointer(intent, INTENT_EXTRA_PEEP, peep);
|
||||
context_open_intent(intent);
|
||||
intent_release(intent);
|
||||
break;
|
||||
}
|
||||
case NEWS_ITEM_MONEY:
|
||||
context_open_window(WC_FINANCES);
|
||||
break;
|
||||
|
|
|
@ -367,21 +367,6 @@ void game_command_hire_new_staff_member(sint32* eax, sint32* ebx, sint32* ecx, s
|
|||
edi);
|
||||
}
|
||||
|
||||
void game_command_callback_hire_new_staff_member(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp)
|
||||
{
|
||||
sint32 sprite_index = edi;
|
||||
if (sprite_index == SPRITE_INDEX_NULL)
|
||||
{
|
||||
rct_window *window = window_find_by_class(WC_STAFF_LIST);
|
||||
window_invalidate(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
rct_peep *peep = &get_sprite(sprite_index)->peep;
|
||||
window_staff_open(peep);
|
||||
}
|
||||
}
|
||||
|
||||
/** rct2: 0x00982134 */
|
||||
static const bool peep_slow_walking_types[] = {
|
||||
false, // PEEP_SPRITE_TYPE_NORMAL
|
||||
|
|
|
@ -1665,7 +1665,9 @@ rct_window *window_ride_open_vehicle(rct_vehicle *vehicle)
|
|||
rct_window *w2 = window_find_by_number(WC_PEEP, peepSpriteIndex);
|
||||
if (w2 == nullptr) {
|
||||
rct_peep *peep = &(get_sprite(peepSpriteIndex)->peep);
|
||||
window_guest_open(peep);
|
||||
auto intent = Intent(WC_PEEP);
|
||||
intent.putExtra(INTENT_EXTRA_PEEP, peep);
|
||||
context_open_intent(&intent);
|
||||
openedPeepWindow = 1;
|
||||
|
||||
break;
|
||||
|
@ -3655,7 +3657,11 @@ static void window_ride_locate_mechanic(rct_window *w)
|
|||
if (mechanic == nullptr)
|
||||
context_show_error(STR_UNABLE_TO_LOCATE_MECHANIC, STR_NONE);
|
||||
else
|
||||
window_staff_open(mechanic);
|
||||
{
|
||||
auto intent = Intent(WC_PEEP);
|
||||
intent.putExtra(INTENT_EXTRA_PEEP, mechanic);
|
||||
context_open_intent(&intent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
#pragma endregion
|
||||
|
||||
#include "_legacy.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../peep/staff.h"
|
||||
#include "Intent.h"
|
||||
#include "../Context.h"
|
||||
|
||||
#pragma warning(disable : 4295) // 'identifier': array is too small to include a terminating null character
|
||||
|
||||
|
@ -63,3 +67,69 @@ const rct_object_entry DefaultSelectedObjects[26] = {
|
|||
{ 0x00000087, { "SCGSNOW " }, 0 }, // Snow and Ice Theming
|
||||
{ 0x00000087, { "SCGWATER" }, 0 } // Water Feature Theming
|
||||
};
|
||||
|
||||
void game_command_callback_pickup_guest(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp)
|
||||
{
|
||||
switch (ecx)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
sint32 peepnum = eax;
|
||||
rct_window * w = window_find_by_number(WC_PEEP, peepnum);
|
||||
if (w)
|
||||
{
|
||||
tool_set(w, WC_PEEP__WIDX_PICKUP, TOOL_PICKER);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (ebx == 0)
|
||||
{
|
||||
tool_cancel();
|
||||
gPickupPeepImage = UINT32_MAX;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void game_command_callback_hire_new_staff_member(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp)
|
||||
{
|
||||
sint32 sprite_index = edi;
|
||||
if (sprite_index == SPRITE_INDEX_NULL)
|
||||
{
|
||||
rct_window * window = window_find_by_class(WC_STAFF_LIST);
|
||||
window_invalidate(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
rct_peep * peep = &get_sprite(sprite_index)->peep;
|
||||
Intent * intent = intent_create(WC_PEEP);
|
||||
intent_set_pointer(intent, INTENT_EXTRA_PEEP, peep);
|
||||
context_open_intent(intent);
|
||||
intent_release(intent);
|
||||
}
|
||||
}
|
||||
|
||||
void game_command_callback_pickup_staff(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp)
|
||||
{
|
||||
switch (ecx)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
sint32 peepnum = eax;
|
||||
rct_window * w = window_find_by_number(WC_PEEP, peepnum);
|
||||
if (w)
|
||||
{
|
||||
tool_set(w, WC_STAFF__WIDX_PICKUP, TOOL_PICKER);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (ebx == 0)
|
||||
{
|
||||
tool_cancel();
|
||||
gPickupPeepImage = UINT32_MAX;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue