2014-06-24 23:12:26 +02:00
|
|
|
/*****************************************************************************
|
2019-03-17 08:16:15 +01:00
|
|
|
* Copyright (c) 2014-2019 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-06-24 23:12:26 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2-ui/interface/Viewport.h>
|
|
|
|
#include <openrct2-ui/interface/Widget.h>
|
2017-10-06 23:21:00 +02:00
|
|
|
#include <openrct2-ui/windows/Window.h>
|
2017-10-22 01:22:08 +02:00
|
|
|
#include <openrct2/Context.h>
|
2017-11-30 18:17:06 +01:00
|
|
|
#include <openrct2/Game.h>
|
2017-12-12 14:52:57 +01:00
|
|
|
#include <openrct2/Input.h>
|
2019-03-16 22:25:56 +01:00
|
|
|
#include <openrct2/actions/GuestSetFlagsAction.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>
|
2017-10-11 21:38:26 +02:00
|
|
|
#include <openrct2/management/Marketing.h>
|
2017-10-22 01:22:08 +02:00
|
|
|
#include <openrct2/network/network.h>
|
2017-10-24 09:19:17 +02:00
|
|
|
#include <openrct2/peep/Peep.h>
|
2017-10-13 10:06:36 +02:00
|
|
|
#include <openrct2/peep/Staff.h>
|
2018-01-10 00:00:09 +01:00
|
|
|
#include <openrct2/ride/RideData.h>
|
2018-05-14 19:21:43 +02:00
|
|
|
#include <openrct2/ride/ShopItem.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2/scenario/Scenario.h>
|
2017-10-06 23:21:00 +02:00
|
|
|
#include <openrct2/sprites.h>
|
2017-12-13 13:02:24 +01:00
|
|
|
#include <openrct2/util/Util.h>
|
2017-10-21 16:03:33 +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>
|
2014-06-24 23:12:26 +02:00
|
|
|
|
2018-05-16 20:41:29 +02:00
|
|
|
// clang-format off
|
2014-10-07 20:39:52 +02:00
|
|
|
enum WINDOW_GUEST_PAGE {
|
2017-06-06 23:24:18 +02:00
|
|
|
WINDOW_GUEST_OVERVIEW,
|
|
|
|
WINDOW_GUEST_STATS,
|
|
|
|
WINDOW_GUEST_RIDES,
|
|
|
|
WINDOW_GUEST_FINANCE,
|
|
|
|
WINDOW_GUEST_THOUGHTS,
|
2019-01-01 20:13:18 +01:00
|
|
|
WINDOW_GUEST_INVENTORY,
|
|
|
|
WINDOW_GUEST_DEBUG
|
2014-06-25 19:01:10 +02:00
|
|
|
};
|
|
|
|
|
2014-10-07 20:39:52 +02:00
|
|
|
enum WINDOW_GUEST_WIDGET_IDX {
|
2017-06-06 23:24:18 +02:00
|
|
|
WIDX_BACKGROUND,
|
|
|
|
WIDX_TITLE,
|
|
|
|
WIDX_CLOSE,
|
|
|
|
WIDX_PAGE_BACKGROUND,
|
|
|
|
WIDX_TAB_1,
|
|
|
|
WIDX_TAB_2,
|
|
|
|
WIDX_TAB_3,
|
|
|
|
WIDX_TAB_4,
|
|
|
|
WIDX_TAB_5,
|
|
|
|
WIDX_TAB_6,
|
2019-01-01 20:13:18 +01:00
|
|
|
WIDX_TAB_7,
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-01-01 20:13:18 +01:00
|
|
|
WIDX_MARQUEE = 11,
|
2017-06-06 23:24:18 +02:00
|
|
|
WIDX_VIEWPORT,
|
|
|
|
WIDX_ACTION_LBL,
|
|
|
|
WIDX_PICKUP,
|
|
|
|
WIDX_RENAME,
|
|
|
|
WIDX_LOCATE,
|
|
|
|
WIDX_TRACK,
|
|
|
|
|
2019-01-01 20:13:18 +01:00
|
|
|
WIDX_RIDE_SCROLL = 11
|
2014-06-25 19:01:10 +02:00
|
|
|
};
|
|
|
|
|
2017-10-06 23:21:00 +02:00
|
|
|
validate_global_widx(WC_PEEP, WIDX_PICKUP);
|
2017-05-02 02:01:29 +02:00
|
|
|
|
2019-01-05 14:09:58 +01:00
|
|
|
static constexpr int32_t TabWidth = 30;
|
2019-01-01 20:40:11 +01:00
|
|
|
|
2019-05-04 17:01:51 +02:00
|
|
|
#define MAIN_GUEST_WIDGETS \
|
|
|
|
{ WWT_FRAME, 0, 0, 191, 0, 156, 0xFFFFFFFF, STR_NONE }, /* Panel / Background */ \
|
|
|
|
{ WWT_CAPTION, 0, 1, 190, 1, 14, STR_STRINGID, STR_WINDOW_TITLE_TIP }, /* Title */ \
|
|
|
|
{ WWT_CLOSEBOX, 0, 179, 189, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, /* Close x button */ \
|
|
|
|
{ WWT_RESIZE, 1, 0, 191, 43, 156, 0xFFFFFFFF, STR_NONE }, /* Resize */ \
|
|
|
|
{ WWT_TAB, 1, 3, TabWidth + 3, 17, 43, IMAGE_TYPE_REMAP | SPR_TAB, STR_SHOW_GUEST_VIEW_TIP }, /* Tab 1 */ \
|
|
|
|
{ WWT_TAB, 1, 34, TabWidth + 34, 17, 43, IMAGE_TYPE_REMAP | SPR_TAB, STR_SHOW_GUEST_NEEDS_TIP }, /* Tab 2 */ \
|
|
|
|
{ WWT_TAB, 1, 65, TabWidth + 65, 17, 43, IMAGE_TYPE_REMAP | SPR_TAB, STR_SHOW_GUEST_VISITED_RIDES_TIP }, /* Tab 3 */ \
|
|
|
|
{ WWT_TAB, 1, 96, TabWidth + 96, 17, 43, IMAGE_TYPE_REMAP | SPR_TAB, STR_SHOW_GUEST_FINANCE_TIP }, /* Tab 4 */ \
|
|
|
|
{ WWT_TAB, 1, 127, TabWidth + 127, 17, 43, IMAGE_TYPE_REMAP | SPR_TAB, STR_SHOW_GUEST_THOUGHTS_TIP }, /* Tab 5 */ \
|
|
|
|
{ WWT_TAB, 1, 158, TabWidth + 158, 17, 43, IMAGE_TYPE_REMAP | SPR_TAB, STR_SHOW_GUEST_ITEMS_TIP }, /* Tab 6 */ \
|
|
|
|
{ WWT_TAB, 1, 189, TabWidth + 189, 17, 43, IMAGE_TYPE_REMAP | SPR_TAB, STR_DEBUG_TIP } /* Tab 7 */
|
|
|
|
|
2017-08-06 14:41:13 +02:00
|
|
|
static rct_widget window_guest_overview_widgets[] = {
|
2019-05-04 17:01:51 +02:00
|
|
|
MAIN_GUEST_WIDGETS,
|
|
|
|
{ WWT_LABEL_CENTRED, 1, 3, 166, 45, 56, 0xFFFFFFFF, STR_NONE }, // Label Thought marquee
|
|
|
|
{ WWT_VIEWPORT, 1, 3, 166, 57, 143, 0xFFFFFFFF, STR_NONE }, // Viewport
|
|
|
|
{ WWT_LABEL_CENTRED, 1, 3, 166, 144, 154, 0xFFFFFFFF, STR_NONE }, // Label Action
|
|
|
|
{ WWT_FLATBTN, 1, 167, 190, 45, 68, SPR_PICKUP_BTN, STR_PICKUP_TIP }, // Pickup Button
|
|
|
|
{ WWT_FLATBTN, 1, 167, 190, 69, 92, SPR_RENAME, STR_NAME_GUEST_TIP }, // Rename Button
|
|
|
|
{ WWT_FLATBTN, 1, 167, 190, 93, 116, SPR_LOCATE, STR_LOCATE_SUBJECT_TIP }, // Locate Button
|
|
|
|
{ WWT_FLATBTN, 1, 167, 190, 117, 140, SPR_TRACK_PEEP, STR_TOGGLE_GUEST_TRACKING_TIP }, // Track Button
|
2017-06-06 23:24:18 +02:00
|
|
|
{ WIDGETS_END },
|
2014-06-24 23:12:26 +02:00
|
|
|
};
|
|
|
|
|
2017-08-06 14:41:13 +02:00
|
|
|
static rct_widget window_guest_stats_widgets[] = {
|
2019-05-04 17:01:51 +02:00
|
|
|
MAIN_GUEST_WIDGETS,
|
|
|
|
{ WIDGETS_END },
|
2014-08-25 20:31:53 +02:00
|
|
|
};
|
2014-08-25 17:47:01 +02:00
|
|
|
|
2017-08-06 14:41:13 +02:00
|
|
|
static rct_widget window_guest_rides_widgets[] = {
|
2019-05-04 17:01:51 +02:00
|
|
|
MAIN_GUEST_WIDGETS,
|
|
|
|
{ WWT_SCROLL, 1, 3, 188, 57, 143, SCROLL_VERTICAL, STR_NONE },
|
|
|
|
{ WIDGETS_END },
|
2014-08-26 13:30:06 +02:00
|
|
|
};
|
|
|
|
|
2017-08-06 14:41:13 +02:00
|
|
|
static rct_widget window_guest_finance_widgets[] = {
|
2019-05-04 17:01:51 +02:00
|
|
|
MAIN_GUEST_WIDGETS,
|
|
|
|
{ WIDGETS_END },
|
2014-08-26 13:30:06 +02:00
|
|
|
};
|
|
|
|
|
2017-08-06 14:41:13 +02:00
|
|
|
static rct_widget window_guest_thoughts_widgets[] = {
|
2019-05-04 17:01:51 +02:00
|
|
|
MAIN_GUEST_WIDGETS,
|
|
|
|
{ WIDGETS_END },
|
2014-08-26 13:30:06 +02:00
|
|
|
};
|
|
|
|
|
2017-08-06 14:41:13 +02:00
|
|
|
static rct_widget window_guest_inventory_widgets[] = {
|
2019-05-04 17:01:51 +02:00
|
|
|
MAIN_GUEST_WIDGETS,
|
|
|
|
{ WIDGETS_END },
|
2019-01-01 20:13:18 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static rct_widget window_guest_debug_widgets[] = {
|
2019-05-04 17:01:51 +02:00
|
|
|
MAIN_GUEST_WIDGETS,
|
|
|
|
{ WIDGETS_END },
|
2014-08-26 13:30:06 +02:00
|
|
|
};
|
|
|
|
|
2017-05-15 09:28:43 +02:00
|
|
|
// 0x981D0C
|
2017-08-06 14:41:13 +02:00
|
|
|
static rct_widget *window_guest_page_widgets[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_overview_widgets,
|
|
|
|
window_guest_stats_widgets,
|
|
|
|
window_guest_rides_widgets,
|
|
|
|
window_guest_finance_widgets,
|
|
|
|
window_guest_thoughts_widgets,
|
2019-01-01 20:13:18 +01:00
|
|
|
window_guest_inventory_widgets,
|
|
|
|
window_guest_debug_widgets
|
2014-06-25 19:01:10 +02:00
|
|
|
};
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
static void window_guest_set_page(rct_window* w, int32_t page);
|
2017-08-06 14:41:13 +02:00
|
|
|
static void window_guest_disable_widgets(rct_window* w);
|
|
|
|
static void window_guest_viewport_init(rct_window* w);
|
2019-05-04 18:23:29 +02:00
|
|
|
static void window_guest_common_resize(rct_window* w);
|
|
|
|
static void window_guest_common_invalidate(rct_window* w);
|
2017-08-06 14:41:13 +02:00
|
|
|
|
|
|
|
static void window_guest_overview_close(rct_window *w);
|
|
|
|
static void window_guest_overview_resize(rct_window *w);
|
|
|
|
static void window_guest_overview_mouse_up(rct_window *w, rct_widgetindex widgetIndex);
|
|
|
|
static void window_guest_overview_paint(rct_window *w, rct_drawpixelinfo *dpi);
|
|
|
|
static void window_guest_overview_invalidate(rct_window *w);
|
|
|
|
static void window_guest_overview_viewport_rotate(rct_window *w);
|
|
|
|
static void window_guest_overview_update(rct_window* w);
|
|
|
|
static void window_guest_overview_text_input(rct_window *w, rct_widgetindex widgetIndex, char *text);
|
2018-06-20 17:28:51 +02:00
|
|
|
static void window_guest_overview_tool_update(rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y);
|
|
|
|
static void window_guest_overview_tool_down(rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y);
|
2017-08-06 14:41:13 +02:00
|
|
|
static void window_guest_overview_tool_abort(rct_window *w, rct_widgetindex widgetIndex);
|
|
|
|
|
|
|
|
static void window_guest_mouse_up(rct_window *w, rct_widgetindex widgetIndex);
|
|
|
|
|
|
|
|
static void window_guest_stats_update(rct_window *w);
|
|
|
|
static void window_guest_stats_paint(rct_window *w, rct_drawpixelinfo *dpi);
|
|
|
|
|
|
|
|
static void window_guest_rides_update(rct_window *w);
|
2018-06-20 17:28:51 +02:00
|
|
|
static void window_guest_rides_scroll_get_size(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height);
|
|
|
|
static void window_guest_rides_scroll_mouse_down(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y);
|
|
|
|
static void window_guest_rides_scroll_mouse_over(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y);
|
2017-08-06 14:41:13 +02:00
|
|
|
static void window_guest_rides_invalidate(rct_window *w);
|
|
|
|
static void window_guest_rides_paint(rct_window *w, rct_drawpixelinfo *dpi);
|
2018-06-20 17:28:51 +02:00
|
|
|
static void window_guest_rides_scroll_paint(rct_window *w, rct_drawpixelinfo *dpi, int32_t scrollIndex);
|
2017-08-06 14:41:13 +02:00
|
|
|
|
|
|
|
static void window_guest_finance_update(rct_window *w);
|
|
|
|
static void window_guest_finance_paint(rct_window *w, rct_drawpixelinfo *dpi);
|
|
|
|
|
|
|
|
static void window_guest_thoughts_update(rct_window *w);
|
|
|
|
static void window_guest_thoughts_paint(rct_window *w, rct_drawpixelinfo *dpi);
|
|
|
|
|
|
|
|
static void window_guest_inventory_update(rct_window *w);
|
|
|
|
static void window_guest_inventory_paint(rct_window *w, rct_drawpixelinfo *dpi);
|
2015-07-10 02:39:16 +02:00
|
|
|
|
2019-05-04 16:53:25 +02:00
|
|
|
static void window_guest_debug_update(rct_window *w);
|
2019-01-01 20:13:18 +01:00
|
|
|
static void window_guest_debug_paint(rct_window *w, rct_drawpixelinfo* dpi);
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static rct_window_event_list window_guest_overview_events = {
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_overview_close,
|
|
|
|
window_guest_overview_mouse_up,
|
|
|
|
window_guest_overview_resize,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_overview_update,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_overview_tool_update,
|
|
|
|
window_guest_overview_tool_down,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_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_guest_overview_text_input,
|
2017-06-26 09:56:41 +02:00
|
|
|
window_guest_overview_viewport_rotate,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_overview_invalidate,
|
|
|
|
window_guest_overview_paint,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr
|
2014-06-24 23:12:26 +02:00
|
|
|
};
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static rct_window_event_list window_guest_stats_events = {
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_mouse_up,
|
2019-05-04 18:23:29 +02:00
|
|
|
window_guest_common_resize,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2019-05-04 16:53:25 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_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,
|
2019-05-04 18:23:29 +02:00
|
|
|
window_guest_common_invalidate,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_stats_paint,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr
|
2014-08-25 13:58:59 +02:00
|
|
|
};
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static rct_window_event_list window_guest_rides_events = {
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_mouse_up,
|
2019-05-04 18:23:29 +02:00
|
|
|
window_guest_common_resize,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2019-05-04 16:53:25 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_rides_update,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_rides_scroll_get_size,
|
|
|
|
window_guest_rides_scroll_mouse_down,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_rides_scroll_mouse_over,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2018-08-04 16:24:24 +02:00
|
|
|
nullptr,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_rides_invalidate,
|
|
|
|
window_guest_rides_paint,
|
|
|
|
window_guest_rides_scroll_paint
|
2014-08-25 13:58:59 +02:00
|
|
|
};
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static rct_window_event_list window_guest_finance_events = {
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_mouse_up,
|
2019-05-04 18:23:29 +02:00
|
|
|
window_guest_common_resize,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2019-05-04 16:53:25 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_finance_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,
|
2019-05-04 18:23:29 +02:00
|
|
|
window_guest_common_invalidate,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_finance_paint,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr
|
2014-08-25 13:58:59 +02:00
|
|
|
};
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static rct_window_event_list window_guest_thoughts_events = {
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_mouse_up,
|
2019-05-04 18:23:29 +02:00
|
|
|
window_guest_common_resize,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2019-05-04 16:53:25 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_thoughts_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,
|
2019-05-04 18:23:29 +02:00
|
|
|
window_guest_common_invalidate,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_thoughts_paint,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr
|
2014-08-25 13:58:59 +02:00
|
|
|
};
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static rct_window_event_list window_guest_inventory_events = {
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_mouse_up,
|
2019-05-04 18:23:29 +02:00
|
|
|
window_guest_common_resize,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2019-05-04 16:53:25 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_inventory_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,
|
2019-05-04 18:23:29 +02:00
|
|
|
window_guest_common_invalidate,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_inventory_paint,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr
|
2014-08-25 13:58:59 +02:00
|
|
|
};
|
|
|
|
|
2019-01-01 20:13:18 +01:00
|
|
|
static rct_window_event_list window_guest_debug_events = {
|
2019-05-04 16:53:25 +02:00
|
|
|
nullptr,
|
|
|
|
window_guest_mouse_up,
|
2019-05-04 18:23:29 +02:00
|
|
|
window_guest_common_resize,
|
2019-05-04 16:53:25 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
window_guest_debug_update,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2019-05-04 18:23:29 +02:00
|
|
|
window_guest_common_invalidate,
|
2019-05-04 16:53:25 +02:00
|
|
|
window_guest_debug_paint,
|
|
|
|
nullptr
|
2019-01-01 20:13:18 +01:00
|
|
|
};
|
|
|
|
|
2017-05-15 09:28:43 +02:00
|
|
|
// 0x981D24
|
2015-07-10 02:39:16 +02:00
|
|
|
static rct_window_event_list *window_guest_page_events[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
&window_guest_overview_events,
|
|
|
|
&window_guest_stats_events,
|
|
|
|
&window_guest_rides_events,
|
|
|
|
&window_guest_finance_events,
|
|
|
|
&window_guest_thoughts_events,
|
2019-01-01 20:13:18 +01:00
|
|
|
&window_guest_inventory_events,
|
|
|
|
&window_guest_debug_events
|
2014-06-25 19:01:10 +02:00
|
|
|
};
|
|
|
|
|
2015-05-21 12:28:51 +02:00
|
|
|
void window_guest_set_colours();
|
|
|
|
|
2017-05-15 09:28:43 +02:00
|
|
|
// 0x981D3C
|
2018-06-20 17:28:51 +02:00
|
|
|
static constexpr const uint32_t window_guest_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_TAB_4) |
|
|
|
|
(1 << WIDX_TAB_5) |
|
|
|
|
(1 << WIDX_TAB_6) |
|
2019-01-01 20:13:18 +01:00
|
|
|
(1 << WIDX_TAB_7) |
|
2017-06-06 23:24:18 +02:00
|
|
|
(1 << WIDX_RENAME)|
|
|
|
|
(1 << WIDX_PICKUP)|
|
|
|
|
(1 << WIDX_LOCATE)|
|
|
|
|
(1 << WIDX_TRACK),
|
|
|
|
|
|
|
|
(1 << WIDX_CLOSE) |
|
|
|
|
(1 << WIDX_TAB_1) |
|
|
|
|
(1 << WIDX_TAB_2) |
|
|
|
|
(1 << WIDX_TAB_3) |
|
|
|
|
(1 << WIDX_TAB_4) |
|
|
|
|
(1 << WIDX_TAB_5) |
|
2019-01-01 20:13:18 +01:00
|
|
|
(1 << WIDX_TAB_6) |
|
|
|
|
(1 << WIDX_TAB_7),
|
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_TAB_4) |
|
|
|
|
(1 << WIDX_TAB_5) |
|
|
|
|
(1 << WIDX_TAB_6) |
|
2019-01-01 20:13:18 +01:00
|
|
|
(1 << WIDX_TAB_7) |
|
2017-06-06 23:24:18 +02:00
|
|
|
(1 << WIDX_RIDE_SCROLL),
|
|
|
|
|
|
|
|
(1 << WIDX_CLOSE) |
|
|
|
|
(1 << WIDX_TAB_1) |
|
|
|
|
(1 << WIDX_TAB_2) |
|
|
|
|
(1 << WIDX_TAB_3) |
|
|
|
|
(1 << WIDX_TAB_4) |
|
|
|
|
(1 << WIDX_TAB_5) |
|
2019-01-01 20:13:18 +01:00
|
|
|
(1 << WIDX_TAB_6) |
|
|
|
|
(1 << WIDX_TAB_7),
|
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_TAB_4) |
|
|
|
|
(1 << WIDX_TAB_5) |
|
2019-01-01 20:13:18 +01:00
|
|
|
(1 << WIDX_TAB_6) |
|
|
|
|
(1 << WIDX_TAB_7),
|
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_TAB_4) |
|
|
|
|
(1 << WIDX_TAB_5) |
|
2019-01-01 20:13:18 +01:00
|
|
|
(1 << WIDX_TAB_6) |
|
|
|
|
(1 << WIDX_TAB_7),
|
|
|
|
|
|
|
|
(1 << WIDX_CLOSE) |
|
|
|
|
(1 << WIDX_TAB_1) |
|
|
|
|
(1 << WIDX_TAB_2) |
|
|
|
|
(1 << WIDX_TAB_3) |
|
|
|
|
(1 << WIDX_TAB_4) |
|
|
|
|
(1 << WIDX_TAB_5) |
|
|
|
|
(1 << WIDX_TAB_6) |
|
|
|
|
(1 << WIDX_TAB_7)
|
2014-06-25 19:01:10 +02:00
|
|
|
};
|
2019-05-04 18:23:29 +02:00
|
|
|
|
|
|
|
static constexpr const rct_size16 window_guest_page_sizes[][2] = {
|
|
|
|
{ 192, 159, 500, 450 }, // WINDOW_GUEST_OVERVIEW
|
|
|
|
{ 192, 180, 192, 180 }, // WINDOW_GUEST_STATS
|
|
|
|
{ 192, 180, 500, 400 }, // WINDOW_GUEST_RIDES
|
|
|
|
{ 210, 148, 210, 148 }, // WINDOW_GUEST_FINANCE
|
|
|
|
{ 192, 159, 500, 450 }, // WINDOW_GUEST_THOUGHTS
|
|
|
|
{ 192, 159, 500, 450 }, // WINDOW_GUEST_INVENTORY
|
|
|
|
{ 192, 159, 192, 159 } // WINDOW_GUEST_DEBUG
|
|
|
|
};
|
2018-05-16 20:41:29 +02:00
|
|
|
// clang-format on
|
2014-06-25 19:01:10 +02:00
|
|
|
|
2014-06-24 23:12:26 +02:00
|
|
|
/**
|
2015-12-11 16:38:37 +01:00
|
|
|
*
|
|
|
|
* rct2: 0x006989E9
|
2014-06-24 23:12:26 +02:00
|
|
|
*
|
|
|
|
*/
|
2019-02-28 20:28:58 +01:00
|
|
|
rct_window* window_guest_open(Peep* peep)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
|
|
|
if (peep->type == PEEP_TYPE_STAFF)
|
|
|
|
{
|
2017-10-06 23:21:00 +02:00
|
|
|
return window_staff_open(peep);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rct_window* window;
|
|
|
|
|
|
|
|
window = window_bring_to_front_by_number(WC_PEEP, peep->sprite_index);
|
2018-06-22 23:21:44 +02:00
|
|
|
if (window == nullptr)
|
|
|
|
{
|
2019-01-05 14:14:57 +01:00
|
|
|
int32_t windowWidth = 192;
|
|
|
|
if (gConfigGeneral.debugging_tools)
|
|
|
|
windowWidth += TabWidth;
|
|
|
|
|
|
|
|
window = window_create_auto_pos(windowWidth, 157, &window_guest_overview_events, WC_PEEP, WF_RESIZABLE);
|
2017-06-06 23:24:18 +02:00
|
|
|
window->widgets = window_guest_overview_widgets;
|
|
|
|
window->enabled_widgets = window_guest_page_enabled_widgets[0];
|
|
|
|
window->number = peep->sprite_index;
|
|
|
|
window->page = 0;
|
|
|
|
window->viewport_focus_coordinates.y = 0;
|
|
|
|
window->frame_no = 0;
|
|
|
|
window->list_information_type = 0;
|
|
|
|
window->picked_peep_frame = 0;
|
|
|
|
window->highlighted_item = 0;
|
|
|
|
window_guest_disable_widgets(window);
|
2019-01-05 14:14:57 +01:00
|
|
|
window->min_width = windowWidth;
|
2017-06-06 23:24:18 +02:00
|
|
|
window->min_height = 157;
|
|
|
|
window->max_width = 500;
|
|
|
|
window->max_height = 450;
|
|
|
|
window->no_list_items = 0;
|
|
|
|
window->selected_list_item = -1;
|
|
|
|
|
|
|
|
window->viewport_focus_coordinates.y = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
window->page = 0;
|
|
|
|
window_invalidate(window);
|
|
|
|
|
|
|
|
window->widgets = window_guest_page_widgets[WINDOW_GUEST_OVERVIEW];
|
|
|
|
window->enabled_widgets = window_guest_page_enabled_widgets[WINDOW_GUEST_OVERVIEW];
|
|
|
|
window->hold_down_widgets = 0;
|
|
|
|
window->event_handlers = window_guest_page_events[WINDOW_GUEST_OVERVIEW];
|
|
|
|
window->pressed_widgets = 0;
|
|
|
|
|
|
|
|
window_guest_disable_widgets(window);
|
|
|
|
window_init_scroll_widgets(window);
|
|
|
|
window_guest_viewport_init(window);
|
2017-10-06 23:21:00 +02:00
|
|
|
|
|
|
|
return window;
|
2014-06-25 13:53:05 +02:00
|
|
|
}
|
2014-08-20 13:36:29 +02:00
|
|
|
|
2019-05-04 18:23:29 +02:00
|
|
|
static void window_guest_common_resize(rct_window* w)
|
|
|
|
{
|
|
|
|
// Get page specific min and max size
|
|
|
|
int32_t minWidth = window_guest_page_sizes[w->page][0].width;
|
|
|
|
int32_t minHeight = window_guest_page_sizes[w->page][0].height;
|
|
|
|
int32_t maxWidth = window_guest_page_sizes[w->page][1].width;
|
|
|
|
int32_t maxHeight = window_guest_page_sizes[w->page][1].height;
|
|
|
|
|
|
|
|
// Ensure min size is large enough for all tabs to fit
|
|
|
|
for (int32_t i = WIDX_TAB_1; i <= WIDX_TAB_7; i++)
|
|
|
|
{
|
|
|
|
if (!(w->disabled_widgets & (1ULL << i)))
|
|
|
|
{
|
|
|
|
minWidth = std::max(minWidth, w->widgets[i].right + 3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
maxWidth = std::max(minWidth, maxWidth);
|
|
|
|
|
|
|
|
window_set_resize(w, minWidth, minHeight, maxWidth, maxHeight);
|
|
|
|
}
|
|
|
|
|
2019-05-04 16:40:45 +02:00
|
|
|
static void window_guest_common_invalidate(rct_window* w)
|
|
|
|
{
|
|
|
|
if (window_guest_page_widgets[w->page] != w->widgets)
|
|
|
|
{
|
|
|
|
w->widgets = window_guest_page_widgets[w->page];
|
|
|
|
window_init_scroll_widgets(w);
|
|
|
|
}
|
|
|
|
|
|
|
|
w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1);
|
|
|
|
|
|
|
|
auto peep = GET_PEEP(w->number);
|
|
|
|
set_format_arg(0, rct_string_id, peep->name_string_idx);
|
|
|
|
set_format_arg(2, uint32_t, peep->id);
|
|
|
|
|
|
|
|
w->widgets[WIDX_BACKGROUND].right = w->width - 1;
|
|
|
|
w->widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
|
|
|
w->widgets[WIDX_PAGE_BACKGROUND].right = w->width - 1;
|
|
|
|
w->widgets[WIDX_PAGE_BACKGROUND].bottom = w->height - 1;
|
|
|
|
w->widgets[WIDX_TITLE].right = w->width - 2;
|
|
|
|
w->widgets[WIDX_CLOSE].left = w->width - 13;
|
|
|
|
w->widgets[WIDX_CLOSE].right = w->width - 3;
|
|
|
|
|
|
|
|
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_7);
|
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
2014-08-23 11:39:15 +02:00
|
|
|
* Disables the finance tab when no money.
|
|
|
|
* Disables peep pickup when in certain no pickup states.
|
2015-12-11 16:38:37 +01:00
|
|
|
* rct2: 0x006987A6
|
2014-08-23 11:39:15 +02:00
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_disable_widgets(rct_window* w)
|
|
|
|
{
|
2019-02-28 20:28:58 +01:00
|
|
|
Peep* peep = &get_sprite(w->number)->peep;
|
2018-06-20 17:28:51 +02:00
|
|
|
uint64_t disabled_widgets = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (peep_can_be_picked_up(peep))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (w->disabled_widgets & (1 << WIDX_PICKUP))
|
|
|
|
window_invalidate(w);
|
|
|
|
}
|
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)))
|
|
|
|
window_invalidate(w);
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
if (gParkFlags & PARK_FLAGS_NO_MONEY)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
disabled_widgets |= (1 << WIDX_TAB_4); // Disable finance tab if no money
|
|
|
|
}
|
2019-01-01 20:18:07 +01:00
|
|
|
if (!gConfigGeneral.debugging_tools)
|
|
|
|
{
|
|
|
|
disabled_widgets |= (1 << WIDX_TAB_7); // Disable debug tab when debug tools not turned on
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
w->disabled_widgets = disabled_widgets;
|
2014-08-23 11:39:15 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x00696A75
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_overview_close(rct_window* w)
|
2015-09-22 19:02:39 +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-20 13:36:29 +02:00
|
|
|
}
|
2014-08-20 13:52:27 +02:00
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x00696FBE
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_overview_resize(rct_window* w)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_disable_widgets(w);
|
|
|
|
window_event_invalidate_call(w);
|
|
|
|
|
|
|
|
widget_invalidate(w, WIDX_MARQUEE);
|
|
|
|
|
2019-05-04 18:23:29 +02:00
|
|
|
window_guest_common_resize(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-05-04 18:23:29 +02:00
|
|
|
auto viewport = w->viewport;
|
|
|
|
if (viewport != nullptr)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2019-05-04 18:23:29 +02:00
|
|
|
auto reqViewportWidth = w->width - 30;
|
|
|
|
auto reqViewportHeight = w->height - 72;
|
|
|
|
if (viewport->width != reqViewportWidth || viewport->height != reqViewportHeight)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2019-05-04 18:23:29 +02:00
|
|
|
uint8_t zoom_amount = 1 << viewport->zoom;
|
|
|
|
viewport->width = reqViewportWidth;
|
|
|
|
viewport->height = reqViewportHeight;
|
|
|
|
viewport->view_width = viewport->width / zoom_amount;
|
|
|
|
viewport->view_height = viewport->height / zoom_amount;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
window_guest_viewport_init(w);
|
2014-08-20 13:52:27 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x00696A06
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_overview_mouse_up(rct_window* w, rct_widgetindex widgetIndex)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2019-02-28 20:28:58 +01:00
|
|
|
Peep* peep = GET_PEEP(w->number);
|
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:
|
|
|
|
case WIDX_TAB_4:
|
|
|
|
case WIDX_TAB_5:
|
|
|
|
case WIDX_TAB_6:
|
2019-01-01 20:13:18 +01:00
|
|
|
case WIDX_TAB_7:
|
2018-06-22 23:21:44 +02:00
|
|
|
window_guest_set_page(w, widgetIndex - WIDX_TAB_1);
|
|
|
|
break;
|
|
|
|
case WIDX_PICKUP:
|
|
|
|
if (!peep_can_be_picked_up(peep))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
w->picked_peep_old_x = peep->x;
|
|
|
|
game_command_callback = game_command_callback_pickup_guest;
|
|
|
|
game_do_command(w->number, GAME_COMMAND_FLAG_APPLY, 0, 0, GAME_COMMAND_PICKUP_GUEST, 0, 0);
|
|
|
|
break;
|
|
|
|
case WIDX_RENAME:
|
|
|
|
window_text_input_open(
|
|
|
|
w, widgetIndex, STR_GUEST_RENAME_TITLE, STR_GUEST_RENAME_PROMPT, peep->name_string_idx, peep->id, 32);
|
|
|
|
break;
|
|
|
|
case WIDX_LOCATE:
|
|
|
|
window_scroll_to_viewport(w);
|
|
|
|
break;
|
|
|
|
case WIDX_TRACK:
|
2019-03-16 22:25:56 +01:00
|
|
|
{
|
|
|
|
uint32_t flags = peep->peep_flags ^ PEEP_FLAGS_TRACKING;
|
|
|
|
|
|
|
|
auto guestSetFlagsAction = GuestSetFlagsAction(w->number, flags);
|
|
|
|
GameActions::Execute(&guestSetFlagsAction);
|
|
|
|
}
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-08-21 14:05:46 +02:00
|
|
|
}
|
2014-08-21 17:45:01 +02:00
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x696AA0
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_set_page(rct_window* w, int32_t page)
|
|
|
|
{
|
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();
|
|
|
|
}
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t listen = 0;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (page == WINDOW_GUEST_OVERVIEW && w->page == WINDOW_GUEST_OVERVIEW && w->viewport)
|
|
|
|
{
|
|
|
|
if (!(w->viewport->flags & VIEWPORT_FLAG_SOUND_ON))
|
2017-06-06 23:24:18 +02:00
|
|
|
listen = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
w->page = page;
|
|
|
|
w->frame_no = 0;
|
|
|
|
w->no_list_items = 0;
|
|
|
|
w->selected_list_item = -1;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
w->enabled_widgets = window_guest_page_enabled_widgets[page];
|
|
|
|
w->hold_down_widgets = 0;
|
|
|
|
w->event_handlers = window_guest_page_events[page];
|
|
|
|
w->pressed_widgets = 0;
|
|
|
|
w->widgets = window_guest_page_widgets[page];
|
|
|
|
window_guest_disable_widgets(w);
|
|
|
|
window_invalidate(w);
|
|
|
|
window_event_resize_call(w);
|
|
|
|
window_event_invalidate_call(w);
|
|
|
|
window_init_scroll_widgets(w);
|
|
|
|
window_invalidate(w);
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (listen && w->viewport)
|
|
|
|
w->viewport->flags |= VIEWPORT_FLAG_SOUND_ON;
|
2014-08-21 17:45:01 +02:00
|
|
|
}
|
2014-08-23 11:39:15 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_overview_viewport_rotate(rct_window* w)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_viewport_init(w);
|
2014-08-27 13:48:29 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0069883C
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_viewport_init(rct_window* w)
|
|
|
|
{
|
|
|
|
if (w->page != WINDOW_GUEST_OVERVIEW)
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-03-09 13:29:33 +01:00
|
|
|
auto peep = GET_PEEP(w->number);
|
|
|
|
if (peep != nullptr)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2019-03-09 13:29:33 +01:00
|
|
|
auto focus = viewport_update_smart_guest_follow(w, peep);
|
|
|
|
bool reCreateViewport = false;
|
|
|
|
uint16_t origViewportFlags{};
|
|
|
|
if (w->viewport != nullptr)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2019-03-09 13:29:33 +01:00
|
|
|
// Check all combos, for now skipping y and rot
|
|
|
|
if (focus.coordinate.x == w->viewport_focus_coordinates.x
|
|
|
|
&& (focus.coordinate.y & VIEWPORT_FOCUS_Y_MASK) == w->viewport_focus_coordinates.y
|
|
|
|
&& focus.coordinate.z == w->viewport_focus_coordinates.z
|
|
|
|
&& focus.coordinate.rotation == w->viewport_focus_coordinates.rotation)
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-03-09 13:29:33 +01:00
|
|
|
origViewportFlags = w->viewport->flags;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-03-09 13:29:33 +01:00
|
|
|
reCreateViewport = true;
|
|
|
|
w->viewport->width = 0;
|
|
|
|
w->viewport = nullptr;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2019-03-09 13:29:33 +01:00
|
|
|
window_event_invalidate_call(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-03-09 13:29:33 +01:00
|
|
|
w->viewport_focus_coordinates.x = focus.coordinate.x;
|
|
|
|
w->viewport_focus_coordinates.y = focus.coordinate.y;
|
|
|
|
w->viewport_focus_coordinates.z = focus.coordinate.z;
|
|
|
|
w->viewport_focus_coordinates.rotation = focus.coordinate.rotation;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-03-09 13:29:33 +01:00
|
|
|
if (peep->state != PEEP_STATE_PICKED && w->viewport == nullptr)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2019-03-09 13:29:33 +01:00
|
|
|
auto view_widget = &w->widgets[WIDX_VIEWPORT];
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t x = view_widget->left + 1 + w->x;
|
|
|
|
int32_t y = view_widget->top + 1 + w->y;
|
|
|
|
int32_t width = view_widget->right - view_widget->left - 1;
|
|
|
|
int32_t height = view_widget->bottom - view_widget->top - 1;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
viewport_create(
|
2018-08-07 16:20:51 +02:00
|
|
|
w, x, y, width, height, 0, focus.coordinate.x, focus.coordinate.y & VIEWPORT_FOCUS_Y_MASK, focus.coordinate.z,
|
2018-07-21 13:51:54 +02:00
|
|
|
focus.sprite.type & VIEWPORT_FOCUS_TYPE_MASK, focus.sprite.sprite_id);
|
2019-03-09 13:29:33 +01:00
|
|
|
if (w->viewport != nullptr && reCreateViewport)
|
|
|
|
{
|
|
|
|
w->viewport->flags = origViewportFlags;
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
w->flags |= WF_NO_SCROLLING;
|
|
|
|
window_invalidate(w);
|
|
|
|
}
|
2019-03-09 13:29:33 +01:00
|
|
|
window_invalidate(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-08-23 13:06:25 +02:00
|
|
|
}
|
|
|
|
|
2014-09-08 19:21:01 +02:00
|
|
|
/**
|
2015-12-11 16:38:37 +01:00
|
|
|
*
|
|
|
|
* rct2: 0x6983dd
|
2014-09-08 19:21:01 +02:00
|
|
|
* used by window_staff as well
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
static void window_guest_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|
|
|
{
|
|
|
|
if (w->disabled_widgets & (1 << WIDX_TAB_1))
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
rct_widget* widget = &w->widgets[WIDX_TAB_1];
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t width = widget->right - widget->left - 1;
|
|
|
|
int32_t height = widget->bottom - widget->top - 1;
|
|
|
|
int32_t x = widget->left + 1 + w->x;
|
|
|
|
int32_t y = widget->top + 1 + w->y;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->page == WINDOW_GUEST_OVERVIEW)
|
|
|
|
height++;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
rct_drawpixelinfo clip_dpi;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (!clip_drawpixelinfo(&clip_dpi, dpi, x, y, width, height))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
x = 14;
|
|
|
|
y = 20;
|
|
|
|
|
2019-02-28 20:28:58 +01:00
|
|
|
Peep* peep = GET_PEEP(w->number);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
if (peep->type == PEEP_TYPE_STAFF && peep->staff_type == STAFF_TYPE_ENTERTAINER)
|
|
|
|
y++;
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t ebx = g_peep_animation_entries[peep->sprite_type].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_GUEST_OVERVIEW)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
eax = w->var_496;
|
|
|
|
eax &= 0xFFFC;
|
|
|
|
}
|
|
|
|
ebx += eax;
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t sprite_id = ebx | SPRITE_ID_PALETTE_COLOUR_2(peep->tshirt_colour, peep->trousers_colour);
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_sprite(&clip_dpi, sprite_id, x, y, 0);
|
|
|
|
|
|
|
|
// 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;
|
2017-07-20 20:56:29 +02:00
|
|
|
ebx |= SPRITE_ID_PALETTE_COLOUR_1(peep->balloon_colour);
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_sprite(&clip_dpi, ebx, x, y, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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;
|
2017-07-20 20:56:29 +02:00
|
|
|
ebx |= SPRITE_ID_PALETTE_COLOUR_1(peep->umbrella_colour);
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_sprite(&clip_dpi, ebx, x, y, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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;
|
2017-07-20 20:56:29 +02:00
|
|
|
ebx |= SPRITE_ID_PALETTE_COLOUR_1(peep->hat_colour);
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_sprite(&clip_dpi, ebx, x, y, 0);
|
|
|
|
}
|
2014-09-08 13:45:38 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x69869b
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
static void window_guest_stats_tab_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (w->disabled_widgets & (1 << WIDX_TAB_2))
|
|
|
|
return;
|
|
|
|
|
|
|
|
rct_widget* widget = &w->widgets[WIDX_TAB_2];
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t x = widget->left + w->x;
|
|
|
|
int32_t y = widget->top + w->y;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-02-28 20:28:58 +01:00
|
|
|
Peep* peep = GET_PEEP(w->number);
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t image_id = get_peep_face_sprite_large(peep);
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->page == WINDOW_GUEST_STATS)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
// If currently viewing this tab animate tab
|
|
|
|
// if it is very sick or angry.
|
2018-06-22 23:21:44 +02:00
|
|
|
switch (image_id)
|
|
|
|
{
|
|
|
|
case SPR_PEEP_LARGE_FACE_VERY_VERY_SICK_0:
|
|
|
|
image_id += (w->frame_no / 4) & 0xF;
|
|
|
|
break;
|
|
|
|
case SPR_PEEP_LARGE_FACE_VERY_SICK_0:
|
|
|
|
image_id += (w->frame_no / 8) & 0x3;
|
|
|
|
break;
|
|
|
|
case SPR_PEEP_LARGE_FACE_ANGRY_0:
|
|
|
|
image_id += (w->frame_no / 8) & 0x3;
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
gfx_draw_sprite(dpi, image_id, x, y, 0);
|
2014-09-08 19:21:01 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x69861F
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
static void window_guest_rides_tab_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|
|
|
{
|
|
|
|
if (w->disabled_widgets & (1 << WIDX_TAB_3))
|
|
|
|
return;
|
2014-09-09 13:29:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_widget* widget = &w->widgets[WIDX_TAB_3];
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t x = widget->left + w->x;
|
|
|
|
int32_t y = widget->top + w->y;
|
2014-09-09 13:29:55 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t image_id = SPR_TAB_RIDE_0;
|
2014-09-09 13:29:55 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->page == WINDOW_GUEST_RIDES)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
image_id += (w->frame_no / 4) & 0xF;
|
|
|
|
}
|
2015-09-22 19:02:39 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_sprite(dpi, image_id, x, y, 0);
|
2014-09-09 13:29:55 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x698597
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
static void window_guest_finance_tab_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|
|
|
{
|
|
|
|
if (w->disabled_widgets & (1 << WIDX_TAB_4))
|
|
|
|
return;
|
2014-09-09 13:29:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_widget* widget = &w->widgets[WIDX_TAB_4];
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t x = widget->left + w->x;
|
|
|
|
int32_t y = widget->top + w->y;
|
2014-09-09 13:29:55 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t image_id = SPR_TAB_FINANCES_SUMMARY_0;
|
2014-09-09 13:29:55 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->page == WINDOW_GUEST_FINANCE)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
image_id += (w->frame_no / 2) & 0x7;
|
|
|
|
}
|
2015-09-22 19:02:39 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_sprite(dpi, image_id, x, y, 0);
|
2014-09-09 13:29:55 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x6985D8
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
static void window_guest_thoughts_tab_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|
|
|
{
|
|
|
|
if (w->disabled_widgets & (1 << WIDX_TAB_5))
|
|
|
|
return;
|
2014-09-09 13:29:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_widget* widget = &w->widgets[WIDX_TAB_5];
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t x = widget->left + w->x;
|
|
|
|
int32_t y = widget->top + w->y;
|
2014-09-09 13:29:55 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t image_id = SPR_TAB_THOUGHTS_0;
|
2014-09-09 13:29:55 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->page == WINDOW_GUEST_THOUGHTS)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
image_id += (w->frame_no / 2) & 0x7;
|
|
|
|
}
|
2015-09-22 19:02:39 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_sprite(dpi, image_id, x, y, 0);
|
2014-09-09 13:29:55 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x698661
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
static void window_guest_inventory_tab_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|
|
|
{
|
|
|
|
if (w->disabled_widgets & (1 << WIDX_TAB_6))
|
|
|
|
return;
|
2014-09-09 13:29:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_widget* widget = &w->widgets[WIDX_TAB_6];
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t x = widget->left + w->x;
|
|
|
|
int32_t y = widget->top + w->y;
|
2014-09-09 13:29:55 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t image_id = SPR_TAB_GUEST_INVENTORY;
|
2015-09-22 19:02:39 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_sprite(dpi, image_id, x, y, 0);
|
2014-09-09 13:29:55 +02:00
|
|
|
}
|
|
|
|
|
2019-01-01 20:18:14 +01:00
|
|
|
static void window_guest_debug_tab_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
2019-01-01 20:13:18 +01:00
|
|
|
{
|
|
|
|
if (w->disabled_widgets & (1 << WIDX_TAB_7))
|
|
|
|
return;
|
|
|
|
|
|
|
|
rct_widget* widget = &w->widgets[WIDX_TAB_7];
|
|
|
|
int32_t x = widget->left + w->x;
|
|
|
|
int32_t y = widget->top + w->y;
|
|
|
|
|
|
|
|
int32_t image_id = SPR_TAB_GEARS_0;
|
|
|
|
if (w->page == WINDOW_GUEST_DEBUG)
|
|
|
|
{
|
|
|
|
image_id += (w->frame_no / 2) & 0x3;
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx_draw_sprite(dpi, image_id, x, y, 0);
|
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x696887
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_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_guest_overview_tab_paint(w, dpi);
|
|
|
|
window_guest_stats_tab_paint(w, dpi);
|
|
|
|
window_guest_rides_tab_paint(w, dpi);
|
|
|
|
window_guest_finance_tab_paint(w, dpi);
|
|
|
|
window_guest_thoughts_tab_paint(w, dpi);
|
|
|
|
window_guest_inventory_tab_paint(w, dpi);
|
2019-01-01 20:13:18 +01:00
|
|
|
window_guest_debug_tab_paint(w, dpi);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// 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)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_sprite(dpi, SPR_HEARING_VIEWPORT, w->x + 2, w->y + 2, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-01 00:11:28 +02:00
|
|
|
// Draw the centred label
|
2018-06-20 17:28:51 +02:00
|
|
|
uint32_t argument1, argument2;
|
2019-02-28 20:28:58 +01:00
|
|
|
Peep* peep = GET_PEEP(w->number);
|
2017-06-06 23:24:18 +02:00
|
|
|
get_arguments_from_action(peep, &argument1, &argument2);
|
2018-06-20 17:28:51 +02:00
|
|
|
set_format_arg(0, uint32_t, argument1);
|
|
|
|
set_format_arg(4, uint32_t, argument2);
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_widget* widget = &w->widgets[WIDX_ACTION_LBL];
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t x = (widget->left + widget->right) / 2 + w->x;
|
|
|
|
int32_t y = w->y + widget->top - 1;
|
|
|
|
int32_t width = widget->right - widget->left;
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_centred_clipped(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, x, y, width);
|
|
|
|
|
|
|
|
// Draw the marquee thought
|
|
|
|
widget = &w->widgets[WIDX_MARQUEE];
|
|
|
|
width = widget->right - widget->left - 3;
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t left = widget->left + 2 + w->x;
|
|
|
|
int32_t top = widget->top + w->y;
|
|
|
|
int32_t height = widget->bottom - widget->top;
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_drawpixelinfo dpi_marquee;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (!clip_drawpixelinfo(&dpi_marquee, dpi, left, top, width, height))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t i = 0;
|
2018-06-22 23:21:44 +02:00
|
|
|
for (; i < PEEP_MAX_THOUGHTS; ++i)
|
|
|
|
{
|
|
|
|
if (peep->thoughts[i].type == PEEP_THOUGHT_TYPE_NONE)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->list_information_type = 0;
|
|
|
|
return;
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
if (peep->thoughts[i].freshness == 1)
|
|
|
|
{ // If a fresh thought
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
if (i == PEEP_MAX_THOUGHTS)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->list_information_type = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
x = widget->right - widget->left - w->list_information_type;
|
|
|
|
peep_thought_set_format_args(&peep->thoughts[i]);
|
|
|
|
gfx_draw_string_left(&dpi_marquee, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, x, 0);
|
2014-08-25 13:58:59 +02:00
|
|
|
}
|
2014-08-26 14:10:36 +02:00
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x696749
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_overview_invalidate(rct_window* w)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2019-05-04 16:40:45 +02:00
|
|
|
window_guest_common_invalidate(w);
|
2015-09-22 19:02:39 +02:00
|
|
|
|
2019-05-04 16:40:45 +02:00
|
|
|
auto peep = GET_PEEP(w->number);
|
2018-06-22 23:21:44 +02:00
|
|
|
w->pressed_widgets &= ~(1 << WIDX_TRACK);
|
|
|
|
if (peep->peep_flags & PEEP_FLAGS_TRACKING)
|
|
|
|
{
|
|
|
|
w->pressed_widgets |= (1 << WIDX_TRACK);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2015-09-22 19:02:39 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_overview_widgets[WIDX_VIEWPORT].right = w->width - 26;
|
|
|
|
window_guest_overview_widgets[WIDX_VIEWPORT].bottom = w->height - 14;
|
2014-08-27 13:14:52 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_overview_widgets[WIDX_ACTION_LBL].top = w->height - 12;
|
|
|
|
window_guest_overview_widgets[WIDX_ACTION_LBL].bottom = w->height - 3;
|
|
|
|
window_guest_overview_widgets[WIDX_ACTION_LBL].right = w->width - 24;
|
2015-09-22 19:02:39 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_overview_widgets[WIDX_MARQUEE].right = w->width - 24;
|
2014-08-27 13:14:52 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_overview_widgets[WIDX_PICKUP].right = w->width - 2;
|
|
|
|
window_guest_overview_widgets[WIDX_RENAME].right = w->width - 2;
|
|
|
|
window_guest_overview_widgets[WIDX_LOCATE].right = w->width - 2;
|
|
|
|
window_guest_overview_widgets[WIDX_TRACK].right = w->width - 2;
|
2014-08-27 13:14:52 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_overview_widgets[WIDX_PICKUP].left = w->width - 25;
|
|
|
|
window_guest_overview_widgets[WIDX_RENAME].left = w->width - 25;
|
|
|
|
window_guest_overview_widgets[WIDX_LOCATE].left = w->width - 25;
|
|
|
|
window_guest_overview_widgets[WIDX_TRACK].left = w->width - 25;
|
2014-08-26 14:10:36 +02:00
|
|
|
}
|
2014-08-27 17:49:31 +02:00
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x696F45
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_overview_update(rct_window* w)
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t var_496 = w->var_496;
|
2017-06-06 23:24:18 +02:00
|
|
|
var_496++;
|
|
|
|
var_496 %= 24;
|
|
|
|
w->var_496 = var_496;
|
|
|
|
|
|
|
|
widget_invalidate(w, WIDX_TAB_1);
|
|
|
|
widget_invalidate(w, WIDX_TAB_2);
|
|
|
|
|
2019-04-15 19:11:30 +02:00
|
|
|
Peep* peep = GET_PEEP(w->number);
|
|
|
|
if (peep != nullptr && peep->window_invalidate_flags & PEEP_INVALIDATE_PEEP_ACTION)
|
2019-04-15 14:03:24 +02:00
|
|
|
{
|
|
|
|
peep->window_invalidate_flags &= ~PEEP_INVALIDATE_PEEP_ACTION;
|
|
|
|
widget_invalidate(w, WIDX_ACTION_LBL);
|
|
|
|
}
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
w->list_information_type += 2;
|
|
|
|
|
|
|
|
if ((w->highlighted_item & 0xFFFF) == 0xFFFF)
|
|
|
|
w->highlighted_item &= 0xFFFF0000;
|
|
|
|
else
|
|
|
|
w->highlighted_item++;
|
|
|
|
|
|
|
|
// Disable peep watching thought for multiplayer as it's client specific
|
2018-06-22 23:21:44 +02:00
|
|
|
if (network_get_mode() == NETWORK_MODE_NONE)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
// Create the "I have the strangest feeling I am being watched thought"
|
2018-06-22 23:21:44 +02:00
|
|
|
if ((w->highlighted_item & 0xFFFF) >= 3840)
|
|
|
|
{
|
|
|
|
if (!(w->highlighted_item & 0x3FF))
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t random = util_rand() & 0xFFFF;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (random <= 0x2AAA)
|
|
|
|
{
|
2018-01-06 00:38:44 +01:00
|
|
|
peep_insert_new_thought(peep, PEEP_THOUGHT_TYPE_WATCHED, PEEP_THOUGHT_ITEM_NONE);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-09 13:53:10 +02:00
|
|
|
}
|
2014-09-09 19:08:34 +02:00
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/* rct2: 0x696A6A */
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_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-09-09 19:08:34 +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
|
|
|
guest_set_name(w->number, text);
|
2014-09-13 12:03:46 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x696A5F
|
|
|
|
*/
|
2018-06-20 17:28:51 +02:00
|
|
|
void window_guest_overview_tool_update(rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y)
|
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;
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t map_x, map_y;
|
2017-08-15 10:07:44 +02:00
|
|
|
footpath_get_coordinates_from_pos(x, y + 16, &map_x, &map_y, nullptr, nullptr);
|
2018-06-22 23:21:44 +02:00
|
|
|
if (map_x != LOCATION_NULL)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
|
|
|
gMapSelectType = MAP_SELECT_TYPE_FULL;
|
|
|
|
gMapSelectPositionA.x = map_x;
|
|
|
|
gMapSelectPositionB.x = map_x;
|
|
|
|
gMapSelectPositionA.y = map_y;
|
|
|
|
gMapSelectPositionB.y = map_y;
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
}
|
|
|
|
|
|
|
|
gPickupPeepImage = UINT32_MAX;
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t interactionType;
|
2017-08-15 10:07:44 +02:00
|
|
|
get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_NONE, nullptr, nullptr, &interactionType, nullptr, nullptr);
|
2017-06-06 23:24:18 +02:00
|
|
|
if (interactionType == VIEWPORT_INTERACTION_ITEM_NONE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
x--;
|
|
|
|
y += 16;
|
|
|
|
gPickupPeepX = x;
|
|
|
|
gPickupPeepY = y;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-02-28 20:28:58 +01:00
|
|
|
Peep* peep;
|
2017-06-06 23:24:18 +02:00
|
|
|
peep = GET_PEEP(w->number);
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
uint32_t imageId = g_peep_animation_entries[peep->sprite_type].sprite_animation[PEEP_ACTION_SPRITE_TYPE_UI].base_image;
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId += w->picked_peep_frame >> 2;
|
|
|
|
|
2017-07-20 20:56:29 +02:00
|
|
|
imageId |= (peep->tshirt_colour << 19) | (peep->trousers_colour << 24) | IMAGE_TYPE_REMAP | IMAGE_TYPE_REMAP_2_PLUS;
|
2017-06-06 23:24:18 +02:00
|
|
|
gPickupPeepImage = imageId;
|
2014-09-13 13:49:18 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x696A54
|
|
|
|
*/
|
2018-06-20 17:28:51 +02:00
|
|
|
void window_guest_overview_tool_down(rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (widgetIndex != WIDX_PICKUP)
|
|
|
|
return;
|
2014-09-13 13:49:18 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t dest_x, dest_y;
|
2018-11-01 13:53:50 +01:00
|
|
|
TileElement* tileElement;
|
2017-10-31 14:03:45 +01:00
|
|
|
footpath_get_coordinates_from_pos(x, y + 16, &dest_x, &dest_y, nullptr, &tileElement);
|
2016-10-18 21:33:43 +02:00
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
if (dest_x == LOCATION_NULL)
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
2016-10-18 21:33:43 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
game_command_callback = game_command_callback_pickup_guest;
|
2017-10-31 14:03:45 +01:00
|
|
|
game_do_command(w->number, GAME_COMMAND_FLAG_APPLY, 2, tileElement->base_height, GAME_COMMAND_PICKUP_GUEST, dest_x, dest_y);
|
2014-09-13 14:58:25 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x696A49
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_overview_tool_abort(rct_window* w, rct_widgetindex widgetIndex)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (widgetIndex != WIDX_PICKUP)
|
|
|
|
return;
|
2014-09-13 14:58:25 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
game_do_command(w->number, GAME_COMMAND_FLAG_APPLY, 1, 0, GAME_COMMAND_PICKUP_GUEST, w->picked_peep_old_x, 0);
|
2014-09-13 15:11:44 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
2014-09-13 15:11:44 +02:00
|
|
|
* This is a combination of 5 functions that were identical
|
2015-12-11 16:38:37 +01:00
|
|
|
* rct2: 0x69744F, 0x697795, 0x697BDD, 0x697E18, 0x698279
|
2014-09-13 15:11:44 +02:00
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_mouse_up(rct_window* w, rct_widgetindex widgetIndex)
|
2015-07-10 02:39:16 +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:
|
|
|
|
case WIDX_TAB_4:
|
|
|
|
case WIDX_TAB_5:
|
|
|
|
case WIDX_TAB_6:
|
2019-01-01 20:13:18 +01:00
|
|
|
case WIDX_TAB_7:
|
2018-06-22 23:21:44 +02:00
|
|
|
window_guest_set_page(w, widgetIndex - WIDX_TAB_1);
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-09-13 15:30:21 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x69746A
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_stats_update(rct_window* w)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->frame_no++;
|
2019-02-28 20:28:58 +01:00
|
|
|
Peep* peep = GET_PEEP(w->number);
|
2017-06-06 23:24:18 +02:00
|
|
|
peep->window_invalidate_flags &= ~PEEP_INVALIDATE_PEEP_STATS;
|
2014-09-13 15:58:51 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_invalidate(w);
|
2014-09-13 15:58:51 +02:00
|
|
|
}
|
|
|
|
|
2014-09-20 12:12:45 +02:00
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
*
|
|
|
|
* rct2: 0x0066ECC1
|
|
|
|
*
|
|
|
|
* ebp: colour, contains flag BAR_BLINK for blinking
|
|
|
|
*/
|
2018-07-21 11:50:45 +02:00
|
|
|
static void window_guest_stats_bars_paint(
|
|
|
|
int32_t value, int32_t x, int32_t y, rct_window* w, rct_drawpixelinfo* dpi, int32_t colour)
|
2018-01-03 00:09:25 +01:00
|
|
|
{
|
|
|
|
if (font_get_line_height(gCurrentFontSpriteBase) > 10)
|
|
|
|
{
|
|
|
|
y += 1;
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-01-03 00:09:25 +01:00
|
|
|
gfx_fill_rect_inset(dpi, x + 61, y + 1, x + 61 + 121, y + 9, w->colours[1], INSET_RECT_F_30);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t blink_flag = colour & BAR_BLINK;
|
2017-07-20 12:57:37 +02:00
|
|
|
colour &= ~BAR_BLINK;
|
|
|
|
|
2018-12-01 17:00:11 +01:00
|
|
|
if (!blink_flag || game_is_paused() || (gCurrentRealTimeTicks & 8) == 0)
|
2017-06-06 23:24:18 +02:00
|
|
|
{
|
2018-01-03 00:09:25 +01:00
|
|
|
value *= 118;
|
|
|
|
value >>= 8;
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (value <= 2)
|
|
|
|
return;
|
2014-09-20 12:12:45 +02:00
|
|
|
|
2018-01-03 00:09:25 +01:00
|
|
|
gfx_fill_rect_inset(dpi, x + 63, y + 2, x + 63 + value - 1, y + 8, colour, 0);
|
|
|
|
}
|
2014-09-20 12:12:45 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0069711D
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_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_guest_overview_tab_paint(w, dpi);
|
|
|
|
window_guest_stats_tab_paint(w, dpi);
|
|
|
|
window_guest_rides_tab_paint(w, dpi);
|
|
|
|
window_guest_finance_tab_paint(w, dpi);
|
|
|
|
window_guest_thoughts_tab_paint(w, dpi);
|
|
|
|
window_guest_inventory_tab_paint(w, dpi);
|
2019-01-01 20:13:18 +01:00
|
|
|
window_guest_debug_tab_paint(w, dpi);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// ebx
|
2019-02-28 20:28:58 +01:00
|
|
|
Peep* peep = GET_PEEP(w->number);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// Not sure why this is not stats widgets
|
|
|
|
// cx
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t x = w->x + window_guest_rides_widgets[WIDX_PAGE_BACKGROUND].left + 4;
|
2017-06-06 23:24:18 +02:00
|
|
|
// dx
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t y = w->y + window_guest_rides_widgets[WIDX_PAGE_BACKGROUND].top + 4;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// Happiness
|
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_STAT_HAPPINESS_LABEL, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t happiness = peep->happiness;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (happiness < 10)
|
|
|
|
happiness = 10;
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t ebp = COLOUR_BRIGHT_GREEN;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (happiness < 50)
|
|
|
|
{
|
2017-07-20 12:57:37 +02:00
|
|
|
ebp |= BAR_BLINK;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
window_guest_stats_bars_paint(happiness, x, y, w, dpi, ebp);
|
|
|
|
|
|
|
|
// Energy
|
2018-01-03 00:09:25 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_STAT_ENERGY_LABEL, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t energy = ((peep->energy - PEEP_MIN_ENERGY) * 255) / (PEEP_MAX_ENERGY - PEEP_MIN_ENERGY);
|
2017-06-06 23:24:18 +02:00
|
|
|
ebp = COLOUR_BRIGHT_GREEN;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (energy < 50)
|
|
|
|
{
|
2017-07-20 12:57:37 +02:00
|
|
|
ebp |= BAR_BLINK;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
if (energy < 10)
|
|
|
|
energy = 10;
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_stats_bars_paint(energy, x, y, w, dpi, ebp);
|
|
|
|
|
|
|
|
// Hunger
|
2018-01-03 00:09:25 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_STAT_HUNGER_LABEL, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t hunger = peep->hunger;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (hunger > 190)
|
|
|
|
hunger = 190;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
hunger -= 32;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (hunger < 0)
|
|
|
|
hunger = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
hunger *= 51;
|
|
|
|
hunger /= 32;
|
|
|
|
hunger = 0xFF & ~hunger;
|
|
|
|
|
|
|
|
ebp = COLOUR_BRIGHT_RED;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (hunger > 170)
|
|
|
|
{
|
2017-07-20 12:57:37 +02:00
|
|
|
ebp |= BAR_BLINK;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
window_guest_stats_bars_paint(hunger, x, y, w, dpi, ebp);
|
|
|
|
|
|
|
|
// Thirst
|
2018-01-03 00:09:25 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_STAT_THIRST_LABEL, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t thirst = peep->thirst;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (thirst > 190)
|
|
|
|
thirst = 190;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
thirst -= 32;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (thirst < 0)
|
|
|
|
thirst = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
thirst *= 51;
|
|
|
|
thirst /= 32;
|
|
|
|
thirst = 0xFF & ~thirst;
|
|
|
|
|
|
|
|
ebp = COLOUR_BRIGHT_RED;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (thirst > 170)
|
|
|
|
{
|
2017-07-20 12:57:37 +02:00
|
|
|
ebp |= BAR_BLINK;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
window_guest_stats_bars_paint(thirst, x, y, w, dpi, ebp);
|
|
|
|
|
|
|
|
// Nausea
|
2018-01-03 00:09:25 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_STAT_NAUSEA_LABEL, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t nausea = peep->nausea - 32;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (nausea < 0)
|
|
|
|
nausea = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
nausea *= 36;
|
|
|
|
nausea /= 32;
|
|
|
|
|
|
|
|
ebp = COLOUR_BRIGHT_RED;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (nausea > 120)
|
|
|
|
{
|
2017-07-20 12:57:37 +02:00
|
|
|
ebp |= BAR_BLINK;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
window_guest_stats_bars_paint(nausea, x, y, w, dpi, ebp);
|
|
|
|
|
2018-01-09 09:32:21 +01:00
|
|
|
// Toilet
|
2018-01-03 00:09:25 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_STAT_TOILET_LABEL, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t toilet = peep->toilet - 32;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (toilet > 210)
|
|
|
|
toilet = 210;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-01-09 09:32:21 +01:00
|
|
|
toilet -= 32;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (toilet < 0)
|
|
|
|
toilet = 0;
|
2018-01-09 09:32:21 +01:00
|
|
|
toilet *= 45;
|
|
|
|
toilet /= 32;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
ebp = COLOUR_BRIGHT_RED;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (toilet > 160)
|
|
|
|
{
|
2017-07-20 12:57:37 +02:00
|
|
|
ebp |= BAR_BLINK;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-01-09 09:32:21 +01:00
|
|
|
window_guest_stats_bars_paint(toilet, x, y, w, dpi, ebp);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// Time in park
|
2018-01-03 00:09:25 +01:00
|
|
|
y += LIST_ROW_HEIGHT + 1;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (peep->time_in_park != -1)
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t eax = gScenarioTicks;
|
2017-06-06 23:24:18 +02:00
|
|
|
eax -= peep->time_in_park;
|
|
|
|
eax >>= 11;
|
2018-06-20 17:28:51 +02:00
|
|
|
set_format_arg(0, uint16_t, eax & 0xFFFF);
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_STAT_TIME_IN_PARK, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
}
|
|
|
|
|
2018-01-03 00:09:25 +01:00
|
|
|
y += LIST_ROW_HEIGHT + 9;
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_fill_rect_inset(dpi, x, y - 6, x + 179, y - 5, w->colours[1], INSET_RECT_FLAG_BORDER_INSET);
|
|
|
|
|
|
|
|
// Preferred Ride
|
2017-08-15 10:07:44 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_STAT_PREFERRED_RIDE, nullptr, COLOUR_BLACK, x, y);
|
2018-01-03 00:09:25 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// Intensity
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t intensity = peep->intensity / 16;
|
|
|
|
set_format_arg(0, uint16_t, intensity);
|
|
|
|
int32_t string_id = STR_GUEST_STAT_PREFERRED_INTESITY_BELOW;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (peep->intensity & 0xF)
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
set_format_arg(0, uint16_t, peep->intensity & 0xF);
|
|
|
|
set_format_arg(2, uint16_t, intensity);
|
2017-06-06 23:24:18 +02:00
|
|
|
string_id = STR_GUEST_STAT_PREFERRED_INTESITY_BETWEEN;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (intensity == 15)
|
|
|
|
string_id = STR_GUEST_STAT_PREFERRED_INTESITY_ABOVE;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
gfx_draw_string_left(dpi, string_id, gCommonFormatArgs, COLOUR_BLACK, x + 4, y);
|
|
|
|
|
|
|
|
// Nausea tolerance
|
2018-01-11 14:50:31 +01:00
|
|
|
static constexpr const rct_string_id nauseaTolerances[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
STR_PEEP_STAT_NAUSEA_TOLERANCE_NONE,
|
|
|
|
STR_PEEP_STAT_NAUSEA_TOLERANCE_LOW,
|
|
|
|
STR_PEEP_STAT_NAUSEA_TOLERANCE_AVERAGE,
|
|
|
|
STR_PEEP_STAT_NAUSEA_TOLERANCE_HIGH,
|
|
|
|
};
|
2018-01-03 00:09:25 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t nausea_tolerance = peep->nausea_tolerance & 0x3;
|
2017-06-06 23:24:18 +02:00
|
|
|
set_format_arg(0, rct_string_id, nauseaTolerances[nausea_tolerance]);
|
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_STAT_NAUSEA_TOLERANCE, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
2014-09-14 14:50:39 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x6977B0
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_rides_update(rct_window* w)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->frame_no++;
|
|
|
|
|
|
|
|
widget_invalidate(w, WIDX_TAB_2);
|
|
|
|
widget_invalidate(w, WIDX_TAB_3);
|
|
|
|
|
2019-02-28 20:28:58 +01:00
|
|
|
Peep* peep = GET_PEEP(w->number);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// Every 2048 ticks do a full window_invalidate
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t number_of_ticks = gScenarioTicks - peep->time_in_park;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (!(number_of_ticks & 0x7FF))
|
|
|
|
window_invalidate(w);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
uint8_t curr_list_position = 0;
|
2019-01-12 11:11:55 +01:00
|
|
|
for (ride_id_t ride_id = 0; ride_id < MAX_RIDES; ride_id++)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
// Offset to the ride_id bit in peep_rides_been_on
|
2018-06-20 17:28:51 +02:00
|
|
|
uint8_t ride_id_bit = ride_id % 8;
|
|
|
|
uint8_t ride_id_offset = ride_id / 8;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (peep->rides_been_on[ride_id_offset] & (1 << ride_id_bit))
|
|
|
|
{
|
2017-09-12 11:16:57 +02:00
|
|
|
Ride* ride = get_ride(ride_id);
|
2018-06-22 23:21:44 +02:00
|
|
|
if (gRideClassifications[ride->type] == RIDE_CLASS_RIDE)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->list_item_positions[curr_list_position] = ride_id;
|
|
|
|
curr_list_position++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// If there are new items
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->no_list_items != curr_list_position)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->no_list_items = curr_list_position;
|
|
|
|
window_invalidate(w);
|
|
|
|
}
|
2014-09-14 15:15:32 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x69784E
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_rides_scroll_get_size(rct_window* w, int32_t scrollIndex, int32_t* width, int32_t* height)
|
2015-05-26 20:28:37 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
*height = w->no_list_items * 10;
|
2014-09-14 15:15:32 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w->selected_list_item != -1)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->selected_list_item = -1;
|
|
|
|
window_invalidate(w);
|
|
|
|
}
|
2014-09-14 15:15:32 +02:00
|
|
|
|
2018-07-21 11:50:45 +02:00
|
|
|
int32_t visable_height = *height - window_guest_rides_widgets[WIDX_RIDE_SCROLL].bottom
|
|
|
|
+ window_guest_rides_widgets[WIDX_RIDE_SCROLL].top + 21;
|
2014-09-14 15:15:32 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (visable_height < 0)
|
|
|
|
visable_height = 0;
|
2014-09-14 15:15:32 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (visable_height < w->scrolls[0].v_top)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->scrolls[0].v_top = visable_height;
|
|
|
|
window_invalidate(w);
|
|
|
|
}
|
2014-09-14 15:33:20 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006978CC
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_rides_scroll_mouse_down(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t index;
|
2014-09-14 15:33:20 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
index = y / 10;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (index >= w->no_list_items)
|
|
|
|
return;
|
2014-09-14 15:33:20 +02:00
|
|
|
|
2017-10-21 16:03:33 +02:00
|
|
|
auto intent = Intent(WC_RIDE);
|
|
|
|
intent.putExtra(INTENT_EXTRA_RIDE_ID, w->list_item_positions[index]);
|
|
|
|
context_open_intent(&intent);
|
2014-09-14 15:33:20 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0069789C
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_rides_scroll_mouse_over(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t index;
|
2014-09-14 15:33:20 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
index = y / 10;
|
2018-06-22 23:21:44 +02:00
|
|
|
if (index >= w->no_list_items)
|
|
|
|
return;
|
2014-09-14 15:33:20 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (index == w->selected_list_item)
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
w->selected_list_item = index;
|
2014-09-14 15:33:20 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_invalidate(w);
|
2014-09-14 16:46:50 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0069757A
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_rides_invalidate(rct_window* w)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2019-05-04 16:40:45 +02:00
|
|
|
window_guest_common_invalidate(w);
|
2014-09-14 16:46:50 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_guest_rides_widgets[WIDX_RIDE_SCROLL].right = w->width - 4;
|
|
|
|
window_guest_rides_widgets[WIDX_RIDE_SCROLL].bottom = w->height - 15;
|
2014-09-14 16:46:50 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x00697637
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_rides_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_guest_overview_tab_paint(w, dpi);
|
|
|
|
window_guest_stats_tab_paint(w, dpi);
|
|
|
|
window_guest_rides_tab_paint(w, dpi);
|
|
|
|
window_guest_finance_tab_paint(w, dpi);
|
|
|
|
window_guest_thoughts_tab_paint(w, dpi);
|
|
|
|
window_guest_inventory_tab_paint(w, dpi);
|
2019-01-01 20:13:18 +01:00
|
|
|
window_guest_debug_tab_paint(w, dpi);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-02-28 20:28:58 +01:00
|
|
|
Peep* peep = GET_PEEP(w->number);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// cx
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t x = w->x + window_guest_rides_widgets[WIDX_PAGE_BACKGROUND].left + 2;
|
2017-06-06 23:24:18 +02:00
|
|
|
// dx
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t y = w->y + window_guest_rides_widgets[WIDX_PAGE_BACKGROUND].top + 2;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-08-15 10:07:44 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_LABEL_RIDES_BEEN_ON, nullptr, COLOUR_BLACK, x, y);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
y = w->y + window_guest_rides_widgets[WIDX_PAGE_BACKGROUND].bottom - 12;
|
|
|
|
|
2018-06-13 19:27:32 +02:00
|
|
|
rct_string_id ride_string_id = STR_PEEP_FAVOURITE_RIDE_NOT_AVAILABLE;
|
2018-06-20 17:28:51 +02:00
|
|
|
uint32_t ride_string_arguments = 0;
|
2018-06-13 19:27:32 +02:00
|
|
|
if (peep->favourite_ride != 0xFF)
|
|
|
|
{
|
|
|
|
auto ride = get_ride(peep->favourite_ride);
|
|
|
|
if (ride != nullptr)
|
|
|
|
{
|
|
|
|
ride_string_arguments = ride->name_arguments;
|
|
|
|
ride_string_id = ride->name;
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
set_format_arg(0, rct_string_id, ride_string_id);
|
2018-06-20 17:28:51 +02:00
|
|
|
set_format_arg(2, uint32_t, ride_string_arguments);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gfx_draw_string_left_clipped(dpi, STR_FAVOURITE_RIDE, gCommonFormatArgs, COLOUR_BLACK, x, y, w->width - 14);
|
2014-09-14 21:06:32 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006976FC
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_rides_scroll_paint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t left = dpi->x;
|
|
|
|
int32_t right = dpi->x + dpi->width - 1;
|
|
|
|
int32_t top = dpi->y;
|
|
|
|
int32_t bottom = dpi->y + dpi->height - 1;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-13 19:32:00 +02:00
|
|
|
auto colour = ColourMapA[w->colours[1]].mid_light;
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_fill_rect(dpi, left, top, right, bottom, colour);
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
for (int32_t list_index = 0; list_index < w->no_list_items; list_index++)
|
2018-06-13 19:32:00 +02:00
|
|
|
{
|
|
|
|
auto y = list_index * 10;
|
|
|
|
rct_string_id stringId = STR_BLACK_STRING;
|
|
|
|
if (list_index == w->selected_list_item)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_filter_rect(dpi, 0, y, 800, y + 9, PALETTE_DARKEN_1);
|
2018-06-13 19:32:00 +02:00
|
|
|
stringId = STR_WINDOW_COLOUR_2_STRINGID;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2018-06-13 19:32:00 +02:00
|
|
|
auto ride = get_ride(w->list_item_positions[list_index]);
|
|
|
|
if (ride != nullptr)
|
|
|
|
{
|
|
|
|
set_format_arg(0, rct_string_id, ride->name);
|
2018-06-20 17:28:51 +02:00
|
|
|
set_format_arg(2, uint32_t, ride->name_arguments);
|
2018-06-13 19:32:00 +02:00
|
|
|
gfx_draw_string_left(dpi, stringId, gCommonFormatArgs, COLOUR_BLACK, 0, y - 1);
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-09-14 22:21:54 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x00697BF8
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_finance_update(rct_window* w)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->frame_no++;
|
2014-09-14 22:21:54 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
widget_invalidate(w, WIDX_TAB_2);
|
|
|
|
widget_invalidate(w, WIDX_TAB_4);
|
2014-09-14 22:21:54 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x00697A08
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_finance_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_guest_overview_tab_paint(w, dpi);
|
|
|
|
window_guest_stats_tab_paint(w, dpi);
|
|
|
|
window_guest_rides_tab_paint(w, dpi);
|
|
|
|
window_guest_finance_tab_paint(w, dpi);
|
|
|
|
window_guest_thoughts_tab_paint(w, dpi);
|
|
|
|
window_guest_inventory_tab_paint(w, dpi);
|
2019-01-01 20:13:18 +01:00
|
|
|
window_guest_debug_tab_paint(w, dpi);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-02-28 20:28:58 +01:00
|
|
|
Peep* peep = GET_PEEP(w->number);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// cx
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t x = w->x + window_guest_finance_widgets[WIDX_PAGE_BACKGROUND].left + 4;
|
2017-06-06 23:24:18 +02:00
|
|
|
// dx
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t y = w->y + window_guest_finance_widgets[WIDX_PAGE_BACKGROUND].top + 4;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// Cash in pocket
|
|
|
|
set_format_arg(0, money32, peep->cash_in_pocket);
|
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_STAT_CASH_IN_POCKET, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
|
|
|
|
// Cash spent
|
2018-01-03 00:09:25 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
set_format_arg(0, money32, peep->cash_spent);
|
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_STAT_CASH_SPENT, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
|
2018-01-03 00:09:25 +01:00
|
|
|
y += LIST_ROW_HEIGHT * 2;
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_fill_rect_inset(dpi, x, y - 6, x + 179, y - 5, w->colours[1], INSET_RECT_FLAG_BORDER_INSET);
|
|
|
|
|
|
|
|
// Paid to enter
|
|
|
|
set_format_arg(0, money32, peep->paid_to_enter);
|
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_EXPENSES_ENTRANCE_FEE, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
|
|
|
|
// Paid on rides
|
2018-01-03 00:09:25 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
set_format_arg(0, money32, peep->paid_on_rides);
|
2018-06-20 17:28:51 +02:00
|
|
|
set_format_arg(4, uint16_t, peep->no_of_rides);
|
2018-06-22 23:21:44 +02:00
|
|
|
if (peep->no_of_rides != 1)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_EXPENSES_RIDE_PLURAL, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
else
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_EXPENSES_RIDE, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Paid on food
|
2018-01-03 00:09:25 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
set_format_arg(0, money32, peep->paid_on_food);
|
2018-06-20 17:28:51 +02:00
|
|
|
set_format_arg(4, uint16_t, peep->no_of_food);
|
2018-06-22 23:21:44 +02:00
|
|
|
if (peep->no_of_food != 1)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_EXPENSES_FOOD_PLURAL, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
else
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_EXPENSES_FOOD, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Paid on drinks
|
2018-01-03 00:09:25 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
set_format_arg(0, money32, peep->paid_on_drink);
|
2018-06-20 17:28:51 +02:00
|
|
|
set_format_arg(4, uint16_t, peep->no_of_drinks);
|
2018-06-22 23:21:44 +02:00
|
|
|
if (peep->no_of_drinks != 1)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_EXPENSES_DRINK_PLURAL, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
else
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_EXPENSES_DRINK, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Paid on souvenirs
|
2018-01-03 00:09:25 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
2017-06-06 23:24:18 +02:00
|
|
|
set_format_arg(0, money32, peep->paid_on_souvenirs);
|
2018-06-20 17:28:51 +02:00
|
|
|
set_format_arg(4, uint16_t, peep->no_of_souvenirs);
|
2018-06-22 23:21:44 +02:00
|
|
|
if (peep->no_of_souvenirs != 1)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_EXPENSES_SOUVENIR_PLURAL, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
else
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_EXPENSES_SOUVENIR, gCommonFormatArgs, COLOUR_BLACK, x, y);
|
|
|
|
}
|
2014-09-14 22:56:45 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x00697EB4
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_thoughts_update(rct_window* w)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->frame_no++;
|
2014-09-14 22:56:45 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
widget_invalidate(w, WIDX_TAB_2);
|
|
|
|
widget_invalidate(w, WIDX_TAB_5);
|
2014-09-14 22:56:45 +02:00
|
|
|
|
2019-05-04 18:23:29 +02:00
|
|
|
auto peep = GET_PEEP(w->number);
|
|
|
|
if (peep->window_invalidate_flags & PEEP_INVALIDATE_PEEP_THOUGHTS)
|
|
|
|
{
|
|
|
|
peep->window_invalidate_flags &= ~PEEP_INVALIDATE_PEEP_THOUGHTS;
|
|
|
|
window_invalidate(w);
|
|
|
|
}
|
2014-09-14 22:56:45 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x00697D2A
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_thoughts_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_guest_overview_tab_paint(w, dpi);
|
|
|
|
window_guest_stats_tab_paint(w, dpi);
|
|
|
|
window_guest_rides_tab_paint(w, dpi);
|
|
|
|
window_guest_finance_tab_paint(w, dpi);
|
|
|
|
window_guest_thoughts_tab_paint(w, dpi);
|
|
|
|
window_guest_inventory_tab_paint(w, dpi);
|
2019-01-01 20:13:18 +01:00
|
|
|
window_guest_debug_tab_paint(w, dpi);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-02-28 20:28:58 +01:00
|
|
|
Peep* peep = GET_PEEP(w->number);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// cx
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t x = w->x + window_guest_thoughts_widgets[WIDX_PAGE_BACKGROUND].left + 4;
|
2017-06-06 23:24:18 +02:00
|
|
|
// dx
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t y = w->y + window_guest_thoughts_widgets[WIDX_PAGE_BACKGROUND].top + 4;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-08-15 10:07:44 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_GUEST_RECENT_THOUGHTS_LABEL, nullptr, COLOUR_BLACK, x, y);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
y += 10;
|
2018-06-22 23:21:44 +02:00
|
|
|
for (rct_peep_thought* thought = peep->thoughts; thought < &peep->thoughts[PEEP_MAX_THOUGHTS]; ++thought)
|
|
|
|
{
|
|
|
|
if (thought->type == PEEP_THOUGHT_TYPE_NONE)
|
|
|
|
return;
|
|
|
|
if (thought->freshness == 0)
|
|
|
|
continue;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t width = window_guest_thoughts_widgets[WIDX_PAGE_BACKGROUND].right
|
2018-06-22 23:21:44 +02:00
|
|
|
- window_guest_thoughts_widgets[WIDX_PAGE_BACKGROUND].left - 8;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
peep_thought_set_format_args(thought);
|
|
|
|
y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, width, STR_BLACK_STRING, COLOUR_BLACK);
|
|
|
|
|
|
|
|
// If this is the last visible line end drawing.
|
2018-06-22 23:21:44 +02:00
|
|
|
if (y > w->y + window_guest_thoughts_widgets[WIDX_PAGE_BACKGROUND].bottom - 32)
|
|
|
|
return;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-09-15 18:42:49 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x00698315
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_inventory_update(rct_window* w)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->frame_no++;
|
2014-09-15 18:42:49 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
widget_invalidate(w, WIDX_TAB_2);
|
|
|
|
widget_invalidate(w, WIDX_TAB_6);
|
2014-09-15 18:42:49 +02:00
|
|
|
|
2019-05-04 18:23:29 +02:00
|
|
|
auto peep = GET_PEEP(w->number);
|
|
|
|
if (peep->window_invalidate_flags & PEEP_INVALIDATE_PEEP_INVENTORY)
|
|
|
|
{
|
|
|
|
peep->window_invalidate_flags &= ~PEEP_INVALIDATE_PEEP_INVENTORY;
|
|
|
|
window_invalidate(w);
|
|
|
|
}
|
2014-09-15 18:42:49 +02:00
|
|
|
}
|
|
|
|
|
2019-02-28 20:28:58 +01:00
|
|
|
static rct_string_id window_guest_inventory_format_item(Peep* peep, int32_t item)
|
2015-08-05 20:17:37 +02:00
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
Ride* ride;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// Default arguments
|
2019-04-26 20:25:11 +02:00
|
|
|
set_format_arg(0, uint32_t, ShopItems[item].Image);
|
|
|
|
set_format_arg(4, rct_string_id, ShopItems[item].Naming.Display);
|
2017-06-06 23:24:18 +02:00
|
|
|
set_format_arg(6, rct_string_id, gParkName);
|
2018-06-20 17:28:51 +02:00
|
|
|
set_format_arg(8, uint32_t, gParkNameArgs);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// Special overrides
|
2018-06-22 23:21:44 +02:00
|
|
|
switch (item)
|
|
|
|
{
|
|
|
|
case SHOP_ITEM_BALLOON:
|
2019-04-26 20:25:11 +02:00
|
|
|
set_format_arg(0, uint32_t, SPRITE_ID_PALETTE_COLOUR_1(peep->balloon_colour) | ShopItems[item].Image);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
2018-06-22 23:21:44 +02:00
|
|
|
case SHOP_ITEM_PHOTO:
|
|
|
|
ride = get_ride(peep->photo1_ride_ref);
|
|
|
|
set_format_arg(6, rct_string_id, ride->name);
|
|
|
|
set_format_arg(8, uint32_t, ride->name_arguments);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
2018-06-22 23:21:44 +02:00
|
|
|
case SHOP_ITEM_UMBRELLA:
|
2019-04-26 20:25:11 +02:00
|
|
|
set_format_arg(0, uint32_t, SPRITE_ID_PALETTE_COLOUR_1(peep->umbrella_colour) | ShopItems[item].Image);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
2018-06-22 23:21:44 +02:00
|
|
|
case SHOP_ITEM_VOUCHER:
|
|
|
|
switch (peep->voucher_type)
|
|
|
|
{
|
|
|
|
case VOUCHER_TYPE_PARK_ENTRY_FREE:
|
|
|
|
set_format_arg(6, rct_string_id, STR_PEEP_INVENTORY_VOUCHER_PARK_ENTRY_FREE);
|
|
|
|
set_format_arg(8, rct_string_id, gParkName);
|
|
|
|
set_format_arg(10, uint32_t, gParkNameArgs);
|
|
|
|
break;
|
|
|
|
case VOUCHER_TYPE_RIDE_FREE:
|
|
|
|
ride = get_ride(peep->voucher_arguments);
|
|
|
|
set_format_arg(6, rct_string_id, STR_PEEP_INVENTORY_VOUCHER_RIDE_FREE);
|
|
|
|
set_format_arg(8, rct_string_id, ride->name);
|
|
|
|
set_format_arg(10, uint32_t, ride->name_arguments);
|
|
|
|
break;
|
|
|
|
case VOUCHER_TYPE_PARK_ENTRY_HALF_PRICE:
|
|
|
|
set_format_arg(6, rct_string_id, STR_PEEP_INVENTORY_VOUCHER_PARK_ENTRY_HALF_PRICE);
|
|
|
|
set_format_arg(8, rct_string_id, gParkName);
|
|
|
|
set_format_arg(10, uint32_t, gParkNameArgs);
|
|
|
|
break;
|
|
|
|
case VOUCHER_TYPE_FOOD_OR_DRINK_FREE:
|
|
|
|
set_format_arg(6, rct_string_id, STR_PEEP_INVENTORY_VOUCHER_FOOD_OR_DRINK_FREE);
|
2019-04-26 20:25:11 +02:00
|
|
|
set_format_arg(8, rct_string_id, ShopItems[peep->voucher_arguments].Naming.Singular);
|
2018-06-22 23:21:44 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SHOP_ITEM_HAT:
|
2019-04-26 20:25:11 +02:00
|
|
|
set_format_arg(0, uint32_t, SPRITE_ID_PALETTE_COLOUR_1(peep->hat_colour) | ShopItems[item].Image);
|
2018-06-22 23:21:44 +02:00
|
|
|
break;
|
|
|
|
case SHOP_ITEM_TSHIRT:
|
2019-04-26 20:25:11 +02:00
|
|
|
set_format_arg(0, uint32_t, SPRITE_ID_PALETTE_COLOUR_1(peep->tshirt_colour) | ShopItems[item].Image);
|
2018-06-22 23:21:44 +02:00
|
|
|
break;
|
|
|
|
case SHOP_ITEM_PHOTO2:
|
|
|
|
ride = get_ride(peep->photo2_ride_ref);
|
|
|
|
set_format_arg(6, rct_string_id, ride->name);
|
|
|
|
set_format_arg(8, uint32_t, ride->name_arguments);
|
|
|
|
break;
|
|
|
|
case SHOP_ITEM_PHOTO3:
|
|
|
|
ride = get_ride(peep->photo3_ride_ref);
|
|
|
|
set_format_arg(6, rct_string_id, ride->name);
|
|
|
|
set_format_arg(8, uint32_t, ride->name_arguments);
|
|
|
|
break;
|
|
|
|
case SHOP_ITEM_PHOTO4:
|
|
|
|
ride = get_ride(peep->photo4_ride_ref);
|
|
|
|
set_format_arg(6, rct_string_id, ride->name);
|
|
|
|
set_format_arg(8, uint32_t, ride->name_arguments);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return STR_GUEST_ITEM_FORMAT;
|
2015-08-05 20:17:37 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x00697F81
|
|
|
|
*/
|
2018-06-22 23:21:44 +02:00
|
|
|
void window_guest_inventory_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_guest_overview_tab_paint(w, dpi);
|
|
|
|
window_guest_stats_tab_paint(w, dpi);
|
|
|
|
window_guest_rides_tab_paint(w, dpi);
|
|
|
|
window_guest_finance_tab_paint(w, dpi);
|
|
|
|
window_guest_thoughts_tab_paint(w, dpi);
|
|
|
|
window_guest_inventory_tab_paint(w, dpi);
|
2019-01-01 20:13:18 +01:00
|
|
|
window_guest_debug_tab_paint(w, dpi);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-02-28 20:28:58 +01:00
|
|
|
const auto guest = (GET_PEEP(w->number))->AsGuest();
|
|
|
|
if (guest != nullptr)
|
|
|
|
{
|
|
|
|
rct_widget* pageBackgroundWidget = &window_guest_inventory_widgets[WIDX_PAGE_BACKGROUND];
|
|
|
|
int32_t x = w->x + pageBackgroundWidget->left + 4;
|
|
|
|
int32_t y = w->y + pageBackgroundWidget->top + 2;
|
|
|
|
int32_t itemNameWidth = pageBackgroundWidget->right - pageBackgroundWidget->left - 8;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-02-28 20:28:58 +01:00
|
|
|
int32_t maxY = w->y + w->height - 22;
|
|
|
|
int32_t numItems = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-02-28 20:28:58 +01:00
|
|
|
gfx_draw_string_left(dpi, STR_CARRYING, nullptr, COLOUR_BLACK, x, y);
|
|
|
|
y += 10;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-02-28 20:28:58 +01:00
|
|
|
for (int32_t item = 0; item < SHOP_ITEM_COUNT; item++)
|
|
|
|
{
|
|
|
|
if (y >= maxY)
|
|
|
|
break;
|
|
|
|
if (!guest->HasItem(item))
|
|
|
|
continue;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-02-28 20:28:58 +01:00
|
|
|
rct_string_id stringId = window_guest_inventory_format_item(guest, item);
|
|
|
|
y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, itemNameWidth, stringId, COLOUR_BLACK);
|
|
|
|
numItems++;
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-02-28 20:28:58 +01:00
|
|
|
if (numItems == 0)
|
|
|
|
{
|
|
|
|
gfx_draw_string_left(dpi, STR_NOTHING, nullptr, COLOUR_BLACK, x, y);
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-08-27 17:49:31 +02:00
|
|
|
}
|
2019-01-01 20:13:18 +01:00
|
|
|
|
2019-05-04 16:53:25 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x00698315
|
|
|
|
*/
|
|
|
|
void window_guest_debug_update(rct_window* w)
|
|
|
|
{
|
|
|
|
w->frame_no++;
|
|
|
|
window_invalidate(w);
|
|
|
|
}
|
|
|
|
|
2019-01-01 20:13:18 +01:00
|
|
|
void window_guest_debug_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|
|
|
{
|
2019-05-04 23:48:02 +02:00
|
|
|
char buffer[512]{};
|
|
|
|
char buffer2[512]{};
|
|
|
|
|
2019-01-01 20:13:18 +01:00
|
|
|
window_draw_widgets(w, dpi);
|
|
|
|
window_guest_overview_tab_paint(w, dpi);
|
|
|
|
window_guest_stats_tab_paint(w, dpi);
|
|
|
|
window_guest_rides_tab_paint(w, dpi);
|
|
|
|
window_guest_finance_tab_paint(w, dpi);
|
|
|
|
window_guest_thoughts_tab_paint(w, dpi);
|
|
|
|
window_guest_inventory_tab_paint(w, dpi);
|
|
|
|
window_guest_debug_tab_paint(w, dpi);
|
2019-01-01 20:58:23 +01:00
|
|
|
|
2019-05-02 22:56:03 +02:00
|
|
|
auto peep = GET_PEEP(w->number);
|
2019-05-03 02:18:14 +02:00
|
|
|
auto x = w->x + window_guest_debug_widgets[WIDX_PAGE_BACKGROUND].left + 4;
|
|
|
|
auto y = w->y + window_guest_debug_widgets[WIDX_PAGE_BACKGROUND].top + 4;
|
2019-05-04 23:48:02 +02:00
|
|
|
{
|
|
|
|
int32_t args[] = { peep->x, peep->y, peep->x };
|
|
|
|
gfx_draw_string_left(dpi, STR_PEEP_DEBUG_POSITION, args, 0, x, y);
|
|
|
|
}
|
2019-01-01 20:58:23 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
2019-01-01 21:36:31 +01:00
|
|
|
{
|
2019-05-04 23:48:02 +02:00
|
|
|
int32_t args[] = { peep->next_x, peep->next_y, peep->next_z };
|
|
|
|
format_string(buffer, sizeof(buffer), STR_PEEP_DEBUG_NEXT, args);
|
|
|
|
if (peep->GetNextIsSurface())
|
|
|
|
{
|
|
|
|
format_string(buffer2, sizeof(buffer2), STR_PEEP_DEBUG_NEXT_SURFACE, nullptr);
|
|
|
|
safe_strcat(buffer, buffer2, sizeof(buffer));
|
|
|
|
}
|
|
|
|
if (peep->GetNextIsSloped())
|
|
|
|
{
|
|
|
|
int32_t args2[1] = { peep->GetNextDirection() };
|
|
|
|
format_string(buffer2, sizeof(buffer2), STR_PEEP_DEBUG_NEXT_SLOPE, args2);
|
|
|
|
safe_strcat(buffer, buffer2, sizeof(buffer));
|
|
|
|
}
|
|
|
|
gfx_draw_string(dpi, buffer, 0, x, y);
|
2019-01-01 21:36:31 +01:00
|
|
|
}
|
|
|
|
y += LIST_ROW_HEIGHT;
|
2019-05-04 23:48:02 +02:00
|
|
|
{
|
|
|
|
int32_t args[] = { peep->destination_x, peep->destination_y, peep->destination_tolerance };
|
|
|
|
gfx_draw_string_left(dpi, STR_PEEP_DEBUG_DEST, args, 0, x, y);
|
|
|
|
}
|
2019-01-01 21:36:31 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
2019-05-04 23:48:02 +02:00
|
|
|
{
|
|
|
|
int32_t args[] = { peep->pathfind_goal.x, peep->pathfind_goal.y, peep->pathfind_goal.z, peep->pathfind_goal.direction };
|
|
|
|
gfx_draw_string_left(dpi, STR_PEEP_DEBUG_PATHFIND_GOAL, args, 0, x, y);
|
|
|
|
}
|
2019-01-01 21:36:31 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
2019-05-04 23:48:02 +02:00
|
|
|
gfx_draw_string_left(dpi, STR_PEEP_DEBUG_PATHFIND_HISTORY, nullptr, 0, x, y);
|
2019-01-01 21:36:31 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
|
|
|
|
|
|
|
x += 10;
|
2019-01-05 14:01:48 +01:00
|
|
|
for (auto& point : peep->pathfind_history)
|
|
|
|
{
|
2019-05-04 23:48:02 +02:00
|
|
|
int32_t args[] = { point.x, point.y, point.z, point.direction };
|
|
|
|
gfx_draw_string_left(dpi, STR_PEEP_DEBUG_PATHFIND_HISTORY_ITEM, args, 0, x, y);
|
2019-01-01 21:36:31 +01:00
|
|
|
y += LIST_ROW_HEIGHT;
|
|
|
|
}
|
|
|
|
x -= 10;
|
2019-01-01 20:13:18 +01:00
|
|
|
}
|