2017-06-01 21:55:10 +02:00
|
|
|
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
|
2014-04-11 03:42:39 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
|
|
|
*
|
2016-05-04 19:24:41 +02:00
|
|
|
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
|
|
|
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
2014-04-11 03:42:39 +02:00
|
|
|
*
|
|
|
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2016-05-04 19:24:41 +02:00
|
|
|
*
|
|
|
|
* A full copy of the GNU General Public License can be found in licence.txt
|
2014-04-11 03:42:39 +02:00
|
|
|
*****************************************************************************/
|
2016-05-04 19:24:41 +02:00
|
|
|
#pragma endregion
|
2014-04-11 03:42:39 +02:00
|
|
|
|
2017-11-11 02:57:45 +01:00
|
|
|
#include <openrct2-ui/windows/Window.h>
|
|
|
|
|
2017-10-17 22:31:05 +02:00
|
|
|
#include <string>
|
|
|
|
|
2017-11-11 02:57:45 +01:00
|
|
|
#include <openrct2/audio/audio.h>
|
2017-12-13 13:02:24 +01:00
|
|
|
#include <openrct2/Cheats.h>
|
2017-11-11 02:57:45 +01:00
|
|
|
#include <openrct2/config/Config.h>
|
|
|
|
#include <openrct2/Context.h>
|
|
|
|
#include <openrct2/core/Math.hpp>
|
|
|
|
#include <openrct2/core/Util.hpp>
|
|
|
|
#include <openrct2/Editor.h>
|
2017-12-12 14:52:57 +01:00
|
|
|
#include <openrct2/Input.h>
|
2018-01-06 00:28:04 +01:00
|
|
|
#include <openrct2/interface/Console.h>
|
2017-11-11 02:57:45 +01:00
|
|
|
#include <openrct2/interface/Screenshot.h>
|
2018-01-03 00:13:37 +01:00
|
|
|
#include <openrct2-ui/interface/Viewport.h>
|
|
|
|
#include <openrct2-ui/interface/Widget.h>
|
2017-11-11 02:57:45 +01:00
|
|
|
#include <openrct2/network/network.h>
|
|
|
|
#include <openrct2/network/twitch.h>
|
|
|
|
#include <openrct2/OpenRCT2.h>
|
|
|
|
#include <openrct2/ParkImporter.h>
|
2018-03-04 17:44:42 +01:00
|
|
|
#include <openrct2/paint/VirtualFloor.h>
|
2017-11-11 02:57:45 +01:00
|
|
|
#include <openrct2/peep/Staff.h>
|
2017-12-13 13:02:24 +01:00
|
|
|
#include <openrct2/util/Util.h>
|
2017-12-07 22:33:11 +01:00
|
|
|
#include <openrct2-ui/interface/Dropdown.h>
|
2017-11-11 02:57:45 +01:00
|
|
|
#include <openrct2/windows/Intent.h>
|
2018-01-11 10:59:26 +01:00
|
|
|
#include <openrct2/world/Footpath.h>
|
2017-11-20 11:13:55 +01:00
|
|
|
#include <openrct2/world/LargeScenery.h>
|
2018-01-11 10:59:26 +01:00
|
|
|
#include <openrct2/world/Scenery.h>
|
2017-11-20 11:13:55 +01:00
|
|
|
#include <openrct2/world/SmallScenery.h>
|
|
|
|
#include <openrct2/world/Wall.h>
|
2017-12-07 02:47:26 +01:00
|
|
|
#include <openrct2-ui/interface/LandTool.h>
|
2018-03-19 23:28:40 +01:00
|
|
|
#include <openrct2/scenario/Scenario.h>
|
|
|
|
#include <openrct2/world/Park.h>
|
2018-05-01 16:33:16 +02:00
|
|
|
#include <openrct2/world/Surface.h>
|
2018-03-11 23:25:34 +01:00
|
|
|
#include "../interface/InGameConsole.h"
|
|
|
|
#include "../UiContext.h"
|
|
|
|
|
|
|
|
using namespace OpenRCT2::Ui;
|
2014-04-11 03:42:39 +02:00
|
|
|
|
|
|
|
enum {
|
2017-06-06 23:24:18 +02:00
|
|
|
WIDX_PAUSE,
|
|
|
|
WIDX_FILE_MENU,
|
|
|
|
WIDX_MUTE,
|
|
|
|
WIDX_ZOOM_OUT,
|
|
|
|
WIDX_ZOOM_IN,
|
|
|
|
WIDX_ROTATE,
|
|
|
|
WIDX_VIEW_MENU,
|
|
|
|
WIDX_MAP,
|
|
|
|
|
|
|
|
WIDX_LAND,
|
|
|
|
WIDX_WATER,
|
|
|
|
WIDX_SCENERY,
|
|
|
|
WIDX_PATH,
|
|
|
|
WIDX_CONSTRUCT_RIDE,
|
|
|
|
WIDX_RIDES,
|
|
|
|
WIDX_PARK,
|
|
|
|
WIDX_STAFF,
|
|
|
|
WIDX_GUESTS,
|
|
|
|
WIDX_CLEAR_SCENERY,
|
|
|
|
|
|
|
|
WIDX_FASTFORWARD,
|
|
|
|
WIDX_CHEATS,
|
|
|
|
WIDX_DEBUG,
|
|
|
|
WIDX_FINANCES,
|
|
|
|
WIDX_RESEARCH,
|
|
|
|
WIDX_NEWS,
|
|
|
|
WIDX_NETWORK,
|
|
|
|
|
|
|
|
WIDX_SEPARATOR,
|
2014-04-11 03:42:39 +02:00
|
|
|
};
|
|
|
|
|
2017-05-02 02:01:29 +02:00
|
|
|
validate_global_widx(WC_TOP_TOOLBAR, WIDX_PAUSE);
|
|
|
|
validate_global_widx(WC_TOP_TOOLBAR, WIDX_LAND);
|
|
|
|
validate_global_widx(WC_TOP_TOOLBAR, WIDX_WATER);
|
|
|
|
validate_global_widx(WC_TOP_TOOLBAR, WIDX_SCENERY);
|
|
|
|
validate_global_widx(WC_TOP_TOOLBAR, WIDX_PATH);
|
|
|
|
|
2018-02-14 09:42:26 +01:00
|
|
|
enum FILE_MENU_DDIDX {
|
2017-06-06 23:24:18 +02:00
|
|
|
DDIDX_NEW_GAME = 0,
|
|
|
|
DDIDX_LOAD_GAME = 1,
|
|
|
|
DDIDX_SAVE_GAME = 2,
|
|
|
|
DDIDX_SAVE_GAME_AS = 3,
|
|
|
|
// separator
|
|
|
|
DDIDX_ABOUT = 5,
|
|
|
|
DDIDX_OPTIONS = 6,
|
|
|
|
DDIDX_SCREENSHOT = 7,
|
|
|
|
DDIDX_GIANT_SCREENSHOT = 8,
|
|
|
|
// separator
|
|
|
|
DDIDX_QUIT_TO_MENU = 10,
|
|
|
|
DDIDX_EXIT_OPENRCT2 = 11,
|
|
|
|
// separator
|
|
|
|
DDIDX_ENABLE_TWITCH = 13
|
2018-02-14 09:42:26 +01:00
|
|
|
};
|
2014-08-10 10:34:27 +02:00
|
|
|
|
2018-02-14 09:42:26 +01:00
|
|
|
enum TOP_TOOLBAR_VIEW_MENU_DDIDX {
|
2017-06-06 23:24:18 +02:00
|
|
|
DDIDX_UNDERGROUND_INSIDE = 0,
|
|
|
|
DDIDX_HIDE_BASE = 1,
|
|
|
|
DDIDX_HIDE_VERTICAL = 2,
|
|
|
|
DDIDX_SEETHROUGH_RIDES = 4,
|
|
|
|
DDIDX_SEETHROUGH_SCENARY = 5,
|
|
|
|
DDIDX_SEETHROUGH_PATHS = 6,
|
|
|
|
DDIDX_INVISIBLE_SUPPORTS = 7,
|
|
|
|
DDIDX_INVISIBLE_PEEPS = 8,
|
|
|
|
DDIDX_LAND_HEIGHTS = 10,
|
|
|
|
DDIDX_TRACK_HEIGHTS = 11,
|
|
|
|
DDIDX_PATH_HEIGHTS = 12,
|
|
|
|
// 13 is a separator
|
|
|
|
DDIDX_VIEW_CLIPPING = 14,
|
2018-01-11 00:26:19 +01:00
|
|
|
DDIDX_HIGHLIGHT_PATH_ISSUES = 15,
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
TOP_TOOLBAR_VIEW_MENU_COUNT
|
2018-02-14 09:42:26 +01:00
|
|
|
};
|
2015-02-10 15:41:35 +01:00
|
|
|
|
2018-02-14 09:42:26 +01:00
|
|
|
enum TOP_TOOLBAR_DEBUG_DDIDX {
|
2017-06-06 23:24:18 +02:00
|
|
|
DDIDX_CONSOLE = 0,
|
|
|
|
DDIDX_TILE_INSPECTOR = 1,
|
|
|
|
DDIDX_OBJECT_SELECTION = 2,
|
|
|
|
DDIDX_INVENTIONS_LIST = 3,
|
|
|
|
DDIDX_SCENARIO_OPTIONS = 4,
|
|
|
|
DDIDX_DEBUG_PAINT = 5,
|
|
|
|
|
|
|
|
TOP_TOOLBAR_DEBUG_COUNT
|
2018-02-14 09:42:26 +01:00
|
|
|
};
|
2015-06-01 03:33:56 +02:00
|
|
|
|
2018-02-14 09:42:26 +01:00
|
|
|
enum TOP_TOOLBAR_NETWORK_DDIDX {
|
2017-06-06 23:24:18 +02:00
|
|
|
DDIDX_MULTIPLAYER = 0
|
2018-02-14 09:42:26 +01:00
|
|
|
};
|
2015-07-16 19:32:43 +02:00
|
|
|
|
2015-06-26 23:40:09 +02:00
|
|
|
enum {
|
2017-06-06 23:24:18 +02:00
|
|
|
DDIDX_CHEATS,
|
|
|
|
DDIDX_ENABLE_SANDBOX_MODE = 2,
|
|
|
|
DDIDX_DISABLE_CLEARANCE_CHECKS,
|
|
|
|
DDIDX_DISABLE_SUPPORT_LIMITS
|
2015-06-26 23:40:09 +02:00
|
|
|
};
|
|
|
|
|
2016-01-18 00:37:14 +01:00
|
|
|
enum {
|
2017-06-06 23:24:18 +02:00
|
|
|
DDIDX_SHOW_MAP,
|
|
|
|
DDIDX_OPEN_VIEWPORT,
|
2016-01-18 00:37:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2017-06-06 23:24:18 +02:00
|
|
|
DDIDX_ROTATE_CLOCKWISE,
|
|
|
|
DDIDX_ROTATE_ANTI_CLOCKWISE,
|
2016-01-18 00:37:14 +01:00
|
|
|
};
|
|
|
|
|
2015-02-05 22:22:35 +01:00
|
|
|
#pragma region Toolbar_widget_ordering
|
|
|
|
|
|
|
|
// from left to right
|
2018-01-11 14:50:31 +01:00
|
|
|
static constexpr const sint32 left_aligned_widgets_order[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
WIDX_PAUSE,
|
|
|
|
WIDX_FASTFORWARD,
|
|
|
|
WIDX_FILE_MENU,
|
|
|
|
WIDX_MUTE,
|
|
|
|
WIDX_NETWORK,
|
|
|
|
WIDX_CHEATS,
|
|
|
|
WIDX_DEBUG,
|
|
|
|
|
|
|
|
WIDX_SEPARATOR,
|
|
|
|
|
|
|
|
WIDX_ZOOM_OUT,
|
|
|
|
WIDX_ZOOM_IN,
|
|
|
|
WIDX_ROTATE,
|
|
|
|
WIDX_VIEW_MENU,
|
|
|
|
WIDX_MAP,
|
|
|
|
|
2015-02-05 22:22:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// from right to left
|
2018-01-11 14:50:31 +01:00
|
|
|
static constexpr const sint32 right_aligned_widgets_order[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
WIDX_NEWS,
|
|
|
|
WIDX_GUESTS,
|
|
|
|
WIDX_STAFF,
|
|
|
|
WIDX_PARK,
|
|
|
|
WIDX_RIDES,
|
|
|
|
WIDX_RESEARCH,
|
|
|
|
WIDX_FINANCES,
|
|
|
|
|
|
|
|
WIDX_SEPARATOR,
|
|
|
|
|
|
|
|
WIDX_CONSTRUCT_RIDE,
|
|
|
|
WIDX_PATH,
|
|
|
|
WIDX_SCENERY,
|
|
|
|
WIDX_WATER,
|
|
|
|
WIDX_LAND,
|
|
|
|
WIDX_CLEAR_SCENERY
|
2015-02-05 22:22:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#pragma endregion
|
|
|
|
|
2015-02-09 19:32:58 +01:00
|
|
|
static rct_widget window_top_toolbar_widgets[] = {
|
2017-07-20 20:56:29 +02:00
|
|
|
{ WWT_TRNBTN, 0, 0x0000, 0x001D, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_PAUSE, STR_PAUSE_GAME_TIP }, // Pause
|
|
|
|
{ WWT_TRNBTN, 0, 0x001E + 30, 0x003B + 30, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_FILE, STR_DISC_AND_GAME_OPTIONS_TIP }, // File menu
|
|
|
|
{ WWT_TRNBTN, 0, 0x00DC + 30, 0x00F9 + 30, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_G2_TOOLBAR_MUTE, STR_TOOLBAR_MUTE_TIP }, // Mute
|
|
|
|
{ WWT_TRNBTN, 1, 0x0046 + 30, 0x0063 + 30, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_ZOOM_OUT, STR_ZOOM_OUT_TIP }, // Zoom out
|
|
|
|
{ WWT_TRNBTN, 1, 0x0064 + 30, 0x0081 + 30, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_ZOOM_IN, STR_ZOOM_IN_TIP }, // Zoom in
|
|
|
|
{ WWT_TRNBTN, 1, 0x0082 + 30, 0x009F + 30, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_ROTATE, STR_ROTATE_TIP }, // Rotate camera
|
|
|
|
{ WWT_TRNBTN, 1, 0x00A0 + 30, 0x00BD + 30, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_VIEW, STR_VIEW_OPTIONS_TIP }, // Transparency menu
|
|
|
|
{ WWT_TRNBTN, 1, 0x00BE + 30, 0x00DB + 30, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_MAP, STR_SHOW_MAP_TIP }, // Map
|
|
|
|
{ WWT_TRNBTN, 2, 0x010B, 0x0128, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_LAND, STR_ADJUST_LAND_TIP }, // Land
|
|
|
|
{ WWT_TRNBTN, 2, 0x0129, 0x0146, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_WATER, STR_ADJUST_WATER_TIP }, // Water
|
|
|
|
{ WWT_TRNBTN, 2, 0x0147, 0x0164, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_SCENERY, STR_PLACE_SCENERY_TIP }, // Scenery
|
|
|
|
{ WWT_TRNBTN, 2, 0x0165, 0x0182, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_FOOTPATH, STR_BUILD_FOOTPATH_TIP }, // Path
|
|
|
|
{ WWT_TRNBTN, 2, 0x0183, 0x01A0, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_CONSTRUCT_RIDE, STR_BUILD_RIDE_TIP }, // Construct ride
|
|
|
|
{ WWT_TRNBTN, 3, 0x01EA, 0x0207, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_RIDES, STR_RIDES_IN_PARK_TIP }, // Rides
|
|
|
|
{ WWT_TRNBTN, 3, 0x0208, 0x0225, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_PARK, STR_PARK_INFORMATION_TIP }, // Park
|
|
|
|
{ WWT_TRNBTN, 3, 0x0226, 0x0243, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TAB_TOOLBAR, STR_STAFF_TIP }, // Staff
|
|
|
|
{ WWT_TRNBTN, 3, 0x0230, 0x024D, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_GUESTS, STR_GUESTS_TIP }, // Guests
|
|
|
|
{ WWT_TRNBTN, 2, 0x0230, 0x024D, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TOOLBAR_CLEAR_SCENERY, STR_CLEAR_SCENERY_TIP }, // Clear scenery
|
|
|
|
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TAB_TOOLBAR, STR_GAME_SPEED_TIP }, // Fast forward
|
|
|
|
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TAB_TOOLBAR, STR_CHEATS_TIP }, // Cheats
|
|
|
|
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TAB_TOOLBAR, STR_DEBUG_TIP }, // Debug
|
|
|
|
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TAB_TOOLBAR, STR_SCENARIO_OPTIONS_FINANCIAL_TIP },// Finances
|
|
|
|
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TAB_TOOLBAR, STR_FINANCES_RESEARCH_TIP }, // Research
|
|
|
|
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TAB_TOOLBAR, STR_SHOW_RECENT_MESSAGES_TIP }, // News
|
|
|
|
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, TOP_TOOLBAR_HEIGHT, IMAGE_TYPE_REMAP | SPR_TAB_TOOLBAR, STR_SHOW_MULTIPLAYER_STATUS_TIP }, // Network
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
{ WWT_EMPTY, 0, 0, 10-1, 0, 0, 0xFFFFFFFF, STR_NONE }, // Artificial widget separator
|
|
|
|
{ WIDGETS_END },
|
2014-04-11 03:42:39 +02:00
|
|
|
};
|
|
|
|
|
2017-05-01 15:41:45 +02:00
|
|
|
static void window_top_toolbar_mouseup(rct_window *w, rct_widgetindex widgetIndex);
|
2017-07-03 23:09:46 +02:00
|
|
|
static void window_top_toolbar_mousedown(rct_window *w, rct_widgetindex widgetIndex, rct_widget* widget);
|
2017-05-01 15:41:45 +02:00
|
|
|
static void window_top_toolbar_dropdown(rct_window *w, rct_widgetindex widgetIndex, sint32 dropdownIndex);
|
|
|
|
static void window_top_toolbar_tool_update(rct_window* w, rct_widgetindex widgetIndex, sint32 x, sint32 y);
|
|
|
|
static void window_top_toolbar_tool_down(rct_window* w, rct_widgetindex widgetIndex, sint32 x, sint32 y);
|
|
|
|
static void window_top_toolbar_tool_drag(rct_window* w, rct_widgetindex widgetIndex, sint32 x, sint32 y);
|
|
|
|
static void window_top_toolbar_tool_up(rct_window* w, rct_widgetindex widgetIndex, sint32 x, sint32 y);
|
|
|
|
static void window_top_toolbar_tool_abort(rct_window *w, rct_widgetindex widgetIndex);
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_top_toolbar_invalidate(rct_window *w);
|
|
|
|
static void window_top_toolbar_paint(rct_window *w, rct_drawpixelinfo *dpi);
|
|
|
|
|
|
|
|
static rct_window_event_list window_top_toolbar_events = {
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_top_toolbar_mouseup,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_top_toolbar_mousedown,
|
|
|
|
window_top_toolbar_dropdown,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr, // check if editor versions are significantly different...
|
2017-06-06 23:24:18 +02:00
|
|
|
window_top_toolbar_tool_update, // editor: 0x0066fB0E
|
|
|
|
window_top_toolbar_tool_down, // editor: 0x0066fB5C
|
|
|
|
window_top_toolbar_tool_drag, // editor: 0x0066fB37
|
|
|
|
window_top_toolbar_tool_up, // editor: 0x0066fC44 (Exactly the same)
|
|
|
|
window_top_toolbar_tool_abort, // editor: 0x0066fA74 (Exactly the same)
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_top_toolbar_invalidate,
|
|
|
|
window_top_toolbar_paint,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr
|
2014-04-11 03:42:39 +02:00
|
|
|
};
|
|
|
|
|
2017-08-06 14:41:13 +02:00
|
|
|
static void top_toolbar_init_view_menu(rct_window *window, rct_widget *widget);
|
|
|
|
static void top_toolbar_view_menu_dropdown(sint16 dropdownIndex);
|
|
|
|
static void top_toolbar_init_fastforward_menu(rct_window *window, rct_widget *widget);
|
|
|
|
static void top_toolbar_fastforward_menu_dropdown(sint16 dropdownIndex);
|
|
|
|
static void top_toolbar_init_rotate_menu(rct_window *window, rct_widget *widget);
|
|
|
|
static void top_toolbar_rotate_menu_dropdown(sint16 dropdownIndex);
|
|
|
|
static void top_toolbar_init_debug_menu(rct_window *window, rct_widget *widget);
|
|
|
|
static void top_toolbar_debug_menu_dropdown(sint16 dropdownIndex);
|
|
|
|
static void top_toolbar_init_network_menu(rct_window *window, rct_widget *widget);
|
|
|
|
static void top_toolbar_network_menu_dropdown(sint16 dropdownIndex);
|
2015-02-10 15:41:35 +01:00
|
|
|
|
2017-08-06 14:41:13 +02:00
|
|
|
static void toggle_footpath_window();
|
|
|
|
static void toggle_land_window(rct_window *topToolbar, rct_widgetindex widgetIndex);
|
|
|
|
static void toggle_clear_scenery_window(rct_window *topToolbar, rct_widgetindex widgetIndex);
|
|
|
|
static void toggle_water_window(rct_window *topToolbar, rct_widgetindex widgetIndex);
|
2015-02-10 15:41:35 +01:00
|
|
|
|
2017-11-11 02:57:45 +01:00
|
|
|
static money32 selection_lower_land(uint8 flags);
|
|
|
|
static money32 selection_raise_land(uint8 flags);
|
2015-05-26 21:36:05 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
static bool _menuDropdownIncludesTwitch;
|
|
|
|
static uint8 _unkF64F0E;
|
|
|
|
static sint16 _unkF64F0A;
|
2018-03-08 13:23:33 +01:00
|
|
|
// rct2: 0x00F64F15
|
|
|
|
static colour_t _secondaryColour;
|
|
|
|
// rct2: 0x00F64F16
|
|
|
|
static colour_t _tertiaryColour;
|
2015-05-25 21:36:40 +02:00
|
|
|
|
2014-04-11 03:42:39 +02:00
|
|
|
/**
|
|
|
|
* Creates the main game top toolbar window.
|
|
|
|
* rct2: 0x0066B485 (part of 0x0066B3E8)
|
|
|
|
*/
|
2017-11-11 02:57:45 +01:00
|
|
|
rct_window * window_top_toolbar_open()
|
2014-04-11 03:42:39 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window * window = window_create(
|
|
|
|
0, 0,
|
|
|
|
context_get_width(), TOP_TOOLBAR_HEIGHT + 1,
|
|
|
|
&window_top_toolbar_events,
|
|
|
|
WC_TOP_TOOLBAR,
|
|
|
|
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND
|
|
|
|
);
|
|
|
|
window->widgets = window_top_toolbar_widgets;
|
|
|
|
|
|
|
|
window_init_scroll_widgets(window);
|
2017-11-11 02:57:45 +01:00
|
|
|
|
|
|
|
return window;
|
2014-04-11 03:42:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2014-04-11 03:42:39 +02:00
|
|
|
* rct2: 0x0066C957
|
|
|
|
*/
|
2017-05-01 15:41:45 +02:00
|
|
|
static void window_top_toolbar_mouseup(rct_window *w, rct_widgetindex widgetIndex)
|
2014-04-11 03:42:39 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window *mainWindow;
|
|
|
|
|
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_PAUSE:
|
|
|
|
if (network_get_mode() != NETWORK_MODE_CLIENT) {
|
|
|
|
game_do_command(0, 1, 0, 0, GAME_COMMAND_TOGGLE_PAUSE, 0, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WIDX_ZOOM_OUT:
|
2017-08-15 10:07:44 +02:00
|
|
|
if ((mainWindow = window_get_main()) != nullptr)
|
2017-06-06 23:24:18 +02:00
|
|
|
window_zoom_out(mainWindow, false);
|
|
|
|
break;
|
|
|
|
case WIDX_ZOOM_IN:
|
2017-08-15 10:07:44 +02:00
|
|
|
if ((mainWindow = window_get_main()) != nullptr)
|
2017-06-06 23:24:18 +02:00
|
|
|
window_zoom_in(mainWindow, false);
|
|
|
|
break;
|
|
|
|
case WIDX_CLEAR_SCENERY:
|
|
|
|
toggle_clear_scenery_window(w, WIDX_CLEAR_SCENERY);
|
|
|
|
break;
|
|
|
|
case WIDX_LAND:
|
|
|
|
toggle_land_window(w, WIDX_LAND);
|
|
|
|
break;
|
|
|
|
case WIDX_WATER:
|
|
|
|
toggle_water_window(w, WIDX_WATER);
|
|
|
|
break;
|
|
|
|
case WIDX_SCENERY:
|
|
|
|
if (!tool_set(w, WIDX_SCENERY, TOOL_ARROW)) {
|
|
|
|
input_set_flag(INPUT_FLAG_6, true);
|
2017-11-12 02:32:11 +01:00
|
|
|
context_open_window(WC_SCENERY);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WIDX_PATH:
|
|
|
|
toggle_footpath_window();
|
|
|
|
break;
|
|
|
|
case WIDX_CONSTRUCT_RIDE:
|
2017-10-07 01:28:00 +02:00
|
|
|
context_open_window(WC_CONSTRUCT_RIDE);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case WIDX_RIDES:
|
2017-10-08 22:15:41 +02:00
|
|
|
context_open_window(WC_RIDE_LIST);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case WIDX_PARK:
|
2017-09-05 20:55:18 +02:00
|
|
|
context_open_window(WC_PARK_INFORMATION);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case WIDX_STAFF:
|
2017-08-12 23:06:12 +02:00
|
|
|
context_open_window(WC_STAFF_LIST);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case WIDX_GUESTS:
|
2017-09-10 11:02:16 +02:00
|
|
|
context_open_window(WC_GUEST_LIST);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case WIDX_FINANCES:
|
2017-09-05 20:55:18 +02:00
|
|
|
context_open_window(WC_FINANCES);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case WIDX_RESEARCH:
|
2017-10-07 01:28:00 +02:00
|
|
|
context_open_window(WC_RESEARCH);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case WIDX_NEWS:
|
2017-08-06 05:22:00 +02:00
|
|
|
context_open_window(WC_RECENT_NEWS);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case WIDX_MUTE:
|
|
|
|
audio_toggle_all_sounds();
|
|
|
|
break;
|
|
|
|
}
|
2014-04-11 03:42:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2014-04-11 03:42:39 +02:00
|
|
|
* rct2: 0x0066CA3B
|
|
|
|
*/
|
2017-07-03 23:09:46 +02:00
|
|
|
static void window_top_toolbar_mousedown(rct_window *w, rct_widgetindex widgetIndex, rct_widget* widget)
|
2014-04-11 03:42:39 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
sint32 numItems;
|
|
|
|
|
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_FILE_MENU:
|
|
|
|
_menuDropdownIncludesTwitch = false;
|
|
|
|
if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) {
|
|
|
|
gDropdownItemsFormat[0] = STR_ABOUT;
|
|
|
|
gDropdownItemsFormat[1] = STR_OPTIONS;
|
|
|
|
gDropdownItemsFormat[2] = STR_SCREENSHOT;
|
|
|
|
gDropdownItemsFormat[3] = STR_GIANT_SCREENSHOT;
|
|
|
|
gDropdownItemsFormat[4] = STR_EMPTY;
|
|
|
|
gDropdownItemsFormat[5] = STR_QUIT_TRACK_DESIGNS_MANAGER;
|
|
|
|
gDropdownItemsFormat[6] = STR_EXIT_OPENRCT2;
|
|
|
|
|
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|
|
|
|
gDropdownItemsFormat[5] = STR_QUIT_ROLLERCOASTER_DESIGNER;
|
|
|
|
|
|
|
|
numItems = 7;
|
|
|
|
} else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) {
|
|
|
|
gDropdownItemsFormat[0] = STR_LOAD_LANDSCAPE;
|
|
|
|
gDropdownItemsFormat[1] = STR_SAVE_LANDSCAPE;
|
|
|
|
gDropdownItemsFormat[2] = STR_EMPTY;
|
|
|
|
gDropdownItemsFormat[3] = STR_ABOUT;
|
|
|
|
gDropdownItemsFormat[4] = STR_OPTIONS;
|
|
|
|
gDropdownItemsFormat[5] = STR_SCREENSHOT;
|
|
|
|
gDropdownItemsFormat[6] = STR_GIANT_SCREENSHOT;
|
|
|
|
gDropdownItemsFormat[7] = STR_EMPTY;
|
|
|
|
gDropdownItemsFormat[8] = STR_QUIT_SCENARIO_EDITOR;
|
|
|
|
gDropdownItemsFormat[9] = STR_EXIT_OPENRCT2;
|
|
|
|
numItems = 10;
|
|
|
|
} else {
|
|
|
|
gDropdownItemsFormat[0] = STR_NEW_GAME;
|
|
|
|
gDropdownItemsFormat[1] = STR_LOAD_GAME;
|
|
|
|
gDropdownItemsFormat[2] = STR_SAVE_GAME;
|
|
|
|
gDropdownItemsFormat[3] = STR_SAVE_GAME_AS;
|
|
|
|
gDropdownItemsFormat[4] = STR_EMPTY;
|
|
|
|
gDropdownItemsFormat[5] = STR_ABOUT;
|
|
|
|
gDropdownItemsFormat[6] = STR_OPTIONS;
|
|
|
|
gDropdownItemsFormat[7] = STR_SCREENSHOT;
|
|
|
|
gDropdownItemsFormat[8] = STR_GIANT_SCREENSHOT;
|
|
|
|
gDropdownItemsFormat[9] = STR_EMPTY;
|
|
|
|
gDropdownItemsFormat[10] = STR_QUIT_TO_MENU;
|
|
|
|
gDropdownItemsFormat[11] = STR_EXIT_OPENRCT2;
|
|
|
|
numItems = 12;
|
|
|
|
|
|
|
|
#ifndef DISABLE_TWITCH
|
2017-08-15 10:07:44 +02:00
|
|
|
if (gConfigTwitch.channel != nullptr && gConfigTwitch.channel[0] != 0) {
|
2017-06-06 23:24:18 +02:00
|
|
|
_menuDropdownIncludesTwitch = true;
|
|
|
|
gDropdownItemsFormat[12] = STR_EMPTY;
|
|
|
|
gDropdownItemsFormat[DDIDX_ENABLE_TWITCH] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsArgs[DDIDX_ENABLE_TWITCH] = STR_TWITCH_ENABLE;
|
|
|
|
numItems = 14;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
window_dropdown_show_text(
|
|
|
|
w->x + widget->left,
|
|
|
|
w->y + widget->top,
|
|
|
|
widget->bottom - widget->top + 1,
|
|
|
|
w->colours[0] | 0x80,
|
|
|
|
DROPDOWN_FLAG_STAY_OPEN,
|
|
|
|
numItems
|
|
|
|
);
|
2015-05-25 21:36:40 +02:00
|
|
|
|
2015-05-28 12:52:40 +02:00
|
|
|
#ifndef DISABLE_TWITCH
|
2017-06-06 23:24:18 +02:00
|
|
|
if (_menuDropdownIncludesTwitch && gTwitchEnable) {
|
|
|
|
dropdown_set_checked(DDIDX_ENABLE_TWITCH, true);
|
|
|
|
}
|
2015-05-28 12:52:40 +02:00
|
|
|
#endif
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case WIDX_CHEATS:
|
|
|
|
gDropdownItemsFormat[0] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[1] = STR_EMPTY;
|
|
|
|
gDropdownItemsFormat[2] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[3] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[4] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsArgs[0] = STR_CHEAT_TITLE;
|
|
|
|
gDropdownItemsArgs[2] = STR_ENABLE_SANDBOX_MODE;
|
|
|
|
gDropdownItemsArgs[3] = STR_DISABLE_CLEARANCE_CHECKS;
|
|
|
|
gDropdownItemsArgs[4] = STR_DISABLE_SUPPORT_LIMITS;
|
|
|
|
window_dropdown_show_text(
|
|
|
|
w->x + widget->left,
|
|
|
|
w->y + widget->top,
|
|
|
|
widget->bottom - widget->top + 1,
|
|
|
|
w->colours[0] | 0x80,
|
|
|
|
0,
|
|
|
|
5
|
|
|
|
);
|
|
|
|
if (gCheatsSandboxMode) {
|
|
|
|
dropdown_set_checked(DDIDX_ENABLE_SANDBOX_MODE, true);
|
|
|
|
}
|
|
|
|
if (gCheatsDisableClearanceChecks) {
|
|
|
|
dropdown_set_checked(DDIDX_DISABLE_CLEARANCE_CHECKS, true);
|
|
|
|
}
|
|
|
|
if (gCheatsDisableSupportLimits) {
|
|
|
|
dropdown_set_checked(DDIDX_DISABLE_SUPPORT_LIMITS, true);
|
|
|
|
}
|
|
|
|
gDropdownDefaultIndex = DDIDX_CHEATS;
|
|
|
|
break;
|
|
|
|
case WIDX_VIEW_MENU:
|
|
|
|
top_toolbar_init_view_menu(w, widget);
|
|
|
|
break;
|
|
|
|
case WIDX_MAP:
|
|
|
|
gDropdownItemsFormat[0] = STR_SHORTCUT_SHOW_MAP;
|
|
|
|
gDropdownItemsFormat[1] = STR_EXTRA_VIEWPORT;
|
|
|
|
numItems = 2;
|
|
|
|
|
|
|
|
if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) {
|
|
|
|
gDropdownItemsFormat[2] = STR_MAPGEN_WINDOW_TITLE;
|
|
|
|
numItems++;
|
|
|
|
}
|
|
|
|
|
|
|
|
window_dropdown_show_text(
|
|
|
|
w->x + widget->left,
|
|
|
|
w->y + widget->top,
|
|
|
|
widget->bottom - widget->top + 1,
|
|
|
|
w->colours[1] | 0x80,
|
|
|
|
0,
|
|
|
|
numItems
|
|
|
|
);
|
|
|
|
gDropdownDefaultIndex = DDIDX_SHOW_MAP;
|
|
|
|
break;
|
|
|
|
case WIDX_FASTFORWARD:
|
|
|
|
top_toolbar_init_fastforward_menu(w, widget);
|
|
|
|
break;
|
|
|
|
case WIDX_ROTATE:
|
|
|
|
top_toolbar_init_rotate_menu(w, widget);
|
|
|
|
break;
|
|
|
|
case WIDX_DEBUG:
|
|
|
|
top_toolbar_init_debug_menu(w, widget);
|
|
|
|
break;
|
|
|
|
case WIDX_NETWORK:
|
|
|
|
top_toolbar_init_network_menu(w, widget);
|
|
|
|
break;
|
|
|
|
}
|
2014-04-11 03:42:39 +02:00
|
|
|
}
|
|
|
|
|
2016-02-10 19:44:00 +01:00
|
|
|
static void window_top_toolbar_scenarioselect_callback(const utf8 *path)
|
|
|
|
{
|
2017-08-23 08:04:36 +02:00
|
|
|
context_load_park_from_file(path);
|
2016-02-10 19:44:00 +01:00
|
|
|
}
|
|
|
|
|
2014-04-11 03:42:39 +02:00
|
|
|
/**
|
2015-06-26 23:40:09 +02:00
|
|
|
*
|
2014-04-11 03:42:39 +02:00
|
|
|
* rct2: 0x0066C9EA
|
|
|
|
*/
|
2017-05-01 15:41:45 +02:00
|
|
|
static void window_top_toolbar_dropdown(rct_window *w, rct_widgetindex widgetIndex, sint32 dropdownIndex)
|
2014-04-11 03:42:39 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_FILE_MENU:
|
|
|
|
|
|
|
|
// New game is only available in the normal game. Skip one position to avoid incorrect mappings in the menus of the other modes.
|
|
|
|
if (gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR))
|
|
|
|
dropdownIndex += 1;
|
|
|
|
|
|
|
|
// Quicksave is only available in the normal game. Skip one position to avoid incorrect mappings in the menus of the other modes.
|
|
|
|
if (gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR) && dropdownIndex > DDIDX_LOAD_GAME)
|
|
|
|
dropdownIndex += 1;
|
|
|
|
|
|
|
|
// Track designer and track designs manager start with About, not Load/save
|
|
|
|
if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))
|
|
|
|
dropdownIndex += DDIDX_ABOUT;
|
|
|
|
|
|
|
|
switch (dropdownIndex) {
|
|
|
|
case DDIDX_NEW_GAME:
|
2017-09-12 00:04:03 +02:00
|
|
|
{
|
|
|
|
auto intent = Intent(WC_SCENARIO_SELECT);
|
2017-09-12 21:21:39 +02:00
|
|
|
intent.putExtra(INTENT_EXTRA_CALLBACK, (void *) window_top_toolbar_scenarioselect_callback);
|
2017-09-12 00:04:03 +02:00
|
|
|
context_open_intent(&intent);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
2017-09-12 00:04:03 +02:00
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
case DDIDX_LOAD_GAME:
|
|
|
|
game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);
|
|
|
|
break;
|
|
|
|
case DDIDX_SAVE_GAME:
|
|
|
|
tool_cancel();
|
|
|
|
save_game();
|
|
|
|
break;
|
|
|
|
case DDIDX_SAVE_GAME_AS:
|
|
|
|
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) {
|
2017-09-12 00:04:03 +02:00
|
|
|
auto intent = Intent(WC_LOADSAVE);
|
2017-09-12 21:21:39 +02:00
|
|
|
intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE);
|
2017-10-17 22:31:05 +02:00
|
|
|
intent.putExtra(INTENT_EXTRA_PATH, std::string { gS6Info.name });
|
2017-09-12 00:04:03 +02:00
|
|
|
context_open_intent(&intent);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
tool_cancel();
|
|
|
|
save_game_as();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DDIDX_ABOUT:
|
2017-08-06 05:22:00 +02:00
|
|
|
context_open_window(WC_ABOUT);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_OPTIONS:
|
2017-08-06 05:22:00 +02:00
|
|
|
context_open_window(WC_OPTIONS);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_SCREENSHOT:
|
|
|
|
gScreenshotCountdown = 10;
|
|
|
|
break;
|
|
|
|
case DDIDX_GIANT_SCREENSHOT:
|
|
|
|
screenshot_giant();
|
|
|
|
break;
|
|
|
|
case DDIDX_QUIT_TO_MENU:
|
|
|
|
window_close_by_class(WC_MANAGE_TRACK_DESIGN);
|
|
|
|
window_close_by_class(WC_TRACK_DELETE_PROMPT);
|
|
|
|
game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 1, 0);
|
|
|
|
break;
|
|
|
|
case DDIDX_EXIT_OPENRCT2:
|
2017-07-28 19:43:48 +02:00
|
|
|
context_quit();
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
2015-05-28 12:52:40 +02:00
|
|
|
#ifndef DISABLE_TWITCH
|
2017-06-06 23:24:18 +02:00
|
|
|
case DDIDX_ENABLE_TWITCH:
|
|
|
|
gTwitchEnable = !gTwitchEnable;
|
|
|
|
break;
|
2015-05-28 12:52:40 +02:00
|
|
|
#endif
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WIDX_CHEATS:
|
|
|
|
switch (dropdownIndex) {
|
|
|
|
case DDIDX_CHEATS:
|
2017-08-06 05:22:00 +02:00
|
|
|
context_open_window(WC_CHEATS);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_ENABLE_SANDBOX_MODE:
|
|
|
|
game_do_command(0, GAME_COMMAND_FLAG_APPLY, CHEAT_SANDBOXMODE, !gCheatsSandboxMode, GAME_COMMAND_CHEAT, 0, 0);
|
|
|
|
break;
|
|
|
|
case DDIDX_DISABLE_CLEARANCE_CHECKS:
|
|
|
|
game_do_command(0, GAME_COMMAND_FLAG_APPLY, CHEAT_DISABLECLEARANCECHECKS, !gCheatsDisableClearanceChecks, GAME_COMMAND_CHEAT, 0, 0);
|
|
|
|
break;
|
|
|
|
case DDIDX_DISABLE_SUPPORT_LIMITS:
|
|
|
|
game_do_command(0, GAME_COMMAND_FLAG_APPLY, CHEAT_DISABLESUPPORTLIMITS, !gCheatsDisableSupportLimits, GAME_COMMAND_CHEAT, 0, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WIDX_VIEW_MENU:
|
|
|
|
top_toolbar_view_menu_dropdown(dropdownIndex);
|
|
|
|
break;
|
|
|
|
case WIDX_MAP:
|
|
|
|
switch (dropdownIndex) {
|
|
|
|
case 0:
|
2017-10-06 23:03:48 +02:00
|
|
|
context_open_window(WC_MAP);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 1:
|
2017-08-06 05:22:00 +02:00
|
|
|
context_open_window(WC_VIEWPORT);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2017-08-06 05:22:00 +02:00
|
|
|
context_open_window(WC_MAPGEN);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WIDX_FASTFORWARD:
|
|
|
|
top_toolbar_fastforward_menu_dropdown(dropdownIndex);
|
|
|
|
break;
|
|
|
|
case WIDX_ROTATE:
|
|
|
|
top_toolbar_rotate_menu_dropdown(dropdownIndex);
|
|
|
|
break;
|
|
|
|
case WIDX_DEBUG:
|
|
|
|
top_toolbar_debug_menu_dropdown(dropdownIndex);
|
|
|
|
break;
|
|
|
|
case WIDX_NETWORK:
|
|
|
|
top_toolbar_network_menu_dropdown(dropdownIndex);
|
|
|
|
break;
|
|
|
|
}
|
2014-04-11 03:42:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2014-04-11 03:42:39 +02:00
|
|
|
* rct2: 0x0066C810
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_top_toolbar_invalidate(rct_window *w)
|
2014-04-11 03:42:39 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
sint32 x, enabledWidgets, widgetIndex, widgetWidth, firstAlignment;
|
|
|
|
rct_widget *widget;
|
|
|
|
|
|
|
|
// Enable / disable buttons
|
|
|
|
window_top_toolbar_widgets[WIDX_PAUSE].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_FILE_MENU].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_ZOOM_OUT].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_ZOOM_IN].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_ROTATE].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_VIEW_MENU].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_MAP].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_MUTE].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_LAND].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_WATER].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_SCENERY].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_PATH].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_CONSTRUCT_RIDE].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_RIDES].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_PARK].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_STAFF].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_GUESTS].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_CLEAR_SCENERY].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_FINANCES].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_RESEARCH].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_FASTFORWARD].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_DEBUG].type = gConfigGeneral.debugging_tools ? WWT_TRNBTN : WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_NEWS].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_NETWORK].type = WWT_TRNBTN;
|
|
|
|
|
2017-08-02 22:28:23 +02:00
|
|
|
if (!gConfigInterface.toolbar_show_mute)
|
|
|
|
{
|
|
|
|
window_top_toolbar_widgets[WIDX_MUTE].type = WWT_EMPTY;
|
|
|
|
}
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) {
|
|
|
|
window_top_toolbar_widgets[WIDX_PAUSE].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_RIDES].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_PARK].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_STAFF].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_GUESTS].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_FINANCES].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_RESEARCH].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_NEWS].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_NETWORK].type = WWT_EMPTY;
|
|
|
|
|
|
|
|
if (gS6Info.editor_step != EDITOR_STEP_LANDSCAPE_EDITOR) {
|
|
|
|
window_top_toolbar_widgets[WIDX_MAP].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_LAND].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_WATER].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_SCENERY].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_PATH].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_CLEAR_SCENERY].type = WWT_EMPTY;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) {
|
|
|
|
window_top_toolbar_widgets[WIDX_CONSTRUCT_RIDE].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_FASTFORWARD].type = WWT_EMPTY;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gS6Info.editor_step != EDITOR_STEP_LANDSCAPE_EDITOR && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) {
|
|
|
|
window_top_toolbar_widgets[WIDX_ZOOM_OUT].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_ZOOM_IN].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_ROTATE].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_VIEW_MENU].type = WWT_EMPTY;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ((gParkFlags & PARK_FLAGS_NO_MONEY) || !gConfigInterface.toolbar_show_finances)
|
|
|
|
window_top_toolbar_widgets[WIDX_FINANCES].type = WWT_EMPTY;
|
|
|
|
|
|
|
|
if (!gConfigInterface.toolbar_show_research)
|
|
|
|
window_top_toolbar_widgets[WIDX_RESEARCH].type = WWT_EMPTY;
|
|
|
|
|
|
|
|
if (!gConfigInterface.toolbar_show_cheats)
|
|
|
|
window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_EMPTY;
|
|
|
|
|
|
|
|
if (!gConfigInterface.toolbar_show_news)
|
|
|
|
window_top_toolbar_widgets[WIDX_NEWS].type = WWT_EMPTY;
|
|
|
|
|
|
|
|
switch (network_get_mode()) {
|
|
|
|
case NETWORK_MODE_NONE:
|
|
|
|
window_top_toolbar_widgets[WIDX_NETWORK].type = WWT_EMPTY;
|
|
|
|
break;
|
|
|
|
case NETWORK_MODE_CLIENT:
|
|
|
|
window_top_toolbar_widgets[WIDX_PAUSE].type = WWT_EMPTY;
|
|
|
|
// Fall-through
|
|
|
|
case NETWORK_MODE_SERVER:
|
|
|
|
window_top_toolbar_widgets[WIDX_FASTFORWARD].type = WWT_EMPTY;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
enabledWidgets = 0;
|
|
|
|
for (int i = WIDX_PAUSE; i <= WIDX_NETWORK; i++)
|
|
|
|
if (window_top_toolbar_widgets[i].type != WWT_EMPTY)
|
|
|
|
enabledWidgets |= (1 << i);
|
|
|
|
w->enabled_widgets = enabledWidgets;
|
|
|
|
|
|
|
|
// Align left hand side toolbar buttons
|
|
|
|
firstAlignment = 1;
|
|
|
|
x = 0;
|
2017-08-03 03:06:32 +02:00
|
|
|
for (size_t i = 0; i < Util::CountOf(left_aligned_widgets_order); ++i) {
|
2017-06-06 23:24:18 +02:00
|
|
|
widgetIndex = left_aligned_widgets_order[i];
|
|
|
|
widget = &window_top_toolbar_widgets[widgetIndex];
|
|
|
|
if (widget->type == WWT_EMPTY && widgetIndex != WIDX_SEPARATOR)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (firstAlignment && widgetIndex == WIDX_SEPARATOR)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
widgetWidth = widget->right - widget->left;
|
|
|
|
widget->left = x;
|
|
|
|
x += widgetWidth;
|
|
|
|
widget->right = x;
|
|
|
|
x += 1;
|
|
|
|
firstAlignment = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Align right hand side toolbar buttons
|
|
|
|
sint32 screenWidth = context_get_width();
|
|
|
|
firstAlignment = 1;
|
2017-08-02 00:20:32 +02:00
|
|
|
x = Math::Max(640, screenWidth);
|
2017-08-03 03:06:32 +02:00
|
|
|
for (size_t i = 0; i < Util::CountOf(right_aligned_widgets_order); ++i) {
|
2017-06-06 23:24:18 +02:00
|
|
|
widgetIndex = right_aligned_widgets_order[i];
|
|
|
|
widget = &window_top_toolbar_widgets[widgetIndex];
|
|
|
|
if (widget->type == WWT_EMPTY && widgetIndex != WIDX_SEPARATOR)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (firstAlignment && widgetIndex == WIDX_SEPARATOR)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
widgetWidth = widget->right - widget->left;
|
|
|
|
x -= 1;
|
|
|
|
widget->right = x;
|
|
|
|
x -= widgetWidth;
|
|
|
|
widget->left = x;
|
|
|
|
firstAlignment = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Footpath button pressed down
|
2017-08-15 10:07:44 +02:00
|
|
|
if (window_find_by_class(WC_FOOTPATH) == nullptr)
|
2017-06-06 23:24:18 +02:00
|
|
|
w->pressed_widgets &= ~(1 << WIDX_PATH);
|
|
|
|
else
|
|
|
|
w->pressed_widgets |= (1 << WIDX_PATH);
|
|
|
|
|
|
|
|
if (gGamePaused & GAME_PAUSED_NORMAL)
|
|
|
|
w->pressed_widgets |= (1 << WIDX_PAUSE);
|
|
|
|
else
|
|
|
|
w->pressed_widgets &= ~(1 << WIDX_PAUSE);
|
|
|
|
|
|
|
|
if (!gGameSoundsOff)
|
2017-07-20 20:56:29 +02:00
|
|
|
window_top_toolbar_widgets[WIDX_MUTE].image = IMAGE_TYPE_REMAP | SPR_G2_TOOLBAR_MUTE;
|
2017-06-06 23:24:18 +02:00
|
|
|
else
|
2017-07-20 20:56:29 +02:00
|
|
|
window_top_toolbar_widgets[WIDX_MUTE].image = IMAGE_TYPE_REMAP | SPR_G2_TOOLBAR_UNMUTE;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// Zoomed out/in disable. Not sure where this code is in the original.
|
2017-11-30 22:21:25 +01:00
|
|
|
if (window_get_main()->viewport->zoom == 0)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->disabled_widgets |= (1 << WIDX_ZOOM_IN);
|
2017-11-30 22:21:25 +01:00
|
|
|
}
|
|
|
|
else if (window_get_main()->viewport->zoom >= MAX_ZOOM_LEVEL)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->disabled_widgets |= (1 << WIDX_ZOOM_OUT);
|
2017-11-30 22:21:25 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
w->disabled_widgets &= ~((1 << WIDX_ZOOM_IN) | (1 << WIDX_ZOOM_OUT));
|
|
|
|
}
|
2014-04-11 03:42:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2014-04-11 03:42:39 +02:00
|
|
|
* rct2: 0x0066C8EC
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_top_toolbar_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
2014-04-11 03:42:39 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
sint32 x, y, imgId;
|
|
|
|
|
|
|
|
window_draw_widgets(w, dpi);
|
|
|
|
|
|
|
|
// Draw staff button image (setting masks to the staff colours)
|
|
|
|
if (window_top_toolbar_widgets[WIDX_STAFF].type != WWT_EMPTY) {
|
|
|
|
x = w->x + window_top_toolbar_widgets[WIDX_STAFF].left;
|
|
|
|
y = w->y + window_top_toolbar_widgets[WIDX_STAFF].top;
|
|
|
|
imgId = SPR_TOOLBAR_STAFF;
|
|
|
|
if (widget_is_pressed(w, WIDX_STAFF))
|
|
|
|
imgId++;
|
2017-07-20 20:56:29 +02:00
|
|
|
imgId |= SPRITE_ID_PALETTE_COLOUR_2(gStaffHandymanColour, gStaffMechanicColour);
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_sprite(dpi, imgId, x, y, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw fast forward button
|
|
|
|
if (window_top_toolbar_widgets[WIDX_FASTFORWARD].type != WWT_EMPTY) {
|
|
|
|
x = w->x + window_top_toolbar_widgets[WIDX_FASTFORWARD].left + 0;
|
|
|
|
y = w->y + window_top_toolbar_widgets[WIDX_FASTFORWARD].top + 0;
|
|
|
|
if (widget_is_pressed(w, WIDX_FASTFORWARD))
|
|
|
|
y++;
|
|
|
|
imgId = SPR_G2_FASTFORWARD;
|
|
|
|
gfx_draw_sprite(dpi, imgId, x + 6, y + 3, 0);
|
|
|
|
|
|
|
|
|
|
|
|
for (sint32 i = 0; i < gGameSpeed && gGameSpeed <= 4; i++) {
|
|
|
|
gfx_draw_sprite(dpi, SPR_G2_SPEED_ARROW, x + 5 + i * 5, y + 15, 0);
|
|
|
|
}
|
|
|
|
for (sint32 i = 0; i < 3 && i < gGameSpeed - 4 && gGameSpeed >= 5; i++) {
|
|
|
|
gfx_draw_sprite(dpi, SPR_G2_HYPER_ARROW, x + 5 + i * 6, y + 15, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw cheats button
|
|
|
|
if (window_top_toolbar_widgets[WIDX_CHEATS].type != WWT_EMPTY) {
|
|
|
|
x = w->x + window_top_toolbar_widgets[WIDX_CHEATS].left - 1;
|
|
|
|
y = w->y + window_top_toolbar_widgets[WIDX_CHEATS].top - 1;
|
|
|
|
if (widget_is_pressed(w, WIDX_CHEATS))
|
|
|
|
y++;
|
|
|
|
imgId = SPR_G2_SANDBOX;
|
|
|
|
gfx_draw_sprite(dpi, imgId, x, y, 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw debug button
|
|
|
|
if (window_top_toolbar_widgets[WIDX_DEBUG].type != WWT_EMPTY) {
|
|
|
|
x = w->x + window_top_toolbar_widgets[WIDX_DEBUG].left;
|
|
|
|
y = w->y + window_top_toolbar_widgets[WIDX_DEBUG].top - 1;
|
|
|
|
if (widget_is_pressed(w, WIDX_DEBUG))
|
|
|
|
y++;
|
|
|
|
imgId = SPR_TAB_GEARS_0;
|
|
|
|
gfx_draw_sprite(dpi, imgId, x, y, 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw research button
|
|
|
|
if (window_top_toolbar_widgets[WIDX_RESEARCH].type != WWT_EMPTY) {
|
|
|
|
x = w->x + window_top_toolbar_widgets[WIDX_RESEARCH].left - 1;
|
|
|
|
y = w->y + window_top_toolbar_widgets[WIDX_RESEARCH].top;
|
|
|
|
if (widget_is_pressed(w, WIDX_RESEARCH))
|
|
|
|
y++;
|
|
|
|
imgId = SPR_TAB_FINANCES_RESEARCH_0;
|
|
|
|
gfx_draw_sprite(dpi, imgId, x, y, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw finances button
|
|
|
|
if (window_top_toolbar_widgets[WIDX_FINANCES].type != WWT_EMPTY) {
|
|
|
|
x = w->x + window_top_toolbar_widgets[WIDX_FINANCES].left + 3;
|
|
|
|
y = w->y + window_top_toolbar_widgets[WIDX_FINANCES].top + 1;
|
|
|
|
if (widget_is_pressed(w, WIDX_FINANCES))
|
|
|
|
y++;
|
|
|
|
imgId = SPR_FINANCE;
|
|
|
|
gfx_draw_sprite(dpi, imgId, x, y, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw news button
|
|
|
|
if (window_top_toolbar_widgets[WIDX_NEWS].type != WWT_EMPTY) {
|
|
|
|
x = w->x + window_top_toolbar_widgets[WIDX_NEWS].left + 3;
|
|
|
|
y = w->y + window_top_toolbar_widgets[WIDX_NEWS].top + 0;
|
|
|
|
if (widget_is_pressed(w, WIDX_NEWS))
|
|
|
|
y++;
|
|
|
|
imgId = SPR_G2_TAB_NEWS;
|
|
|
|
gfx_draw_sprite(dpi, imgId, x, y, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw network button
|
|
|
|
if (window_top_toolbar_widgets[WIDX_NETWORK].type != WWT_EMPTY) {
|
|
|
|
x = w->x + window_top_toolbar_widgets[WIDX_NETWORK].left + 3;
|
|
|
|
y = w->y + window_top_toolbar_widgets[WIDX_NETWORK].top + 0;
|
|
|
|
if (widget_is_pressed(w, WIDX_NETWORK))
|
|
|
|
y++;
|
|
|
|
imgId = SPR_SHOW_GUESTS_ON_THIS_RIDE_ATTRACTION;
|
|
|
|
gfx_draw_sprite(dpi, imgId, x, y, 0);
|
|
|
|
}
|
2014-04-21 11:27:48 +02:00
|
|
|
}
|
2014-10-21 18:59:47 +02:00
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006E3158
|
|
|
|
*/
|
2017-05-01 15:41:45 +02:00
|
|
|
static void repaint_scenery_tool_down(sint16 x, sint16 y, rct_widgetindex widgetIndex){
|
2017-06-06 23:24:18 +02:00
|
|
|
// ax, cx, bl
|
|
|
|
sint16 grid_x, grid_y;
|
|
|
|
sint32 type;
|
|
|
|
// edx
|
2017-10-31 12:57:40 +01:00
|
|
|
rct_tile_element* tile_element;
|
2017-06-06 23:24:18 +02:00
|
|
|
uint16 flags =
|
|
|
|
VIEWPORT_INTERACTION_MASK_SCENERY &
|
|
|
|
VIEWPORT_INTERACTION_MASK_WALL &
|
|
|
|
VIEWPORT_INTERACTION_MASK_LARGE_SCENERY &
|
|
|
|
VIEWPORT_INTERACTION_MASK_BANNER;
|
|
|
|
// This is -2 as banner is 12 but flags are offset different
|
|
|
|
|
|
|
|
// not used
|
|
|
|
rct_viewport* viewport;
|
2017-10-31 12:57:40 +01:00
|
|
|
get_map_coordinates_from_pos(x, y, flags, &grid_x, &grid_y, &type, &tile_element, &viewport);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
switch (type){
|
|
|
|
case VIEWPORT_INTERACTION_ITEM_SCENERY:
|
|
|
|
{
|
2017-10-31 12:57:40 +01:00
|
|
|
rct_scenery_entry* scenery_entry = get_small_scenery_entry(tile_element->properties.scenery.type);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// If can't repaint
|
2017-12-04 20:09:38 +01:00
|
|
|
if (!scenery_small_entry_has_flag(scenery_entry, SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR | SMALL_SCENERY_FLAG_HAS_GLASS))
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
gGameCommandErrorTitle = STR_CANT_REPAINT_THIS;
|
|
|
|
game_do_command(
|
|
|
|
grid_x,
|
2017-10-31 12:57:40 +01:00
|
|
|
1 | (tile_element->type << 8),
|
2017-06-06 23:24:18 +02:00
|
|
|
grid_y,
|
2017-10-31 12:57:40 +01:00
|
|
|
tile_element->base_height | (tile_element->properties.scenery.type << 8),
|
2017-06-06 23:24:18 +02:00
|
|
|
GAME_COMMAND_SET_SCENERY_COLOUR,
|
|
|
|
0,
|
|
|
|
gWindowSceneryPrimaryColour | (gWindowScenerySecondaryColour << 8));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case VIEWPORT_INTERACTION_ITEM_WALL:
|
|
|
|
{
|
2017-10-31 12:57:40 +01:00
|
|
|
rct_scenery_entry* scenery_entry = get_wall_entry(tile_element->properties.wall.type);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// If can't repaint
|
|
|
|
if (!(scenery_entry->wall.flags &
|
|
|
|
(WALL_SCENERY_HAS_PRIMARY_COLOUR |
|
|
|
|
WALL_SCENERY_HAS_GLASS)))
|
|
|
|
return;
|
|
|
|
|
|
|
|
gGameCommandErrorTitle = STR_CANT_REPAINT_THIS;
|
|
|
|
game_do_command(
|
|
|
|
grid_x,
|
|
|
|
1 | (gWindowSceneryPrimaryColour << 8),
|
|
|
|
grid_y,
|
2017-10-31 12:57:40 +01:00
|
|
|
(tile_element->type & TILE_ELEMENT_DIRECTION_MASK) | (tile_element->base_height << 8),
|
2017-06-06 23:24:18 +02:00
|
|
|
GAME_COMMAND_SET_WALL_COLOUR,
|
|
|
|
0,
|
|
|
|
gWindowScenerySecondaryColour | (gWindowSceneryTertiaryColour << 8));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY:
|
|
|
|
{
|
2017-11-01 15:24:04 +01:00
|
|
|
rct_scenery_entry * scenery_entry = get_large_scenery_entry(scenery_large_get_type(tile_element));
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
// If can't repaint
|
|
|
|
if (!(scenery_entry->large_scenery.flags &
|
|
|
|
LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR))
|
|
|
|
return;
|
|
|
|
|
|
|
|
gGameCommandErrorTitle = STR_CANT_REPAINT_THIS;
|
|
|
|
game_do_command(
|
|
|
|
grid_x,
|
2017-10-31 12:57:40 +01:00
|
|
|
1 | ((tile_element->type & TILE_ELEMENT_DIRECTION_MASK) << 8),
|
2017-06-06 23:24:18 +02:00
|
|
|
grid_y,
|
2017-11-01 15:24:04 +01:00
|
|
|
tile_element->base_height | (scenery_large_get_sequence(tile_element) << 8),
|
2017-06-06 23:24:18 +02:00
|
|
|
GAME_COMMAND_SET_LARGE_SCENERY_COLOUR,
|
|
|
|
0,
|
|
|
|
gWindowSceneryPrimaryColour | (gWindowScenerySecondaryColour << 8));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case VIEWPORT_INTERACTION_ITEM_BANNER:
|
|
|
|
{
|
2017-10-31 12:57:40 +01:00
|
|
|
rct_banner* banner = &gBanners[tile_element->properties.banner.index];
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_scenery_entry* scenery_entry = get_banner_entry(banner->type);
|
2017-11-22 23:06:56 +01:00
|
|
|
if (scenery_entry->banner.flags & BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR)
|
|
|
|
{
|
|
|
|
gGameCommandErrorTitle = STR_CANT_REPAINT_THIS;
|
|
|
|
game_do_command(
|
|
|
|
grid_x,
|
|
|
|
1,
|
|
|
|
grid_y,
|
|
|
|
tile_element->base_height | ((tile_element->properties.banner.position & 0x3) << 8),
|
|
|
|
GAME_COMMAND_SET_BANNER_COLOUR,
|
|
|
|
0,
|
|
|
|
gWindowSceneryPrimaryColour | (gWindowScenerySecondaryColour << 8));
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2015-04-15 21:52:19 +02:00
|
|
|
}
|
|
|
|
|
2017-05-01 15:41:45 +02:00
|
|
|
static void scenery_eyedropper_tool_down(sint16 x, sint16 y, rct_widgetindex widgetIndex)
|
2017-03-13 19:05:13 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
uint16 flags =
|
|
|
|
VIEWPORT_INTERACTION_MASK_SCENERY &
|
|
|
|
VIEWPORT_INTERACTION_MASK_WALL &
|
|
|
|
VIEWPORT_INTERACTION_MASK_LARGE_SCENERY &
|
|
|
|
VIEWPORT_INTERACTION_MASK_BANNER &
|
|
|
|
VIEWPORT_INTERACTION_MASK_FOOTPATH_ITEM;
|
|
|
|
|
|
|
|
sint16 gridX, gridY;
|
|
|
|
sint32 type;
|
2017-10-31 14:03:45 +01:00
|
|
|
rct_tile_element* tileElement;
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_viewport * viewport;
|
2017-10-31 14:03:45 +01:00
|
|
|
get_map_coordinates_from_pos(x, y, flags, &gridX, &gridY, &type, &tileElement, &viewport);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case VIEWPORT_INTERACTION_ITEM_SCENERY:
|
|
|
|
{
|
2017-10-31 14:03:45 +01:00
|
|
|
sint32 entryIndex = tileElement->properties.scenery.type;
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_scenery_entry * sceneryEntry = get_small_scenery_entry(entryIndex);
|
2017-11-17 17:15:55 +01:00
|
|
|
if (sceneryEntry != nullptr)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_SMALL_SCENERY, entryIndex);
|
2017-11-17 17:15:55 +01:00
|
|
|
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId))
|
|
|
|
{
|
2017-10-31 14:03:45 +01:00
|
|
|
gWindowSceneryRotation = (get_current_rotation() + tile_element_get_direction(tileElement)) & 3;
|
2017-11-17 17:15:55 +01:00
|
|
|
gWindowSceneryPrimaryColour = scenery_small_get_primary_colour(tileElement);
|
|
|
|
gWindowScenerySecondaryColour = scenery_small_get_secondary_colour(tileElement);
|
2017-06-06 23:24:18 +02:00
|
|
|
gWindowSceneryEyedropperEnabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case VIEWPORT_INTERACTION_ITEM_WALL:
|
|
|
|
{
|
2017-10-31 14:03:45 +01:00
|
|
|
sint32 entryIndex = tileElement->properties.wall.type;
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_scenery_entry * sceneryEntry = get_wall_entry(entryIndex);
|
2017-11-17 17:15:55 +01:00
|
|
|
if (sceneryEntry != nullptr)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_WALLS, entryIndex);
|
2017-11-17 17:15:55 +01:00
|
|
|
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId))
|
|
|
|
{
|
|
|
|
gWindowSceneryPrimaryColour = wall_get_primary_colour(tileElement);
|
|
|
|
gWindowScenerySecondaryColour = wall_get_secondary_colour(tileElement);
|
|
|
|
gWindowSceneryTertiaryColour = wall_get_tertiary_colour(tileElement);
|
2017-06-06 23:24:18 +02:00
|
|
|
gWindowSceneryEyedropperEnabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY:
|
|
|
|
{
|
2017-11-01 15:24:04 +01:00
|
|
|
sint32 entryIndex = scenery_large_get_type(tileElement);
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_scenery_entry * sceneryEntry = get_large_scenery_entry(entryIndex);
|
2017-11-17 17:15:55 +01:00
|
|
|
if (sceneryEntry != nullptr)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_LARGE_SCENERY, entryIndex);
|
2017-11-17 17:15:55 +01:00
|
|
|
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId))
|
|
|
|
{
|
2017-10-31 14:03:45 +01:00
|
|
|
gWindowSceneryRotation = (get_current_rotation() + tile_element_get_direction(tileElement)) & 3;
|
2017-11-17 17:15:55 +01:00
|
|
|
gWindowSceneryPrimaryColour = scenery_large_get_primary_colour(tileElement);
|
|
|
|
gWindowScenerySecondaryColour = scenery_large_get_secondary_colour(tileElement);
|
2017-06-06 23:24:18 +02:00
|
|
|
gWindowSceneryEyedropperEnabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case VIEWPORT_INTERACTION_ITEM_BANNER:
|
|
|
|
{
|
2017-10-31 14:03:45 +01:00
|
|
|
sint32 bannerIndex = tileElement->properties.banner.index;
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_banner *banner = &gBanners[bannerIndex];
|
|
|
|
rct_scenery_entry * sceneryEntry = get_banner_entry(banner->type);
|
2017-10-15 15:53:16 +02:00
|
|
|
if (sceneryEntry != nullptr) {
|
2017-06-06 23:24:18 +02:00
|
|
|
sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_BANNERS, banner->type);
|
|
|
|
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId)) {
|
|
|
|
gWindowSceneryEyedropperEnabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM:
|
|
|
|
{
|
2017-10-31 14:03:45 +01:00
|
|
|
sint32 entryIndex = footpath_element_get_path_scenery_index(tileElement);
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_scenery_entry * sceneryEntry = get_footpath_item_entry(entryIndex);
|
2017-10-15 15:53:16 +02:00
|
|
|
if (sceneryEntry != nullptr) {
|
2017-06-06 23:24:18 +02:00
|
|
|
sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_PATH_BITS, entryIndex);
|
|
|
|
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId)) {
|
|
|
|
gWindowSceneryEyedropperEnabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2017-03-13 19:05:13 +01:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006E1F34
|
2015-04-20 21:11:45 +02:00
|
|
|
* Outputs
|
2017-03-13 20:27:20 +01:00
|
|
|
* eax : gridX
|
2015-04-20 21:11:45 +02:00
|
|
|
* ebx : parameter_1
|
2017-03-13 20:27:20 +01:00
|
|
|
* ecx : gridY
|
2015-04-20 21:11:45 +02:00
|
|
|
* edx : parameter_2
|
|
|
|
* edi : parameter_3
|
|
|
|
*/
|
2016-07-13 00:46:51 +02:00
|
|
|
static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid_x, sint16* grid_y, uint32* parameter_1, uint32* parameter_2, uint32* parameter_3){
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window* w = window_find_by_class(WC_SCENERY);
|
|
|
|
|
2017-08-15 10:07:44 +02:00
|
|
|
if (w == nullptr) {
|
2017-10-13 22:23:07 +02:00
|
|
|
*grid_x = LOCATION_NULL;
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 scenery_type = selected_scenery >> 8;
|
2017-07-15 11:55:20 +02:00
|
|
|
bool can_raise_item = false;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-07-15 11:55:20 +02:00
|
|
|
if (scenery_type == SCENERY_TYPE_SMALL) {
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_scenery_entry* scenery_entry = get_small_scenery_entry(selected_scenery);
|
|
|
|
|
2017-12-04 20:09:38 +01:00
|
|
|
if (scenery_small_entry_has_flag(scenery_entry, SMALL_SCENERY_FLAG_STACKABLE))
|
|
|
|
{
|
2017-07-15 11:55:20 +02:00
|
|
|
can_raise_item = true;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
2017-07-15 11:55:20 +02:00
|
|
|
else if (scenery_type == SCENERY_TYPE_WALL || scenery_type == SCENERY_TYPE_LARGE) {
|
|
|
|
can_raise_item = true;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2017-07-15 11:55:20 +02:00
|
|
|
if (!can_raise_item && !gCheatsDisableSupportLimits) {
|
2017-06-06 23:24:18 +02:00
|
|
|
gSceneryCtrlPressed = false;
|
|
|
|
gSceneryShiftPressed = false;
|
2017-07-15 11:55:20 +02:00
|
|
|
}
|
|
|
|
else {
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!gSceneryCtrlPressed) {
|
|
|
|
if (input_test_place_object_modifier(PLACE_OBJECT_MODIFIER_COPY_Z)) {
|
|
|
|
// CTRL pressed
|
2017-10-31 12:57:40 +01:00
|
|
|
rct_tile_element* tile_element;
|
2017-06-06 23:24:18 +02:00
|
|
|
uint16 flags =
|
|
|
|
VIEWPORT_INTERACTION_MASK_TERRAIN &
|
|
|
|
VIEWPORT_INTERACTION_MASK_RIDE &
|
|
|
|
VIEWPORT_INTERACTION_MASK_SCENERY &
|
|
|
|
VIEWPORT_INTERACTION_MASK_FOOTPATH &
|
|
|
|
VIEWPORT_INTERACTION_MASK_WALL &
|
|
|
|
VIEWPORT_INTERACTION_MASK_LARGE_SCENERY;
|
|
|
|
sint32 interaction_type;
|
2017-10-31 12:57:40 +01:00
|
|
|
get_map_coordinates_from_pos(x, y, flags, nullptr, nullptr, &interaction_type, &tile_element, nullptr);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-07-15 11:55:20 +02:00
|
|
|
if (interaction_type != VIEWPORT_INTERACTION_ITEM_NONE) {
|
2017-06-06 23:24:18 +02:00
|
|
|
gSceneryCtrlPressed = true;
|
2017-10-31 12:57:40 +01:00
|
|
|
gSceneryCtrlPressZ = tile_element->base_height * 8;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
2017-07-15 11:55:20 +02:00
|
|
|
}
|
|
|
|
else {
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(input_test_place_object_modifier(PLACE_OBJECT_MODIFIER_COPY_Z))) {
|
|
|
|
// CTRL not pressed
|
|
|
|
gSceneryCtrlPressed = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!gSceneryShiftPressed) {
|
|
|
|
if (input_test_place_object_modifier(PLACE_OBJECT_MODIFIER_SHIFT_Z)) {
|
|
|
|
// SHIFT pressed
|
|
|
|
gSceneryShiftPressed = true;
|
|
|
|
gSceneryShiftPressX = x;
|
|
|
|
gSceneryShiftPressY = y;
|
|
|
|
gSceneryShiftPressZOffset = 0;
|
|
|
|
}
|
|
|
|
}
|
2017-07-15 11:55:20 +02:00
|
|
|
else {
|
2017-06-06 23:24:18 +02:00
|
|
|
if (input_test_place_object_modifier(PLACE_OBJECT_MODIFIER_SHIFT_Z)) {
|
|
|
|
// SHIFT pressed
|
|
|
|
gSceneryShiftPressZOffset = (gSceneryShiftPressY - y + 4) & 0xFFF8;
|
|
|
|
|
|
|
|
x = gSceneryShiftPressX;
|
|
|
|
y = gSceneryShiftPressY;
|
2017-07-15 11:55:20 +02:00
|
|
|
}
|
|
|
|
else {
|
2017-06-06 23:24:18 +02:00
|
|
|
// SHIFT not pressed
|
|
|
|
gSceneryShiftPressed = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-15 11:55:20 +02:00
|
|
|
switch (scenery_type) {
|
|
|
|
case SCENERY_TYPE_SMALL:
|
2017-06-06 23:24:18 +02:00
|
|
|
{
|
|
|
|
// Small scenery
|
|
|
|
rct_scenery_entry* scenery = get_small_scenery_entry(selected_scenery);
|
2017-12-04 20:09:38 +01:00
|
|
|
if (!scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_FULL_TILE))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
uint8 cl = 0;
|
|
|
|
|
|
|
|
// If CTRL not pressed
|
|
|
|
if (!gSceneryCtrlPressed) {
|
|
|
|
screen_get_map_xy_quadrant(x, y, grid_x, grid_y, &cl);
|
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
if (*grid_x == LOCATION_NULL)
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
gSceneryPlaceZ = 0;
|
|
|
|
|
|
|
|
// If SHIFT pressed
|
|
|
|
if (gSceneryShiftPressed) {
|
2017-10-31 12:57:40 +01:00
|
|
|
rct_tile_element* tile_element = map_get_surface_element_at(*grid_x / 32, *grid_y / 32);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-10-31 12:57:40 +01:00
|
|
|
if (tile_element == nullptr) {
|
2017-10-13 22:23:07 +02:00
|
|
|
*grid_x = LOCATION_NULL;
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-10-31 12:57:40 +01:00
|
|
|
sint16 z = (tile_element->base_height * 8) & 0xFFF0;
|
2017-06-06 23:24:18 +02:00
|
|
|
z += gSceneryShiftPressZOffset;
|
|
|
|
|
2017-08-02 00:20:32 +02:00
|
|
|
z = Math::Max<sint16>(z, 16);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gSceneryPlaceZ = z;
|
|
|
|
}
|
|
|
|
}
|
2017-07-15 11:55:20 +02:00
|
|
|
else {
|
2017-06-06 23:24:18 +02:00
|
|
|
sint16 z = gSceneryCtrlPressZ;
|
|
|
|
|
|
|
|
screen_get_map_xy_quadrant_with_z(x, y, z, grid_x, grid_y, &cl);
|
|
|
|
|
|
|
|
// If SHIFT pressed
|
|
|
|
if (gSceneryShiftPressed) {
|
|
|
|
z += gSceneryShiftPressZOffset;
|
|
|
|
}
|
|
|
|
|
2017-08-02 00:20:32 +02:00
|
|
|
z = Math::Max<sint16>(z, 16);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gSceneryPlaceZ = z;
|
|
|
|
}
|
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
if (*grid_x == LOCATION_NULL)
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
uint8 rotation = gWindowSceneryRotation;
|
|
|
|
|
2017-12-04 20:09:38 +01:00
|
|
|
if (!scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_ROTATABLE))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rotation = util_rand() & 0xFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
rotation -= get_current_rotation();
|
|
|
|
rotation &= 0x3;
|
|
|
|
|
|
|
|
// Also places it in lower but think thats for clobbering
|
|
|
|
*parameter_1 = (selected_scenery & 0xFF) << 8;
|
|
|
|
*parameter_2 = (cl ^ (1 << 1)) | (gWindowSceneryPrimaryColour << 8);
|
|
|
|
*parameter_3 = rotation | (gWindowScenerySecondaryColour << 16);
|
2017-12-27 18:04:10 +01:00
|
|
|
|
2018-01-10 15:05:05 +01:00
|
|
|
if (gConfigGeneral.use_virtual_floor)
|
|
|
|
{
|
2018-03-04 17:44:42 +01:00
|
|
|
virtual_floor_set_height(gSceneryPlaceZ);
|
2018-01-10 15:05:05 +01:00
|
|
|
}
|
2017-09-29 04:45:20 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If CTRL not pressed
|
|
|
|
if (!gSceneryCtrlPressed) {
|
|
|
|
uint16 flags =
|
|
|
|
VIEWPORT_INTERACTION_MASK_TERRAIN &
|
|
|
|
VIEWPORT_INTERACTION_MASK_WATER;
|
|
|
|
sint32 interaction_type = 0;
|
2017-10-31 12:57:40 +01:00
|
|
|
rct_tile_element* tile_element;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-10-31 12:57:40 +01:00
|
|
|
get_map_coordinates_from_pos(x, y, flags, grid_x, grid_y, &interaction_type, &tile_element, nullptr);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-07-15 11:55:20 +02:00
|
|
|
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE) {
|
2017-10-13 22:23:07 +02:00
|
|
|
*grid_x = LOCATION_NULL;
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gSceneryPlaceZ = 0;
|
2018-05-01 16:33:16 +02:00
|
|
|
uint16 water_height = surface_get_water_height(tile_element);
|
2017-07-15 11:55:20 +02:00
|
|
|
if (water_height != 0) {
|
2017-06-06 23:24:18 +02:00
|
|
|
gSceneryPlaceZ = water_height * 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If SHIFT pressed
|
|
|
|
if (gSceneryShiftPressed) {
|
2017-10-31 12:57:40 +01:00
|
|
|
tile_element = map_get_surface_element_at(*grid_x / 32, *grid_y / 32);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-10-31 12:57:40 +01:00
|
|
|
if (tile_element == nullptr) {
|
2017-10-13 22:23:07 +02:00
|
|
|
*grid_x = LOCATION_NULL;
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-10-31 12:57:40 +01:00
|
|
|
sint16 z = (tile_element->base_height * 8) & 0xFFF0;
|
2017-06-06 23:24:18 +02:00
|
|
|
z += gSceneryShiftPressZOffset;
|
|
|
|
|
2017-08-02 00:20:32 +02:00
|
|
|
z = Math::Max<sint16>(z, 16);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gSceneryPlaceZ = z;
|
|
|
|
}
|
|
|
|
}
|
2017-07-15 11:55:20 +02:00
|
|
|
else {
|
2017-06-06 23:24:18 +02:00
|
|
|
sint16 z = gSceneryCtrlPressZ;
|
|
|
|
screen_get_map_xy_with_z(x, y, z, grid_x, grid_y);
|
|
|
|
|
|
|
|
// If SHIFT pressed
|
|
|
|
if (gSceneryShiftPressed) {
|
|
|
|
z += gSceneryShiftPressZOffset;
|
|
|
|
}
|
|
|
|
|
2017-08-02 00:20:32 +02:00
|
|
|
z = Math::Max<sint16>(z, 16);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gSceneryPlaceZ = z;
|
|
|
|
}
|
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
if (*grid_x == LOCATION_NULL)
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
*grid_x &= 0xFFE0;
|
|
|
|
*grid_y &= 0xFFE0;
|
|
|
|
uint8 rotation = gWindowSceneryRotation;
|
|
|
|
|
2017-12-04 20:09:38 +01:00
|
|
|
if (!scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_ROTATABLE))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rotation = util_rand() & 0xFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
rotation -= get_current_rotation();
|
|
|
|
rotation &= 0x3;
|
|
|
|
|
|
|
|
// Also places it in lower but think thats for clobbering
|
|
|
|
*parameter_1 = (selected_scenery & 0xFF) << 8;
|
|
|
|
*parameter_2 = 0 | (gWindowSceneryPrimaryColour << 8);
|
|
|
|
*parameter_3 = rotation | (gWindowScenerySecondaryColour << 16);
|
|
|
|
break;
|
|
|
|
}
|
2017-07-15 11:55:20 +02:00
|
|
|
case SCENERY_TYPE_PATH_ITEM:
|
2017-06-06 23:24:18 +02:00
|
|
|
{
|
|
|
|
// Path bits
|
|
|
|
uint16 flags =
|
|
|
|
VIEWPORT_INTERACTION_MASK_FOOTPATH &
|
|
|
|
VIEWPORT_INTERACTION_MASK_FOOTPATH_ITEM;
|
|
|
|
sint32 interaction_type = 0;
|
2017-10-31 12:57:40 +01:00
|
|
|
rct_tile_element* tile_element;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-10-31 12:57:40 +01:00
|
|
|
get_map_coordinates_from_pos(x, y, flags, grid_x, grid_y, &interaction_type, &tile_element, nullptr);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-07-15 11:55:20 +02:00
|
|
|
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE) {
|
2017-10-13 22:23:07 +02:00
|
|
|
*grid_x = LOCATION_NULL;
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-01-04 21:23:56 +01:00
|
|
|
*parameter_1 = (tile_element->properties.path.type & (FOOTPATH_PROPERTIES_FLAG_IS_SLOPED | FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)) << 8;
|
2018-01-03 10:57:37 +01:00
|
|
|
*parameter_2 = tile_element->base_height;
|
|
|
|
*parameter_2 |= ((footpath_element_get_type(tile_element)) << 8);
|
2018-01-04 21:23:56 +01:00
|
|
|
if (footpath_element_is_queue(tile_element)) {
|
2017-10-13 22:23:07 +02:00
|
|
|
*parameter_2 |= LOCATION_NULL;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
*parameter_3 = (selected_scenery & 0xFF) + 1;
|
|
|
|
break;
|
|
|
|
}
|
2017-07-15 11:55:20 +02:00
|
|
|
case SCENERY_TYPE_WALL:
|
2017-06-06 23:24:18 +02:00
|
|
|
{
|
|
|
|
// Walls
|
|
|
|
uint8 cl;
|
|
|
|
// If CTRL not pressed
|
|
|
|
if (!gSceneryCtrlPressed) {
|
|
|
|
screen_get_map_xy_side(x, y, grid_x, grid_y, &cl);
|
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
if (*grid_x == LOCATION_NULL)
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
gSceneryPlaceZ = 0;
|
|
|
|
|
|
|
|
// If SHIFT pressed
|
|
|
|
if (gSceneryShiftPressed) {
|
2017-10-31 12:57:40 +01:00
|
|
|
rct_tile_element* tile_element = map_get_surface_element_at(*grid_x / 32, *grid_y / 32);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-10-31 12:57:40 +01:00
|
|
|
if (tile_element == nullptr) {
|
2017-10-13 22:23:07 +02:00
|
|
|
*grid_x = LOCATION_NULL;
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-10-31 12:57:40 +01:00
|
|
|
sint16 z = (tile_element->base_height * 8) & 0xFFF0;
|
2017-06-06 23:24:18 +02:00
|
|
|
z += gSceneryShiftPressZOffset;
|
|
|
|
|
2017-08-02 00:20:32 +02:00
|
|
|
z = Math::Max<sint16>(z, 16);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gSceneryPlaceZ = z;
|
|
|
|
}
|
|
|
|
}
|
2017-07-15 11:55:20 +02:00
|
|
|
else {
|
2017-06-06 23:24:18 +02:00
|
|
|
sint16 z = gSceneryCtrlPressZ;
|
|
|
|
screen_get_map_xy_side_with_z(x, y, z, grid_x, grid_y, &cl);
|
|
|
|
|
|
|
|
// If SHIFT pressed
|
|
|
|
if (gSceneryShiftPressed) {
|
|
|
|
z += gSceneryShiftPressZOffset;
|
|
|
|
}
|
|
|
|
|
2017-08-02 00:20:32 +02:00
|
|
|
z = Math::Max<sint16>(z, 16);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gSceneryPlaceZ = z;
|
|
|
|
}
|
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
if (*grid_x == LOCATION_NULL)
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
|
2018-03-08 13:23:33 +01:00
|
|
|
_secondaryColour = gWindowScenerySecondaryColour;
|
|
|
|
_tertiaryColour = gWindowSceneryTertiaryColour;
|
2017-06-06 23:24:18 +02:00
|
|
|
// Also places it in lower but think thats for clobbering
|
|
|
|
*parameter_1 = (selected_scenery & 0xFF) << 8;
|
|
|
|
*parameter_2 = cl | (gWindowSceneryPrimaryColour << 8);
|
|
|
|
*parameter_3 = 0;
|
|
|
|
break;
|
|
|
|
}
|
2017-07-15 11:55:20 +02:00
|
|
|
case SCENERY_TYPE_LARGE:
|
2017-06-06 23:24:18 +02:00
|
|
|
{
|
|
|
|
// Large scenery
|
|
|
|
// If CTRL not pressed
|
|
|
|
if (!gSceneryCtrlPressed) {
|
2017-08-15 10:07:44 +02:00
|
|
|
sub_68A15E(x, y, grid_x, grid_y, nullptr, nullptr);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
if (*grid_x == LOCATION_NULL)
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
gSceneryPlaceZ = 0;
|
|
|
|
|
|
|
|
// If SHIFT pressed
|
|
|
|
if (gSceneryShiftPressed) {
|
2017-10-31 12:57:40 +01:00
|
|
|
rct_tile_element* tile_element = map_get_surface_element_at(*grid_x / 32, *grid_y / 32);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-10-31 12:57:40 +01:00
|
|
|
if (tile_element == nullptr) {
|
2017-10-13 22:23:07 +02:00
|
|
|
*grid_x = LOCATION_NULL;
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-10-31 12:57:40 +01:00
|
|
|
sint16 z = (tile_element->base_height * 8) & 0xFFF0;
|
2017-06-06 23:24:18 +02:00
|
|
|
z += gSceneryShiftPressZOffset;
|
|
|
|
|
2017-08-02 00:20:32 +02:00
|
|
|
z = Math::Max<sint16>(z, 16);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gSceneryPlaceZ = z;
|
|
|
|
}
|
|
|
|
}
|
2017-07-15 11:55:20 +02:00
|
|
|
else {
|
2017-06-06 23:24:18 +02:00
|
|
|
sint16 z = gSceneryCtrlPressZ;
|
|
|
|
screen_get_map_xy_with_z(x, y, z, grid_x, grid_y);
|
|
|
|
|
|
|
|
// If SHIFT pressed
|
|
|
|
if (gSceneryShiftPressed) {
|
|
|
|
z += gSceneryShiftPressZOffset;
|
|
|
|
}
|
|
|
|
|
2017-08-02 00:20:32 +02:00
|
|
|
z = Math::Max<sint16>(z, 16);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gSceneryPlaceZ = z;
|
|
|
|
}
|
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
if (*grid_x == LOCATION_NULL)
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
*grid_x &= 0xFFE0;
|
|
|
|
*grid_y &= 0xFFE0;
|
|
|
|
|
|
|
|
uint8 rotation = gWindowSceneryRotation;
|
|
|
|
rotation -= get_current_rotation();
|
|
|
|
rotation &= 0x3;
|
|
|
|
|
|
|
|
*parameter_1 = (rotation << 8);
|
|
|
|
*parameter_2 = gWindowSceneryPrimaryColour | (gWindowScenerySecondaryColour << 8);
|
|
|
|
*parameter_3 = selected_scenery & 0xFF;
|
|
|
|
break;
|
|
|
|
}
|
2017-07-15 11:55:20 +02:00
|
|
|
case SCENERY_TYPE_BANNER:
|
2017-06-06 23:24:18 +02:00
|
|
|
{
|
|
|
|
// Banner
|
|
|
|
uint16 flags =
|
|
|
|
VIEWPORT_INTERACTION_MASK_FOOTPATH &
|
|
|
|
VIEWPORT_INTERACTION_MASK_FOOTPATH_ITEM;
|
|
|
|
sint32 interaction_type = 0;
|
2017-10-31 12:57:40 +01:00
|
|
|
rct_tile_element* tile_element;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-10-31 12:57:40 +01:00
|
|
|
get_map_coordinates_from_pos(x, y, flags, grid_x, grid_y, &interaction_type, &tile_element, nullptr);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-07-15 11:55:20 +02:00
|
|
|
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE) {
|
2017-10-13 22:23:07 +02:00
|
|
|
*grid_x = LOCATION_NULL;
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 rotation = gWindowSceneryRotation;
|
|
|
|
rotation -= get_current_rotation();
|
|
|
|
rotation &= 0x3;
|
|
|
|
|
2017-10-31 12:57:40 +01:00
|
|
|
sint16 z = tile_element->base_height;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-10-31 12:57:40 +01:00
|
|
|
if (tile_element->properties.path.type & (1 << 2)) {
|
|
|
|
if (rotation != ((tile_element->properties.path.type & 3) ^ 2)) {
|
2017-06-06 23:24:18 +02:00
|
|
|
z += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
z /= 2;
|
|
|
|
|
|
|
|
// Also places it in lower but think thats for clobbering
|
|
|
|
*parameter_1 = (selected_scenery & 0xFF) << 8;
|
|
|
|
*parameter_2 = z | (rotation << 8);
|
|
|
|
*parameter_3 = gWindowSceneryPrimaryColour;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2017-09-29 04:45:20 +02:00
|
|
|
|
2018-01-10 15:05:05 +01:00
|
|
|
if (gConfigGeneral.use_virtual_floor)
|
|
|
|
{
|
2018-03-04 17:44:42 +01:00
|
|
|
virtual_floor_set_height(gSceneryPlaceZ);
|
2018-01-10 15:05:05 +01:00
|
|
|
}
|
2015-04-18 13:17:44 +02:00
|
|
|
}
|
|
|
|
|
2014-10-21 18:59:47 +02:00
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2015-08-31 00:45:45 +02:00
|
|
|
* rct2: 0x006E2CC6
|
2014-10-21 18:59:47 +02:00
|
|
|
*/
|
2017-05-01 15:41:45 +02:00
|
|
|
static void window_top_toolbar_scenery_tool_down(sint16 x, sint16 y, rct_window *w, rct_widgetindex widgetIndex)
|
2015-08-31 00:45:45 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
if (gWindowSceneryPaintEnabled & 1) {
|
|
|
|
repaint_scenery_tool_down(x, y, widgetIndex);
|
|
|
|
return;
|
|
|
|
} else if (gWindowSceneryEyedropperEnabled) {
|
|
|
|
scenery_eyedropper_tool_down(x, y, widgetIndex);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sint32 selectedTab = gWindowSceneryTabSelections[gWindowSceneryActiveTabIndex];
|
|
|
|
uint8 sceneryType = (selectedTab & 0xFF00) >> 8;
|
|
|
|
|
|
|
|
if (selectedTab == -1) return;
|
|
|
|
|
|
|
|
sint16 gridX, gridY;
|
|
|
|
uint32 parameter_1, parameter_2, parameter_3;
|
|
|
|
|
|
|
|
sub_6E1F34(x, y, selectedTab, &gridX, &gridY, ¶meter_1, ¶meter_2, ¶meter_3);
|
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
if (gridX == LOCATION_NULL) return;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
switch (sceneryType){
|
|
|
|
case SCENERY_TYPE_SMALL:
|
|
|
|
{
|
|
|
|
sint32 quantity = 1;
|
|
|
|
bool isCluster = gWindowSceneryClusterEnabled && (network_get_mode() != NETWORK_MODE_CLIENT || network_can_perform_command(network_get_current_player_group_index(), -2));
|
|
|
|
if (isCluster) {
|
|
|
|
quantity = 35;
|
|
|
|
}
|
|
|
|
sint32 successfulPlacements = 0;
|
|
|
|
for (sint32 q = 0; q < quantity; q++) {
|
|
|
|
sint32 zCoordinate = gSceneryPlaceZ;
|
|
|
|
rct_scenery_entry* scenery = get_small_scenery_entry((parameter_1 >> 8) & 0xFF);
|
|
|
|
|
|
|
|
sint16 cur_grid_x = gridX;
|
|
|
|
sint16 cur_grid_y = gridY;
|
|
|
|
|
2017-12-04 20:09:38 +01:00
|
|
|
if (isCluster)
|
|
|
|
{
|
|
|
|
if (!scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_FULL_TILE))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
parameter_2 &= 0xFF00;
|
|
|
|
parameter_2 |= util_rand() & 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
cur_grid_x += ((util_rand() % 16) - 8) * 32;
|
|
|
|
cur_grid_y += ((util_rand() % 16) - 8) * 32;
|
|
|
|
|
2017-12-04 20:09:38 +01:00
|
|
|
if (!scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_ROTATABLE))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gSceneryPlaceRotation = (gSceneryPlaceRotation + 1) & 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 zAttemptRange = 1;
|
|
|
|
if (
|
|
|
|
gSceneryPlaceZ != 0 &&
|
|
|
|
gSceneryShiftPressed
|
|
|
|
) {
|
|
|
|
zAttemptRange = 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool success = false;
|
|
|
|
for (; zAttemptRange != 0; zAttemptRange--){
|
|
|
|
sint32 flags = GAME_COMMAND_FLAG_APPLY | (parameter_1 & 0xFF00);
|
|
|
|
|
|
|
|
gDisableErrorWindowSound = true;
|
|
|
|
gGameCommandErrorTitle = STR_CANT_POSITION_THIS_HERE;
|
|
|
|
sint32 cost = game_do_command(
|
|
|
|
cur_grid_x,
|
|
|
|
flags,
|
|
|
|
cur_grid_y,
|
|
|
|
parameter_2,
|
|
|
|
GAME_COMMAND_PLACE_SCENERY,
|
|
|
|
gSceneryPlaceRotation | (parameter_3 & 0xFFFF0000),
|
|
|
|
gSceneryPlaceZ
|
|
|
|
);
|
|
|
|
gDisableErrorWindowSound = false;
|
|
|
|
|
|
|
|
if (cost != MONEY32_UNDEFINED){
|
|
|
|
window_close_by_class(WC_ERROR);
|
|
|
|
audio_play_sound_at_location(SOUND_PLACE_ITEM, gCommandPosition.x, gCommandPosition.y, gCommandPosition.z);
|
|
|
|
success = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
|
|
|
gGameCommandErrorText == STR_NOT_ENOUGH_CASH_REQUIRES ||
|
|
|
|
gGameCommandErrorText == STR_CAN_ONLY_BUILD_THIS_ON_WATER
|
|
|
|
) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gSceneryPlaceZ += 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (success) {
|
|
|
|
successfulPlacements++;
|
|
|
|
} else {
|
|
|
|
if (gGameCommandErrorText == STR_NOT_ENOUGH_CASH_REQUIRES) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gSceneryPlaceZ = zCoordinate;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (successfulPlacements > 0) {
|
|
|
|
window_close_by_class(WC_ERROR);
|
|
|
|
} else {
|
|
|
|
audio_play_sound_at_location(SOUND_ERROR, gCommandPosition.x, gCommandPosition.y, gCommandPosition.z);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SCENERY_TYPE_PATH_ITEM:
|
|
|
|
{
|
2017-06-17 14:44:34 +02:00
|
|
|
sint32 flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_PATH_SCENERY | (parameter_1 & 0xFF00);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gGameCommandErrorTitle = STR_CANT_POSITION_THIS_HERE;
|
|
|
|
sint32 cost = game_do_command(gridX, flags, gridY, parameter_2, GAME_COMMAND_PLACE_PATH, parameter_3, 0);
|
|
|
|
if (cost != MONEY32_UNDEFINED) {
|
|
|
|
audio_play_sound_at_location(SOUND_PLACE_ITEM, gCommandPosition.x, gCommandPosition.y, gCommandPosition.z);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SCENERY_TYPE_WALL:
|
|
|
|
{
|
|
|
|
uint8 zAttemptRange = 1;
|
|
|
|
if (
|
|
|
|
gSceneryPlaceZ != 0 &&
|
|
|
|
gSceneryShiftPressed
|
|
|
|
) {
|
|
|
|
zAttemptRange = 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (; zAttemptRange != 0; zAttemptRange--) {
|
|
|
|
sint32 flags = (parameter_1 & 0xFF00) | GAME_COMMAND_FLAG_APPLY;
|
|
|
|
|
|
|
|
gDisableErrorWindowSound = true;
|
|
|
|
gGameCommandErrorTitle = STR_CANT_BUILD_PARK_ENTRANCE_HERE;
|
2018-03-08 13:23:33 +01:00
|
|
|
sint32 cost = game_do_command(gridX, flags, gridY, parameter_2, GAME_COMMAND_PLACE_WALL, gSceneryPlaceZ, _secondaryColour | (_tertiaryColour << 8));
|
2017-06-06 23:24:18 +02:00
|
|
|
gDisableErrorWindowSound = false;
|
|
|
|
|
|
|
|
if (cost != MONEY32_UNDEFINED){
|
|
|
|
window_close_by_class(WC_ERROR);
|
|
|
|
audio_play_sound_at_location(SOUND_PLACE_ITEM, gCommandPosition.x, gCommandPosition.y, gCommandPosition.z);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
|
|
|
gGameCommandErrorText == STR_NOT_ENOUGH_CASH_REQUIRES ||
|
|
|
|
gGameCommandErrorText == STR_CAN_ONLY_BUILD_THIS_ON_WATER
|
|
|
|
) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gSceneryPlaceZ += 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
audio_play_sound_at_location(SOUND_ERROR, gCommandPosition.x, gCommandPosition.y, gCommandPosition.z);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SCENERY_TYPE_LARGE:
|
|
|
|
{
|
|
|
|
uint8 zAttemptRange = 1;
|
|
|
|
if (
|
|
|
|
gSceneryPlaceZ != 0 &&
|
|
|
|
gSceneryShiftPressed
|
|
|
|
) {
|
|
|
|
zAttemptRange = 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (; zAttemptRange != 0; zAttemptRange--) {
|
|
|
|
sint32 flags = (parameter_1 & 0xFF00) | GAME_COMMAND_FLAG_APPLY;
|
|
|
|
|
|
|
|
gDisableErrorWindowSound = true;
|
|
|
|
gGameCommandErrorTitle = STR_CANT_POSITION_THIS_HERE;
|
|
|
|
sint32 cost = game_do_command(gridX, flags, gridY, parameter_2, GAME_COMMAND_PLACE_LARGE_SCENERY, parameter_3, gSceneryPlaceZ);
|
|
|
|
gDisableErrorWindowSound = false;
|
|
|
|
|
|
|
|
if (cost != MONEY32_UNDEFINED){
|
|
|
|
window_close_by_class(WC_ERROR);
|
|
|
|
audio_play_sound_at_location(SOUND_PLACE_ITEM, gCommandPosition.x, gCommandPosition.y, gCommandPosition.z);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
|
|
|
gGameCommandErrorText == STR_NOT_ENOUGH_CASH_REQUIRES ||
|
|
|
|
gGameCommandErrorText == STR_CAN_ONLY_BUILD_THIS_ON_WATER
|
|
|
|
) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gSceneryPlaceZ += 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
audio_play_sound_at_location(SOUND_ERROR, gCommandPosition.x, gCommandPosition.y, gCommandPosition.z);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SCENERY_TYPE_BANNER:
|
|
|
|
{
|
|
|
|
sint32 flags = (parameter_1 & 0xFF00) | GAME_COMMAND_FLAG_APPLY;
|
|
|
|
|
|
|
|
gGameCommandErrorTitle = STR_CANT_POSITION_THIS_HERE;
|
|
|
|
game_command_callback = game_command_callback_place_banner;
|
|
|
|
game_do_command(gridX, flags, gridY, parameter_2, GAME_COMMAND_PLACE_BANNER, parameter_3, gWindowSceneryPrimaryColour);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-10-21 18:59:47 +02:00
|
|
|
}
|
|
|
|
|
2015-05-25 18:24:18 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0068E213
|
|
|
|
*/
|
2016-07-13 00:46:51 +02:00
|
|
|
static void top_toolbar_tool_update_scenery_clear(sint16 x, sint16 y){
|
2017-06-06 23:24:18 +02:00
|
|
|
map_invalidate_selection_rect();
|
|
|
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
LocationXY16 mapTile = { 0 };
|
2017-08-15 10:07:44 +02:00
|
|
|
screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, nullptr);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
if (mapTile.x == LOCATION_NULL) {
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gClearSceneryCost != MONEY32_UNDEFINED) {
|
|
|
|
gClearSceneryCost = MONEY32_UNDEFINED;
|
|
|
|
window_invalidate_by_class(WC_CLEAR_SCENERY);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 state_changed = 0;
|
|
|
|
|
|
|
|
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) {
|
|
|
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectType != MAP_SELECT_TYPE_FULL) {
|
|
|
|
gMapSelectType = MAP_SELECT_TYPE_FULL;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
2017-08-02 00:20:32 +02:00
|
|
|
sint16 tool_size = Math::Max<uint16>(1, gLandToolSize);
|
2017-06-06 23:24:18 +02:00
|
|
|
sint16 tool_length = (tool_size - 1) * 32;
|
|
|
|
|
|
|
|
// Move to tool bottom left
|
|
|
|
mapTile.x -= (tool_size - 1) * 16;
|
|
|
|
mapTile.y -= (tool_size - 1) * 16;
|
|
|
|
mapTile.x &= 0xFFE0;
|
|
|
|
mapTile.y &= 0xFFE0;
|
|
|
|
|
|
|
|
if (gMapSelectPositionA.x != mapTile.x){
|
|
|
|
gMapSelectPositionA.x = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectPositionA.y != mapTile.y){
|
|
|
|
gMapSelectPositionA.y = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
mapTile.x += tool_length;
|
|
|
|
mapTile.y += tool_length;
|
|
|
|
|
|
|
|
if (gMapSelectPositionB.x != mapTile.x){
|
|
|
|
gMapSelectPositionB.x = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectPositionB.y != mapTile.y){
|
|
|
|
gMapSelectPositionB.y = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
if (!state_changed)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sint32 eax = gMapSelectPositionA.x;
|
|
|
|
sint32 ecx = gMapSelectPositionA.y;
|
|
|
|
sint32 edi = gMapSelectPositionB.x;
|
|
|
|
sint32 ebp = gMapSelectPositionB.y;
|
|
|
|
sint32 clear = (gClearSmallScenery << 0) | (gClearLargeScenery << 1) | (gClearFootpath << 2);
|
|
|
|
money32 cost = game_do_command(eax, 0, ecx, clear, GAME_COMMAND_CLEAR_SCENERY, edi, ebp);
|
|
|
|
|
|
|
|
if (gClearSceneryCost != cost) {
|
|
|
|
gClearSceneryCost = cost;
|
|
|
|
window_invalidate_by_class(WC_CLEAR_SCENERY);
|
|
|
|
return;
|
|
|
|
}
|
2015-05-25 18:24:18 +02:00
|
|
|
}
|
|
|
|
|
2016-07-13 00:46:51 +02:00
|
|
|
static void top_toolbar_tool_update_land_paint(sint16 x, sint16 y){
|
2017-06-06 23:24:18 +02:00
|
|
|
map_invalidate_selection_rect();
|
|
|
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
LocationXY16 mapTile = { 0 };
|
2017-08-15 10:07:44 +02:00
|
|
|
screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, nullptr);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
if (mapTile.x == LOCATION_NULL) {
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gClearSceneryCost != MONEY32_UNDEFINED) {
|
|
|
|
gClearSceneryCost = MONEY32_UNDEFINED;
|
|
|
|
window_invalidate_by_class(WC_CLEAR_SCENERY);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 state_changed = 0;
|
|
|
|
|
|
|
|
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) {
|
|
|
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectType != MAP_SELECT_TYPE_FULL) {
|
|
|
|
gMapSelectType = MAP_SELECT_TYPE_FULL;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
2017-08-02 00:20:32 +02:00
|
|
|
sint16 tool_size = Math::Max<uint16>(1, gLandToolSize);
|
2017-06-06 23:24:18 +02:00
|
|
|
sint16 tool_length = (tool_size - 1) * 32;
|
|
|
|
|
|
|
|
// Move to tool bottom left
|
|
|
|
mapTile.x -= (tool_size - 1) * 16;
|
|
|
|
mapTile.y -= (tool_size - 1) * 16;
|
|
|
|
mapTile.x &= 0xFFE0;
|
|
|
|
mapTile.y &= 0xFFE0;
|
|
|
|
|
|
|
|
if (gMapSelectPositionA.x != mapTile.x){
|
|
|
|
gMapSelectPositionA.x = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectPositionA.y != mapTile.y){
|
|
|
|
gMapSelectPositionA.y = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
mapTile.x += tool_length;
|
|
|
|
mapTile.y += tool_length;
|
|
|
|
|
|
|
|
if (gMapSelectPositionB.x != mapTile.x){
|
|
|
|
gMapSelectPositionB.x = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectPositionB.y != mapTile.y){
|
|
|
|
gMapSelectPositionB.y = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
if (!state_changed)
|
|
|
|
return;
|
2015-06-02 22:43:21 +02:00
|
|
|
}
|
|
|
|
|
2015-05-26 21:36:05 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x00664280
|
|
|
|
*/
|
2016-07-13 00:46:51 +02:00
|
|
|
static void top_toolbar_tool_update_land(sint16 x, sint16 y){
|
2017-06-06 23:24:18 +02:00
|
|
|
map_invalidate_selection_rect();
|
|
|
|
|
|
|
|
if (gCurrentToolId == TOOL_UP_DOWN_ARROW){
|
|
|
|
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
|
|
|
|
return;
|
|
|
|
|
|
|
|
money32 lower_cost = selection_lower_land(0);
|
|
|
|
money32 raise_cost = selection_raise_land(0);
|
|
|
|
|
|
|
|
if (gLandToolRaiseCost != raise_cost ||
|
|
|
|
gLandToolLowerCost != lower_cost){
|
|
|
|
gLandToolRaiseCost = raise_cost;
|
|
|
|
gLandToolLowerCost = lower_cost;
|
|
|
|
window_invalidate_by_class(WC_LAND);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sint16 tool_size = gLandToolSize;
|
2017-10-13 22:23:07 +02:00
|
|
|
LocationXY16 mapTile = { x, y };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
|
|
|
if (tool_size == 1){
|
|
|
|
sint32 direction;
|
|
|
|
screen_pos_to_map_pos(&mapTile.x, &mapTile.y, &direction);
|
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
if (mapTile.x == LOCATION_NULL) {
|
2017-06-06 23:24:18 +02:00
|
|
|
money32 lower_cost = MONEY32_UNDEFINED;
|
|
|
|
money32 raise_cost = MONEY32_UNDEFINED;
|
|
|
|
|
|
|
|
if (gLandToolRaiseCost != raise_cost ||
|
|
|
|
gLandToolLowerCost != lower_cost){
|
|
|
|
gLandToolRaiseCost = raise_cost;
|
|
|
|
gLandToolLowerCost = lower_cost;
|
|
|
|
window_invalidate_by_class(WC_LAND);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 state_changed = 0;
|
|
|
|
|
|
|
|
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) {
|
|
|
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectType != direction) {
|
|
|
|
gMapSelectType = direction;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (gMapSelectPositionA.x != mapTile.x){
|
|
|
|
gMapSelectPositionA.x = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectPositionA.y != mapTile.y){
|
|
|
|
gMapSelectPositionA.y = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectPositionB.x != mapTile.x){
|
|
|
|
gMapSelectPositionB.x = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectPositionB.y != mapTile.y){
|
|
|
|
gMapSelectPositionB.y = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
if (!state_changed)
|
|
|
|
return;
|
|
|
|
|
|
|
|
money32 lower_cost = selection_lower_land(0);
|
|
|
|
money32 raise_cost = selection_raise_land(0);
|
|
|
|
|
|
|
|
if (gLandToolRaiseCost != raise_cost ||
|
|
|
|
gLandToolLowerCost != lower_cost){
|
|
|
|
gLandToolRaiseCost = raise_cost;
|
|
|
|
gLandToolLowerCost = lower_cost;
|
|
|
|
window_invalidate_by_class(WC_LAND);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-08-15 10:07:44 +02:00
|
|
|
screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, nullptr);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
if (mapTile.x == LOCATION_NULL) {
|
2017-06-06 23:24:18 +02:00
|
|
|
money32 lower_cost = MONEY32_UNDEFINED;
|
|
|
|
money32 raise_cost = MONEY32_UNDEFINED;
|
|
|
|
|
|
|
|
if (gLandToolRaiseCost != raise_cost ||
|
|
|
|
gLandToolLowerCost != lower_cost){
|
|
|
|
gLandToolRaiseCost = raise_cost;
|
|
|
|
gLandToolLowerCost = lower_cost;
|
|
|
|
window_invalidate_by_class(WC_LAND);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 state_changed = 0;
|
|
|
|
|
|
|
|
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) {
|
|
|
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectType != MAP_SELECT_TYPE_FULL) {
|
|
|
|
gMapSelectType = MAP_SELECT_TYPE_FULL;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (tool_size == 0)
|
|
|
|
tool_size = 1;
|
|
|
|
|
|
|
|
sint16 tool_length = (tool_size - 1) * 32;
|
|
|
|
|
|
|
|
// Move to tool bottom left
|
|
|
|
mapTile.x -= (tool_size - 1) * 16;
|
|
|
|
mapTile.y -= (tool_size - 1) * 16;
|
|
|
|
mapTile.x &= 0xFFE0;
|
|
|
|
mapTile.y &= 0xFFE0;
|
|
|
|
|
|
|
|
if (gMapSelectPositionA.x != mapTile.x){
|
|
|
|
gMapSelectPositionA.x = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectPositionA.y != mapTile.y){
|
|
|
|
gMapSelectPositionA.y = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
mapTile.x += tool_length;
|
|
|
|
mapTile.y += tool_length;
|
|
|
|
|
|
|
|
if (gMapSelectPositionB.x != mapTile.x){
|
|
|
|
gMapSelectPositionB.x = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectPositionB.y != mapTile.y){
|
|
|
|
gMapSelectPositionB.y = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
if (!state_changed)
|
|
|
|
return;
|
|
|
|
|
|
|
|
money32 lower_cost = selection_lower_land(0);
|
|
|
|
money32 raise_cost = selection_raise_land(0);
|
|
|
|
|
|
|
|
if (gLandToolRaiseCost != raise_cost ||
|
|
|
|
gLandToolLowerCost != lower_cost){
|
|
|
|
gLandToolRaiseCost = raise_cost;
|
|
|
|
gLandToolLowerCost = lower_cost;
|
|
|
|
window_invalidate_by_class(WC_LAND);
|
|
|
|
}
|
2015-05-26 21:36:05 +02:00
|
|
|
}
|
|
|
|
|
2015-05-27 18:40:57 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006E6BDC
|
|
|
|
*/
|
2016-07-13 00:46:51 +02:00
|
|
|
static void top_toolbar_tool_update_water(sint16 x, sint16 y){
|
2017-06-06 23:24:18 +02:00
|
|
|
map_invalidate_selection_rect();
|
|
|
|
|
|
|
|
if (gCurrentToolId == TOOL_UP_DOWN_ARROW){
|
|
|
|
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
|
|
|
|
return;
|
|
|
|
|
|
|
|
money32 lower_cost = lower_water(
|
|
|
|
gMapSelectPositionA.x,
|
|
|
|
gMapSelectPositionA.y,
|
|
|
|
gMapSelectPositionB.x,
|
|
|
|
gMapSelectPositionB.y,
|
|
|
|
0);
|
|
|
|
|
|
|
|
money32 raise_cost = raise_water(
|
|
|
|
gMapSelectPositionA.x,
|
|
|
|
gMapSelectPositionA.y,
|
|
|
|
gMapSelectPositionB.x,
|
|
|
|
gMapSelectPositionB.y,
|
|
|
|
0);
|
|
|
|
|
|
|
|
if (gWaterToolRaiseCost != raise_cost || gWaterToolLowerCost != lower_cost) {
|
|
|
|
gWaterToolRaiseCost = raise_cost;
|
|
|
|
gWaterToolLowerCost = lower_cost;
|
|
|
|
window_invalidate_by_class(WC_WATER);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
LocationXY16 mapTile = { 0 };
|
2017-06-06 23:24:18 +02:00
|
|
|
sint32 interaction_type = 0;
|
|
|
|
get_map_coordinates_from_pos(
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_WATER,
|
|
|
|
&mapTile.x,
|
|
|
|
&mapTile.y,
|
|
|
|
&interaction_type,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE){
|
|
|
|
if (gWaterToolRaiseCost != MONEY32_UNDEFINED || gWaterToolLowerCost != MONEY32_UNDEFINED) {
|
|
|
|
gWaterToolRaiseCost = MONEY32_UNDEFINED;
|
|
|
|
gWaterToolLowerCost = MONEY32_UNDEFINED;
|
|
|
|
window_invalidate_by_class(WC_WATER);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mapTile.x += 16;
|
|
|
|
mapTile.y += 16;
|
|
|
|
|
|
|
|
uint8 state_changed = 0;
|
|
|
|
|
|
|
|
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) {
|
|
|
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectType != MAP_SELECT_TYPE_FULL_WATER) {
|
|
|
|
gMapSelectType = MAP_SELECT_TYPE_FULL_WATER;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
2017-08-02 00:20:32 +02:00
|
|
|
sint16 tool_size = Math::Max<uint16>(1, gLandToolSize);
|
2017-06-06 23:24:18 +02:00
|
|
|
sint16 tool_length = (tool_size - 1) * 32;
|
|
|
|
|
|
|
|
// Move to tool bottom left
|
|
|
|
mapTile.x -= (tool_size - 1) * 16;
|
|
|
|
mapTile.y -= (tool_size - 1) * 16;
|
|
|
|
mapTile.x &= 0xFFE0;
|
|
|
|
mapTile.y &= 0xFFE0;
|
|
|
|
|
|
|
|
if (gMapSelectPositionA.x != mapTile.x){
|
|
|
|
gMapSelectPositionA.x = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectPositionA.y != mapTile.y){
|
|
|
|
gMapSelectPositionA.y = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
mapTile.x += tool_length;
|
|
|
|
mapTile.y += tool_length;
|
|
|
|
|
|
|
|
if (gMapSelectPositionB.x != mapTile.x){
|
|
|
|
gMapSelectPositionB.x = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gMapSelectPositionB.y != mapTile.y){
|
|
|
|
gMapSelectPositionB.y = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
if (!state_changed)
|
|
|
|
return;
|
|
|
|
|
|
|
|
money32 lower_cost = lower_water(
|
|
|
|
gMapSelectPositionA.x,
|
|
|
|
gMapSelectPositionA.y,
|
|
|
|
gMapSelectPositionB.x,
|
|
|
|
gMapSelectPositionB.y,
|
|
|
|
0);
|
|
|
|
|
|
|
|
money32 raise_cost = raise_water(
|
|
|
|
gMapSelectPositionA.x,
|
|
|
|
gMapSelectPositionA.y,
|
|
|
|
gMapSelectPositionB.x,
|
|
|
|
gMapSelectPositionB.y,
|
|
|
|
0);
|
|
|
|
|
|
|
|
if (gWaterToolRaiseCost != raise_cost || gWaterToolLowerCost != lower_cost) {
|
|
|
|
gWaterToolRaiseCost = raise_cost;
|
|
|
|
gWaterToolLowerCost = lower_cost;
|
|
|
|
window_invalidate_by_class(WC_WATER);
|
|
|
|
}
|
2015-05-27 18:40:57 +02:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006E24F6
|
2015-05-30 08:04:15 +02:00
|
|
|
* On failure returns MONEY32_UNDEFINED
|
|
|
|
* On success places ghost scenery and returns cost to place proper
|
|
|
|
*/
|
2017-10-13 22:23:07 +02:00
|
|
|
static money32 try_place_ghost_scenery(LocationXY16 map_tile, uint32 parameter_1, uint32 parameter_2, uint32 parameter_3, uint16 selected_tab){
|
2017-06-06 23:24:18 +02:00
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
|
|
|
|
uint8 scenery_type = (selected_tab & 0xFF00) >> 8;
|
|
|
|
money32 cost = 0;
|
2017-10-31 14:03:45 +01:00
|
|
|
rct_tile_element* tileElement;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
switch (scenery_type){
|
|
|
|
case 0:
|
|
|
|
// Small Scenery
|
|
|
|
//6e252b
|
|
|
|
cost = game_do_command(
|
|
|
|
map_tile.x,
|
|
|
|
parameter_1 | 0x69,
|
|
|
|
map_tile.y,
|
|
|
|
parameter_2,
|
|
|
|
GAME_COMMAND_PLACE_SCENERY,
|
|
|
|
parameter_3,
|
|
|
|
gSceneryPlaceZ);
|
|
|
|
|
|
|
|
if (cost == MONEY32_UNDEFINED)
|
|
|
|
return cost;
|
|
|
|
|
|
|
|
gSceneryGhostPosition.x = map_tile.x;
|
|
|
|
gSceneryGhostPosition.y = map_tile.y;
|
|
|
|
gSceneryPlaceRotation = (uint16)(parameter_3 & 0xFF);
|
|
|
|
gSceneryPlaceObject = selected_tab;
|
|
|
|
|
2017-10-31 14:03:45 +01:00
|
|
|
tileElement = gSceneryTileElement;
|
|
|
|
gSceneryGhostPosition.z = tileElement->base_height;
|
|
|
|
gSceneryTileElementType = tileElement->type;
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gSceneryGroundFlags & ELEMENT_IS_UNDERGROUND){
|
|
|
|
//Set underground on
|
|
|
|
viewport_set_visibility(4);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
//Set underground off
|
|
|
|
viewport_set_visibility(5);
|
|
|
|
}
|
|
|
|
|
|
|
|
gSceneryGhostType |= (1 << 0);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
// Path Bits
|
|
|
|
//6e265b
|
|
|
|
cost = game_do_command(
|
|
|
|
map_tile.x,
|
|
|
|
(parameter_1 & 0xFF00) | (
|
|
|
|
GAME_COMMAND_FLAG_APPLY |
|
|
|
|
GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED |
|
|
|
|
GAME_COMMAND_FLAG_5 |
|
|
|
|
GAME_COMMAND_FLAG_GHOST |
|
2017-06-17 14:44:34 +02:00
|
|
|
GAME_COMMAND_FLAG_PATH_SCENERY
|
2017-06-06 23:24:18 +02:00
|
|
|
),
|
|
|
|
map_tile.y,
|
|
|
|
parameter_2,
|
|
|
|
GAME_COMMAND_PLACE_PATH,
|
|
|
|
parameter_3,
|
|
|
|
0);
|
|
|
|
|
|
|
|
if (cost == MONEY32_UNDEFINED)
|
|
|
|
return cost;
|
|
|
|
|
|
|
|
gSceneryGhostPosition.x = map_tile.x;
|
|
|
|
gSceneryGhostPosition.y = map_tile.y;
|
|
|
|
gSceneryGhostPosition.z = (parameter_2 & 0xFF);
|
|
|
|
gSceneryPlacePathSlope = ((parameter_1 >> 8) & 0xFF);
|
|
|
|
gSceneryPlacePathType = ((parameter_2 >> 8) & 0xFF);
|
|
|
|
gSceneryGhostPathObjectType = parameter_3;
|
|
|
|
|
|
|
|
gSceneryGhostType |= (1 << 1);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
// Walls
|
|
|
|
//6e26b0
|
|
|
|
cost = game_do_command(
|
|
|
|
map_tile.x,
|
|
|
|
parameter_1 | 0x69,
|
|
|
|
map_tile.y,
|
|
|
|
parameter_2,
|
|
|
|
GAME_COMMAND_PLACE_WALL,
|
|
|
|
gSceneryPlaceZ,
|
2018-03-08 13:23:33 +01:00
|
|
|
_secondaryColour | (_tertiaryColour << 8));
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
if (cost == MONEY32_UNDEFINED)
|
|
|
|
return cost;
|
|
|
|
|
|
|
|
gSceneryGhostPosition.x = map_tile.x;
|
|
|
|
gSceneryGhostPosition.y = map_tile.y;
|
|
|
|
gSceneryGhostWallRotation = (parameter_2 & 0xFF);
|
|
|
|
|
2017-10-31 14:03:45 +01:00
|
|
|
tileElement = gSceneryTileElement;
|
|
|
|
gSceneryGhostPosition.z = tileElement->base_height;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gSceneryGhostType |= (1 << 2);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
// Large Scenery
|
|
|
|
//6e25a7
|
|
|
|
cost = game_do_command(
|
|
|
|
map_tile.x,
|
|
|
|
parameter_1 | 0x69,
|
|
|
|
map_tile.y,
|
|
|
|
parameter_2,
|
|
|
|
GAME_COMMAND_PLACE_LARGE_SCENERY,
|
|
|
|
parameter_3,
|
|
|
|
gSceneryPlaceZ);
|
|
|
|
|
|
|
|
if (cost == MONEY32_UNDEFINED)
|
|
|
|
return cost;
|
|
|
|
|
|
|
|
gSceneryGhostPosition.x = map_tile.x;
|
|
|
|
gSceneryGhostPosition.y = map_tile.y;
|
|
|
|
gSceneryPlaceRotation = ((parameter_1 >> 8) & 0xFF);
|
|
|
|
|
2017-10-31 14:03:45 +01:00
|
|
|
tileElement = gSceneryTileElement;
|
|
|
|
gSceneryGhostPosition.z = tileElement->base_height;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
if (gSceneryGroundFlags & ELEMENT_IS_UNDERGROUND){
|
|
|
|
//Set underground on
|
|
|
|
viewport_set_visibility(4);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
//Set underground off
|
|
|
|
viewport_set_visibility(5);
|
|
|
|
}
|
|
|
|
|
|
|
|
gSceneryGhostType |= (1 << 3);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
// Banners
|
|
|
|
//6e2612
|
|
|
|
cost = game_do_command(
|
|
|
|
map_tile.x,
|
|
|
|
parameter_1 | 0x69,
|
|
|
|
map_tile.y,
|
|
|
|
parameter_2,
|
|
|
|
GAME_COMMAND_PLACE_BANNER,
|
|
|
|
parameter_3,
|
|
|
|
0);
|
|
|
|
|
|
|
|
if (cost == MONEY32_UNDEFINED)
|
|
|
|
return cost;
|
|
|
|
|
|
|
|
gSceneryGhostPosition.x = map_tile.x;
|
|
|
|
gSceneryGhostPosition.y = map_tile.y;
|
|
|
|
gSceneryGhostPosition.z = (parameter_2 & 0xFF) * 2 + 2;
|
|
|
|
gSceneryPlaceRotation = ((parameter_2 >> 8) & 0xFF);
|
|
|
|
gSceneryGhostType |= (1 << 4);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return cost;
|
2015-05-28 23:07:39 +02:00
|
|
|
}
|
|
|
|
|
2015-05-28 20:33:09 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006E287B
|
|
|
|
*/
|
2016-07-13 00:46:51 +02:00
|
|
|
static void top_toolbar_tool_update_scenery(sint16 x, sint16 y){
|
2017-06-06 23:24:18 +02:00
|
|
|
map_invalidate_selection_rect();
|
|
|
|
map_invalidate_map_selection_tiles();
|
2018-01-10 15:05:05 +01:00
|
|
|
|
|
|
|
if (gConfigGeneral.use_virtual_floor)
|
|
|
|
{
|
2018-03-04 17:44:42 +01:00
|
|
|
virtual_floor_invalidate();
|
2018-01-10 15:05:05 +01:00
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
|
|
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
|
|
|
|
|
|
|
if (gWindowSceneryPaintEnabled)
|
|
|
|
return;
|
|
|
|
if (gWindowSceneryEyedropperEnabled)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sint16 selected_tab = gWindowSceneryTabSelections[gWindowSceneryActiveTabIndex];
|
|
|
|
|
|
|
|
if (selected_tab == -1){
|
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 scenery_type = (selected_tab & 0xFF00) >> 8;
|
|
|
|
uint8 selected_scenery = selected_tab & 0xFF;
|
2017-10-13 22:23:07 +02:00
|
|
|
LocationXY16 mapTile = { 0 };
|
2017-06-06 23:24:18 +02:00
|
|
|
uint32 parameter1, parameter2, parameter3;
|
|
|
|
|
|
|
|
sub_6E1F34(x, y, selected_tab, &mapTile.x, &mapTile.y, ¶meter1, ¶meter2, ¶meter3);
|
|
|
|
|
2017-10-13 22:23:07 +02:00
|
|
|
if (mapTile.x == LOCATION_NULL) {
|
2017-06-06 23:24:18 +02:00
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
rct_scenery_entry* scenery;
|
|
|
|
uint8 bl;
|
|
|
|
money32 cost = 0;
|
|
|
|
|
|
|
|
switch (scenery_type){
|
|
|
|
case 0:
|
|
|
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
|
|
|
if (gWindowSceneryClusterEnabled) {
|
|
|
|
gMapSelectPositionA.x = mapTile.x - (8 << 5);
|
|
|
|
gMapSelectPositionA.y = mapTile.y - (8 << 5);
|
|
|
|
gMapSelectPositionB.x = mapTile.x + (7 << 5);
|
|
|
|
gMapSelectPositionB.y = mapTile.y + (7 << 5);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
gMapSelectPositionA.x = mapTile.x;
|
|
|
|
gMapSelectPositionA.y = mapTile.y;
|
|
|
|
gMapSelectPositionB.x = mapTile.x;
|
|
|
|
gMapSelectPositionB.y = mapTile.y;
|
|
|
|
}
|
|
|
|
|
|
|
|
scenery = get_small_scenery_entry(selected_scenery);
|
|
|
|
|
|
|
|
gMapSelectType = MAP_SELECT_TYPE_FULL;
|
2017-12-04 20:09:38 +01:00
|
|
|
if (!scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_FULL_TILE) && !gWindowSceneryClusterEnabled)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gMapSelectType = MAP_SELECT_TYPE_QUARTER_0 + ((parameter2 & 0xFF) ^ 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
|
|
|
|
// If no change in ghost placement
|
2017-10-02 15:45:50 +02:00
|
|
|
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_0) &&
|
2017-06-06 23:24:18 +02:00
|
|
|
mapTile.x == gSceneryGhostPosition.x &&
|
|
|
|
mapTile.y == gSceneryGhostPosition.y &&
|
|
|
|
(parameter2 & 0xFF) == _unkF64F0E &&
|
|
|
|
gSceneryPlaceZ == _unkF64F0A &&
|
|
|
|
gSceneryPlaceObject == selected_tab){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
|
|
|
|
_unkF64F0E = (parameter2 & 0xFF);
|
|
|
|
_unkF64F0A = gSceneryPlaceZ;
|
|
|
|
|
|
|
|
bl = 1;
|
|
|
|
if (gSceneryPlaceZ != 0 &&
|
|
|
|
gSceneryShiftPressed
|
|
|
|
) {
|
|
|
|
bl = 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (; bl != 0; bl--){
|
|
|
|
cost = try_place_ghost_scenery(
|
|
|
|
mapTile,
|
|
|
|
parameter1,
|
|
|
|
parameter2,
|
|
|
|
parameter3,
|
|
|
|
selected_tab);
|
|
|
|
|
|
|
|
if (cost != MONEY32_UNDEFINED)
|
|
|
|
break;
|
|
|
|
gSceneryPlaceZ += 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
gSceneryPlaceCost = cost;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
|
|
|
gMapSelectPositionA.x = mapTile.x;
|
|
|
|
gMapSelectPositionA.y = mapTile.y;
|
|
|
|
gMapSelectPositionB.x = mapTile.x;
|
|
|
|
gMapSelectPositionB.y = mapTile.y;
|
|
|
|
gMapSelectType = MAP_SELECT_TYPE_FULL;
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
|
|
|
|
// If no change in ghost placement
|
2017-10-02 15:45:50 +02:00
|
|
|
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_1) &&
|
2017-06-06 23:24:18 +02:00
|
|
|
mapTile.x == gSceneryGhostPosition.x &&
|
|
|
|
mapTile.y == gSceneryGhostPosition.y &&
|
|
|
|
(sint16)(parameter2 & 0xFF) == gSceneryGhostPosition.z){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
|
|
|
|
cost = try_place_ghost_scenery(
|
|
|
|
mapTile,
|
|
|
|
parameter1,
|
|
|
|
parameter2,
|
|
|
|
parameter3,
|
|
|
|
selected_tab);
|
|
|
|
|
|
|
|
gSceneryPlaceCost = cost;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
|
|
|
gMapSelectPositionA.x = mapTile.x;
|
|
|
|
gMapSelectPositionA.y = mapTile.y;
|
|
|
|
gMapSelectPositionB.x = mapTile.x;
|
|
|
|
gMapSelectPositionB.y = mapTile.y;
|
|
|
|
gMapSelectType = MAP_SELECT_TYPE_EDGE_0 + (parameter2 & 0xFF);
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
|
|
|
|
// If no change in ghost placement
|
2017-10-02 15:45:50 +02:00
|
|
|
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_2) &&
|
2017-06-06 23:24:18 +02:00
|
|
|
mapTile.x == gSceneryGhostPosition.x &&
|
|
|
|
mapTile.y == gSceneryGhostPosition.y &&
|
|
|
|
(parameter2 & 0xFF) == gSceneryGhostWallRotation &&
|
|
|
|
gSceneryPlaceZ == _unkF64F0A
|
|
|
|
){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
|
|
|
|
gSceneryGhostWallRotation = (parameter2 & 0xFF);
|
|
|
|
_unkF64F0A = gSceneryPlaceZ;
|
|
|
|
|
|
|
|
bl = 1;
|
|
|
|
if (gSceneryPlaceZ != 0 &&
|
|
|
|
gSceneryShiftPressed
|
|
|
|
) {
|
|
|
|
bl = 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
cost = 0;
|
|
|
|
for (; bl != 0; bl--){
|
|
|
|
cost = try_place_ghost_scenery(
|
|
|
|
mapTile,
|
|
|
|
parameter1,
|
|
|
|
parameter2,
|
|
|
|
parameter3,
|
|
|
|
selected_tab);
|
|
|
|
|
|
|
|
if (cost != MONEY32_UNDEFINED)
|
|
|
|
break;
|
|
|
|
gSceneryPlaceZ += 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
gSceneryPlaceCost = cost;
|
|
|
|
break;
|
|
|
|
case 3:
|
2017-08-02 00:20:32 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
scenery = get_large_scenery_entry(selected_scenery);
|
2017-10-13 22:23:07 +02:00
|
|
|
LocationXY16* selectedTile = gMapSelectionTiles;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
for (rct_large_scenery_tile* tile = scenery->large_scenery.tiles; tile->x_offset != (sint16)(uint16)0xFFFF; tile++){
|
2017-10-13 22:23:07 +02:00
|
|
|
LocationXY16 tileLocation = { tile->x_offset, tile->y_offset };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
rotate_map_coordinates(&tileLocation.x, &tileLocation.y, (parameter1 >> 8) & 0xFF);
|
|
|
|
|
|
|
|
tileLocation.x += mapTile.x;
|
|
|
|
tileLocation.y += mapTile.y;
|
|
|
|
|
|
|
|
selectedTile->x = tileLocation.x;
|
|
|
|
selectedTile->y = tileLocation.y;
|
|
|
|
selectedTile++;
|
|
|
|
}
|
2017-08-06 02:26:14 +02:00
|
|
|
selectedTile->x = -1;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
|
|
|
map_invalidate_map_selection_tiles();
|
|
|
|
|
|
|
|
// If no change in ghost placement
|
2017-10-02 15:45:50 +02:00
|
|
|
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_3) &&
|
2017-06-06 23:24:18 +02:00
|
|
|
mapTile.x == gSceneryGhostPosition.x &&
|
|
|
|
mapTile.y == gSceneryGhostPosition.y &&
|
|
|
|
gSceneryPlaceZ == _unkF64F0A &&
|
|
|
|
(sint16)(parameter3 & 0xFFFF) == gSceneryPlaceObject
|
|
|
|
) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
|
|
|
|
gSceneryPlaceObject = (parameter3 & 0xFFFF);
|
|
|
|
_unkF64F0A = gSceneryPlaceZ;
|
|
|
|
|
|
|
|
bl = 1;
|
|
|
|
if (gSceneryPlaceZ != 0 && gSceneryShiftPressed) {
|
|
|
|
bl = 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
cost = 0;
|
|
|
|
for (; bl != 0; bl--){
|
|
|
|
cost = try_place_ghost_scenery(
|
|
|
|
mapTile,
|
|
|
|
parameter1,
|
|
|
|
parameter2,
|
|
|
|
parameter3,
|
|
|
|
selected_tab);
|
|
|
|
|
|
|
|
if (cost != MONEY32_UNDEFINED)
|
|
|
|
break;
|
|
|
|
gSceneryPlaceZ += 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
gSceneryPlaceCost = cost;
|
|
|
|
break;
|
2017-08-02 00:20:32 +02:00
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
case 4:
|
|
|
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
|
|
|
gMapSelectPositionA.x = mapTile.x;
|
|
|
|
gMapSelectPositionA.y = mapTile.y;
|
|
|
|
gMapSelectPositionB.x = mapTile.x;
|
|
|
|
gMapSelectPositionB.y = mapTile.y;
|
|
|
|
gMapSelectType = MAP_SELECT_TYPE_FULL;
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
|
|
|
|
// If no change in ghost placement
|
2017-10-02 15:45:50 +02:00
|
|
|
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_4) &&
|
2017-06-06 23:24:18 +02:00
|
|
|
mapTile.x == gSceneryGhostPosition.x &&
|
|
|
|
mapTile.y == gSceneryGhostPosition.y &&
|
|
|
|
(sint16)(parameter2 & 0xFF) == gSceneryGhostPosition.z &&
|
|
|
|
((parameter2 >> 8) & 0xFF) == gSceneryPlaceRotation
|
|
|
|
) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
|
|
|
|
cost = try_place_ghost_scenery(
|
|
|
|
mapTile,
|
|
|
|
parameter1,
|
|
|
|
parameter2,
|
|
|
|
parameter3,
|
|
|
|
selected_tab);
|
|
|
|
|
|
|
|
gSceneryPlaceCost = cost;
|
|
|
|
break;
|
|
|
|
}
|
2015-05-28 20:33:09 +02:00
|
|
|
}
|
|
|
|
|
2014-11-04 04:34:12 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066CB25
|
|
|
|
*/
|
2017-05-01 15:41:45 +02:00
|
|
|
static void window_top_toolbar_tool_update(rct_window* w, rct_widgetindex widgetIndex, sint32 x, sint32 y)
|
2014-11-04 04:34:12 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_CLEAR_SCENERY:
|
|
|
|
top_toolbar_tool_update_scenery_clear(x, y);
|
|
|
|
break;
|
|
|
|
case WIDX_LAND:
|
|
|
|
if (gLandPaintMode)
|
|
|
|
top_toolbar_tool_update_land_paint(x, y);
|
|
|
|
else
|
|
|
|
top_toolbar_tool_update_land(x, y);
|
|
|
|
break;
|
|
|
|
case WIDX_WATER:
|
|
|
|
top_toolbar_tool_update_water(x, y);
|
|
|
|
break;
|
|
|
|
case WIDX_SCENERY:
|
|
|
|
top_toolbar_tool_update_scenery(x, y);
|
|
|
|
break;
|
|
|
|
}
|
2014-11-04 04:34:12 +01:00
|
|
|
}
|
|
|
|
|
2014-10-21 18:59:47 +02:00
|
|
|
/**
|
2015-12-11 16:38:37 +01:00
|
|
|
*
|
|
|
|
* rct2: 0x0066CB73
|
2014-10-21 18:59:47 +02:00
|
|
|
*/
|
2017-05-01 15:41:45 +02:00
|
|
|
static void window_top_toolbar_tool_down(rct_window* w, rct_widgetindex widgetIndex, sint32 x, sint32 y)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
switch (widgetIndex){
|
|
|
|
case WIDX_CLEAR_SCENERY:
|
|
|
|
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
|
|
|
|
break;
|
|
|
|
|
|
|
|
gGameCommandErrorTitle = STR_UNABLE_TO_REMOVE_ALL_SCENERY_FROM_HERE;
|
|
|
|
|
|
|
|
game_do_command(
|
|
|
|
gMapSelectPositionA.x,
|
|
|
|
1,
|
|
|
|
gMapSelectPositionA.y,
|
2017-08-06 02:26:14 +02:00
|
|
|
((gClearSmallScenery ? 1 : 0) | (gClearLargeScenery ? 1 : 0) << 1 | (gClearFootpath ? 1 : 0) << 2),
|
2017-06-06 23:24:18 +02:00
|
|
|
GAME_COMMAND_CLEAR_SCENERY,
|
|
|
|
gMapSelectPositionB.x,
|
|
|
|
gMapSelectPositionB.y
|
|
|
|
);
|
|
|
|
gCurrentToolId = TOOL_CROSSHAIR;
|
|
|
|
break;
|
|
|
|
case WIDX_LAND:
|
|
|
|
if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) {
|
|
|
|
gGameCommandErrorTitle = STR_CANT_CHANGE_LAND_TYPE;
|
|
|
|
game_do_command(
|
|
|
|
gMapSelectPositionA.x,
|
|
|
|
1,
|
|
|
|
gMapSelectPositionA.y,
|
|
|
|
gLandToolTerrainSurface | (gLandToolTerrainEdge << 8),
|
|
|
|
GAME_COMMAND_CHANGE_SURFACE_STYLE,
|
|
|
|
gMapSelectPositionB.x,
|
|
|
|
gMapSelectPositionB.y
|
|
|
|
);
|
|
|
|
gCurrentToolId = TOOL_UP_DOWN_ARROW;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WIDX_WATER:
|
|
|
|
if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) {
|
|
|
|
gCurrentToolId = TOOL_UP_DOWN_ARROW;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WIDX_SCENERY:
|
|
|
|
window_top_toolbar_scenery_tool_down(x, y, w, widgetIndex);
|
|
|
|
break;
|
|
|
|
}
|
2014-11-04 04:34:12 +01:00
|
|
|
}
|
|
|
|
|
2015-02-19 17:33:26 +01:00
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2015-02-19 17:33:26 +01:00
|
|
|
* rct2: 0x006644DD
|
|
|
|
*/
|
2017-11-11 02:57:45 +01:00
|
|
|
static money32 selection_raise_land(uint8 flags)
|
2015-06-10 16:41:50 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
sint32 centreX = (gMapSelectPositionA.x + gMapSelectPositionB.x) / 2;
|
|
|
|
sint32 centreY = (gMapSelectPositionA.y + gMapSelectPositionB.y) / 2;
|
|
|
|
centreX += 16;
|
|
|
|
centreY += 16;
|
|
|
|
|
|
|
|
uint32 xBounds = (gMapSelectPositionA.x & 0xFFFF) | (gMapSelectPositionB.x << 16);
|
|
|
|
uint32 yBounds = (gMapSelectPositionA.y & 0xFFFF) | (gMapSelectPositionB.y << 16);
|
|
|
|
|
|
|
|
gGameCommandErrorTitle = STR_CANT_RAISE_LAND_HERE;
|
|
|
|
if (gLandMountainMode) {
|
|
|
|
return game_do_command(centreX, flags, centreY, xBounds, GAME_COMMAND_EDIT_LAND_SMOOTH, gMapSelectType, yBounds);
|
|
|
|
} else {
|
|
|
|
return game_do_command(centreX, flags, centreY, xBounds, GAME_COMMAND_RAISE_LAND, gMapSelectType, yBounds);
|
|
|
|
}
|
2015-02-19 17:33:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006645B3
|
|
|
|
*/
|
2017-11-11 02:57:45 +01:00
|
|
|
static money32 selection_lower_land(uint8 flags)
|
2015-06-10 16:41:50 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
sint32 centreX = (gMapSelectPositionA.x + gMapSelectPositionB.x) / 2;
|
|
|
|
sint32 centreY = (gMapSelectPositionA.y + gMapSelectPositionB.y) / 2;
|
|
|
|
centreX += 16;
|
|
|
|
centreY += 16;
|
|
|
|
|
|
|
|
uint32 xBounds = (gMapSelectPositionA.x & 0xFFFF) | (gMapSelectPositionB.x << 16);
|
|
|
|
uint32 yBounds = (gMapSelectPositionA.y & 0xFFFF) | (gMapSelectPositionB.y << 16);
|
|
|
|
|
|
|
|
gGameCommandErrorTitle = STR_CANT_LOWER_LAND_HERE;
|
|
|
|
if (gLandMountainMode) {
|
|
|
|
return game_do_command(centreX, flags, centreY, xBounds, GAME_COMMAND_EDIT_LAND_SMOOTH, 0x8000+gMapSelectType, yBounds);
|
|
|
|
} else {
|
|
|
|
return game_do_command(centreX, flags, centreY, xBounds, GAME_COMMAND_LOWER_LAND, gMapSelectType, yBounds);
|
|
|
|
}
|
2015-02-19 17:33:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* part of window_top_toolbar_tool_drag(0x0066CB4E)
|
|
|
|
* rct2: 0x00664454
|
|
|
|
*/
|
2017-01-04 22:17:08 +01:00
|
|
|
static void window_top_toolbar_land_tool_drag(sint16 x, sint16 y)
|
2015-02-19 17:33:26 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window *window = window_find_from_point(x, y);
|
|
|
|
if (!window)
|
|
|
|
return;
|
|
|
|
rct_widgetindex widget_index = window_find_widget_from_point(window, x, y);
|
|
|
|
if (widget_index == -1)
|
|
|
|
return;
|
|
|
|
rct_widget *widget = &window->widgets[widget_index];
|
|
|
|
if (widget->type != WWT_VIEWPORT)
|
|
|
|
return;
|
|
|
|
rct_viewport *viewport = window->viewport;
|
|
|
|
if (!viewport)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sint16 tile_height = -16 / (1 << viewport->zoom);
|
|
|
|
|
|
|
|
sint32 y_diff = y - gInputDragLastY;
|
|
|
|
if (y_diff <= tile_height) {
|
|
|
|
gInputDragLastY += tile_height;
|
|
|
|
|
|
|
|
selection_raise_land(GAME_COMMAND_FLAG_APPLY);
|
|
|
|
|
|
|
|
gLandToolRaiseCost = MONEY32_UNDEFINED;
|
|
|
|
gLandToolLowerCost = MONEY32_UNDEFINED;
|
|
|
|
} else if (y_diff >= -tile_height) {
|
|
|
|
gInputDragLastY -= tile_height;
|
|
|
|
|
|
|
|
selection_lower_land(GAME_COMMAND_FLAG_APPLY);
|
|
|
|
|
|
|
|
gLandToolRaiseCost = MONEY32_UNDEFINED;
|
|
|
|
gLandToolLowerCost = MONEY32_UNDEFINED;
|
|
|
|
}
|
2015-02-19 17:33:26 +01:00
|
|
|
}
|
|
|
|
|
2015-02-18 20:26:16 +01:00
|
|
|
/**
|
|
|
|
* part of window_top_toolbar_tool_drag(0x0066CB4E)
|
|
|
|
* rct2: 0x006E6D4B
|
|
|
|
*/
|
2017-01-04 22:17:08 +01:00
|
|
|
static void window_top_toolbar_water_tool_drag(sint16 x, sint16 y)
|
2015-02-18 20:26:16 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window *window = window_find_from_point(x, y);
|
|
|
|
if (!window)
|
|
|
|
return;
|
|
|
|
rct_widgetindex widget_index = window_find_widget_from_point(window, x, y);
|
|
|
|
if (widget_index == -1)
|
|
|
|
return;
|
|
|
|
rct_widget *widget = &window->widgets[widget_index];
|
|
|
|
if (widget->type != WWT_VIEWPORT)
|
|
|
|
return;
|
|
|
|
rct_viewport *viewport = window->viewport;
|
|
|
|
if (!viewport)
|
|
|
|
return;
|
|
|
|
|
2017-08-06 17:55:33 +02:00
|
|
|
sint16 dx = -16;
|
2017-06-06 23:24:18 +02:00
|
|
|
dx >>= viewport->zoom;
|
|
|
|
|
|
|
|
y -= gInputDragLastY;
|
|
|
|
|
|
|
|
if (y <= dx) {
|
|
|
|
gInputDragLastY += dx;
|
|
|
|
|
|
|
|
gGameCommandErrorTitle = STR_CANT_RAISE_WATER_LEVEL_HERE;
|
|
|
|
|
|
|
|
game_do_command(
|
|
|
|
gMapSelectPositionA.x,
|
|
|
|
1,
|
|
|
|
gMapSelectPositionA.y,
|
|
|
|
dx,
|
|
|
|
GAME_COMMAND_RAISE_WATER,
|
|
|
|
gMapSelectPositionB.x,
|
|
|
|
gMapSelectPositionB.y
|
|
|
|
);
|
|
|
|
gWaterToolRaiseCost = MONEY32_UNDEFINED;
|
|
|
|
gWaterToolLowerCost = MONEY32_UNDEFINED;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dx = -dx;
|
|
|
|
|
|
|
|
if (y >= dx) {
|
|
|
|
gInputDragLastY += dx;
|
|
|
|
|
|
|
|
gGameCommandErrorTitle = STR_CANT_LOWER_WATER_LEVEL_HERE;
|
|
|
|
|
|
|
|
game_do_command(
|
|
|
|
gMapSelectPositionA.x,
|
|
|
|
1,
|
|
|
|
gMapSelectPositionA.y,
|
|
|
|
dx,
|
|
|
|
GAME_COMMAND_LOWER_WATER,
|
|
|
|
gMapSelectPositionB.x,
|
|
|
|
gMapSelectPositionB.y
|
|
|
|
);
|
|
|
|
gWaterToolRaiseCost = MONEY32_UNDEFINED;
|
|
|
|
gWaterToolLowerCost = MONEY32_UNDEFINED;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2015-02-18 20:26:16 +01:00
|
|
|
}
|
|
|
|
|
2014-11-04 04:34:12 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066CB4E
|
|
|
|
*/
|
2017-05-01 15:41:45 +02:00
|
|
|
static void window_top_toolbar_tool_drag(rct_window* w, rct_widgetindex widgetIndex, sint32 x, sint32 y)
|
2014-11-04 04:34:12 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
switch (widgetIndex){
|
|
|
|
case WIDX_CLEAR_SCENERY:
|
2017-08-15 10:07:44 +02:00
|
|
|
if (window_find_by_class(WC_ERROR) != nullptr)
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
|
|
|
|
break;
|
|
|
|
|
|
|
|
gGameCommandErrorTitle = STR_UNABLE_TO_REMOVE_ALL_SCENERY_FROM_HERE;
|
|
|
|
|
|
|
|
game_do_command(
|
|
|
|
gMapSelectPositionA.x,
|
|
|
|
1,
|
|
|
|
gMapSelectPositionA.y,
|
2017-08-06 02:26:14 +02:00
|
|
|
((gClearSmallScenery ? 1 : 0) | (gClearLargeScenery ? 1 : 0) << 1 | (gClearFootpath ? 1 : 0) << 2),
|
2017-06-06 23:24:18 +02:00
|
|
|
GAME_COMMAND_CLEAR_SCENERY,
|
|
|
|
gMapSelectPositionB.x,
|
|
|
|
gMapSelectPositionB.y
|
|
|
|
);
|
|
|
|
gCurrentToolId = TOOL_CROSSHAIR;
|
|
|
|
break;
|
|
|
|
case WIDX_LAND:
|
|
|
|
// Custom setting to only change land style instead of raising or lowering land
|
|
|
|
if (gLandPaintMode) {
|
|
|
|
if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) {
|
|
|
|
gGameCommandErrorTitle = STR_CANT_CHANGE_LAND_TYPE;
|
|
|
|
game_do_command(
|
|
|
|
gMapSelectPositionA.x,
|
|
|
|
1,
|
|
|
|
gMapSelectPositionA.y,
|
|
|
|
gLandToolTerrainSurface | (gLandToolTerrainEdge << 8),
|
|
|
|
GAME_COMMAND_CHANGE_SURFACE_STYLE,
|
|
|
|
gMapSelectPositionB.x,
|
|
|
|
gMapSelectPositionB.y
|
|
|
|
);
|
|
|
|
// The tool is set to 12 here instead of 3 so that the dragging cursor is not the elevation change cursor
|
|
|
|
gCurrentToolId = TOOL_CROSSHAIR;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
window_top_toolbar_land_tool_drag(x, y);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WIDX_WATER:
|
|
|
|
window_top_toolbar_water_tool_drag(x, y);
|
|
|
|
break;
|
|
|
|
case WIDX_SCENERY:
|
|
|
|
if (gWindowSceneryPaintEnabled & 1)
|
|
|
|
window_top_toolbar_scenery_tool_down(x, y, w, widgetIndex);
|
|
|
|
if (gWindowSceneryEyedropperEnabled)
|
|
|
|
window_top_toolbar_scenery_tool_down(x, y, w, widgetIndex);
|
|
|
|
break;
|
|
|
|
}
|
2015-02-10 15:41:35 +01:00
|
|
|
}
|
|
|
|
|
2015-06-26 17:40:37 +02:00
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2015-06-26 17:40:37 +02:00
|
|
|
* rct2: 0x0066CC5B
|
|
|
|
*/
|
2017-05-01 15:41:45 +02:00
|
|
|
static void window_top_toolbar_tool_up(rct_window* w, rct_widgetindex widgetIndex, sint32 x, sint32 y)
|
2015-10-20 20:16:30 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_LAND:
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
|
|
|
gCurrentToolId = TOOL_DIG_DOWN;
|
|
|
|
break;
|
|
|
|
case WIDX_WATER:
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
|
|
|
gCurrentToolId = TOOL_WATER_DOWN;
|
|
|
|
break;
|
|
|
|
case WIDX_CLEAR_SCENERY:
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
|
|
|
gCurrentToolId = TOOL_CROSSHAIR;
|
|
|
|
break;
|
|
|
|
}
|
2015-06-26 17:40:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2015-06-26 17:40:37 +02:00
|
|
|
* rct2: 0x0066CA58
|
|
|
|
*/
|
2017-05-01 15:41:45 +02:00
|
|
|
static void window_top_toolbar_tool_abort(rct_window *w, rct_widgetindex widgetIndex)
|
2015-06-26 17:40:37 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_LAND:
|
|
|
|
case WIDX_WATER:
|
|
|
|
case WIDX_CLEAR_SCENERY:
|
|
|
|
hide_gridlines();
|
|
|
|
break;
|
|
|
|
}
|
2015-06-26 17:40:37 +02:00
|
|
|
}
|
2015-05-19 00:16:43 +02:00
|
|
|
|
2017-11-11 02:57:45 +01:00
|
|
|
static void top_toolbar_init_fastforward_menu(rct_window* w, rct_widget* widget) {
|
2017-06-06 23:24:18 +02:00
|
|
|
sint32 num_items = 4;
|
|
|
|
gDropdownItemsFormat[0] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[1] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[2] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[3] = STR_TOGGLE_OPTION;
|
|
|
|
if (gConfigGeneral.debugging_tools) {
|
|
|
|
gDropdownItemsFormat[4] = STR_EMPTY;
|
|
|
|
gDropdownItemsFormat[5] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsArgs[5] = STR_SPEED_HYPER;
|
|
|
|
num_items = 6;
|
|
|
|
}
|
|
|
|
|
|
|
|
gDropdownItemsArgs[0] = STR_SPEED_NORMAL;
|
|
|
|
gDropdownItemsArgs[1] = STR_SPEED_QUICK;
|
|
|
|
gDropdownItemsArgs[2] = STR_SPEED_FAST;
|
|
|
|
gDropdownItemsArgs[3] = STR_SPEED_TURBO;
|
|
|
|
|
|
|
|
|
|
|
|
window_dropdown_show_text(
|
|
|
|
w->x + widget->left,
|
|
|
|
w->y + widget->top,
|
|
|
|
widget->bottom - widget->top + 1,
|
|
|
|
w->colours[0] | 0x80,
|
|
|
|
0,
|
|
|
|
num_items
|
|
|
|
);
|
|
|
|
|
|
|
|
// Set checkmarks
|
|
|
|
if (gGameSpeed <= 4) {
|
|
|
|
dropdown_set_checked(gGameSpeed - 1, true);
|
|
|
|
}
|
|
|
|
if (gGameSpeed == 8) {
|
|
|
|
dropdown_set_checked(5, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gConfigGeneral.debugging_tools) {
|
|
|
|
gDropdownDefaultIndex = (gGameSpeed == 8 ? 0 : gGameSpeed);
|
|
|
|
} else {
|
|
|
|
gDropdownDefaultIndex = (gGameSpeed >= 4 ? 0 : gGameSpeed);
|
|
|
|
}
|
|
|
|
if (gDropdownDefaultIndex == 4) {
|
|
|
|
gDropdownDefaultIndex = 5;
|
|
|
|
}
|
2015-05-19 00:16:43 +02:00
|
|
|
}
|
|
|
|
|
2017-11-11 02:57:45 +01:00
|
|
|
static void top_toolbar_fastforward_menu_dropdown(sint16 dropdownIndex)
|
2016-01-18 00:37:14 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window* w = window_get_main();
|
|
|
|
if (w) {
|
|
|
|
if (dropdownIndex >= 0 && dropdownIndex <= 5) {
|
|
|
|
gGameSpeed = dropdownIndex + 1;
|
|
|
|
if (gGameSpeed >= 5)
|
|
|
|
gGameSpeed = 8;
|
|
|
|
window_invalidate(w);
|
|
|
|
}
|
|
|
|
}
|
2015-05-19 00:16:43 +02:00
|
|
|
}
|
|
|
|
|
2017-11-11 02:57:45 +01:00
|
|
|
static void top_toolbar_init_rotate_menu(rct_window* w, rct_widget* widget)
|
2016-01-18 00:37:14 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gDropdownItemsFormat[0] = STR_ROTATE_CLOCKWISE;
|
|
|
|
gDropdownItemsFormat[1] = STR_ROTATE_ANTI_CLOCKWISE;
|
|
|
|
|
|
|
|
window_dropdown_show_text(
|
|
|
|
w->x + widget->left,
|
|
|
|
w->y + widget->top,
|
|
|
|
widget->bottom - widget->top + 1,
|
|
|
|
w->colours[1] | 0x80,
|
|
|
|
0,
|
|
|
|
2
|
|
|
|
);
|
|
|
|
|
|
|
|
gDropdownDefaultIndex = DDIDX_ROTATE_CLOCKWISE;
|
2015-07-09 12:45:47 +02:00
|
|
|
}
|
|
|
|
|
2017-11-11 02:57:45 +01:00
|
|
|
static void top_toolbar_rotate_menu_dropdown(sint16 dropdownIndex)
|
2016-01-18 00:37:14 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window* w = window_get_main();
|
|
|
|
if (w) {
|
|
|
|
if (dropdownIndex == 0) {
|
|
|
|
window_rotate_camera(w, 1);
|
|
|
|
window_invalidate(w);
|
|
|
|
}
|
|
|
|
else if (dropdownIndex == 1){
|
|
|
|
window_rotate_camera(w, -1);
|
|
|
|
window_invalidate(w);
|
|
|
|
}
|
|
|
|
}
|
2015-07-09 12:45:47 +02:00
|
|
|
}
|
|
|
|
|
2017-11-11 02:57:45 +01:00
|
|
|
static void top_toolbar_init_debug_menu(rct_window* w, rct_widget* widget)
|
2016-01-18 00:37:14 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gDropdownItemsFormat[DDIDX_CONSOLE] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsArgs[DDIDX_CONSOLE] = STR_DEBUG_DROPDOWN_CONSOLE;
|
|
|
|
gDropdownItemsFormat[DDIDX_TILE_INSPECTOR] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsArgs[DDIDX_TILE_INSPECTOR] = STR_DEBUG_DROPDOWN_TILE_INSPECTOR;
|
|
|
|
gDropdownItemsFormat[DDIDX_OBJECT_SELECTION] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsArgs[DDIDX_OBJECT_SELECTION] = STR_DEBUG_DROPDOWN_OBJECT_SELECTION;
|
|
|
|
gDropdownItemsFormat[DDIDX_INVENTIONS_LIST] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsArgs[DDIDX_INVENTIONS_LIST] = STR_DEBUG_DROPDOWN_INVENTIONS_LIST;
|
|
|
|
gDropdownItemsFormat[DDIDX_SCENARIO_OPTIONS] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsArgs[DDIDX_SCENARIO_OPTIONS] = STR_DEBUG_DROPDOWN_SCENARIO_OPTIONS;
|
|
|
|
gDropdownItemsFormat[DDIDX_DEBUG_PAINT] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsArgs[DDIDX_DEBUG_PAINT] = STR_DEBUG_DROPDOWN_DEBUG_PAINT;
|
|
|
|
|
|
|
|
window_dropdown_show_text(
|
|
|
|
w->x + widget->left,
|
|
|
|
w->y + widget->top,
|
|
|
|
widget->bottom - widget->top + 1,
|
|
|
|
w->colours[0] | 0x80,
|
|
|
|
DROPDOWN_FLAG_STAY_OPEN,
|
|
|
|
TOP_TOOLBAR_DEBUG_COUNT
|
|
|
|
);
|
|
|
|
|
|
|
|
// Disable items that are not yet available in multiplayer
|
|
|
|
if (network_get_mode() != NETWORK_MODE_NONE) {
|
|
|
|
dropdown_set_disabled(DDIDX_OBJECT_SELECTION, true);
|
|
|
|
dropdown_set_disabled(DDIDX_INVENTIONS_LIST, true);
|
|
|
|
}
|
|
|
|
|
2017-08-15 10:07:44 +02:00
|
|
|
dropdown_set_checked(DDIDX_DEBUG_PAINT, window_find_by_class(WC_DEBUG_PAINT) != nullptr);
|
2017-06-06 23:24:18 +02:00
|
|
|
gDropdownDefaultIndex = DDIDX_CONSOLE;
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
|
|
|
|
2017-11-11 02:57:45 +01:00
|
|
|
static void top_toolbar_init_network_menu(rct_window* w, rct_widget* widget)
|
2016-01-18 00:37:14 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
gDropdownItemsFormat[0] = STR_MULTIPLAYER;
|
|
|
|
|
|
|
|
window_dropdown_show_text(
|
|
|
|
w->x + widget->left,
|
|
|
|
w->y + widget->top,
|
|
|
|
widget->bottom - widget->top + 1,
|
|
|
|
w->colours[0] | 0x80,
|
|
|
|
0,
|
|
|
|
1
|
|
|
|
);
|
|
|
|
|
|
|
|
gDropdownDefaultIndex = DDIDX_MULTIPLAYER;
|
2015-07-16 19:32:43 +02:00
|
|
|
}
|
|
|
|
|
2017-11-11 02:57:45 +01:00
|
|
|
static void top_toolbar_debug_menu_dropdown(sint16 dropdownIndex)
|
2016-01-18 00:37:14 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window* w = window_get_main();
|
|
|
|
if (w) {
|
|
|
|
switch (dropdownIndex) {
|
|
|
|
case DDIDX_CONSOLE:
|
2018-03-11 23:25:34 +01:00
|
|
|
{
|
|
|
|
auto& console = GetInGameConsole();
|
|
|
|
console.Open();
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
2018-03-11 23:25:34 +01:00
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
case DDIDX_TILE_INSPECTOR:
|
2017-11-23 00:42:12 +01:00
|
|
|
context_open_window(WC_TILE_INSPECTOR);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_OBJECT_SELECTION:
|
|
|
|
window_close_all();
|
2017-11-23 09:03:56 +01:00
|
|
|
context_open_window(WC_EDITOR_OBJECT_SELECTION);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_INVENTIONS_LIST:
|
2017-08-12 23:06:12 +02:00
|
|
|
context_open_window(WC_EDITOR_INVENTION_LIST);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_SCENARIO_OPTIONS:
|
2017-08-12 23:06:12 +02:00
|
|
|
context_open_window(WC_EDITOR_SCENARIO_OPTIONS);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_DEBUG_PAINT:
|
2017-08-15 10:07:44 +02:00
|
|
|
if (window_find_by_class(WC_DEBUG_PAINT) == nullptr) {
|
2017-08-06 05:22:00 +02:00
|
|
|
context_open_window(WC_DEBUG_PAINT);
|
2017-06-06 23:24:18 +02:00
|
|
|
} else {
|
|
|
|
window_close_by_class(WC_DEBUG_PAINT);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
|
|
|
|
2017-11-11 02:57:45 +01:00
|
|
|
static void top_toolbar_network_menu_dropdown(sint16 dropdownIndex)
|
2016-01-18 00:37:14 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window* w = window_get_main();
|
|
|
|
if (w) {
|
|
|
|
switch (dropdownIndex) {
|
|
|
|
case DDIDX_MULTIPLAYER:
|
2017-08-06 05:22:00 +02:00
|
|
|
context_open_window(WC_MULTIPLAYER);
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2015-07-16 19:32:43 +02:00
|
|
|
}
|
|
|
|
|
2015-02-10 15:41:35 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066CDE4
|
|
|
|
*/
|
2017-11-11 02:57:45 +01:00
|
|
|
static void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget) {
|
2017-06-06 23:24:18 +02:00
|
|
|
gDropdownItemsFormat[0] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[1] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[2] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[3] = STR_EMPTY;
|
|
|
|
gDropdownItemsFormat[4] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[5] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[6] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[7] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[8] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[9] = STR_EMPTY;
|
|
|
|
gDropdownItemsFormat[10] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[11] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[12] = STR_TOGGLE_OPTION;
|
|
|
|
gDropdownItemsFormat[13] = DROPDOWN_SEPARATOR;
|
|
|
|
gDropdownItemsFormat[DDIDX_VIEW_CLIPPING] = STR_TOGGLE_OPTION;
|
2018-01-11 00:26:19 +01:00
|
|
|
gDropdownItemsFormat[DDIDX_HIGHLIGHT_PATH_ISSUES] = STR_TOGGLE_OPTION;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gDropdownItemsArgs[0] = STR_UNDERGROUND_VIEW;
|
|
|
|
gDropdownItemsArgs[1] = STR_REMOVE_BASE_LAND;
|
|
|
|
gDropdownItemsArgs[2] = STR_REMOVE_VERTICAL_FACES;
|
|
|
|
gDropdownItemsArgs[4] = STR_SEE_THROUGH_RIDES;
|
|
|
|
gDropdownItemsArgs[5] = STR_SEE_THROUGH_SCENERY;
|
|
|
|
gDropdownItemsArgs[6] = STR_SEE_THROUGH_PATHS;
|
|
|
|
gDropdownItemsArgs[7] = STR_INVISIBLE_SUPPORTS;
|
|
|
|
gDropdownItemsArgs[8] = STR_INVISIBLE_PEOPLE;
|
|
|
|
gDropdownItemsArgs[10] = STR_HEIGHT_MARKS_ON_LAND;
|
|
|
|
gDropdownItemsArgs[11] = STR_HEIGHT_MARKS_ON_RIDE_TRACKS;
|
|
|
|
gDropdownItemsArgs[12] = STR_HEIGHT_MARKS_ON_PATHS;
|
|
|
|
gDropdownItemsArgs[DDIDX_VIEW_CLIPPING] = STR_VIEW_CLIPPING_MENU;
|
2018-01-11 00:26:19 +01:00
|
|
|
gDropdownItemsArgs[DDIDX_HIGHLIGHT_PATH_ISSUES] = STR_HIGHLIGHT_PATH_ISSUES_MENU;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
window_dropdown_show_text(
|
|
|
|
w->x + widget->left,
|
|
|
|
w->y + widget->top,
|
|
|
|
widget->bottom - widget->top + 1,
|
|
|
|
w->colours[1] | 0x80,
|
|
|
|
0,
|
|
|
|
TOP_TOOLBAR_VIEW_MENU_COUNT
|
|
|
|
);
|
|
|
|
|
|
|
|
// Set checkmarks
|
|
|
|
rct_viewport* mainViewport = window_get_main()->viewport;
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE)
|
|
|
|
dropdown_set_checked(0, true);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_HIDE_BASE)
|
|
|
|
dropdown_set_checked(1, true);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_HIDE_VERTICAL)
|
|
|
|
dropdown_set_checked(2, true);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_SEETHROUGH_RIDES)
|
|
|
|
dropdown_set_checked(4, true);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_SEETHROUGH_SCENERY)
|
|
|
|
dropdown_set_checked(5, true);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_SEETHROUGH_PATHS)
|
|
|
|
dropdown_set_checked(6, true);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS)
|
|
|
|
dropdown_set_checked(7, true);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_INVISIBLE_PEEPS)
|
|
|
|
dropdown_set_checked(8, true);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_LAND_HEIGHTS)
|
|
|
|
dropdown_set_checked(10, true);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_TRACK_HEIGHTS)
|
|
|
|
dropdown_set_checked(11, true);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_PATH_HEIGHTS)
|
|
|
|
dropdown_set_checked(12, true);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT)
|
|
|
|
dropdown_set_checked(DDIDX_VIEW_CLIPPING, true);
|
2018-01-11 00:26:19 +01:00
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)
|
|
|
|
dropdown_set_checked(DDIDX_HIGHLIGHT_PATH_ISSUES, true);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
gDropdownDefaultIndex = DDIDX_UNDERGROUND_INSIDE;
|
2015-02-10 15:41:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066CF8A
|
|
|
|
*/
|
2017-11-11 02:57:45 +01:00
|
|
|
static void top_toolbar_view_menu_dropdown(sint16 dropdownIndex)
|
2016-01-18 00:37:14 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_window* w = window_get_main();
|
|
|
|
if (w) {
|
|
|
|
switch (dropdownIndex) {
|
|
|
|
case DDIDX_UNDERGROUND_INSIDE:
|
|
|
|
w->viewport->flags ^= VIEWPORT_FLAG_UNDERGROUND_INSIDE;
|
|
|
|
break;
|
|
|
|
case DDIDX_HIDE_BASE:
|
|
|
|
w->viewport->flags ^= VIEWPORT_FLAG_HIDE_BASE;
|
|
|
|
break;
|
|
|
|
case DDIDX_HIDE_VERTICAL:
|
|
|
|
w->viewport->flags ^= VIEWPORT_FLAG_HIDE_VERTICAL;
|
|
|
|
break;
|
|
|
|
case DDIDX_SEETHROUGH_RIDES:
|
|
|
|
w->viewport->flags ^= VIEWPORT_FLAG_SEETHROUGH_RIDES;
|
|
|
|
break;
|
|
|
|
case DDIDX_SEETHROUGH_SCENARY:
|
|
|
|
w->viewport->flags ^= VIEWPORT_FLAG_SEETHROUGH_SCENERY;
|
|
|
|
break;
|
|
|
|
case DDIDX_SEETHROUGH_PATHS:
|
|
|
|
w->viewport->flags ^= VIEWPORT_FLAG_SEETHROUGH_PATHS;
|
|
|
|
break;
|
|
|
|
case DDIDX_INVISIBLE_SUPPORTS:
|
|
|
|
w->viewport->flags ^= VIEWPORT_FLAG_INVISIBLE_SUPPORTS;
|
|
|
|
break;
|
|
|
|
case DDIDX_INVISIBLE_PEEPS:
|
|
|
|
w->viewport->flags ^= VIEWPORT_FLAG_INVISIBLE_PEEPS;
|
|
|
|
break;
|
|
|
|
case DDIDX_LAND_HEIGHTS:
|
|
|
|
w->viewport->flags ^= VIEWPORT_FLAG_LAND_HEIGHTS;
|
|
|
|
break;
|
|
|
|
case DDIDX_TRACK_HEIGHTS:
|
|
|
|
w->viewport->flags ^= VIEWPORT_FLAG_TRACK_HEIGHTS;
|
|
|
|
break;
|
|
|
|
case DDIDX_PATH_HEIGHTS:
|
|
|
|
w->viewport->flags ^= VIEWPORT_FLAG_PATH_HEIGHTS;
|
|
|
|
break;
|
|
|
|
case DDIDX_VIEW_CLIPPING:
|
2017-08-12 23:06:12 +02:00
|
|
|
if (window_find_by_class(WC_VIEW_CLIPPING) == nullptr) {
|
|
|
|
context_open_window(WC_VIEW_CLIPPING);
|
|
|
|
} else {
|
|
|
|
// If window is already open, toggle the view clipping on/off
|
|
|
|
w->viewport->flags ^= VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT;
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
2018-01-11 00:26:19 +01:00
|
|
|
case DDIDX_HIGHLIGHT_PATH_ISSUES:
|
|
|
|
w->viewport->flags ^= VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES;
|
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
window_invalidate(w);
|
|
|
|
}
|
2015-02-10 15:41:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066CCE7
|
|
|
|
*/
|
2017-11-11 02:57:45 +01:00
|
|
|
static void toggle_footpath_window()
|
2015-02-10 15:41:35 +01:00
|
|
|
{
|
2017-08-15 10:07:44 +02:00
|
|
|
if (window_find_by_class(WC_FOOTPATH) == nullptr) {
|
2017-08-12 23:06:12 +02:00
|
|
|
context_open_window(WC_FOOTPATH);
|
2017-06-06 23:24:18 +02:00
|
|
|
} else {
|
|
|
|
tool_cancel();
|
|
|
|
window_close_by_class(WC_FOOTPATH);
|
|
|
|
}
|
2015-02-10 15:41:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
* rct2: 0x0066CD54
|
2015-02-10 15:41:35 +01:00
|
|
|
*/
|
2017-11-11 02:57:45 +01:00
|
|
|
static void toggle_land_window(rct_window *topToolbar, rct_widgetindex widgetIndex)
|
2015-02-10 15:41:35 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WC_TOP_TOOLBAR && gCurrentToolWidget.widget_index == WIDX_LAND) {
|
|
|
|
tool_cancel();
|
|
|
|
} else {
|
|
|
|
show_gridlines();
|
|
|
|
tool_set(topToolbar, widgetIndex, TOOL_DIG_DOWN);
|
|
|
|
input_set_flag(INPUT_FLAG_6, true);
|
2017-08-12 23:06:12 +02:00
|
|
|
context_open_window(WC_LAND);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2015-02-10 15:41:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
* rct2: 0x0066CD0C
|
2015-02-10 15:41:35 +01:00
|
|
|
*/
|
2017-11-11 02:57:45 +01:00
|
|
|
static void toggle_clear_scenery_window(rct_window *topToolbar, rct_widgetindex widgetIndex)
|
2015-02-10 15:41:35 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == WC_TOP_TOOLBAR && gCurrentToolWidget.widget_index == WIDX_CLEAR_SCENERY)) {
|
|
|
|
tool_cancel();
|
|
|
|
} else {
|
|
|
|
show_gridlines();
|
|
|
|
tool_set(topToolbar, widgetIndex, TOOL_CROSSHAIR);
|
|
|
|
input_set_flag(INPUT_FLAG_6, true);
|
2017-08-12 23:06:12 +02:00
|
|
|
context_open_window(WC_CLEAR_SCENERY);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2015-02-10 15:41:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
2015-12-11 16:38:37 +01:00
|
|
|
* rct2: 0x0066CD9C
|
2015-02-10 15:41:35 +01:00
|
|
|
*/
|
2017-11-11 02:57:45 +01:00
|
|
|
static void toggle_water_window(rct_window *topToolbar, rct_widgetindex widgetIndex)
|
2015-02-10 15:41:35 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WC_TOP_TOOLBAR && gCurrentToolWidget.widget_index == WIDX_WATER) {
|
|
|
|
tool_cancel();
|
|
|
|
} else {
|
|
|
|
show_gridlines();
|
|
|
|
tool_set(topToolbar, widgetIndex, TOOL_WATER_DOWN);
|
|
|
|
input_set_flag(INPUT_FLAG_6, true);
|
2017-08-12 23:06:12 +02:00
|
|
|
context_open_window(WC_WATER);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2015-05-12 16:13:30 +02:00
|
|
|
}
|
2015-07-02 18:00:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066D104
|
|
|
|
*/
|
|
|
|
bool land_tool_is_active()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE)))
|
|
|
|
return false;
|
|
|
|
if (gCurrentToolWidget.window_classification != WC_TOP_TOOLBAR)
|
|
|
|
return false;
|
|
|
|
if (gCurrentToolWidget.widget_index != WIDX_LAND)
|
|
|
|
return false;
|
|
|
|
return true;
|
2015-07-02 18:00:39 +02:00
|
|
|
}
|
2017-04-30 23:33:19 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066D125
|
|
|
|
*/
|
|
|
|
bool clear_scenery_tool_is_active()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE)))
|
|
|
|
return false;
|
|
|
|
if (gCurrentToolWidget.window_classification != WC_TOP_TOOLBAR)
|
|
|
|
return false;
|
|
|
|
if (gCurrentToolWidget.widget_index != WIDX_CLEAR_SCENERY)
|
|
|
|
return false;
|
|
|
|
return true;
|
2017-04-30 23:33:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066D125
|
|
|
|
*/
|
|
|
|
bool water_tool_is_active()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE)))
|
|
|
|
return false;
|
|
|
|
if (gCurrentToolWidget.window_classification != WC_TOP_TOOLBAR)
|
|
|
|
return false;
|
|
|
|
if (gCurrentToolWidget.widget_index != WIDX_WATER)
|
|
|
|
return false;
|
|
|
|
return true;
|
2017-04-30 23:33:19 +02:00
|
|
|
}
|