2014-04-11 03:42:39 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Copyright (c) 2014 Ted John
|
|
|
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
|
|
|
*
|
|
|
|
* This file is part of OpenRCT2.
|
|
|
|
*
|
|
|
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2014-04-11 03:42:39 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2014-04-11 03:42:39 +02:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2014-10-06 18:36:58 +02:00
|
|
|
#include "../addresses.h"
|
2015-06-26 23:40:09 +02:00
|
|
|
#include "../cheats.h"
|
2015-03-07 17:38:17 +01:00
|
|
|
#include "../config.h"
|
2015-02-09 19:32:58 +01:00
|
|
|
#include "../editor.h"
|
2014-10-06 18:36:58 +02:00
|
|
|
#include "../game.h"
|
2014-10-15 23:59:26 +02:00
|
|
|
#include "../input.h"
|
2014-10-06 18:36:58 +02:00
|
|
|
#include "../sprites.h"
|
2014-11-23 17:28:23 +01:00
|
|
|
#include "../audio/audio.h"
|
2015-06-02 15:12:36 +02:00
|
|
|
#include "../interface/screenshot.h"
|
2014-10-06 18:36:58 +02:00
|
|
|
#include "../interface/widget.h"
|
|
|
|
#include "../interface/window.h"
|
|
|
|
#include "../interface/viewport.h"
|
2014-11-23 17:28:23 +01:00
|
|
|
#include "../localisation/localisation.h"
|
2015-08-16 13:14:04 +02:00
|
|
|
#include "../network/network.h"
|
2015-05-25 21:36:40 +02:00
|
|
|
#include "../network/twitch.h"
|
2015-04-20 21:11:45 +02:00
|
|
|
#include "../scenario.h"
|
2015-03-29 03:29:07 +02:00
|
|
|
#include "../world/scenery.h"
|
2015-04-16 20:37:51 +02:00
|
|
|
#include "../world/banner.h"
|
2014-11-23 17:28:23 +01:00
|
|
|
#include "dropdown.h"
|
2015-06-01 17:02:09 +02:00
|
|
|
#include "../interface/themes.h"
|
2015-06-01 03:33:56 +02:00
|
|
|
#include "../interface/console.h"
|
2014-04-11 03:42:39 +02:00
|
|
|
|
|
|
|
enum {
|
|
|
|
WIDX_PAUSE,
|
|
|
|
WIDX_FILE_MENU,
|
|
|
|
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,
|
|
|
|
|
2015-05-19 00:16:43 +02:00
|
|
|
WIDX_FASTFORWARD,
|
|
|
|
WIDX_CHEATS,
|
2015-06-01 03:33:56 +02:00
|
|
|
WIDX_DEBUG,
|
2015-01-01 05:28:50 +01:00
|
|
|
WIDX_FINANCES,
|
2015-02-06 12:57:51 +01:00
|
|
|
WIDX_RESEARCH,
|
2015-07-22 19:13:35 +02:00
|
|
|
WIDX_NEWS,
|
2015-07-16 19:32:43 +02:00
|
|
|
WIDX_NETWORK,
|
2015-02-06 12:57:51 +01:00
|
|
|
|
|
|
|
WIDX_SEPARATOR,
|
2014-04-11 03:42:39 +02:00
|
|
|
};
|
|
|
|
|
2014-08-10 10:34:27 +02:00
|
|
|
typedef enum {
|
2015-08-20 12:13:08 +02:00
|
|
|
DDIDX_LOAD_GAME = 0,
|
|
|
|
DDIDX_SAVE_GAME = 1,
|
|
|
|
DDIDX_SAVE_GAME_AS = 2,
|
2015-06-24 12:41:19 +02:00
|
|
|
// separator
|
2015-08-19 21:54:25 +02:00
|
|
|
DDIDX_ABOUT = 4,
|
|
|
|
DDIDX_OPTIONS = 5,
|
|
|
|
DDIDX_SCREENSHOT = 6,
|
|
|
|
DDIDX_GIANT_SCREENSHOT = 7,
|
2015-06-24 12:41:19 +02:00
|
|
|
// separator
|
2015-08-19 21:54:25 +02:00
|
|
|
DDIDX_QUIT_TO_MENU = 9,
|
|
|
|
DDIDX_EXIT_OPENRCT2 = 10,
|
2015-06-24 12:41:19 +02:00
|
|
|
// separator
|
2015-08-19 21:54:25 +02:00
|
|
|
DDIDX_ENABLE_TWITCH = 12
|
2014-08-10 10:34:27 +02:00
|
|
|
} FILE_MENU_DDIDX;
|
|
|
|
|
2015-02-10 15:41:35 +01:00
|
|
|
typedef enum {
|
|
|
|
DDIDX_UNDERGROUND_INSIDE = 0,
|
|
|
|
DDIDX_HIDE_BASE = 1,
|
|
|
|
DDIDX_HIDE_VERTICAL = 2,
|
|
|
|
DDIDX_SEETHROUGH_RIDES = 4,
|
|
|
|
DDIDX_SEETHROUGH_SCENARY = 5,
|
|
|
|
DDIDX_INVISIBLE_SUPPORTS = 6,
|
|
|
|
DDIDX_INVISIBLE_PEEPS = 7,
|
|
|
|
DDIDX_LAND_HEIGHTS = 9,
|
|
|
|
DDIDX_TRACK_HEIGHTS = 10,
|
|
|
|
DDIDX_PATH_HEIGHTS = 11,
|
|
|
|
} TOP_TOOLBAR_VIEW_MENU_DDIDX;
|
|
|
|
|
2015-06-01 03:33:56 +02:00
|
|
|
typedef enum {
|
|
|
|
DDIDX_CONSOLE = 0,
|
2015-06-20 16:07:36 +02:00
|
|
|
DDIDX_TILE_INSPECTOR = 1,
|
2015-08-12 15:31:52 +02:00
|
|
|
DDIDX_OBJECT_SELECTION = 2,
|
|
|
|
DDIDX_INVENTIONS_LIST = 3,
|
|
|
|
DDIDX_SCENARIO_OPTIONS = 4
|
2015-06-01 03:33:56 +02:00
|
|
|
} TOP_TOOLBAR_DEBUG_DDIDX;
|
|
|
|
|
2015-07-16 19:32:43 +02:00
|
|
|
typedef enum {
|
|
|
|
DDIDX_PLAYER_LIST = 0
|
|
|
|
} TOP_TOOLBAR_NETWORK_DDIDX;
|
|
|
|
|
2015-06-26 23:40:09 +02:00
|
|
|
enum {
|
|
|
|
DDIDX_CHEATS,
|
2015-07-02 20:25:04 +02:00
|
|
|
DDIDX_ENABLE_SANDBOX_MODE = 2,
|
|
|
|
DDIDX_DISABLE_CLEARANCE_CHECKS,
|
2015-09-18 11:55:52 +02:00
|
|
|
DDIDX_DISABLE_SUPPORT_LIMITS
|
2015-06-26 23:40:09 +02:00
|
|
|
};
|
|
|
|
|
2015-02-05 22:22:35 +01:00
|
|
|
#pragma region Toolbar_widget_ordering
|
|
|
|
|
|
|
|
// from left to right
|
|
|
|
static const int left_aligned_widgets_order[] = {
|
|
|
|
WIDX_PAUSE,
|
2015-05-19 00:16:43 +02:00
|
|
|
WIDX_FASTFORWARD,
|
2015-02-05 22:22:35 +01:00
|
|
|
WIDX_FILE_MENU,
|
2015-08-27 13:27:46 +02:00
|
|
|
WIDX_NETWORK,
|
2015-05-19 00:16:43 +02:00
|
|
|
WIDX_CHEATS,
|
2015-06-01 03:33:56 +02:00
|
|
|
WIDX_DEBUG,
|
2015-02-05 22:22:35 +01:00
|
|
|
|
2015-02-06 12:57:51 +01:00
|
|
|
WIDX_SEPARATOR,
|
|
|
|
|
2015-02-05 22:22:35 +01:00
|
|
|
WIDX_ZOOM_OUT,
|
|
|
|
WIDX_ZOOM_IN,
|
|
|
|
WIDX_ROTATE,
|
|
|
|
WIDX_VIEW_MENU,
|
|
|
|
WIDX_MAP,
|
|
|
|
};
|
|
|
|
|
|
|
|
// from right to left
|
|
|
|
static const int right_aligned_widgets_order[] = {
|
2015-07-22 19:13:35 +02:00
|
|
|
WIDX_NEWS,
|
2015-02-05 22:22:35 +01:00
|
|
|
WIDX_GUESTS,
|
|
|
|
WIDX_STAFF,
|
|
|
|
WIDX_PARK,
|
|
|
|
WIDX_RIDES,
|
|
|
|
WIDX_RESEARCH,
|
|
|
|
WIDX_FINANCES,
|
|
|
|
|
2015-02-06 12:57:51 +01:00
|
|
|
WIDX_SEPARATOR,
|
|
|
|
|
2015-02-05 22:22:35 +01:00
|
|
|
WIDX_CONSTRUCT_RIDE,
|
|
|
|
WIDX_PATH,
|
|
|
|
WIDX_SCENERY,
|
|
|
|
WIDX_WATER,
|
|
|
|
WIDX_LAND,
|
2015-07-22 19:13:35 +02:00
|
|
|
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[] = {
|
2014-04-11 03:42:39 +02:00
|
|
|
{ WWT_TRNBTN, 0, 0x0000, 0x001D, 0, 27, 0x20000000 | SPR_TOOLBAR_PAUSE, STR_PAUSE_GAME_TIP }, // Pause
|
|
|
|
{ WWT_TRNBTN, 0, 0x001E + 30, 0x003B + 30, 0, 27, 0x20000000 | SPR_TOOLBAR_FILE, STR_DISC_AND_GAME_OPTIONS_TIP }, // File menu
|
|
|
|
{ WWT_TRNBTN, 1, 0x0046 + 30, 0x0063 + 30, 0, 27, 0x20000000 | SPR_TOOLBAR_ZOOM_OUT, STR_ZOOM_OUT_TIP }, // Zoom out
|
|
|
|
{ WWT_TRNBTN, 1, 0x0064 + 30, 0x0081 + 30, 0, 27, 0x20000000 | SPR_TOOLBAR_ZOOM_IN, STR_ZOOM_IN_TIP }, // Zoom in
|
|
|
|
{ WWT_TRNBTN, 1, 0x0082 + 30, 0x009F + 30, 0, 27, 0x20000000 | SPR_TOOLBAR_ROTATE, STR_ROTATE_TIP }, // Rotate camera
|
|
|
|
{ WWT_TRNBTN, 1, 0x00A0 + 30, 0x00BD + 30, 0, 27, 0x20000000 | SPR_TOOLBAR_VIEW, STR_VIEW_OPTIONS_TIP }, // Transparancy menu
|
|
|
|
{ WWT_TRNBTN, 1, 0x00BE + 30, 0x00DB + 30, 0, 27, 0x20000000 | SPR_TOOLBAR_MAP, STR_SHOW_MAP_TIP }, // Map
|
|
|
|
|
|
|
|
{ WWT_TRNBTN, 2, 0x010B, 0x0128, 0, 27, 0x20000000 | SPR_TOOLBAR_LAND, STR_ADJUST_LAND_TIP }, // Land
|
|
|
|
{ WWT_TRNBTN, 2, 0x0129, 0x0146, 0, 27, 0x20000000 | SPR_TOOLBAR_WATER, STR_ADJUST_WATER_TIP }, // Water
|
|
|
|
{ WWT_TRNBTN, 2, 0x0147, 0x0164, 0, 27, 0x20000000 | SPR_TOOLBAR_SCENERY, STR_PLACE_SCENERY_TIP }, // Scenery
|
|
|
|
{ WWT_TRNBTN, 2, 0x0165, 0x0182, 0, 27, 0x20000000 | SPR_TOOLBAR_FOOTPATH, STR_BUILD_FOOTPATH_TIP }, // Path
|
|
|
|
{ WWT_TRNBTN, 2, 0x0183, 0x01A0, 0, 27, 0x20000000 | SPR_TOOLBAR_CONSTRUCT_RIDE, STR_BUILD_RIDE_TIP }, // Construct ride
|
|
|
|
{ WWT_TRNBTN, 3, 0x01EA, 0x0207, 0, 27, 0x20000000 | SPR_TOOLBAR_RIDES, STR_RIDES_IN_PARK_TIP }, // Rides
|
|
|
|
{ WWT_TRNBTN, 3, 0x0208, 0x0225, 0, 27, 0x20000000 | SPR_TOOLBAR_PARK, STR_PARK_INFORMATION_TIP }, // Park
|
|
|
|
{ WWT_TRNBTN, 3, 0x0226, 0x0243, 0, 27, 0x20000000 | 0x15F9, STR_STAFF_TIP }, // Staff
|
|
|
|
{ WWT_TRNBTN, 3, 0x0230, 0x024D, 0, 27, 0x20000000 | SPR_TOOLBAR_GUESTS, STR_GUESTS_TIP }, // Guests
|
|
|
|
{ WWT_TRNBTN, 2, 0x0230, 0x024D, 0, 27, 0x20000000 | SPR_TOOLBAR_CLEAR_SCENERY, STR_CLEAR_SCENERY_TIP }, // Clear scenery
|
|
|
|
|
2015-08-16 13:14:04 +02:00
|
|
|
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, STR_GAME_SPEED_TIP }, // Fast forward
|
|
|
|
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, STR_CHEATS_TIP }, // Cheats
|
2015-07-02 22:18:36 +02:00
|
|
|
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, STR_DEBUG_TIP }, // Debug
|
2015-08-16 13:14:04 +02:00
|
|
|
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, STR_SCENARIO_OPTIONS_FINANCIAL_TIP },// Finances
|
|
|
|
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, STR_FINANCES_RESEARCH_TIP }, // Research
|
2015-08-04 17:56:12 +02:00
|
|
|
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, STR_SHOW_RECENT_MESSAGES_TIP }, // News
|
2015-08-27 13:27:46 +02:00
|
|
|
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, STR_SHOW_MULTIPLAYER_STATUS_TIP }, // Network
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2015-02-06 12:57:51 +01:00
|
|
|
{ WWT_EMPTY, 0, 0, 10-1, 0, 0, 0xFFFFFFFF, STR_NONE }, // Artificial widget separator
|
2014-04-11 03:42:39 +02:00
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_top_toolbar_mouseup(rct_window *w, int widgetIndex);
|
2015-02-09 19:32:58 +01:00
|
|
|
static void window_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widget* widget);
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_top_toolbar_dropdown(rct_window *w, int widgetIndex, int dropdownIndex);
|
|
|
|
static void window_top_toolbar_tool_update(rct_window* w, int widgetIndex, int x, int y);
|
|
|
|
static void window_top_toolbar_tool_down(rct_window* w, int widgetIndex, int x, int y);
|
|
|
|
static void window_top_toolbar_tool_drag(rct_window* w, int widgetIndex, int x, int y);
|
|
|
|
static void window_top_toolbar_tool_up(rct_window* w, int widgetIndex, int x, int y);
|
|
|
|
static void window_top_toolbar_tool_abort(rct_window *w, int widgetIndex);
|
|
|
|
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 = {
|
|
|
|
NULL,
|
2015-02-09 19:32:58 +01:00
|
|
|
window_top_toolbar_mouseup,
|
2015-07-10 02:39:16 +02:00
|
|
|
NULL,
|
2015-02-09 19:32:58 +01:00
|
|
|
window_top_toolbar_mousedown,
|
|
|
|
window_top_toolbar_dropdown,
|
2015-07-10 02:39:16 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL, // check if editor versions are significantly different...
|
2015-02-09 19:32:58 +01:00
|
|
|
window_top_toolbar_tool_update, // editor: 0x0066fB0E
|
|
|
|
window_top_toolbar_tool_down, // editor: 0x0066fB5C
|
|
|
|
window_top_toolbar_tool_drag, // editor: 0x0066fB37
|
2015-06-26 17:40:37 +02:00
|
|
|
window_top_toolbar_tool_up, // editor: 0x0066fC44 (Exactly the same)
|
|
|
|
window_top_toolbar_tool_abort, // editor: 0x0066fA74 (Exactly the same)
|
2015-07-10 02:39:16 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2015-02-09 19:32:58 +01:00
|
|
|
window_top_toolbar_invalidate,
|
|
|
|
window_top_toolbar_paint,
|
2015-07-10 02:39:16 +02:00
|
|
|
NULL
|
2014-04-11 03:42:39 +02:00
|
|
|
};
|
|
|
|
|
2015-02-10 15:41:35 +01:00
|
|
|
void top_toolbar_init_view_menu(rct_window *window, rct_widget *widget);
|
|
|
|
void top_toolbar_view_menu_dropdown(short dropdownIndex);
|
2015-05-19 00:16:43 +02:00
|
|
|
void top_toolbar_init_fastforward_menu(rct_window *window, rct_widget *widget);
|
|
|
|
void top_toolbar_fastforward_menu_dropdown(short dropdownIndex);
|
2015-07-09 12:45:47 +02:00
|
|
|
void top_toolbar_init_rotate_menu(rct_window *window, rct_widget *widget);
|
|
|
|
void top_toolbar_rotate_menu_dropdown(short dropdownIndex);
|
2015-06-01 03:33:56 +02:00
|
|
|
void top_toolbar_init_debug_menu(rct_window *window, rct_widget *widget);
|
|
|
|
void top_toolbar_debug_menu_dropdown(short dropdownIndex);
|
2015-07-16 19:32:43 +02:00
|
|
|
void top_toolbar_init_network_menu(rct_window *window, rct_widget *widget);
|
|
|
|
void top_toolbar_network_menu_dropdown(short dropdownIndex);
|
2015-02-10 15:41:35 +01:00
|
|
|
|
|
|
|
void toggle_footpath_window();
|
|
|
|
void toggle_land_window(rct_window *topToolbar, int widgetIndex);
|
|
|
|
void toggle_clear_scenery_window(rct_window *topToolbar, int widgetIndex);
|
|
|
|
void toggle_water_window(rct_window *topToolbar, int widgetIndex);
|
|
|
|
|
2015-05-26 21:36:05 +02:00
|
|
|
money32 selection_lower_land(uint8 flags);
|
|
|
|
money32 selection_raise_land(uint8 flags);
|
|
|
|
|
2015-05-25 21:36:40 +02:00
|
|
|
static bool _menuDropdownIncludesTwitch;
|
|
|
|
|
2014-04-11 03:42:39 +02:00
|
|
|
/**
|
|
|
|
* Creates the main game top toolbar window.
|
|
|
|
* rct2: 0x0066B485 (part of 0x0066B3E8)
|
|
|
|
*/
|
2015-02-09 19:32:58 +01:00
|
|
|
void window_top_toolbar_open()
|
2014-04-11 03:42:39 +02:00
|
|
|
{
|
|
|
|
rct_window* window;
|
|
|
|
|
2014-04-24 21:26:05 +02:00
|
|
|
window = window_create(
|
|
|
|
0, 0,
|
2015-07-05 16:57:01 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16), 28,
|
2015-07-10 02:39:16 +02:00
|
|
|
&window_top_toolbar_events,
|
2014-04-24 21:26:05 +02:00
|
|
|
WC_TOP_TOOLBAR,
|
2015-10-03 16:48:25 +02:00
|
|
|
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND
|
2014-04-24 21:26:05 +02:00
|
|
|
);
|
2015-02-09 19:32:58 +01:00
|
|
|
window->widgets = window_top_toolbar_widgets;
|
2014-08-17 11:11:19 +02:00
|
|
|
|
2014-04-11 03:42:39 +02:00
|
|
|
window_init_scroll_widgets(window);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2014-04-11 03:42:39 +02:00
|
|
|
* rct2: 0x0066C957
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_top_toolbar_mouseup(rct_window *w, int widgetIndex)
|
2014-04-11 03:42:39 +02:00
|
|
|
{
|
2015-07-10 02:39:16 +02:00
|
|
|
rct_window *mainWindow;
|
2014-04-11 03:42:39 +02:00
|
|
|
|
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_PAUSE:
|
2015-11-08 15:32:22 +01:00
|
|
|
if (network_get_mode() != NETWORK_MODE_CLIENT) {
|
|
|
|
game_do_command(0, 1, 0, 0, GAME_COMMAND_TOGGLE_PAUSE, 0, 0);
|
|
|
|
}
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
|
|
|
case WIDX_ZOOM_OUT:
|
|
|
|
if ((mainWindow = window_get_main()) != NULL)
|
2014-04-26 16:50:01 +02:00
|
|
|
window_zoom_out(mainWindow);
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
|
|
|
case WIDX_ZOOM_IN:
|
|
|
|
if ((mainWindow = window_get_main()) != NULL)
|
2014-04-26 16:50:01 +02:00
|
|
|
window_zoom_in(mainWindow);
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
|
|
|
case WIDX_CLEAR_SCENERY:
|
2014-11-23 17:28:23 +01:00
|
|
|
toggle_clear_scenery_window(w, WIDX_CLEAR_SCENERY);
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
|
|
|
case WIDX_LAND:
|
2014-11-23 17:28:23 +01:00
|
|
|
toggle_land_window(w, WIDX_LAND);
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
|
|
|
case WIDX_WATER:
|
2014-11-23 17:28:23 +01:00
|
|
|
toggle_water_window(w, WIDX_WATER);
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
|
|
|
case WIDX_SCENERY:
|
2014-05-09 22:44:55 +02:00
|
|
|
if (!tool_set(w, WIDX_SCENERY, 0)) {
|
2014-10-15 23:59:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
|
2014-08-28 18:51:24 +02:00
|
|
|
window_scenery_open();
|
2014-05-09 22:44:55 +02:00
|
|
|
}
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
|
|
|
case WIDX_PATH:
|
2014-11-23 17:28:23 +01:00
|
|
|
toggle_footpath_window();
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
|
|
|
case WIDX_CONSTRUCT_RIDE:
|
2014-08-18 00:57:41 +02:00
|
|
|
window_new_ride_open();
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
|
|
|
case WIDX_RIDES:
|
2014-04-19 04:16:20 +02:00
|
|
|
window_ride_list_open();
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
|
|
|
case WIDX_PARK:
|
2014-04-17 04:19:30 +02:00
|
|
|
window_park_entrance_open();
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
|
|
|
case WIDX_STAFF:
|
2014-10-07 20:39:52 +02:00
|
|
|
window_staff_list_open();
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
|
|
|
case WIDX_GUESTS:
|
2014-05-05 04:27:17 +02:00
|
|
|
window_guest_list_open();
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
2015-01-01 05:28:50 +01:00
|
|
|
case WIDX_FINANCES:
|
|
|
|
window_finances_open();
|
|
|
|
break;
|
2014-08-15 23:05:35 +02:00
|
|
|
case WIDX_RESEARCH:
|
|
|
|
window_research_open();
|
|
|
|
break;
|
2015-07-22 19:13:35 +02:00
|
|
|
case WIDX_NEWS:
|
|
|
|
window_news_open();
|
|
|
|
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
|
|
|
|
*/
|
2015-02-09 19:32:58 +01:00
|
|
|
static void window_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widget* widget)
|
2014-04-11 03:42:39 +02:00
|
|
|
{
|
2015-02-09 19:32:58 +01:00
|
|
|
int numItems;
|
|
|
|
|
2014-10-12 16:48:21 +02:00
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_FILE_MENU:
|
2015-05-25 21:36:40 +02:00
|
|
|
_menuDropdownIncludesTwitch = false;
|
2015-02-09 19:32:58 +01:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) {
|
|
|
|
gDropdownItemsFormat[0] = STR_ABOUT;
|
|
|
|
gDropdownItemsFormat[1] = STR_OPTIONS;
|
|
|
|
gDropdownItemsFormat[2] = STR_SCREENSHOT;
|
2015-06-02 15:12:36 +02:00
|
|
|
gDropdownItemsFormat[3] = STR_GIANT_SCREENSHOT;
|
|
|
|
gDropdownItemsFormat[4] = 0;
|
|
|
|
gDropdownItemsFormat[5] = STR_QUIT_TRACK_DESIGNS_MANAGER;
|
|
|
|
gDropdownItemsFormat[6] = STR_EXIT_OPENRCT2;
|
2015-02-09 19:32:58 +01:00
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER)
|
2015-06-07 14:51:27 +02:00
|
|
|
gDropdownItemsFormat[5] = STR_QUIT_ROLLERCOASTER_DESIGNER;
|
2015-02-09 19:32:58 +01:00
|
|
|
|
2015-06-07 14:51:27 +02:00
|
|
|
numItems = 7;
|
2015-02-09 19:32:58 +01:00
|
|
|
} else if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) {
|
|
|
|
gDropdownItemsFormat[0] = STR_LOAD_LANDSCAPE;
|
|
|
|
gDropdownItemsFormat[1] = STR_SAVE_LANDSCAPE;
|
|
|
|
gDropdownItemsFormat[2] = 0;
|
|
|
|
gDropdownItemsFormat[3] = STR_ABOUT;
|
|
|
|
gDropdownItemsFormat[4] = STR_OPTIONS;
|
|
|
|
gDropdownItemsFormat[5] = STR_SCREENSHOT;
|
2015-06-02 15:12:36 +02:00
|
|
|
gDropdownItemsFormat[6] = STR_GIANT_SCREENSHOT;
|
|
|
|
gDropdownItemsFormat[7] = 0;
|
|
|
|
gDropdownItemsFormat[8] = STR_QUIT_SCENARIO_EDITOR;
|
|
|
|
gDropdownItemsFormat[9] = STR_EXIT_OPENRCT2;
|
|
|
|
numItems = 10;
|
2015-02-09 19:32:58 +01:00
|
|
|
} else {
|
2015-08-20 12:13:08 +02:00
|
|
|
gDropdownItemsFormat[0] = STR_LOAD_GAME;
|
|
|
|
gDropdownItemsFormat[1] = STR_SAVE_GAME;
|
|
|
|
gDropdownItemsFormat[2] = STR_SAVE_GAME_AS;
|
2015-08-19 21:54:25 +02:00
|
|
|
gDropdownItemsFormat[3] = 0;
|
|
|
|
gDropdownItemsFormat[4] = STR_ABOUT;
|
|
|
|
gDropdownItemsFormat[5] = STR_OPTIONS;
|
|
|
|
gDropdownItemsFormat[6] = STR_SCREENSHOT;
|
|
|
|
gDropdownItemsFormat[7] = STR_GIANT_SCREENSHOT;
|
|
|
|
gDropdownItemsFormat[8] = 0;
|
|
|
|
gDropdownItemsFormat[9] = STR_QUIT_TO_MENU;
|
|
|
|
gDropdownItemsFormat[10] = STR_EXIT_OPENRCT2;
|
|
|
|
numItems = 11;
|
2015-05-25 21:36:40 +02:00
|
|
|
|
|
|
|
#ifndef DISABLE_TWITCH
|
|
|
|
if (gConfigTwitch.channel != NULL && gConfigTwitch.channel[0] != 0) {
|
|
|
|
_menuDropdownIncludesTwitch = true;
|
2015-08-19 21:54:25 +02:00
|
|
|
gDropdownItemsFormat[11] = 0;
|
|
|
|
gDropdownItemsFormat[12] = 1156;
|
|
|
|
gDropdownItemsArgs[12] = STR_TWITCH_ENABLE;
|
|
|
|
numItems = 13;
|
2015-05-25 21:36:40 +02:00
|
|
|
}
|
|
|
|
#endif
|
2015-02-09 19:32:58 +01:00
|
|
|
}
|
2014-04-11 03:42:39 +02:00
|
|
|
window_dropdown_show_text(
|
|
|
|
w->x + widget->left,
|
|
|
|
w->y + widget->top,
|
|
|
|
widget->bottom - widget->top + 1,
|
|
|
|
w->colours[0] | 0x80,
|
2015-05-07 20:31:11 +02:00
|
|
|
DROPDOWN_FLAG_STAY_OPEN,
|
2015-02-09 19:32:58 +01:00
|
|
|
numItems
|
2014-04-11 03:42:39 +02:00
|
|
|
);
|
2015-05-25 21:36:40 +02:00
|
|
|
|
2015-05-28 12:52:40 +02:00
|
|
|
#ifndef DISABLE_TWITCH
|
2015-10-14 21:54:02 +02:00
|
|
|
if (_menuDropdownIncludesTwitch && gTwitchEnable) {
|
|
|
|
dropdown_set_checked(11, true);
|
|
|
|
}
|
2015-05-28 12:52:40 +02:00
|
|
|
#endif
|
2014-10-12 16:48:21 +02:00
|
|
|
break;
|
2015-06-26 23:40:09 +02:00
|
|
|
case WIDX_CHEATS:
|
|
|
|
gDropdownItemsFormat[0] = 1156;
|
|
|
|
gDropdownItemsFormat[1] = 0;
|
|
|
|
gDropdownItemsFormat[2] = 1156;
|
|
|
|
gDropdownItemsFormat[3] = 1156;
|
2015-07-02 20:25:04 +02:00
|
|
|
gDropdownItemsFormat[4] = 1156;
|
2015-06-26 23:40:09 +02:00
|
|
|
gDropdownItemsArgs[0] = 5217;
|
2015-07-02 20:25:04 +02:00
|
|
|
gDropdownItemsArgs[2] = STR_ENABLE_SANDBOX_MODE;
|
|
|
|
gDropdownItemsArgs[3] = STR_DISABLE_CLEARANCE_CHECKS;
|
|
|
|
gDropdownItemsArgs[4] = STR_DISABLE_SUPPORT_LIMITS;
|
2015-06-26 23:40:09 +02:00
|
|
|
window_dropdown_show_text(
|
|
|
|
w->x + widget->left,
|
|
|
|
w->y + widget->top,
|
|
|
|
widget->bottom - widget->top + 1,
|
|
|
|
w->colours[0] | 0x80,
|
|
|
|
0,
|
2015-09-18 11:55:52 +02:00
|
|
|
5
|
2015-06-26 23:40:09 +02:00
|
|
|
);
|
2015-10-14 21:54:02 +02:00
|
|
|
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);
|
|
|
|
}
|
2015-06-26 23:40:09 +02:00
|
|
|
RCT2_GLOBAL(0x009DEBA2, uint16) = 0;
|
|
|
|
break;
|
2014-10-12 16:48:21 +02:00
|
|
|
case WIDX_VIEW_MENU:
|
2014-11-23 17:28:23 +01:00
|
|
|
top_toolbar_init_view_menu(w, widget);
|
2014-10-12 16:48:21 +02:00
|
|
|
break;
|
|
|
|
case WIDX_MAP:
|
|
|
|
gDropdownItemsFormat[0] = 2523;
|
|
|
|
gDropdownItemsFormat[1] = 2780;
|
2015-02-09 19:32:58 +01:00
|
|
|
numItems = 2;
|
|
|
|
|
|
|
|
if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && g_editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) {
|
|
|
|
gDropdownItemsFormat[2] = 2690;
|
|
|
|
numItems++;
|
|
|
|
}
|
|
|
|
|
2014-10-12 16:48:21 +02:00
|
|
|
window_dropdown_show_text(
|
|
|
|
w->x + widget->left,
|
|
|
|
w->y + widget->top,
|
|
|
|
widget->bottom - widget->top + 1,
|
|
|
|
w->colours[1] | 0x80,
|
|
|
|
0,
|
2015-02-09 19:32:58 +01:00
|
|
|
numItems
|
2015-06-26 23:40:09 +02:00
|
|
|
);
|
2015-02-09 19:32:58 +01:00
|
|
|
RCT2_GLOBAL(0x009DEBA2, uint16) = 0;
|
2014-10-12 16:48:21 +02:00
|
|
|
break;
|
2015-05-19 00:16:43 +02:00
|
|
|
case WIDX_FASTFORWARD:
|
|
|
|
top_toolbar_init_fastforward_menu(w, widget);
|
|
|
|
break;
|
2015-07-09 12:45:47 +02:00
|
|
|
case WIDX_ROTATE:
|
|
|
|
top_toolbar_init_rotate_menu(w, widget);
|
|
|
|
break;
|
2015-06-01 03:33:56 +02:00
|
|
|
case WIDX_DEBUG:
|
|
|
|
top_toolbar_init_debug_menu(w, widget);
|
|
|
|
break;
|
2015-07-16 19:32:43 +02:00
|
|
|
case WIDX_NETWORK:
|
|
|
|
top_toolbar_init_network_menu(w, widget);
|
|
|
|
break;
|
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
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_top_toolbar_dropdown(rct_window *w, int widgetIndex, int dropdownIndex)
|
2014-04-11 03:42:39 +02:00
|
|
|
{
|
2014-10-12 16:48:21 +02:00
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_FILE_MENU:
|
2015-08-20 12:13:08 +02:00
|
|
|
|
|
|
|
// Quicksave is only available in the normal game. Skip one position to avoid incorrect mappings in the menus of the other modes.
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR) && dropdownIndex > DDIDX_LOAD_GAME)
|
|
|
|
dropdownIndex += 1;
|
|
|
|
|
|
|
|
// Track designer and track designs manager start with About, not Load/save
|
2015-02-09 19:32:58 +01:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))
|
|
|
|
dropdownIndex += DDIDX_ABOUT;
|
|
|
|
|
2014-04-11 03:42:39 +02:00
|
|
|
switch (dropdownIndex) {
|
2015-02-09 19:32:58 +01:00
|
|
|
case DDIDX_LOAD_GAME:
|
2014-08-06 21:06:51 +02:00
|
|
|
game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
2015-08-20 12:13:08 +02:00
|
|
|
case DDIDX_SAVE_GAME:
|
|
|
|
tool_cancel();
|
|
|
|
save_game();
|
|
|
|
break;
|
2015-08-19 21:54:25 +02:00
|
|
|
case DDIDX_SAVE_GAME_AS:
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) {
|
|
|
|
rct_s6_info *s6Info = (rct_s6_info*)0x0141F570;
|
|
|
|
window_loadsave_open(LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE, s6Info->name);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
tool_cancel();
|
|
|
|
save_game_as();
|
|
|
|
}
|
|
|
|
break;
|
2015-02-09 19:32:58 +01:00
|
|
|
case DDIDX_ABOUT:
|
2014-04-28 03:35:37 +02:00
|
|
|
window_about_open();
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
2015-02-09 19:32:58 +01:00
|
|
|
case DDIDX_OPTIONS:
|
2014-05-11 17:24:52 +02:00
|
|
|
window_options_open();
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
2015-02-09 19:32:58 +01:00
|
|
|
case DDIDX_SCREENSHOT:
|
2014-04-28 22:00:54 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, sint8) = 10;
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
2015-06-02 15:12:36 +02:00
|
|
|
case DDIDX_GIANT_SCREENSHOT:
|
|
|
|
screenshot_giant();
|
|
|
|
break;
|
2015-05-23 02:21:05 +02:00
|
|
|
case DDIDX_QUIT_TO_MENU:
|
2015-02-09 19:32:58 +01:00
|
|
|
window_close_by_class(WC_MANAGE_TRACK_DESIGN);
|
|
|
|
window_close_by_class(WC_TRACK_DELETE_PROMPT);
|
2014-08-06 21:06:51 +02:00
|
|
|
game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 1, 0);
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
2015-05-23 02:21:05 +02:00
|
|
|
case DDIDX_EXIT_OPENRCT2:
|
|
|
|
rct2_quit();
|
|
|
|
break;
|
2015-05-28 12:52:40 +02:00
|
|
|
#ifndef DISABLE_TWITCH
|
2015-05-25 21:36:40 +02:00
|
|
|
case DDIDX_ENABLE_TWITCH:
|
|
|
|
gTwitchEnable = !gTwitchEnable;
|
|
|
|
break;
|
2015-05-28 12:52:40 +02:00
|
|
|
#endif
|
2014-04-11 03:42:39 +02:00
|
|
|
}
|
2014-10-14 04:38:46 +02:00
|
|
|
break;
|
2015-06-26 23:40:09 +02:00
|
|
|
case WIDX_CHEATS:
|
|
|
|
if (dropdownIndex == -1) dropdownIndex = RCT2_GLOBAL(0x009DEBA2, uint16);
|
|
|
|
switch (dropdownIndex) {
|
|
|
|
case DDIDX_CHEATS:
|
|
|
|
window_cheats_open();
|
|
|
|
break;
|
2015-07-02 20:25:04 +02:00
|
|
|
case DDIDX_ENABLE_SANDBOX_MODE:
|
|
|
|
gCheatsSandboxMode = !gCheatsSandboxMode;
|
|
|
|
break;
|
2015-06-26 23:40:09 +02:00
|
|
|
case DDIDX_DISABLE_CLEARANCE_CHECKS:
|
|
|
|
gCheatsDisableClearanceChecks = !gCheatsDisableClearanceChecks;
|
|
|
|
break;
|
|
|
|
case DDIDX_DISABLE_SUPPORT_LIMITS:
|
|
|
|
gCheatsDisableSupportLimits = !gCheatsDisableSupportLimits;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2014-10-12 16:48:21 +02:00
|
|
|
case WIDX_VIEW_MENU:
|
2014-11-23 17:28:23 +01:00
|
|
|
top_toolbar_view_menu_dropdown(dropdownIndex);
|
2014-10-14 04:38:46 +02:00
|
|
|
break;
|
2014-10-12 16:48:21 +02:00
|
|
|
case WIDX_MAP:
|
|
|
|
if (dropdownIndex == -1)
|
2015-02-09 19:32:58 +01:00
|
|
|
dropdownIndex = RCT2_GLOBAL(0x009DEBA2, uint16);
|
|
|
|
|
2014-10-12 16:48:21 +02:00
|
|
|
switch (dropdownIndex) {
|
|
|
|
case 0:
|
|
|
|
window_map_open();
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
window_viewport_open();
|
|
|
|
break;
|
2015-02-09 19:32:58 +01:00
|
|
|
case 2:
|
|
|
|
window_mapgen_open();
|
|
|
|
break;
|
2014-10-12 16:48:21 +02:00
|
|
|
}
|
|
|
|
break;
|
2015-05-19 00:16:43 +02:00
|
|
|
case WIDX_FASTFORWARD:
|
|
|
|
top_toolbar_fastforward_menu_dropdown(dropdownIndex);
|
|
|
|
break;
|
2015-07-09 12:45:47 +02:00
|
|
|
case WIDX_ROTATE:
|
|
|
|
top_toolbar_rotate_menu_dropdown(dropdownIndex);
|
|
|
|
break;
|
2015-06-01 03:33:56 +02:00
|
|
|
case WIDX_DEBUG:
|
|
|
|
top_toolbar_debug_menu_dropdown(dropdownIndex);
|
|
|
|
break;
|
2015-07-16 19:32:43 +02:00
|
|
|
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
|
|
|
{
|
2015-02-10 15:41:35 +01:00
|
|
|
int i, x, enabledWidgets, widgetIndex, widgetWidth, firstAlignment;
|
2015-02-09 19:32:58 +01:00
|
|
|
rct_widget *widget;
|
2014-04-11 03:42:39 +02:00
|
|
|
|
2015-05-29 18:04:53 +02:00
|
|
|
colour_scheme_update(w);
|
2015-05-21 12:28:51 +02:00
|
|
|
|
2015-02-09 19:32:58 +01:00
|
|
|
// 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_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;
|
2015-05-19 00:16:43 +02:00
|
|
|
window_top_toolbar_widgets[WIDX_FASTFORWARD].type = WWT_TRNBTN;
|
|
|
|
window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_TRNBTN;
|
2015-06-13 19:58:58 +02:00
|
|
|
window_top_toolbar_widgets[WIDX_DEBUG].type = gConfigGeneral.debugging_tools ? WWT_TRNBTN : WWT_EMPTY;
|
2015-07-22 19:13:35 +02:00
|
|
|
window_top_toolbar_widgets[WIDX_NEWS].type = WWT_TRNBTN;
|
2015-07-16 19:32:43 +02:00
|
|
|
window_top_toolbar_widgets[WIDX_NETWORK].type = WWT_TRNBTN;
|
2015-02-09 19:32:58 +01:00
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (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;
|
2015-05-19 00:16:43 +02:00
|
|
|
window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_EMPTY;
|
2015-07-22 19:13:35 +02:00
|
|
|
window_top_toolbar_widgets[WIDX_NEWS].type = WWT_EMPTY;
|
2015-08-28 23:27:31 +02:00
|
|
|
window_top_toolbar_widgets[WIDX_NETWORK].type = WWT_EMPTY;
|
2015-02-09 19:32:58 +01:00
|
|
|
|
|
|
|
if (g_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;
|
|
|
|
}
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2015-02-09 19:32:58 +01:00
|
|
|
if (g_editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) {
|
|
|
|
window_top_toolbar_widgets[WIDX_CONSTRUCT_RIDE].type = WWT_EMPTY;
|
2015-05-19 00:16:43 +02:00
|
|
|
window_top_toolbar_widgets[WIDX_FASTFORWARD].type = WWT_EMPTY;
|
2015-02-09 19:32:58 +01:00
|
|
|
}
|
2015-02-05 22:22:35 +01:00
|
|
|
|
2015-02-09 19:32:58 +01:00
|
|
|
if (g_editor_step != EDITOR_STEP_LANDSCAPE_EDITOR && g_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 {
|
2015-03-07 17:38:17 +01:00
|
|
|
if ((RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY) || !gConfigInterface.toolbar_show_finances)
|
2015-02-09 19:32:58 +01:00
|
|
|
window_top_toolbar_widgets[WIDX_FINANCES].type = WWT_EMPTY;
|
2015-03-07 17:38:17 +01:00
|
|
|
|
|
|
|
if (!gConfigInterface.toolbar_show_research)
|
|
|
|
window_top_toolbar_widgets[WIDX_RESEARCH].type = WWT_EMPTY;
|
2015-05-19 00:16:43 +02:00
|
|
|
|
|
|
|
if (!gConfigInterface.toolbar_show_cheats)
|
|
|
|
window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_EMPTY;
|
2015-07-22 19:13:35 +02:00
|
|
|
|
|
|
|
if (!gConfigInterface.toolbar_show_news)
|
|
|
|
window_top_toolbar_widgets[WIDX_NEWS].type = WWT_EMPTY;
|
2015-08-16 13:14:04 +02:00
|
|
|
|
2015-08-16 18:29:47 +02:00
|
|
|
switch (network_get_mode()) {
|
|
|
|
case NETWORK_MODE_SERVER:
|
|
|
|
window_top_toolbar_widgets[WIDX_FASTFORWARD].type = WWT_EMPTY;
|
|
|
|
break;
|
|
|
|
case NETWORK_MODE_CLIENT:
|
|
|
|
window_top_toolbar_widgets[WIDX_PAUSE].type = WWT_EMPTY;
|
|
|
|
window_top_toolbar_widgets[WIDX_FASTFORWARD].type = WWT_EMPTY;
|
|
|
|
break;
|
|
|
|
default:
|
2015-08-16 13:14:04 +02:00
|
|
|
window_top_toolbar_widgets[WIDX_NETWORK].type = WWT_EMPTY;
|
2015-08-16 18:29:47 +02:00
|
|
|
}
|
2015-02-05 22:22:35 +01:00
|
|
|
}
|
|
|
|
|
2015-02-09 19:32:58 +01:00
|
|
|
enabledWidgets = 0;
|
2015-07-16 19:32:43 +02:00
|
|
|
for (i = WIDX_PAUSE; i <= WIDX_NETWORK; i++)
|
2015-02-09 19:32:58 +01:00
|
|
|
if (window_top_toolbar_widgets[i].type != WWT_EMPTY)
|
|
|
|
enabledWidgets |= (1 << i);
|
|
|
|
w->enabled_widgets = enabledWidgets;
|
2015-02-05 22:22:35 +01:00
|
|
|
|
2015-02-09 19:32:58 +01:00
|
|
|
// Align left hand side toolbar buttons
|
2015-02-10 15:41:35 +01:00
|
|
|
firstAlignment = 1;
|
2015-02-09 19:32:58 +01:00
|
|
|
x = 0;
|
2015-02-05 22:22:35 +01:00
|
|
|
for (int i = 0; i < countof(left_aligned_widgets_order); ++i) {
|
2015-02-09 19:32:58 +01:00
|
|
|
widgetIndex = left_aligned_widgets_order[i];
|
|
|
|
widget = &window_top_toolbar_widgets[widgetIndex];
|
|
|
|
if (widget->type == WWT_EMPTY && widgetIndex != WIDX_SEPARATOR)
|
|
|
|
continue;
|
|
|
|
|
2015-02-10 15:41:35 +01:00
|
|
|
if (firstAlignment && widgetIndex == WIDX_SEPARATOR)
|
|
|
|
continue;
|
|
|
|
|
2015-02-09 19:32:58 +01:00
|
|
|
widgetWidth = widget->right - widget->left;
|
|
|
|
widget->left = x;
|
|
|
|
x += widgetWidth;
|
|
|
|
widget->right = x;
|
2015-02-05 22:22:35 +01:00
|
|
|
x += 1;
|
2015-02-10 15:41:35 +01:00
|
|
|
firstAlignment = 0;
|
2015-02-05 22:22:35 +01:00
|
|
|
}
|
2014-04-11 03:42:39 +02:00
|
|
|
|
2015-02-09 19:32:58 +01:00
|
|
|
// Align right hand side toolbar buttons
|
2015-02-10 15:41:35 +01:00
|
|
|
firstAlignment = 1;
|
2015-07-05 16:57:01 +02:00
|
|
|
x = max(640, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16));
|
2015-02-09 19:32:58 +01:00
|
|
|
for (int i = 0; i < countof(right_aligned_widgets_order); ++i) {
|
|
|
|
widgetIndex = right_aligned_widgets_order[i];
|
|
|
|
widget = &window_top_toolbar_widgets[widgetIndex];
|
|
|
|
if (widget->type == WWT_EMPTY && widgetIndex != WIDX_SEPARATOR)
|
|
|
|
continue;
|
|
|
|
|
2015-02-10 15:41:35 +01:00
|
|
|
if (firstAlignment && widgetIndex == WIDX_SEPARATOR)
|
|
|
|
continue;
|
|
|
|
|
2015-02-09 19:32:58 +01:00
|
|
|
widgetWidth = widget->right - widget->left;
|
|
|
|
x -= 1;
|
|
|
|
widget->right = x;
|
|
|
|
x -= widgetWidth;
|
|
|
|
widget->left = x;
|
2015-02-10 15:41:35 +01:00
|
|
|
firstAlignment = 0;
|
2015-02-09 19:32:58 +01:00
|
|
|
}
|
|
|
|
|
2014-04-11 03:42:39 +02:00
|
|
|
// Footpath button pressed down
|
2014-10-16 03:02:43 +02:00
|
|
|
if (window_find_by_class(WC_FOOTPATH) == NULL)
|
2014-04-11 03:42:39 +02:00
|
|
|
w->pressed_widgets &= ~(1 << WIDX_PATH);
|
|
|
|
else
|
|
|
|
w->pressed_widgets |= (1 << WIDX_PATH);
|
|
|
|
|
2015-02-07 18:40:20 +01:00
|
|
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint32) & 1))
|
2014-12-01 18:04:47 +01:00
|
|
|
w->pressed_widgets &= ~(1 << WIDX_PAUSE);
|
|
|
|
else
|
|
|
|
w->pressed_widgets |= (1 << WIDX_PAUSE);
|
|
|
|
|
2014-08-17 11:11:19 +02:00
|
|
|
// Zoomed out/in disable. Not sure where this code is in the original.
|
|
|
|
if (window_get_main()->viewport->zoom == 0){
|
|
|
|
w->disabled_widgets |= (1 << WIDX_ZOOM_IN);
|
2015-02-09 19:32:58 +01:00
|
|
|
} else if (window_get_main()->viewport->zoom == 3){
|
2014-08-17 11:11:19 +02:00
|
|
|
w->disabled_widgets |= (1 << WIDX_ZOOM_OUT);
|
2015-02-09 19:32:58 +01:00
|
|
|
} else {
|
2014-08-17 11:11:19 +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
|
|
|
{
|
|
|
|
int x, y, imgId;
|
|
|
|
|
|
|
|
window_draw_widgets(w, dpi);
|
|
|
|
|
|
|
|
// Draw staff button image (setting masks to the staff colours)
|
2015-02-09 19:32:58 +01:00
|
|
|
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 = 5627;
|
|
|
|
if (widget_is_pressed(w, WIDX_STAFF))
|
|
|
|
imgId++;
|
|
|
|
imgId |= (RCT2_GLOBAL(RCT2_ADDRESS_HANDYMAN_COLOUR, uint8) << 19) | 0xA0000000 | (RCT2_GLOBAL(RCT2_ADDRESS_MECHANIC_COLOUR, uint8) << 24);
|
|
|
|
gfx_draw_sprite(dpi, imgId, x, y, 0);
|
|
|
|
}
|
2014-08-15 23:05:35 +02:00
|
|
|
|
2015-05-19 00:16:43 +02:00
|
|
|
// 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++;
|
2015-05-19 17:51:59 +02:00
|
|
|
imgId = SPR_G2_FASTFORWARD;
|
|
|
|
gfx_draw_sprite(dpi, imgId, x + 6, y + 3, 0);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < gGameSpeed && gGameSpeed <= 4; i++) {
|
|
|
|
gfx_draw_sprite(dpi, SPR_G2_SPEED_ARROW, x + 5 + i * 5, y + 15, 0);
|
|
|
|
}
|
2015-05-20 17:52:40 +02:00
|
|
|
for (int 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);
|
2015-05-19 17:51:59 +02:00
|
|
|
}
|
2015-05-19 00:16:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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++;
|
2015-07-02 22:18:36 +02:00
|
|
|
imgId = SPR_G2_SANDBOX;
|
2015-05-19 00:16:43 +02:00
|
|
|
gfx_draw_sprite(dpi, imgId, x, y, 3);
|
|
|
|
}
|
|
|
|
|
2015-06-01 03:33:56 +02:00
|
|
|
// 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 = 5201;
|
|
|
|
gfx_draw_sprite(dpi, imgId, x, y, 3);
|
|
|
|
}
|
|
|
|
|
2014-08-15 23:05:35 +02:00
|
|
|
// Draw research button
|
2015-02-09 19:32:58 +01:00
|
|
|
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;
|
2015-05-19 00:16:43 +02:00
|
|
|
if (widget_is_pressed(w, WIDX_RESEARCH))
|
|
|
|
y++;
|
2015-02-09 19:32:58 +01:00
|
|
|
imgId = SPR_TAB_FINANCES_RESEARCH_0;
|
|
|
|
gfx_draw_sprite(dpi, imgId, x, y, 0);
|
|
|
|
}
|
2015-01-01 05:28:50 +01:00
|
|
|
|
|
|
|
// Draw finances button
|
2015-02-09 19:32:58 +01:00
|
|
|
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;
|
2015-05-19 00:16:43 +02:00
|
|
|
if (widget_is_pressed(w, WIDX_FINANCES))
|
|
|
|
y++;
|
2015-01-12 19:57:03 +01:00
|
|
|
imgId = SPR_FINANCE;
|
|
|
|
gfx_draw_sprite(dpi, imgId, x, y, 0);
|
|
|
|
}
|
2015-07-22 19:13:35 +02:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
}
|
2015-08-16 13:14:04 +02:00
|
|
|
|
|
|
|
// 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-04-15 21:52:19 +02:00
|
|
|
/* rct2: 0x006E3158 */
|
|
|
|
static void repaint_scenery_tool_down(sint16 x, sint16 y, sint16 widgetIndex){
|
|
|
|
// ax, cx, bl
|
2015-05-27 19:05:57 +02:00
|
|
|
sint16 grid_x, grid_y;
|
|
|
|
int type;
|
2015-04-15 21:52:19 +02:00
|
|
|
// edx
|
|
|
|
rct_map_element* map_element;
|
2015-04-16 20:37:51 +02:00
|
|
|
uint16 flags =
|
2015-05-05 20:11:35 +02:00
|
|
|
VIEWPORT_INTERACTION_MASK_SCENERY &
|
|
|
|
VIEWPORT_INTERACTION_MASK_WALL &
|
|
|
|
VIEWPORT_INTERACTION_MASK_LARGE_SCENERY &
|
|
|
|
VIEWPORT_INTERACTION_MASK_BANNER;
|
2015-04-16 20:37:51 +02:00
|
|
|
// This is -2 as banner is 12 but flags are offset different
|
|
|
|
|
2015-04-15 21:52:19 +02:00
|
|
|
// not used
|
|
|
|
rct_viewport* viewport;
|
2015-04-16 20:37:51 +02:00
|
|
|
get_map_coordinates_from_pos(x, y, flags, &grid_x, &grid_y, &type, &map_element, &viewport);
|
|
|
|
|
|
|
|
switch (type){
|
|
|
|
case VIEWPORT_INTERACTION_ITEM_SCENERY:
|
|
|
|
{
|
|
|
|
rct_scenery_entry* scenery_entry = g_smallSceneryEntries[map_element->properties.scenery.type];
|
2015-04-15 21:52:19 +02:00
|
|
|
|
2015-04-16 20:37:51 +02:00
|
|
|
// If can't repaint
|
|
|
|
if (!(scenery_entry->small_scenery.flags &
|
|
|
|
(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR |
|
|
|
|
SMALL_SCENERY_FLAG10)))
|
|
|
|
return;
|
|
|
|
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_REPAINT_THIS;
|
2015-04-16 20:37:51 +02:00
|
|
|
game_do_command(
|
|
|
|
grid_x,
|
|
|
|
1 | (map_element->type << 8),
|
|
|
|
grid_y,
|
|
|
|
map_element->base_height | (map_element->properties.scenery.type << 8),
|
2015-06-29 18:36:07 +02:00
|
|
|
GAME_COMMAND_SET_SCENERY_COLOUR,
|
2015-04-16 20:37:51 +02:00
|
|
|
0,
|
|
|
|
window_scenery_primary_colour | (window_scenery_secondary_colour << 8));
|
2015-04-23 22:09:01 +02:00
|
|
|
break;
|
2015-04-16 20:37:51 +02:00
|
|
|
}
|
|
|
|
case VIEWPORT_INTERACTION_ITEM_WALL:
|
|
|
|
{
|
|
|
|
rct_scenery_entry* scenery_entry = g_wallSceneryEntries[map_element->properties.fence.type];
|
|
|
|
|
|
|
|
// If can't repaint
|
|
|
|
if (!(scenery_entry->wall.flags &
|
|
|
|
(WALL_SCENERY_FLAG1 |
|
|
|
|
WALL_SCENERY_FLAG2)))
|
|
|
|
return;
|
|
|
|
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_REPAINT_THIS;
|
2015-04-16 20:37:51 +02:00
|
|
|
game_do_command(
|
|
|
|
grid_x,
|
|
|
|
1 | (window_scenery_primary_colour << 8),
|
|
|
|
grid_y,
|
|
|
|
(map_element->type & MAP_ELEMENT_DIRECTION_MASK) | (map_element->base_height << 8),
|
2015-06-29 18:36:07 +02:00
|
|
|
GAME_COMMAND_SET_FENCE_COLOUR,
|
2015-04-16 20:37:51 +02:00
|
|
|
0,
|
|
|
|
window_scenery_secondary_colour | (window_scenery_tertiary_colour << 8));
|
2015-04-23 22:09:01 +02:00
|
|
|
break;
|
2015-04-16 20:37:51 +02:00
|
|
|
}
|
|
|
|
case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY:
|
|
|
|
{
|
|
|
|
rct_scenery_entry* scenery_entry = g_largeSceneryEntries[map_element->properties.scenerymultiple.type & MAP_ELEMENT_LARGE_TYPE_MASK];
|
|
|
|
|
|
|
|
// If can't repaint
|
|
|
|
if (!(scenery_entry->large_scenery.flags &
|
|
|
|
(1 << 0)))
|
|
|
|
return;
|
|
|
|
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_REPAINT_THIS;
|
2015-04-16 20:37:51 +02:00
|
|
|
game_do_command(
|
|
|
|
grid_x,
|
|
|
|
1 | ((map_element->type & MAP_ELEMENT_DIRECTION_MASK) << 8),
|
|
|
|
grid_y,
|
|
|
|
map_element->base_height | ((map_element->properties.scenerymultiple.type >> 10) << 8),
|
2015-06-29 18:36:07 +02:00
|
|
|
GAME_COMMAND_SET_LARGE_SCENERY_COLOUR,
|
2015-04-16 20:37:51 +02:00
|
|
|
0,
|
|
|
|
window_scenery_primary_colour | (window_scenery_secondary_colour << 8));
|
2015-04-23 22:09:01 +02:00
|
|
|
break;
|
2015-04-16 20:37:51 +02:00
|
|
|
}
|
|
|
|
case VIEWPORT_INTERACTION_ITEM_BANNER:
|
|
|
|
{
|
|
|
|
rct_banner* banner = &gBanners[map_element->properties.banner.index];
|
|
|
|
rct_scenery_entry* scenery_entry = g_bannerSceneryEntries[banner->type];
|
|
|
|
|
|
|
|
// If can't repaint
|
|
|
|
if (!(scenery_entry->banner.flags &
|
|
|
|
(1 << 0)))
|
|
|
|
return;
|
|
|
|
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_REPAINT_THIS;
|
2015-04-16 20:37:51 +02:00
|
|
|
game_do_command(
|
|
|
|
grid_x,
|
|
|
|
1,
|
|
|
|
grid_y,
|
|
|
|
map_element->base_height | ((map_element->properties.banner.position & 0x3) << 8),
|
2015-06-29 18:36:07 +02:00
|
|
|
GAME_COMMAND_SET_BANNER_COLOUR,
|
2015-04-16 20:37:51 +02:00
|
|
|
0,
|
|
|
|
window_scenery_primary_colour | (window_scenery_secondary_colour << 8));
|
2015-04-23 22:09:01 +02:00
|
|
|
break;
|
2015-04-16 20:37:51 +02:00
|
|
|
}
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2015-04-15 21:52:19 +02:00
|
|
|
}
|
|
|
|
|
2015-10-20 20:16:30 +02:00
|
|
|
/* rct2: 0x006E1F34
|
2015-04-20 21:11:45 +02:00
|
|
|
* Outputs
|
|
|
|
* eax : grid_x
|
|
|
|
* ebx : parameter_1
|
|
|
|
* ecx : grid_y
|
|
|
|
* edx : parameter_2
|
|
|
|
* edi : parameter_3
|
|
|
|
*/
|
|
|
|
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){
|
2015-04-18 13:17:44 +02:00
|
|
|
rct_window* w = window_find_by_class(WC_SCENERY);
|
|
|
|
|
2015-04-20 21:11:45 +02:00
|
|
|
if (w == NULL)
|
2015-04-18 13:17:44 +02:00
|
|
|
{
|
|
|
|
*grid_x = 0x8000;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 scenery_type = selected_scenery >> 8;
|
|
|
|
// Not sure what this type is yet.
|
|
|
|
uint8 type = 0;
|
|
|
|
|
|
|
|
if (scenery_type == 0){
|
|
|
|
rct_scenery_entry* scenery_entry = g_smallSceneryEntries[selected_scenery];
|
|
|
|
|
2015-04-20 21:11:45 +02:00
|
|
|
if (scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG18){
|
2015-04-18 13:17:44 +02:00
|
|
|
type = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (scenery_type == 2 || scenery_type == 3){
|
|
|
|
type = 1;
|
|
|
|
}
|
|
|
|
|
2015-07-23 19:55:51 +02:00
|
|
|
if (type == 0 && !gCheatsDisableSupportLimits) {
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_CTRL_PRESSED, uint8) = 0;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) = 0;
|
2015-04-18 13:17:44 +02:00
|
|
|
}
|
|
|
|
else{
|
2015-04-23 21:00:18 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_CTRL_PRESSED, uint8) == 0){
|
2015-04-18 13:17:44 +02:00
|
|
|
// CTRL pressed
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & (1 << 1)){
|
|
|
|
rct_map_element* map_element;
|
2015-05-05 20:11:35 +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;
|
2015-04-18 13:17:44 +02:00
|
|
|
int interaction_type;
|
|
|
|
get_map_coordinates_from_pos(x, y, flags, NULL, NULL, &interaction_type, &map_element, NULL);
|
|
|
|
|
|
|
|
if (interaction_type != VIEWPORT_INTERACTION_ITEM_NONE){
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_CTRL_PRESSED, uint8) = 1;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_CTRL_PRESS_Z_COORDINATE, uint16) = map_element->base_height * 8;
|
2015-04-18 13:17:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
// CTRL not pressed
|
|
|
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & (1 << 1))){
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_CTRL_PRESSED, uint8) = 0;
|
2015-04-18 13:17:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) == 0){
|
2015-04-18 13:17:44 +02:00
|
|
|
// SHIFT pressed
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & (1 << 0)){
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) = 1;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_X_COORDINATE, uint16) = x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Y_COORDINATE, uint16) = y;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Z_VECTOR, uint16) = 0;
|
2015-04-18 13:17:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
// SHIFT pressed
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & (1 << 0)){
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Z_VECTOR, sint16) =
|
|
|
|
(RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Y_COORDINATE, sint16) - y + 4) & 0xFFF8;
|
2015-04-18 13:17:44 +02:00
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
x = RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_X_COORDINATE, sint16);
|
|
|
|
y = RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Y_COORDINATE, sint16);
|
2015-04-18 13:17:44 +02:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
// SHIFT not pressed
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) = 0;
|
2015-04-18 13:17:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2015-04-18 13:17:44 +02:00
|
|
|
switch (scenery_type){
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
// Small scenery
|
|
|
|
rct_scenery_entry* scenery = g_smallSceneryEntries[selected_scenery];
|
|
|
|
if (!(scenery->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE)){
|
2015-04-20 21:11:45 +02:00
|
|
|
uint8 cl = 0;
|
2015-04-18 13:17:44 +02:00
|
|
|
|
2015-04-20 21:11:45 +02:00
|
|
|
// If CTRL not pressed
|
2015-04-23 21:00:18 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_CTRL_PRESSED, uint8) == 0){
|
2015-07-11 19:23:59 +02:00
|
|
|
screen_get_map_xy_quadrant(x, y, grid_x, grid_y, &cl);
|
2015-04-20 21:11:45 +02:00
|
|
|
|
2015-05-05 20:11:35 +02:00
|
|
|
if (*grid_x == (sint16)0x8000)
|
2015-04-20 21:11:45 +02:00
|
|
|
return;
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) = 0;
|
2015-04-20 21:11:45 +02:00
|
|
|
|
|
|
|
// If SHIFT pressed
|
2015-04-23 21:00:18 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) != 0){
|
2015-04-20 21:11:45 +02:00
|
|
|
|
|
|
|
rct_map_element* map_element = map_get_surface_element_at(*grid_x / 32, *grid_y / 32);
|
|
|
|
|
|
|
|
if (map_element == NULL){
|
|
|
|
*grid_x = 0x8000;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sint16 z = (map_element->base_height * 8) & 0xFFF0;
|
2015-04-23 21:00:18 +02:00
|
|
|
z += RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Z_VECTOR, sint16);
|
2015-04-20 21:11:45 +02:00
|
|
|
|
|
|
|
if (z < 16){
|
|
|
|
z = 16;
|
|
|
|
}
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) = z;
|
2015-04-20 21:11:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
2015-04-23 21:00:18 +02:00
|
|
|
sint16 z = RCT2_GLOBAL(RCT2_ADDRESS_CTRL_PRESS_Z_COORDINATE, sint16);
|
2015-04-20 21:11:45 +02:00
|
|
|
|
2015-07-11 19:23:59 +02:00
|
|
|
screen_get_map_xy_quadrant_with_z(x, y, z, grid_x, grid_y, &cl);
|
2015-04-20 21:11:45 +02:00
|
|
|
|
|
|
|
// If SHIFT pressed
|
2015-04-23 21:00:18 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) != 0){
|
|
|
|
z += RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Z_VECTOR, sint16);
|
2015-04-20 21:11:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (z < 16){
|
|
|
|
z = 16;
|
|
|
|
}
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) = z;
|
2015-04-20 21:11:45 +02:00
|
|
|
}
|
|
|
|
|
2015-05-05 20:11:35 +02:00
|
|
|
if (*grid_x == (sint16)0x8000)
|
2015-04-20 21:11:45 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
uint8 rotation = window_scenery_rotation;
|
|
|
|
|
|
|
|
if (!(scenery->small_scenery.flags & SMALL_SCENERY_FLAG4)){
|
2015-11-08 16:01:30 +01:00
|
|
|
rotation = rand() & 0xFF;
|
2015-04-20 21:11:45 +02:00
|
|
|
}
|
2015-04-21 19:19:11 +02:00
|
|
|
|
2015-10-30 11:00:35 +01:00
|
|
|
rotation -= get_current_rotation();
|
2015-04-20 21:11:45 +02:00
|
|
|
rotation &= 0x3;
|
|
|
|
|
|
|
|
// Also places it in lower but think thats for clobering
|
|
|
|
*parameter_1 = (selected_scenery & 0xFF) << 8;
|
|
|
|
*parameter_2 = cl ^ (1 << 1) | (window_scenery_primary_colour << 8);
|
|
|
|
*parameter_3 = rotation | (window_scenery_secondary_colour << 16);
|
|
|
|
return;
|
|
|
|
}
|
2015-04-21 19:19:11 +02:00
|
|
|
|
2015-04-20 21:11:45 +02:00
|
|
|
// If CTRL not pressed
|
2015-04-23 21:00:18 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_CTRL_PRESSED, uint8) == 0){
|
2015-10-20 20:16:30 +02:00
|
|
|
uint16 flags =
|
2015-05-05 20:11:35 +02:00
|
|
|
VIEWPORT_INTERACTION_MASK_TERRAIN &
|
|
|
|
VIEWPORT_INTERACTION_MASK_WATER;
|
2015-04-20 21:11:45 +02:00
|
|
|
int interaction_type = 0;
|
|
|
|
rct_map_element* map_element;
|
|
|
|
|
2015-05-27 19:05:57 +02:00
|
|
|
get_map_coordinates_from_pos(x, y, flags, grid_x, grid_y, &interaction_type, &map_element, NULL);
|
2015-04-20 21:11:45 +02:00
|
|
|
|
|
|
|
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE)
|
|
|
|
{
|
|
|
|
*grid_x = 0x8000;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) = 0;
|
2015-04-20 21:11:45 +02:00
|
|
|
uint16 water_height = map_element->properties.surface.terrain & MAP_ELEMENT_WATER_HEIGHT_MASK;
|
|
|
|
if (water_height != 0){
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) = water_height * 16;
|
2015-04-20 21:11:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// If SHIFT pressed
|
2015-04-23 21:00:18 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) != 0){
|
2015-04-20 21:11:45 +02:00
|
|
|
rct_map_element* map_element = map_get_surface_element_at(*grid_x / 32, *grid_y / 32);
|
|
|
|
|
|
|
|
if (map_element == NULL){
|
|
|
|
*grid_x = 0x8000;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sint16 z = (map_element->base_height * 8) & 0xFFF0;
|
2015-04-23 21:00:18 +02:00
|
|
|
z += RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Z_VECTOR, sint16);
|
2015-04-20 21:11:45 +02:00
|
|
|
|
|
|
|
if (z < 16){
|
|
|
|
z = 16;
|
|
|
|
}
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) = z;
|
2015-04-18 13:17:44 +02:00
|
|
|
}
|
|
|
|
}
|
2015-04-20 21:11:45 +02:00
|
|
|
else{
|
2015-04-23 21:00:18 +02:00
|
|
|
sint16 z = RCT2_GLOBAL(RCT2_ADDRESS_CTRL_PRESS_Z_COORDINATE, sint16);
|
2015-07-11 19:23:59 +02:00
|
|
|
screen_get_map_xy_with_z(x, y, z, grid_x, grid_y);
|
2015-04-20 21:11:45 +02:00
|
|
|
|
|
|
|
// If SHIFT pressed
|
2015-04-23 21:00:18 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) != 0){
|
|
|
|
z += RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Z_VECTOR, sint16);
|
2015-04-20 21:11:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (z < 16){
|
|
|
|
z = 16;
|
|
|
|
}
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) = z;
|
2015-04-20 21:11:45 +02:00
|
|
|
}
|
|
|
|
|
2015-05-05 20:11:35 +02:00
|
|
|
if (*grid_x == (sint16)0x8000)
|
2015-04-20 21:11:45 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
*grid_x &= 0xFFE0;
|
|
|
|
*grid_y &= 0xFFE0;
|
|
|
|
uint8 rotation = window_scenery_rotation;
|
|
|
|
|
|
|
|
if (!(scenery->small_scenery.flags & SMALL_SCENERY_FLAG4)){
|
2015-11-08 16:01:30 +01:00
|
|
|
rotation = rand() & 0xFF;
|
2015-04-20 21:11:45 +02:00
|
|
|
}
|
|
|
|
|
2015-10-30 11:00:35 +01:00
|
|
|
rotation -= get_current_rotation();
|
2015-04-20 21:11:45 +02:00
|
|
|
rotation &= 0x3;
|
|
|
|
|
|
|
|
// Also places it in lower but think thats for clobering
|
|
|
|
*parameter_1 = (selected_scenery & 0xFF) << 8;
|
|
|
|
*parameter_2 = 0 | (window_scenery_primary_colour << 8);
|
|
|
|
*parameter_3 = rotation | (window_scenery_secondary_colour << 16);
|
2015-04-18 13:17:44 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
2015-04-21 19:19:11 +02:00
|
|
|
{
|
2015-04-18 13:17:44 +02:00
|
|
|
// Path bits
|
2015-04-21 19:19:11 +02:00
|
|
|
|
2015-10-20 20:16:30 +02:00
|
|
|
uint16 flags =
|
2015-05-05 20:11:35 +02:00
|
|
|
VIEWPORT_INTERACTION_MASK_FOOTPATH &
|
|
|
|
VIEWPORT_INTERACTION_MASK_FOOTPATH_ITEM;
|
2015-04-21 19:19:11 +02:00
|
|
|
int interaction_type = 0;
|
|
|
|
rct_map_element* map_element;
|
|
|
|
|
2015-05-27 19:05:57 +02:00
|
|
|
get_map_coordinates_from_pos(x, y, flags, grid_x, grid_y, &interaction_type, &map_element, NULL);
|
2015-04-21 19:19:11 +02:00
|
|
|
|
|
|
|
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE)
|
|
|
|
{
|
|
|
|
*grid_x = 0x8000;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-04-28 18:07:36 +02:00
|
|
|
*parameter_1 = 0 | ((map_element->properties.path.type & 0x7) << 8);
|
2015-04-21 19:19:11 +02:00
|
|
|
*parameter_2 = map_element->base_height | ((map_element->properties.path.type >> 4) << 8);
|
|
|
|
if (map_element->type & 1){
|
|
|
|
*parameter_2 |= 0x8000;
|
|
|
|
}
|
|
|
|
*parameter_3 = (selected_scenery & 0xFF) + 1;
|
2015-04-18 13:17:44 +02:00
|
|
|
break;
|
2015-04-21 19:19:11 +02:00
|
|
|
}
|
2015-04-18 13:17:44 +02:00
|
|
|
case 2:
|
2015-04-21 19:19:11 +02:00
|
|
|
{
|
2015-04-18 13:17:44 +02:00
|
|
|
// Walls
|
2015-04-21 19:19:11 +02:00
|
|
|
uint8 cl;
|
|
|
|
// If CTRL not pressed
|
2015-04-23 21:00:18 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_CTRL_PRESSED, uint8) == 0){
|
2015-07-11 19:23:59 +02:00
|
|
|
screen_get_map_xy_side(x, y, grid_x, grid_y, &cl);
|
2015-04-21 19:19:11 +02:00
|
|
|
|
2015-05-05 20:11:35 +02:00
|
|
|
if (*grid_x == (sint16)0x8000)
|
2015-04-21 19:19:11 +02:00
|
|
|
return;
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) = 0;
|
2015-04-21 19:19:11 +02:00
|
|
|
|
|
|
|
// If SHIFT pressed
|
2015-04-23 21:00:18 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) != 0){
|
2015-04-21 19:19:11 +02:00
|
|
|
rct_map_element* map_element = map_get_surface_element_at(*grid_x / 32, *grid_y / 32);
|
|
|
|
|
|
|
|
if (map_element == NULL){
|
|
|
|
*grid_x = 0x8000;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sint16 z = (map_element->base_height * 8) & 0xFFF0;
|
2015-04-23 21:00:18 +02:00
|
|
|
z += RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Z_VECTOR, sint16);
|
2015-04-21 19:19:11 +02:00
|
|
|
|
|
|
|
if (z < 16){
|
|
|
|
z = 16;
|
|
|
|
}
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) = z;
|
2015-04-21 19:19:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
2015-04-23 21:00:18 +02:00
|
|
|
sint16 z = RCT2_GLOBAL(RCT2_ADDRESS_CTRL_PRESS_Z_COORDINATE, sint16);
|
2015-07-11 19:23:59 +02:00
|
|
|
screen_get_map_xy_side_with_z(x, y, z, grid_x, grid_y, &cl);
|
2015-04-21 19:19:11 +02:00
|
|
|
|
|
|
|
// If SHIFT pressed
|
2015-04-23 21:00:18 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) != 0){
|
|
|
|
z += RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Z_VECTOR, sint16);
|
2015-04-21 19:19:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (z < 16){
|
|
|
|
z = 16;
|
|
|
|
}
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) = z;
|
2015-04-21 19:19:11 +02:00
|
|
|
}
|
|
|
|
|
2015-05-05 20:11:35 +02:00
|
|
|
if (*grid_x == (sint16)0x8000)
|
2015-04-21 19:19:11 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
RCT2_GLOBAL(0x00F64F15, uint8) = window_scenery_secondary_colour;
|
|
|
|
RCT2_GLOBAL(0x00F64F16, uint8) = window_scenery_tertiary_colour;
|
|
|
|
// Also places it in lower but think thats for clobering
|
|
|
|
*parameter_1 = (selected_scenery & 0xFF) << 8;
|
|
|
|
*parameter_2 = cl | (window_scenery_primary_colour << 8);
|
|
|
|
*parameter_3 = 0;
|
2015-04-18 13:17:44 +02:00
|
|
|
break;
|
2015-04-21 19:19:11 +02:00
|
|
|
}
|
2015-04-18 13:17:44 +02:00
|
|
|
case 3:
|
2015-04-21 19:19:11 +02:00
|
|
|
{
|
2015-04-18 13:17:44 +02:00
|
|
|
// Large scenery
|
2015-04-21 19:19:11 +02:00
|
|
|
|
|
|
|
// If CTRL not pressed
|
2015-04-23 21:00:18 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_CTRL_PRESSED, uint8) == 0){
|
2015-04-21 19:19:11 +02:00
|
|
|
sub_68A15E(x, y, grid_x, grid_y, NULL, NULL);
|
|
|
|
|
2015-05-05 20:11:35 +02:00
|
|
|
if (*grid_x == (sint16)0x8000)
|
2015-04-21 19:19:11 +02:00
|
|
|
return;
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) = 0;
|
2015-04-21 19:19:11 +02:00
|
|
|
|
|
|
|
// If SHIFT pressed
|
2015-04-23 21:00:18 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) != 0){
|
2015-04-21 19:19:11 +02:00
|
|
|
rct_map_element* map_element = map_get_surface_element_at(*grid_x / 32, *grid_y / 32);
|
|
|
|
|
|
|
|
if (map_element == NULL){
|
|
|
|
*grid_x = 0x8000;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sint16 z = (map_element->base_height * 8) & 0xFFF0;
|
2015-04-23 21:00:18 +02:00
|
|
|
z += RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Z_VECTOR, sint16);
|
2015-04-21 19:19:11 +02:00
|
|
|
|
|
|
|
if (z < 16){
|
|
|
|
z = 16;
|
|
|
|
}
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) = z;
|
2015-04-21 19:19:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
2015-04-23 21:00:18 +02:00
|
|
|
sint16 z = RCT2_GLOBAL(RCT2_ADDRESS_CTRL_PRESS_Z_COORDINATE, sint16);
|
2015-07-11 19:23:59 +02:00
|
|
|
screen_get_map_xy_with_z(x, y, z, grid_x, grid_y);
|
2015-04-21 19:19:11 +02:00
|
|
|
|
|
|
|
// If SHIFT pressed
|
2015-04-23 21:00:18 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) != 0){
|
|
|
|
z += RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Z_VECTOR, sint16);
|
2015-04-21 19:19:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (z < 16){
|
|
|
|
z = 16;
|
|
|
|
}
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) = z;
|
2015-04-21 19:19:11 +02:00
|
|
|
}
|
|
|
|
|
2015-05-05 20:11:35 +02:00
|
|
|
if (*grid_x == (sint16)0x8000)
|
2015-04-21 19:19:11 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
*grid_x &= 0xFFE0;
|
|
|
|
*grid_y &= 0xFFE0;
|
|
|
|
|
|
|
|
uint8 rotation = window_scenery_rotation;
|
2015-10-30 11:00:35 +01:00
|
|
|
rotation -= get_current_rotation();
|
2015-04-21 19:19:11 +02:00
|
|
|
rotation &= 0x3;
|
|
|
|
|
|
|
|
*parameter_1 = (rotation << 8);
|
|
|
|
*parameter_2 = window_scenery_primary_colour | (window_scenery_secondary_colour << 8);
|
|
|
|
*parameter_3 = selected_scenery & 0xFF;
|
2015-04-18 13:17:44 +02:00
|
|
|
break;
|
2015-04-21 19:19:11 +02:00
|
|
|
}
|
2015-04-18 13:17:44 +02:00
|
|
|
case 4:
|
2015-04-21 19:19:11 +02:00
|
|
|
{
|
2015-04-18 13:17:44 +02:00
|
|
|
// Banner
|
2015-04-21 19:19:11 +02:00
|
|
|
|
2015-05-05 20:11:35 +02:00
|
|
|
uint16 flags =
|
|
|
|
VIEWPORT_INTERACTION_MASK_FOOTPATH &
|
|
|
|
VIEWPORT_INTERACTION_MASK_FOOTPATH_ITEM;
|
2015-04-21 19:19:11 +02:00
|
|
|
int interaction_type = 0;
|
|
|
|
rct_map_element* map_element;
|
|
|
|
|
2015-05-27 19:05:57 +02:00
|
|
|
get_map_coordinates_from_pos(x, y, flags, grid_x, grid_y, &interaction_type, &map_element, NULL);
|
2015-04-21 19:19:11 +02:00
|
|
|
|
|
|
|
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE)
|
|
|
|
{
|
|
|
|
*grid_x = 0x8000;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 rotation = window_scenery_rotation;
|
2015-10-30 11:00:35 +01:00
|
|
|
rotation -= get_current_rotation();
|
2015-04-21 19:19:11 +02:00
|
|
|
rotation &= 0x3;
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2015-04-21 19:19:11 +02:00
|
|
|
sint16 z = map_element->base_height;
|
|
|
|
|
|
|
|
if (map_element->properties.path.type & (1 << 2)){
|
|
|
|
if (rotation != ((map_element->properties.path.type & 3) ^ 2)){
|
|
|
|
z += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
z /= 2;
|
|
|
|
|
|
|
|
// Also places it in lower but think thats for clobering
|
|
|
|
*parameter_1 = (selected_scenery & 0xFF) << 8;
|
|
|
|
*parameter_2 = z | (rotation << 8);
|
|
|
|
*parameter_3 = window_scenery_primary_colour;
|
2015-04-18 13:17:44 +02:00
|
|
|
break;
|
|
|
|
}
|
2015-04-21 19:19:11 +02: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
|
|
|
*/
|
2015-08-31 00:45:45 +02:00
|
|
|
static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w, short widgetIndex)
|
|
|
|
{
|
2015-04-15 20:41:31 +02:00
|
|
|
scenery_remove_ghost_tool_placement();
|
2015-08-31 00:45:45 +02:00
|
|
|
if (window_scenery_is_repaint_scenery_tool_on & 1) {
|
2015-04-15 21:52:19 +02:00
|
|
|
repaint_scenery_tool_down(x, y, widgetIndex);
|
|
|
|
return;
|
2014-10-21 18:59:47 +02:00
|
|
|
}
|
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
int selectedTab = window_scenery_selected_scenery_by_tab[window_scenery_active_tab_index];
|
|
|
|
uint8 sceneryType = (selectedTab & 0xFF00) >> 8;
|
|
|
|
uint8 selectedScenery = selectedTab & 0xFF;
|
2015-04-23 21:00:18 +02:00
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
if (selectedTab == -1) return;
|
2014-10-21 18:59:47 +02:00
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
sint16 gridX, gridY;
|
|
|
|
int ebp = selectedTab;
|
2015-04-20 21:11:45 +02:00
|
|
|
uint32 parameter_1, parameter_2, parameter_3;
|
2014-10-21 18:59:47 +02:00
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
sub_6E1F34(x, y, selectedTab, &gridX, &gridY, ¶meter_1, ¶meter_2, ¶meter_3);
|
2014-10-21 18:59:47 +02:00
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
if (gridX == (sint16)0x8000) return;
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
switch (sceneryType){
|
|
|
|
case SCENERY_TYPE_SMALL:
|
2015-04-23 21:00:18 +02:00
|
|
|
{
|
2015-08-31 00:45:45 +02:00
|
|
|
int quantity = 1;
|
|
|
|
if (window_scenery_is_build_cluster_tool_on) {
|
|
|
|
quantity = 35;
|
2015-04-23 21:00:18 +02:00
|
|
|
}
|
2014-10-21 18:59:47 +02:00
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
int successfulPlacements = 0;
|
|
|
|
for (int q = 0; q < quantity; q++) {
|
|
|
|
int zCoordinate = RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16);
|
2015-04-23 21:00:18 +02:00
|
|
|
rct_scenery_entry* scenery = g_smallSceneryEntries[(parameter_1 >> 8) & 0xFF];
|
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
sint16 cur_grid_x = gridX;
|
|
|
|
sint16 cur_grid_y = gridY;
|
2015-04-23 21:00:18 +02:00
|
|
|
|
|
|
|
if (window_scenery_is_build_cluster_tool_on){
|
|
|
|
if (!(scenery->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE)){
|
|
|
|
parameter_2 &= 0xFF00;
|
2015-11-08 16:01:30 +01:00
|
|
|
parameter_2 |= rand() & 3;
|
2015-04-23 21:00:18 +02:00
|
|
|
}
|
|
|
|
|
2015-11-08 16:01:30 +01:00
|
|
|
cur_grid_x += ((rand() % 16) - 8) * 32;
|
|
|
|
cur_grid_y += ((rand() % 16) - 8) * 32;
|
2015-04-23 21:00:18 +02:00
|
|
|
|
|
|
|
if (!(scenery->small_scenery.flags & SMALL_SCENERY_FLAG4)){
|
2015-08-22 18:03:40 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_ROTATION, uint16)++;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_ROTATION, uint16) &= 3;
|
2015-04-23 21:00:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
uint8 zAttemptRange = 1;
|
|
|
|
if (
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) != 0 &&
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) != 0
|
|
|
|
) {
|
|
|
|
zAttemptRange = 20;
|
2015-04-23 21:00:18 +02:00
|
|
|
}
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
bool success = false;
|
|
|
|
for (; zAttemptRange != 0; zAttemptRange--){
|
|
|
|
int flags = GAME_COMMAND_FLAG_APPLY | (parameter_1 & 0xFF00);
|
2015-04-23 21:00:18 +02:00
|
|
|
|
|
|
|
RCT2_GLOBAL(0x009A8C29, uint8) |= 1;
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_POSITION_THIS_HERE;
|
2015-08-31 00:45:45 +02:00
|
|
|
int cost = game_do_command(
|
|
|
|
cur_grid_x,
|
|
|
|
flags,
|
|
|
|
cur_grid_y,
|
|
|
|
parameter_2,
|
|
|
|
GAME_COMMAND_PLACE_SCENERY,
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_ROTATION, uint8) | (parameter_3 & 0xFFFF0000),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16)
|
|
|
|
);
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(0x009A8C29, uint8) &= ~1;
|
|
|
|
|
|
|
|
if (cost != MONEY32_UNDEFINED){
|
|
|
|
window_close_by_class(WC_ERROR);
|
2015-11-16 23:39:40 +01:00
|
|
|
audio_sound_play_panned(SOUND_PLACE_ITEM, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
2015-08-31 00:45:45 +02:00
|
|
|
success = true;
|
2015-04-23 21:00:18 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
if (
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) == STR_NOT_ENOUGH_CASH_REQUIRES ||
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) == STR_CAN_ONLY_BUILD_THIS_ON_WATER
|
|
|
|
) {
|
2015-04-23 21:00:18 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) += 8;
|
|
|
|
}
|
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
if (success) {
|
|
|
|
successfulPlacements++;
|
|
|
|
} else {
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) == STR_NOT_ENOUGH_CASH_REQUIRES) {
|
|
|
|
break;
|
|
|
|
}
|
2015-04-23 21:00:18 +02:00
|
|
|
}
|
2015-08-31 00:45:45 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) = zCoordinate;
|
|
|
|
}
|
2015-04-23 21:00:18 +02:00
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
if (successfulPlacements > 0) {
|
|
|
|
window_close_by_class(WC_ERROR);
|
|
|
|
} else {
|
2015-11-16 23:39:40 +01:00
|
|
|
audio_sound_play_panned(SOUND_ERROR, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
2014-10-21 18:59:47 +02:00
|
|
|
}
|
2015-04-23 21:00:18 +02:00
|
|
|
break;
|
|
|
|
}
|
2015-08-31 00:45:45 +02:00
|
|
|
case SCENERY_TYPE_PATH_ITEM:
|
2015-04-23 21:00:18 +02:00
|
|
|
{
|
2015-08-31 01:41:58 +02:00
|
|
|
int flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_7 | (parameter_1 & 0xFF00);
|
2014-10-21 18:59:47 +02:00
|
|
|
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_POSITION_THIS_HERE;
|
2015-08-31 00:45:45 +02:00
|
|
|
int cost = game_do_command(gridX, flags, gridY, parameter_2, GAME_COMMAND_PLACE_PATH, parameter_3, 0);
|
|
|
|
if (cost != MONEY32_UNDEFINED) {
|
2015-11-16 23:39:40 +01:00
|
|
|
audio_sound_play_panned(SOUND_PLACE_ITEM, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
2015-04-23 21:00:18 +02:00
|
|
|
}
|
|
|
|
break;
|
2014-10-21 18:59:47 +02:00
|
|
|
}
|
2015-08-31 00:45:45 +02:00
|
|
|
case SCENERY_TYPE_WALL:
|
2015-04-23 21:00:18 +02:00
|
|
|
{
|
2015-08-31 00:45:45 +02:00
|
|
|
uint8 zAttemptRange = 1;
|
|
|
|
if (
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) != 0 &&
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) != 0
|
|
|
|
) {
|
|
|
|
zAttemptRange = 20;
|
2015-04-18 11:32:23 +02:00
|
|
|
}
|
2015-04-23 21:00:18 +02:00
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
for (; zAttemptRange != 0; zAttemptRange--) {
|
|
|
|
int flags = (parameter_1 & 0xFF00) | GAME_COMMAND_FLAG_APPLY;
|
2015-04-22 21:41:46 +02:00
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
RCT2_GLOBAL(0x009A8C29, uint8) |= 1;
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_BUILD_PARK_ENTRANCE_HERE;
|
2015-08-31 00:45:45 +02:00
|
|
|
int cost = game_do_command(gridX, flags, gridY, parameter_2, GAME_COMMAND_PLACE_FENCE, RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16), RCT2_GLOBAL(0x00F64F15, uint16));
|
2015-04-18 11:32:23 +02:00
|
|
|
RCT2_GLOBAL(0x009A8C29, uint8) &= ~1;
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
if (cost != MONEY32_UNDEFINED){
|
2015-04-22 21:41:46 +02:00
|
|
|
window_close_by_class(WC_ERROR);
|
2015-11-16 23:39:40 +01:00
|
|
|
audio_sound_play_panned(SOUND_PLACE_ITEM, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
2015-04-18 11:32:23 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
if (
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) == STR_NOT_ENOUGH_CASH_REQUIRES ||
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) == STR_CAN_ONLY_BUILD_THIS_ON_WATER
|
|
|
|
) {
|
2015-04-18 11:32:23 +02:00
|
|
|
break;
|
|
|
|
}
|
2015-04-22 21:41:46 +02:00
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) += 8;
|
2015-04-18 11:32:23 +02:00
|
|
|
}
|
2015-04-22 21:41:46 +02:00
|
|
|
|
2015-11-16 23:39:40 +01:00
|
|
|
audio_sound_play_panned(SOUND_ERROR, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
2015-04-23 21:00:18 +02:00
|
|
|
break;
|
2014-10-21 18:59:47 +02:00
|
|
|
}
|
2015-08-31 00:45:45 +02:00
|
|
|
case SCENERY_TYPE_LARGE:
|
2015-04-23 21:00:18 +02:00
|
|
|
{
|
2015-08-31 00:45:45 +02:00
|
|
|
uint8 zAttemptRange = 1;
|
|
|
|
if (
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) != 0 &&
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) != 0
|
|
|
|
) {
|
|
|
|
zAttemptRange = 20;
|
2015-04-22 21:41:46 +02:00
|
|
|
}
|
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
for (; zAttemptRange != 0; zAttemptRange--) {
|
|
|
|
int flags = (parameter_1 & 0xFF00) | GAME_COMMAND_FLAG_APPLY;
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2015-04-22 21:41:46 +02:00
|
|
|
RCT2_GLOBAL(0x009A8C29, uint8) |= 1;
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_POSITION_THIS_HERE;
|
2015-08-31 00:45:45 +02:00
|
|
|
int cost = game_do_command(gridX, flags, gridY, parameter_2, GAME_COMMAND_PLACE_LARGE_SCENERY, parameter_3, RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16));
|
2015-04-22 21:41:46 +02:00
|
|
|
RCT2_GLOBAL(0x009A8C29, uint8) &= ~1;
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
if (cost != MONEY32_UNDEFINED){
|
2015-04-22 21:41:46 +02:00
|
|
|
window_close_by_class(WC_ERROR);
|
2015-11-16 23:39:40 +01:00
|
|
|
audio_sound_play_panned(SOUND_PLACE_ITEM, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
2015-04-22 21:41:46 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
if (
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) == STR_NOT_ENOUGH_CASH_REQUIRES ||
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) == STR_CAN_ONLY_BUILD_THIS_ON_WATER
|
|
|
|
) {
|
2015-04-22 21:41:46 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-04-23 21:00:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) += 8;
|
2015-04-22 21:41:46 +02:00
|
|
|
}
|
|
|
|
|
2015-11-16 23:39:40 +01:00
|
|
|
audio_sound_play_panned(SOUND_ERROR, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
2015-04-23 21:00:18 +02:00
|
|
|
break;
|
2015-08-31 00:45:45 +02:00
|
|
|
}
|
|
|
|
case SCENERY_TYPE_BANNER:
|
2015-04-23 21:00:18 +02:00
|
|
|
{
|
2015-08-31 00:45:45 +02:00
|
|
|
int flags = (parameter_1 & 0xFF00) | GAME_COMMAND_FLAG_APPLY;
|
2015-04-23 18:23:01 +02:00
|
|
|
|
2015-08-31 00:45:45 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_POSITION_THIS_HERE;
|
|
|
|
registers regs = {
|
|
|
|
.eax = gridX,
|
|
|
|
.ebx = flags,
|
|
|
|
.ecx = gridY,
|
|
|
|
.edx = parameter_2,
|
|
|
|
.esi = GAME_COMMAND_PLACE_BANNER,
|
|
|
|
.edi = parameter_3
|
|
|
|
};
|
|
|
|
money32 cost = game_do_command_p(GAME_COMMAND_PLACE_BANNER, ®s.eax, ®s.ebx, ®s.ecx, ®s.edx, ®s.esi, ®s.edi, ®s.ebp);
|
|
|
|
if (cost != MONEY32_UNDEFINED) {
|
|
|
|
int bannerId = regs.edi;
|
|
|
|
|
2015-11-16 23:39:40 +01:00
|
|
|
audio_sound_play_panned(SOUND_PLACE_ITEM, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
2015-08-31 00:45:45 +02:00
|
|
|
window_banner_open(bannerId);
|
2015-04-23 19:03:52 +02:00
|
|
|
}
|
2015-04-23 21:00:18 +02:00
|
|
|
break;
|
|
|
|
}
|
2014-10-21 18:59:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-25 18:24:18 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0068E213
|
|
|
|
*/
|
2015-05-26 18:55:25 +02:00
|
|
|
void top_toolbar_tool_update_scenery_clear(sint16 x, sint16 y){
|
2015-05-25 18:24:18 +02:00
|
|
|
map_invalidate_selection_rect();
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~(1 << 0);
|
|
|
|
|
|
|
|
rct_xy16 mapTile = { 0 };
|
2015-07-11 19:23:59 +02:00
|
|
|
screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, NULL);
|
2015-05-25 18:24:18 +02:00
|
|
|
|
|
|
|
if (mapTile.x == (sint16)0x8000){
|
|
|
|
if (RCT2_GLOBAL(0x00F1AD62, money32) != MONEY32_UNDEFINED){
|
|
|
|
RCT2_GLOBAL(0x00F1AD62, money32) = MONEY32_UNDEFINED;
|
|
|
|
window_invalidate_by_class(WC_CLEAR_SCENERY);
|
|
|
|
}
|
2015-05-26 18:55:25 +02:00
|
|
|
return;
|
2015-05-25 18:24:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
uint8 state_changed = 0;
|
|
|
|
|
|
|
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) & (1 << 0))){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0);
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) != 4){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 4;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
sint16 tool_size = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16);
|
|
|
|
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 (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) != mapTile.x){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) != mapTile.y){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
mapTile.x += tool_length;
|
|
|
|
mapTile.y += tool_length;
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) != mapTile.x){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) != mapTile.y){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
if (!state_changed)
|
|
|
|
return;
|
|
|
|
|
2015-07-18 19:22:59 +02:00
|
|
|
int eax = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16);
|
|
|
|
int ecx = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16);
|
|
|
|
int edi = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16);
|
|
|
|
int ebp = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16);
|
|
|
|
money32 cost = game_do_command(eax, 0, ecx, 0, GAME_COMMAND_CLEAR_SCENERY, edi, ebp);
|
2015-05-25 18:24:18 +02:00
|
|
|
|
|
|
|
if (RCT2_GLOBAL(0x00F1AD62, money32) != cost){
|
|
|
|
RCT2_GLOBAL(0x00F1AD62, money32) = cost;
|
|
|
|
window_invalidate_by_class(WC_CLEAR_SCENERY);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-02 22:43:21 +02:00
|
|
|
void top_toolbar_tool_update_land_paint(sint16 x, sint16 y){
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~(1 << 0);
|
|
|
|
|
|
|
|
rct_xy16 mapTile = { 0 };
|
2015-07-11 19:23:59 +02:00
|
|
|
screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, NULL);
|
2015-06-02 22:43:21 +02:00
|
|
|
|
|
|
|
if (mapTile.x == (sint16)0x8000){
|
|
|
|
if (RCT2_GLOBAL(0x00F1AD62, money32) != MONEY32_UNDEFINED){
|
|
|
|
RCT2_GLOBAL(0x00F1AD62, money32) = MONEY32_UNDEFINED;
|
|
|
|
window_invalidate_by_class(WC_CLEAR_SCENERY);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 state_changed = 0;
|
|
|
|
|
|
|
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) & (1 << 0))){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0);
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) != 4){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 4;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
sint16 tool_size = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16);
|
|
|
|
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 (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) != mapTile.x){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) != mapTile.y){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
mapTile.x += tool_length;
|
|
|
|
mapTile.y += tool_length;
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) != mapTile.x){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) != mapTile.y){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
if (!state_changed)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-05-26 21:36:05 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x00664280
|
|
|
|
*/
|
|
|
|
void top_toolbar_tool_update_land(sint16 x, sint16 y){
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TOOL, uint8) == 3){
|
|
|
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) & (1 << 0)))
|
|
|
|
return;
|
|
|
|
|
|
|
|
money32 lower_cost = selection_lower_land(0);
|
|
|
|
money32 raise_cost = selection_raise_land(0);
|
|
|
|
|
2015-10-20 20:16:30 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) != raise_cost ||
|
2015-05-26 21:36:05 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) != lower_cost){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) = raise_cost;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) = lower_cost;
|
|
|
|
window_invalidate_by_class(WC_LAND);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sint16 tool_size = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16);
|
|
|
|
rct_xy16 mapTile = { .x = x, .y = y };
|
|
|
|
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~(1 << 0);
|
2015-10-11 13:26:33 +02:00
|
|
|
if (tool_size == 1 && !gLandMountainMode){
|
2015-05-26 21:36:05 +02:00
|
|
|
int direction;
|
|
|
|
screen_pos_to_map_pos(&mapTile.x, &mapTile.y, &direction);
|
|
|
|
|
|
|
|
if (mapTile.x == (sint16)0x8000){
|
|
|
|
money32 lower_cost = MONEY32_UNDEFINED;
|
|
|
|
money32 raise_cost = MONEY32_UNDEFINED;
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) != raise_cost ||
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) != lower_cost){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) = raise_cost;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) = lower_cost;
|
|
|
|
window_invalidate_by_class(WC_LAND);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 state_changed = 0;
|
|
|
|
|
|
|
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) & (1 << 0))){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0);
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) != direction){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = direction;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) != mapTile.x){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) != mapTile.y){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) != mapTile.x){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) != mapTile.y){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) = 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 (RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) != raise_cost ||
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) != lower_cost){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) = raise_cost;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) = lower_cost;
|
|
|
|
window_invalidate_by_class(WC_LAND);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-07-11 19:23:59 +02:00
|
|
|
screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, NULL);
|
2015-05-26 21:36:05 +02:00
|
|
|
|
|
|
|
if (mapTile.x == (sint16)0x8000){
|
|
|
|
money32 lower_cost = MONEY32_UNDEFINED;
|
|
|
|
money32 raise_cost = MONEY32_UNDEFINED;
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) != raise_cost ||
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) != lower_cost){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) = raise_cost;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) = lower_cost;
|
|
|
|
window_invalidate_by_class(WC_LAND);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 state_changed = 0;
|
|
|
|
|
|
|
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) & (1 << 0))){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0);
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) != 4){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 4;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2015-05-26 21:36:05 +02:00
|
|
|
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 (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) != mapTile.x){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) != mapTile.y){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
mapTile.x += tool_length;
|
|
|
|
mapTile.y += tool_length;
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) != mapTile.x){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) != mapTile.y){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) = 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 (RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) != raise_cost ||
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) != lower_cost){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) = raise_cost;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) = lower_cost;
|
|
|
|
window_invalidate_by_class(WC_LAND);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-27 18:40:57 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006E6BDC
|
|
|
|
*/
|
|
|
|
void top_toolbar_tool_update_water(sint16 x, sint16 y){
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TOOL, uint8) == 3){
|
|
|
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) & (1 << 0)))
|
|
|
|
return;
|
|
|
|
|
|
|
|
money32 lower_cost = lower_water(
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16),
|
|
|
|
0);
|
|
|
|
|
|
|
|
money32 raise_cost = raise_water(
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16),
|
|
|
|
0);
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_WATER_RAISE_COST, money32) != raise_cost ||
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_WATER_LOWER_COST, money32) != lower_cost){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_WATER_RAISE_COST, money32) = raise_cost;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_WATER_LOWER_COST, money32) = lower_cost;
|
|
|
|
window_invalidate_by_class(WC_WATER);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~(1 << 0);
|
|
|
|
|
|
|
|
rct_xy16 mapTile = { 0 };
|
|
|
|
int interaction_type = 0;
|
|
|
|
get_map_coordinates_from_pos(
|
2015-10-20 20:16:30 +02:00
|
|
|
x,
|
|
|
|
y,
|
|
|
|
VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_WATER,
|
|
|
|
&mapTile.x,
|
|
|
|
&mapTile.y,
|
2015-05-27 18:40:57 +02:00
|
|
|
&interaction_type,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE){
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_WATER_RAISE_COST, money32) != MONEY32_UNDEFINED ||
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_WATER_LOWER_COST, money32) != MONEY32_UNDEFINED){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_WATER_RAISE_COST, money32) = MONEY32_UNDEFINED;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_WATER_LOWER_COST, money32) = MONEY32_UNDEFINED;
|
|
|
|
window_invalidate_by_class(WC_WATER);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mapTile.x += 16;
|
|
|
|
mapTile.y += 16;
|
|
|
|
|
|
|
|
uint8 state_changed = 0;
|
|
|
|
|
|
|
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) & (1 << 0))){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0);
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
2015-11-05 19:02:21 +01:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) != 5){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 5;
|
2015-05-27 18:40:57 +02:00
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
sint16 tool_size = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16);
|
|
|
|
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 (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) != mapTile.x){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) != mapTile.y){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
mapTile.x += tool_length;
|
|
|
|
mapTile.y += tool_length;
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) != mapTile.x){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) = mapTile.x;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) != mapTile.y){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) = mapTile.y;
|
|
|
|
state_changed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
if (!state_changed)
|
|
|
|
return;
|
|
|
|
|
|
|
|
money32 lower_cost = lower_water(
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16),
|
|
|
|
0);
|
|
|
|
|
|
|
|
money32 raise_cost = raise_water(
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16),
|
|
|
|
0);
|
|
|
|
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_WATER_RAISE_COST, money32) != raise_cost ||
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_WATER_LOWER_COST, money32) != lower_cost){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_WATER_RAISE_COST, money32) = raise_cost;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_WATER_LOWER_COST, money32) = lower_cost;
|
|
|
|
window_invalidate_by_class(WC_WATER);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-20 20:16:30 +02: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
|
|
|
|
*/
|
|
|
|
money32 try_place_ghost_scenery(rct_xy16 map_tile, uint32 parameter_1, uint32 parameter_2, uint32 parameter_3, uint16 selected_tab){
|
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
|
|
|
|
uint8 scenery_type = (selected_tab & 0xFF00) >> 8;
|
|
|
|
uint8 selected_scenery = selected_tab & 0xFF;
|
|
|
|
money32 cost = 0;
|
|
|
|
rct_map_element* mapElement;
|
|
|
|
|
|
|
|
switch (scenery_type){
|
|
|
|
case 0:
|
|
|
|
// Small Scenery
|
|
|
|
//6e252b
|
|
|
|
cost = game_do_command(
|
2015-10-20 20:16:30 +02:00
|
|
|
map_tile.x,
|
2015-05-30 08:04:15 +02:00
|
|
|
parameter_1 | 0x69,
|
2015-10-20 20:16:30 +02:00
|
|
|
map_tile.y,
|
|
|
|
parameter_2,
|
|
|
|
GAME_COMMAND_PLACE_SCENERY,
|
|
|
|
parameter_3,
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16));
|
2015-05-30 08:04:15 +02:00
|
|
|
|
|
|
|
if (cost == MONEY32_UNDEFINED)
|
|
|
|
return cost;
|
|
|
|
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) = map_tile.x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) = map_tile.y;
|
2015-08-22 18:03:40 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_ROTATION, uint16) = (uint16)(parameter_3 & 0xFFFF);
|
2015-08-19 05:53:24 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_SELECTED_OBJECT, sint16) = selected_tab;
|
|
|
|
|
|
|
|
mapElement = RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_MAP_ELEMENT, rct_map_element*);
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Z, uint8) = mapElement->base_height;
|
2015-08-19 05:53:24 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_MAP_ELEMENT_TYPE, uint8) = mapElement->type;
|
2015-05-30 08:04:15 +02:00
|
|
|
if (RCT2_GLOBAL(0x00F64F14, uint8) & (1 << 1)){
|
2015-08-27 16:19:17 +02:00
|
|
|
//Set underground on
|
2015-05-30 08:04:15 +02:00
|
|
|
viewport_set_visibility(4);
|
|
|
|
}
|
|
|
|
else{
|
2015-08-27 16:19:17 +02:00
|
|
|
//Set underground off
|
2015-05-30 08:04:15 +02:00
|
|
|
viewport_set_visibility(5);
|
|
|
|
}
|
|
|
|
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) |= (1 << 0);
|
2015-05-30 08:04:15 +02:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
// Path Bits
|
|
|
|
//6e265b
|
|
|
|
cost = game_do_command(
|
|
|
|
map_tile.x,
|
2015-09-09 21:25:34 +02:00
|
|
|
(parameter_1 & 0xFF00) | (
|
|
|
|
GAME_COMMAND_FLAG_APPLY |
|
|
|
|
GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED |
|
|
|
|
GAME_COMMAND_FLAG_5 |
|
|
|
|
GAME_COMMAND_FLAG_GHOST |
|
|
|
|
GAME_COMMAND_FLAG_7
|
|
|
|
),
|
2015-05-30 08:04:15 +02:00
|
|
|
map_tile.y,
|
|
|
|
parameter_2,
|
|
|
|
GAME_COMMAND_PLACE_PATH,
|
|
|
|
parameter_3,
|
|
|
|
0);
|
|
|
|
|
|
|
|
if (cost == MONEY32_UNDEFINED)
|
|
|
|
return cost;
|
|
|
|
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) = map_tile.x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) = map_tile.y;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Z, uint8) = (parameter_2 & 0xFF);
|
2015-08-22 18:03:40 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TARGET_PATH_INCLINE, uint8) = ((parameter_1 >> 8) & 0xFF);
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TARGET_PATH_TYPE, uint8) = ((parameter_2 >> 8) & 0xFF);
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_PATH_OBJECT_TYPE, uint32) = parameter_3;
|
2015-05-28 23:07:39 +02:00
|
|
|
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) |= (1 << 1);
|
2015-05-30 08:04:15 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
// Walls
|
|
|
|
//6e26b0
|
|
|
|
cost = game_do_command(
|
|
|
|
map_tile.x,
|
|
|
|
parameter_1 | 0x69,
|
|
|
|
map_tile.y,
|
|
|
|
parameter_2,
|
2015-06-20 01:05:30 +02:00
|
|
|
GAME_COMMAND_PLACE_FENCE,
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, uint16),
|
2015-05-30 08:04:15 +02:00
|
|
|
RCT2_GLOBAL(0x00F64F15, uint16));
|
|
|
|
|
|
|
|
if (cost == MONEY32_UNDEFINED)
|
|
|
|
return cost;
|
|
|
|
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) = map_tile.x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) = map_tile.y;
|
2015-08-22 18:03:40 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_WALL_ROTATION, uint8) = (parameter_2 & 0xFF);
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2015-08-19 05:53:24 +02:00
|
|
|
mapElement = RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_MAP_ELEMENT, rct_map_element*);
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Z, uint8) = mapElement->base_height;
|
2015-05-28 23:07:39 +02:00
|
|
|
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) |= (1 << 2);
|
2015-05-30 08:04:15 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
// Large Scenery
|
|
|
|
//6e25a7
|
|
|
|
cost = game_do_command(
|
|
|
|
map_tile.x,
|
|
|
|
parameter_1 | 0x69,
|
|
|
|
map_tile.y,
|
|
|
|
parameter_2,
|
2015-06-14 13:56:12 +02:00
|
|
|
GAME_COMMAND_PLACE_LARGE_SCENERY,
|
2015-05-30 08:04:15 +02:00
|
|
|
parameter_3,
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, uint16));
|
2015-05-30 08:04:15 +02:00
|
|
|
|
|
|
|
if (cost == MONEY32_UNDEFINED)
|
|
|
|
return cost;
|
|
|
|
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) = map_tile.x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) = map_tile.y;
|
2015-08-22 18:03:40 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_ROTATION, uint8) = ((parameter_1 >> 8) & 0xFF);
|
2015-05-30 08:04:15 +02:00
|
|
|
|
2015-08-19 05:53:24 +02:00
|
|
|
mapElement = RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_MAP_ELEMENT, rct_map_element*);
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Z, uint8) = mapElement->base_height;
|
2015-05-30 08:04:15 +02:00
|
|
|
|
|
|
|
if (RCT2_GLOBAL(0x00F64F14, uint8) & (1 << 1)){
|
2015-08-27 16:19:17 +02:00
|
|
|
//Set underground on
|
2015-05-30 08:04:15 +02:00
|
|
|
viewport_set_visibility(4);
|
|
|
|
}
|
|
|
|
else{
|
2015-08-27 16:19:17 +02:00
|
|
|
//Set underground off
|
2015-05-30 08:04:15 +02:00
|
|
|
viewport_set_visibility(5);
|
|
|
|
}
|
|
|
|
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) |= (1 << 3);
|
2015-05-30 08:04:15 +02:00
|
|
|
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;
|
|
|
|
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) = map_tile.x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) = map_tile.y;
|
2015-11-13 19:30:14 +01:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Z, uint8) = (parameter_2 & 0xFF) * 2 + 2;
|
2015-08-22 18:03:40 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_ROTATION, uint8) = ((parameter_2 >> 8) & 0xFF);
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) |= (1 << 4);
|
2015-05-30 08:04:15 +02:00
|
|
|
break;
|
|
|
|
}
|
2015-05-28 23:07:39 +02:00
|
|
|
|
2015-05-30 08:04:15 +02:00
|
|
|
return cost;
|
2015-05-28 23:07:39 +02:00
|
|
|
}
|
|
|
|
|
2015-05-28 20:33:09 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006E287B
|
|
|
|
*/
|
|
|
|
void top_toolbar_tool_update_scenery(sint16 x, sint16 y){
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
map_invalidate_map_selection_tiles();
|
|
|
|
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~((1 << 0) | (1 << 1));
|
|
|
|
|
|
|
|
if (window_scenery_is_repaint_scenery_tool_on)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sint16 selected_tab = window_scenery_selected_scenery_by_tab[window_scenery_active_tab_index];
|
|
|
|
|
|
|
|
if (selected_tab == -1){
|
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8 scenery_type = (selected_tab & 0xFF00) >> 8;
|
|
|
|
uint8 selected_scenery = selected_tab & 0xFF;
|
|
|
|
rct_xy16 mapTile = { 0 };
|
|
|
|
uint32 parameter1, parameter2, parameter3;
|
|
|
|
|
|
|
|
sub_6E1F34(x, y, selected_tab, &mapTile.x, &mapTile.y, ¶meter1, ¶meter2, ¶meter3);
|
|
|
|
|
|
|
|
if (mapTile.x == (sint16)0x8000){
|
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
return;
|
|
|
|
}
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2015-05-28 23:07:39 +02:00
|
|
|
rct_scenery_entry* scenery;
|
|
|
|
uint8 bl;
|
|
|
|
money32 cost;
|
|
|
|
|
2015-05-28 20:33:09 +02:00
|
|
|
switch (scenery_type){
|
|
|
|
case 0:
|
2015-05-28 23:07:39 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0);
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) = mapTile.x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) = mapTile.y;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) = mapTile.x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) = mapTile.y;
|
|
|
|
|
|
|
|
scenery = g_smallSceneryEntries[selected_scenery];
|
|
|
|
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 4;
|
|
|
|
if (!(scenery->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE)){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = ((parameter2 & 0xFF) ^ 2) + 6;
|
|
|
|
}
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
|
|
|
|
// If no change in ghost placement
|
2015-08-18 05:05:46 +02:00
|
|
|
if ((RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) & (1 << 0)) &&
|
|
|
|
mapTile.x == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) &&
|
|
|
|
mapTile.y == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) &&
|
2015-05-28 23:07:39 +02:00
|
|
|
(parameter2 & 0xFF) == RCT2_GLOBAL(0x00F64F0E, uint8)&&
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) == RCT2_GLOBAL(0x00F64F0A, sint16) &&
|
2015-08-19 05:53:24 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_SELECTED_OBJECT, uint16) == selected_tab){
|
2015-10-20 20:16:30 +02:00
|
|
|
return;
|
2015-05-28 23:07:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
|
|
|
|
RCT2_GLOBAL(0x00F64F0E, uint8) = (parameter2 & 0xFF);
|
|
|
|
RCT2_GLOBAL(0x00F64F0A, sint16) = RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16);
|
|
|
|
|
|
|
|
bl = 1;
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) != 0 &&
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) != 0){
|
|
|
|
bl = 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (; bl != 0; bl--){
|
2015-05-30 08:04:15 +02:00
|
|
|
cost = try_place_ghost_scenery(
|
2015-05-28 23:07:39 +02:00
|
|
|
mapTile,
|
|
|
|
parameter1,
|
|
|
|
parameter2,
|
|
|
|
parameter3,
|
|
|
|
selected_tab);
|
|
|
|
|
|
|
|
if (cost != MONEY32_UNDEFINED)
|
|
|
|
break;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) += 8;
|
|
|
|
}
|
|
|
|
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, money32) = cost;
|
2015-05-28 20:33:09 +02:00
|
|
|
break;
|
|
|
|
case 1:
|
2015-05-28 23:07:39 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0);
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) = mapTile.x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) = mapTile.y;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) = mapTile.x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) = mapTile.y;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 4;
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
|
|
|
|
// If no change in ghost placement
|
2015-08-18 05:05:46 +02:00
|
|
|
if ((RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) & (1 << 1)) &&
|
|
|
|
mapTile.x == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) &&
|
|
|
|
mapTile.y == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) &&
|
|
|
|
(parameter2 & 0xFF) == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Z, uint8)){
|
2015-05-28 23:07:39 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
|
2015-05-30 08:04:15 +02:00
|
|
|
cost = try_place_ghost_scenery(
|
2015-05-28 23:07:39 +02:00
|
|
|
mapTile,
|
|
|
|
parameter1,
|
|
|
|
parameter2,
|
|
|
|
parameter3,
|
|
|
|
selected_tab);
|
|
|
|
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, money32) = cost;
|
2015-05-28 20:33:09 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2015-05-28 23:07:39 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0);
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) = mapTile.x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) = mapTile.y;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) = mapTile.x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) = mapTile.y;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 10 + parameter2 & 0xFF;
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
|
|
|
|
// If no change in ghost placement
|
2015-08-18 05:05:46 +02:00
|
|
|
if ((RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) & (1 << 2)) &&
|
|
|
|
mapTile.x == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) &&
|
|
|
|
mapTile.y == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) &&
|
2015-08-22 18:03:40 +02:00
|
|
|
(parameter2 & 0xFF) == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_WALL_ROTATION, uint8) &&
|
2015-05-28 23:07:39 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) == RCT2_GLOBAL(0x00F64F0A, sint16)
|
|
|
|
){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
|
2015-08-22 18:03:40 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_WALL_ROTATION, uint8) = (parameter2 & 0xFF);
|
2015-05-28 23:07:39 +02:00
|
|
|
RCT2_GLOBAL(0x00F64F0A, sint16) = RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16);
|
|
|
|
|
|
|
|
bl = 1;
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) != 0 &&
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) != 0){
|
|
|
|
bl = 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
cost = 0;
|
|
|
|
for (; bl != 0; bl--){
|
2015-05-30 08:04:15 +02:00
|
|
|
cost = try_place_ghost_scenery(
|
2015-05-28 23:07:39 +02:00
|
|
|
mapTile,
|
|
|
|
parameter1,
|
|
|
|
parameter2,
|
|
|
|
parameter3,
|
|
|
|
selected_tab);
|
|
|
|
|
|
|
|
if (cost != MONEY32_UNDEFINED)
|
|
|
|
break;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) += 8;
|
|
|
|
}
|
|
|
|
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, money32) = cost;
|
2015-05-28 20:33:09 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2015-05-29 20:08:46 +02:00
|
|
|
scenery = g_largeSceneryEntries[selected_scenery];
|
|
|
|
rct_xy16* selectedTile = gMapSelectionTiles;
|
|
|
|
|
|
|
|
for (rct_large_scenery_tile* tile = scenery->large_scenery.tiles; tile->x_offset != (sint16)0xFFFF; tile++){
|
2015-10-20 20:16:30 +02:00
|
|
|
rct_xy16 tileLocation = {
|
|
|
|
.x = tile->x_offset,
|
|
|
|
.y = tile->y_offset
|
2015-05-29 20:08:46 +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++;
|
|
|
|
}
|
|
|
|
selectedTile->x = 0xFFFF;
|
|
|
|
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 1);
|
|
|
|
map_invalidate_map_selection_tiles();
|
|
|
|
|
|
|
|
// If no change in ghost placement
|
2015-08-18 05:05:46 +02:00
|
|
|
if ((RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) & (1 << 3)) &&
|
|
|
|
mapTile.x == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) &&
|
|
|
|
mapTile.y == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) &&
|
2015-05-29 20:08:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) == RCT2_GLOBAL(0x00F64F0A, sint16) &&
|
2015-08-19 05:53:24 +02:00
|
|
|
(parameter3 & 0xFFFF) == RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_SELECTED_OBJECT, uint16)){
|
2015-05-29 20:08:46 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
|
2015-08-19 05:53:24 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_SELECTED_OBJECT, uint16) = (parameter3 & 0xFFFF);
|
2015-05-29 20:08:46 +02:00
|
|
|
RCT2_GLOBAL(0x00F64F0A, sint16) = RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16);
|
|
|
|
|
|
|
|
bl = 1;
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) != 0 &&
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) != 0){
|
|
|
|
bl = 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
cost = 0;
|
|
|
|
for (; bl != 0; bl--){
|
2015-05-30 08:04:15 +02:00
|
|
|
cost = try_place_ghost_scenery(
|
2015-05-29 20:08:46 +02:00
|
|
|
mapTile,
|
|
|
|
parameter1,
|
|
|
|
parameter2,
|
|
|
|
parameter3,
|
|
|
|
selected_tab);
|
|
|
|
|
|
|
|
if (cost != MONEY32_UNDEFINED)
|
|
|
|
break;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) += 8;
|
|
|
|
}
|
|
|
|
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, money32) = cost;
|
2015-05-28 20:33:09 +02:00
|
|
|
break;
|
|
|
|
case 4:
|
2015-05-28 23:07:39 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0);
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) = mapTile.x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) = mapTile.y;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) = mapTile.x;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) = mapTile.y;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 4;
|
|
|
|
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
|
|
|
|
// If no change in ghost placement
|
2015-08-18 05:05:46 +02:00
|
|
|
if ((RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) & (1 << 4)) &&
|
|
|
|
mapTile.x == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) &&
|
|
|
|
mapTile.y == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) &&
|
|
|
|
(parameter2 & 0xFF) == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Z, uint8) &&
|
2015-08-22 18:03:40 +02:00
|
|
|
((parameter2 >> 8) & 0xFF) == RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_ROTATION, uint8)){
|
2015-05-28 23:07:39 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
scenery_remove_ghost_tool_placement();
|
|
|
|
|
2015-05-30 08:04:15 +02:00
|
|
|
cost = try_place_ghost_scenery(
|
2015-05-28 23:07:39 +02:00
|
|
|
mapTile,
|
|
|
|
parameter1,
|
|
|
|
parameter2,
|
|
|
|
parameter3,
|
|
|
|
selected_tab);
|
|
|
|
|
2015-08-18 05:05:46 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, money32) = cost;
|
2015-05-28 20:33:09 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-04 04:34:12 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066CB25
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_top_toolbar_tool_update(rct_window* w, int widgetIndex, int x, int y)
|
2014-11-04 04:34:12 +01:00
|
|
|
{
|
2015-07-10 02:39:16 +02:00
|
|
|
switch (widgetIndex) {
|
2014-11-04 04:34:12 +01:00
|
|
|
case WIDX_CLEAR_SCENERY:
|
2015-05-26 18:55:25 +02:00
|
|
|
top_toolbar_tool_update_scenery_clear(x, y);
|
2014-11-04 04:34:12 +01:00
|
|
|
break;
|
|
|
|
case WIDX_LAND:
|
2015-10-11 13:26:33 +02:00
|
|
|
if (gLandPaintMode)
|
2015-06-02 22:43:21 +02:00
|
|
|
top_toolbar_tool_update_land_paint(x, y);
|
2015-05-12 17:37:16 +02:00
|
|
|
else
|
2015-05-26 21:36:05 +02:00
|
|
|
top_toolbar_tool_update_land(x, y);
|
2014-11-04 04:34:12 +01:00
|
|
|
break;
|
|
|
|
case WIDX_WATER:
|
2015-05-28 20:33:09 +02:00
|
|
|
top_toolbar_tool_update_water(x, y);
|
2014-11-04 04:34:12 +01:00
|
|
|
break;
|
|
|
|
case WIDX_SCENERY:
|
2015-05-28 23:07:39 +02:00
|
|
|
top_toolbar_tool_update_scenery(x, y);
|
2014-11-04 04:34:12 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-21 18:59:47 +02:00
|
|
|
/**
|
|
|
|
* rct2: 0x0066CB73
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_top_toolbar_tool_down(rct_window* w, int widgetIndex, int x, int y)
|
|
|
|
{
|
2014-10-21 18:59:47 +02:00
|
|
|
switch (widgetIndex){
|
|
|
|
case WIDX_CLEAR_SCENERY:
|
2014-11-04 04:34:12 +01:00
|
|
|
if (!RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) & (1 << 0))
|
|
|
|
break;
|
2014-10-21 18:59:47 +02:00
|
|
|
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_UNABLE_TO_REMOVE_ALL_SCENERY_FROM_HERE;
|
2014-10-21 18:59:47 +02:00
|
|
|
|
|
|
|
game_do_command(
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
|
2014-10-21 18:59:47 +02:00
|
|
|
1,
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
|
2015-07-18 19:22:59 +02:00
|
|
|
(gClearSmallScenery | gClearLargeScenery << 1 | gClearFootpath << 2),
|
2014-11-04 04:34:12 +01:00
|
|
|
GAME_COMMAND_CLEAR_SCENERY,
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16)
|
2014-11-23 17:28:23 +01:00
|
|
|
);
|
2014-11-04 04:34:12 +01:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TOOL, uint8) = 12;
|
2014-10-21 18:59:47 +02:00
|
|
|
break;
|
|
|
|
case WIDX_LAND:
|
2014-12-01 22:49:39 +01:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16)&(1 << 0)){
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_CHANGE_LAND_TYPE;
|
2014-12-01 22:49:39 +01:00
|
|
|
game_do_command(
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
|
2014-12-01 22:49:39 +01:00
|
|
|
1,
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
|
2014-12-01 22:49:39 +01:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) | (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) << 8),
|
2015-01-11 14:37:27 +01:00
|
|
|
GAME_COMMAND_CHANGE_SURFACE_STYLE,
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16)
|
2014-12-01 22:49:39 +01:00
|
|
|
);
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TOOL, uint8) = 3;
|
|
|
|
}
|
2014-10-21 18:59:47 +02:00
|
|
|
break;
|
|
|
|
case WIDX_WATER:
|
2014-12-01 22:49:39 +01:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16)&(1 << 0)){
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TOOL, uint8) = 3;
|
|
|
|
}
|
2014-10-21 18:59:47 +02:00
|
|
|
break;
|
|
|
|
case WIDX_SCENERY:
|
2015-02-09 19:32:58 +01:00
|
|
|
window_top_toolbar_scenery_tool_down(x, y, w, widgetIndex);
|
2014-10-21 18:59:47 +02:00
|
|
|
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
|
|
|
|
*/
|
2015-06-10 16:41:50 +02:00
|
|
|
money32 selection_raise_land(uint8 flags)
|
|
|
|
{
|
|
|
|
int centreX = (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) + RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16)) / 2;
|
|
|
|
int centreY = (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) + RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16)) / 2;
|
|
|
|
centreX += 16;
|
|
|
|
centreY += 16;
|
2015-02-19 17:33:26 +01:00
|
|
|
|
2015-06-10 16:41:50 +02:00
|
|
|
uint32 xBounds = (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) & 0xFFFF) | (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) << 16);
|
|
|
|
uint32 yBounds = (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) & 0xFFFF) | (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) << 16);
|
2015-02-19 17:33:26 +01:00
|
|
|
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_RAISE_LAND_HERE;
|
2015-10-11 13:26:33 +02:00
|
|
|
if (gLandMountainMode) {
|
2015-06-10 16:41:50 +02:00
|
|
|
return game_do_command(centreX, flags, centreY, xBounds, GAME_COMMAND_EDIT_LAND_SMOOTH, 1, yBounds);
|
|
|
|
} else {
|
|
|
|
return game_do_command(centreX, flags, centreY, xBounds, GAME_COMMAND_RAISE_LAND, RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16), yBounds);
|
2015-02-19 17:33:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006645B3
|
|
|
|
*/
|
2015-06-10 16:41:50 +02:00
|
|
|
money32 selection_lower_land(uint8 flags)
|
|
|
|
{
|
|
|
|
int centreX = (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) + RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16)) / 2;
|
|
|
|
int centreY = (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) + RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16)) / 2;
|
|
|
|
centreX += 16;
|
|
|
|
centreY += 16;
|
2015-02-19 17:33:26 +01:00
|
|
|
|
2015-06-10 16:41:50 +02:00
|
|
|
uint32 xBounds = (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) & 0xFFFF) | (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) << 16);
|
|
|
|
uint32 yBounds = (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) & 0xFFFF) | (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) << 16);
|
2015-02-19 17:33:26 +01:00
|
|
|
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_LOWER_LAND_HERE;
|
2015-10-11 13:26:33 +02:00
|
|
|
if (gLandMountainMode) {
|
2015-06-10 16:41:50 +02:00
|
|
|
return game_do_command(centreX, flags, centreY, xBounds, GAME_COMMAND_EDIT_LAND_SMOOTH, 0xFFFF, yBounds);
|
2015-02-19 17:33:26 +01:00
|
|
|
} else {
|
2015-06-10 16:41:50 +02:00
|
|
|
return game_do_command(centreX, flags, centreY, xBounds, GAME_COMMAND_LOWER_LAND, RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16), yBounds);
|
2015-02-19 17:33:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* part of window_top_toolbar_tool_drag(0x0066CB4E)
|
|
|
|
* rct2: 0x00664454
|
|
|
|
*/
|
2015-02-19 17:39:35 +01:00
|
|
|
void window_top_toolbar_land_tool_drag(short x, short y)
|
2015-02-19 17:33:26 +01:00
|
|
|
{
|
|
|
|
rct_window *window = window_find_from_point(x, y);
|
|
|
|
if (!window)
|
|
|
|
return;
|
|
|
|
int widget_index = window_find_widget_from_point(window, x, y);
|
2015-02-19 17:39:35 +01:00
|
|
|
if (widget_index == 0xFFFF)
|
2015-02-19 17:33:26 +01:00
|
|
|
return;
|
|
|
|
rct_widget *widget = &window->widgets[widget_index];
|
|
|
|
if (widget->type != WWT_VIEWPORT)
|
|
|
|
return;
|
|
|
|
rct_viewport *viewport = window->viewport;
|
|
|
|
if (!viewport)
|
|
|
|
return;
|
|
|
|
|
2015-04-18 09:40:43 +02:00
|
|
|
sint16 tile_height = -16 / (1 << viewport->zoom);
|
2015-02-19 17:33:26 +01:00
|
|
|
|
2015-04-18 09:40:43 +02:00
|
|
|
int y_diff = y - RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, uint16);
|
2015-02-19 17:33:26 +01:00
|
|
|
|
2015-04-18 09:40:43 +02:00
|
|
|
if (y_diff <= tile_height) {
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, uint16) += tile_height;
|
2015-02-19 17:33:26 +01:00
|
|
|
|
2015-04-18 09:40:43 +02:00
|
|
|
selection_raise_land(GAME_COMMAND_FLAG_APPLY);
|
2015-02-19 17:33:26 +01:00
|
|
|
|
2015-04-16 01:30:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, uint32) = MONEY32_UNDEFINED;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, uint32) = MONEY32_UNDEFINED;
|
2015-02-19 17:33:26 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-04-18 09:40:43 +02:00
|
|
|
if (y_diff >= -tile_height) {
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, uint16) -= tile_height;
|
2015-02-19 17:33:26 +01:00
|
|
|
|
2015-04-18 09:40:43 +02:00
|
|
|
selection_lower_land(GAME_COMMAND_FLAG_APPLY);
|
2015-02-19 17:33:26 +01:00
|
|
|
|
2015-04-16 01:30:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, uint32) = MONEY32_UNDEFINED;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, uint32) = MONEY32_UNDEFINED;
|
2015-02-19 17:33:26 +01:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-18 20:26:16 +01:00
|
|
|
/**
|
|
|
|
* part of window_top_toolbar_tool_drag(0x0066CB4E)
|
|
|
|
* rct2: 0x006E6D4B
|
|
|
|
*/
|
2015-02-19 17:39:35 +01:00
|
|
|
void window_top_toolbar_water_tool_drag(short x, short y)
|
2015-02-18 20:26:16 +01:00
|
|
|
{
|
|
|
|
rct_window *window = window_find_from_point(x, y);
|
|
|
|
if (!window)
|
|
|
|
return;
|
|
|
|
int widget_index = window_find_widget_from_point(window, x, y);
|
2015-02-19 17:39:35 +01:00
|
|
|
if (widget_index == 0xFFFF)
|
2015-02-18 20:26:16 +01:00
|
|
|
return;
|
|
|
|
rct_widget *widget = &window->widgets[widget_index];
|
|
|
|
if (widget->type != WWT_VIEWPORT)
|
|
|
|
return;
|
|
|
|
rct_viewport *viewport = window->viewport;
|
|
|
|
if (!viewport)
|
|
|
|
return;
|
|
|
|
|
|
|
|
sint16 dx = 0xFFF0;
|
|
|
|
dx >>= viewport->zoom;
|
|
|
|
|
|
|
|
y -= RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, uint16);
|
|
|
|
|
|
|
|
if (y <= dx) {
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, uint16) += dx;
|
|
|
|
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_RAISE_WATER_LEVEL_HERE;
|
2015-02-18 20:26:16 +01:00
|
|
|
|
|
|
|
game_do_command(
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
|
2015-02-18 20:26:16 +01:00
|
|
|
1,
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
|
2015-02-18 20:26:16 +01:00
|
|
|
dx,
|
|
|
|
GAME_COMMAND_RAISE_WATER,
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16)
|
2015-02-18 20:26:16 +01:00
|
|
|
);
|
2015-04-16 01:30:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_WATER_RAISE_COST, uint32) = MONEY32_UNDEFINED;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_WATER_LOWER_COST, uint32) = MONEY32_UNDEFINED;
|
2015-02-18 20:26:16 +01:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dx = -dx;
|
|
|
|
|
|
|
|
if (y >= dx) {
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, uint16) += dx;
|
|
|
|
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_LOWER_WATER_LEVEL_HERE;
|
2015-02-18 20:26:16 +01:00
|
|
|
|
|
|
|
game_do_command(
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
|
2015-02-18 20:26:16 +01:00
|
|
|
1,
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
|
2015-02-18 20:26:16 +01:00
|
|
|
dx,
|
|
|
|
GAME_COMMAND_LOWER_WATER,
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16)
|
2015-02-18 20:26:16 +01:00
|
|
|
);
|
2015-04-16 01:30:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_WATER_RAISE_COST, uint32) = MONEY32_UNDEFINED;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_WATER_LOWER_COST, uint32) = MONEY32_UNDEFINED;
|
2015-02-18 20:26:16 +01:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-04 04:34:12 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066CB4E
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_top_toolbar_tool_drag(rct_window* w, int widgetIndex, int x, int y)
|
2014-11-04 04:34:12 +01:00
|
|
|
{
|
|
|
|
switch (widgetIndex){
|
|
|
|
case WIDX_CLEAR_SCENERY:
|
|
|
|
if (window_find_by_class(WC_ERROR) != NULL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (!RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) & (1 << 0))
|
|
|
|
break;
|
|
|
|
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_UNABLE_TO_REMOVE_ALL_SCENERY_FROM_HERE;
|
2014-11-04 04:34:12 +01:00
|
|
|
|
|
|
|
game_do_command(
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
|
2014-11-04 04:34:12 +01:00
|
|
|
1,
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
|
2015-07-18 19:22:59 +02:00
|
|
|
(gClearSmallScenery | gClearLargeScenery << 1 | gClearFootpath << 2),
|
2014-11-04 04:34:12 +01:00
|
|
|
GAME_COMMAND_CLEAR_SCENERY,
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16)
|
2014-11-04 04:34:12 +01:00
|
|
|
);
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TOOL, uint8) = 12;
|
|
|
|
break;
|
|
|
|
case WIDX_LAND:
|
2015-05-12 17:37:16 +02:00
|
|
|
// Custom setting to only change land style instead of raising or lowering land
|
2015-10-11 13:26:33 +02:00
|
|
|
if (gLandPaintMode) {
|
2015-05-12 17:37:16 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16)&(1 << 0)){
|
2015-08-27 16:44:18 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_CHANGE_LAND_TYPE;
|
2015-05-12 17:37:16 +02:00
|
|
|
game_do_command(
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
|
2015-05-12 17:37:16 +02:00
|
|
|
1,
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
|
2015-05-12 17:37:16 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) | (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) << 8),
|
|
|
|
GAME_COMMAND_CHANGE_SURFACE_STYLE,
|
2015-06-09 15:47:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16)
|
2015-05-12 17:37:16 +02:00
|
|
|
);
|
|
|
|
// The tool is set to 12 here instead of 3 so that the dragging cursor is not the elevation change cursor
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TOOL, uint8) = 12;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
window_top_toolbar_land_tool_drag(x, y);
|
|
|
|
}
|
2014-11-04 04:34:12 +01:00
|
|
|
break;
|
|
|
|
case WIDX_WATER:
|
2015-02-19 17:39:35 +01:00
|
|
|
window_top_toolbar_water_tool_drag(x, y);
|
2014-11-04 04:34:12 +01:00
|
|
|
break;
|
|
|
|
case WIDX_SCENERY:
|
2015-04-16 20:37:51 +02:00
|
|
|
if (window_scenery_is_repaint_scenery_tool_on & 1)
|
|
|
|
window_top_toolbar_scenery_tool_down(x, y, w, widgetIndex);
|
2014-11-04 04:34:12 +01:00
|
|
|
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
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_top_toolbar_tool_up(rct_window* w, int widgetIndex, int x, int y)
|
2015-10-20 20:16:30 +02:00
|
|
|
{
|
2015-06-26 17:40:37 +02:00
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_LAND:
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= 0xFFFE;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TOOL, uint8) = 0x12;
|
|
|
|
break;
|
|
|
|
case WIDX_WATER:
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= 0xFFFE;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TOOL, uint8) = 0x13;
|
|
|
|
break;
|
|
|
|
case WIDX_CLEAR_SCENERY:
|
|
|
|
map_invalidate_selection_rect();
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= 0xFFFE;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TOOL, uint8) = 0x0C;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2015-06-26 17:40:37 +02:00
|
|
|
* rct2: 0x0066CA58
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_top_toolbar_tool_abort(rct_window *w, int widgetIndex)
|
2015-06-26 17:40:37 +02:00
|
|
|
{
|
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_LAND:
|
|
|
|
case WIDX_WATER:
|
|
|
|
case WIDX_CLEAR_SCENERY:
|
|
|
|
hide_gridlines();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2015-05-19 00:16:43 +02:00
|
|
|
|
|
|
|
void top_toolbar_init_fastforward_menu(rct_window* w, rct_widget* widget) {
|
|
|
|
int num_items = 4;
|
|
|
|
gDropdownItemsFormat[0] = 1156;
|
|
|
|
gDropdownItemsFormat[1] = 1156;
|
|
|
|
gDropdownItemsFormat[2] = 1156;
|
|
|
|
gDropdownItemsFormat[3] = 1156;
|
|
|
|
if (gConfigGeneral.debugging_tools) {
|
|
|
|
gDropdownItemsFormat[4] = 0;
|
|
|
|
gDropdownItemsFormat[5] = 1156;
|
|
|
|
gDropdownItemsArgs[5] = 5146;
|
|
|
|
num_items = 6;
|
|
|
|
}
|
|
|
|
|
|
|
|
gDropdownItemsArgs[0] = 5142;
|
|
|
|
gDropdownItemsArgs[1] = 5143;
|
|
|
|
gDropdownItemsArgs[2] = 5144;
|
|
|
|
gDropdownItemsArgs[3] = 5145;
|
2015-07-09 12:45:47 +02:00
|
|
|
|
2015-05-19 00:16:43 +02:00
|
|
|
|
|
|
|
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
|
2015-10-14 21:54:02 +02:00
|
|
|
if (gGameSpeed <= 4) {
|
|
|
|
dropdown_set_checked(gGameSpeed - 1, true);
|
|
|
|
}
|
|
|
|
if (gGameSpeed == 8) {
|
|
|
|
dropdown_set_checked(5, true);
|
|
|
|
}
|
2015-05-19 00:16:43 +02:00
|
|
|
|
|
|
|
if (gConfigGeneral.debugging_tools)
|
|
|
|
RCT2_GLOBAL(0x9DEBA2, uint16) = (gGameSpeed == 8 ? 0 : gGameSpeed);
|
|
|
|
else
|
|
|
|
RCT2_GLOBAL(0x9DEBA2, uint16) = (gGameSpeed >= 4 ? 0 : gGameSpeed);
|
|
|
|
}
|
|
|
|
|
|
|
|
void top_toolbar_fastforward_menu_dropdown(short dropdownIndex) {
|
|
|
|
if (dropdownIndex == -1) dropdownIndex = RCT2_GLOBAL(0x9DEBA2, uint16);
|
|
|
|
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-07-09 12:45:47 +02:00
|
|
|
void top_toolbar_init_rotate_menu(rct_window* w, rct_widget* widget) {
|
|
|
|
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
|
|
|
|
);
|
|
|
|
|
|
|
|
RCT2_GLOBAL(0x9DEBA2, uint16) = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void top_toolbar_rotate_menu_dropdown(short dropdownIndex) {
|
|
|
|
if (dropdownIndex == -1) dropdownIndex = RCT2_GLOBAL(0x9DEBA2, uint16);
|
|
|
|
rct_window* w = window_get_main();
|
|
|
|
if (w) {
|
|
|
|
if (dropdownIndex == 0) {
|
2015-07-09 13:05:21 +02:00
|
|
|
window_rotate_camera(w, 1);
|
2015-07-09 12:45:47 +02:00
|
|
|
window_invalidate(w);
|
|
|
|
}
|
|
|
|
else if (dropdownIndex == 1){
|
2015-07-09 13:05:21 +02:00
|
|
|
window_rotate_camera(w, -1);
|
2015-07-09 12:45:47 +02:00
|
|
|
window_invalidate(w);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-01 03:33:56 +02:00
|
|
|
void top_toolbar_init_debug_menu(rct_window* w, rct_widget* widget) {
|
|
|
|
gDropdownItemsFormat[0] = STR_DEBUG_DROPDOWN_CONSOLE;
|
|
|
|
gDropdownItemsFormat[1] = STR_DEBUG_DROPDOWN_TILE_INSPECTOR;
|
2015-06-20 16:07:36 +02:00
|
|
|
gDropdownItemsFormat[2] = STR_DEBUG_DROPDOWN_OBJECT_SELECTION;
|
2015-08-12 15:31:52 +02:00
|
|
|
gDropdownItemsFormat[3] = STR_DEBUG_DROPDOWN_INVENTIONS_LIST;
|
|
|
|
gDropdownItemsFormat[4] = STR_DEBUG_DROPDOWN_SCENARIO_OPTIONS;
|
2015-06-01 03:33:56 +02:00
|
|
|
|
|
|
|
window_dropdown_show_text(
|
|
|
|
w->x + widget->left,
|
|
|
|
w->y + widget->top,
|
|
|
|
widget->bottom - widget->top + 1,
|
2015-08-27 13:27:46 +02:00
|
|
|
w->colours[0] | 0x80,
|
2015-06-01 03:33:56 +02:00
|
|
|
0,
|
2015-08-12 15:31:52 +02:00
|
|
|
5
|
2015-06-01 03:33:56 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
RCT2_GLOBAL(0x9DEBA2, uint16) = 0;
|
|
|
|
}
|
|
|
|
|
2015-07-16 19:32:43 +02:00
|
|
|
void top_toolbar_init_network_menu(rct_window* w, rct_widget* widget) {
|
|
|
|
gDropdownItemsFormat[0] = STR_PLAYER_LIST;
|
|
|
|
|
|
|
|
window_dropdown_show_text(
|
|
|
|
w->x + widget->left,
|
|
|
|
w->y + widget->top,
|
|
|
|
widget->bottom - widget->top + 1,
|
2015-08-27 13:27:46 +02:00
|
|
|
w->colours[0] | 0x80,
|
2015-07-16 19:32:43 +02:00
|
|
|
0,
|
|
|
|
1
|
|
|
|
);
|
|
|
|
|
|
|
|
RCT2_GLOBAL(0x9DEBA2, uint16) = 0;
|
|
|
|
}
|
|
|
|
|
2015-06-01 03:33:56 +02:00
|
|
|
void top_toolbar_debug_menu_dropdown(short dropdownIndex) {
|
|
|
|
if (dropdownIndex == -1) dropdownIndex = RCT2_GLOBAL(0x9DEBA2, uint16);
|
|
|
|
rct_window* w = window_get_main();
|
|
|
|
if (w) {
|
|
|
|
switch (dropdownIndex) {
|
|
|
|
case DDIDX_CONSOLE:
|
|
|
|
console_open();
|
|
|
|
break;
|
|
|
|
case DDIDX_TILE_INSPECTOR:
|
|
|
|
window_tile_inspector_open();
|
|
|
|
break;
|
2015-06-20 16:07:36 +02:00
|
|
|
case DDIDX_OBJECT_SELECTION:
|
|
|
|
window_close_all();
|
|
|
|
window_editor_object_selection_open();
|
|
|
|
break;
|
2015-08-12 15:31:52 +02:00
|
|
|
case DDIDX_INVENTIONS_LIST:
|
|
|
|
window_editor_inventions_list_open();
|
|
|
|
break;
|
|
|
|
case DDIDX_SCENARIO_OPTIONS:
|
|
|
|
window_editor_scenario_options_open();
|
|
|
|
break;
|
2015-06-01 03:33:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-16 19:32:43 +02:00
|
|
|
void top_toolbar_network_menu_dropdown(short dropdownIndex) {
|
|
|
|
if (dropdownIndex == -1) dropdownIndex = RCT2_GLOBAL(0x9DEBA2, uint16);
|
|
|
|
rct_window* w = window_get_main();
|
|
|
|
if (w) {
|
|
|
|
switch (dropdownIndex) {
|
|
|
|
case DDIDX_PLAYER_LIST:
|
|
|
|
window_player_list_open();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-10 15:41:35 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066CDE4
|
|
|
|
*/
|
|
|
|
void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget) {
|
|
|
|
gDropdownItemsFormat[0] = 1156;
|
|
|
|
gDropdownItemsFormat[1] = 1156;
|
|
|
|
gDropdownItemsFormat[2] = 1156;
|
|
|
|
gDropdownItemsFormat[3] = 0;
|
|
|
|
gDropdownItemsFormat[4] = 1156;
|
|
|
|
gDropdownItemsFormat[5] = 1156;
|
|
|
|
gDropdownItemsFormat[6] = 1156;
|
|
|
|
gDropdownItemsFormat[7] = 1156;
|
|
|
|
gDropdownItemsFormat[8] = 0;
|
|
|
|
gDropdownItemsFormat[9] = 1156;
|
|
|
|
gDropdownItemsFormat[10] = 1156;
|
|
|
|
gDropdownItemsFormat[11] = 1156;
|
|
|
|
|
|
|
|
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_INVISIBLE_SUPPORTS;
|
|
|
|
gDropdownItemsArgs[7] = STR_INVISIBLE_PEOPLE;
|
|
|
|
gDropdownItemsArgs[9] = STR_HEIGHT_MARKS_ON_LAND;
|
|
|
|
gDropdownItemsArgs[10] = STR_HEIGHT_MARKS_ON_RIDE_TRACKS;
|
|
|
|
gDropdownItemsArgs[11] = STR_HEIGHT_MARKS_ON_PATHS;
|
|
|
|
|
|
|
|
window_dropdown_show_text(
|
|
|
|
w->x + widget->left,
|
|
|
|
w->y + widget->top,
|
|
|
|
widget->bottom - widget->top + 1,
|
|
|
|
w->colours[1] | 0x80,
|
|
|
|
0,
|
|
|
|
12
|
|
|
|
);
|
|
|
|
|
|
|
|
// Set checkmarks
|
|
|
|
rct_viewport* mainViewport = window_get_main()->viewport;
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE)
|
2015-10-14 21:54:02 +02:00
|
|
|
dropdown_set_checked(0, true);
|
2015-02-10 15:41:35 +01:00
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_HIDE_BASE)
|
2015-10-14 21:54:02 +02:00
|
|
|
dropdown_set_checked(1, true);
|
2015-02-10 15:41:35 +01:00
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_HIDE_VERTICAL)
|
2015-10-14 21:54:02 +02:00
|
|
|
dropdown_set_checked(2, true);
|
2015-02-10 15:41:35 +01:00
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_SEETHROUGH_RIDES)
|
2015-10-14 21:54:02 +02:00
|
|
|
dropdown_set_checked(4, true);
|
2015-02-10 15:41:35 +01:00
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_SEETHROUGH_SCENERY)
|
2015-10-14 21:54:02 +02:00
|
|
|
dropdown_set_checked(5, true);
|
2015-02-10 15:41:35 +01:00
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS)
|
2015-10-14 21:54:02 +02:00
|
|
|
dropdown_set_checked(6, true);
|
2015-02-10 15:41:35 +01:00
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_INVISIBLE_PEEPS)
|
2015-10-14 21:54:02 +02:00
|
|
|
dropdown_set_checked(7, true);
|
2015-02-10 15:41:35 +01:00
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_LAND_HEIGHTS)
|
2015-10-14 21:54:02 +02:00
|
|
|
dropdown_set_checked(9, true);
|
2015-02-10 15:41:35 +01:00
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_TRACK_HEIGHTS)
|
2015-10-14 21:54:02 +02:00
|
|
|
dropdown_set_checked(10, true);
|
2015-02-10 15:41:35 +01:00
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_PATH_HEIGHTS)
|
2015-10-14 21:54:02 +02:00
|
|
|
dropdown_set_checked(11, true);
|
2015-02-10 15:41:35 +01:00
|
|
|
|
|
|
|
RCT2_GLOBAL(0x9DEBA2, uint16) = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066CF8A
|
|
|
|
*/
|
|
|
|
void top_toolbar_view_menu_dropdown(short dropdownIndex) {
|
|
|
|
if (dropdownIndex == -1) dropdownIndex = RCT2_GLOBAL(0x9DEBA2, uint16);
|
|
|
|
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_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;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
window_invalidate(w);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066CCE7
|
|
|
|
*/
|
|
|
|
void toggle_footpath_window()
|
|
|
|
{
|
|
|
|
if (window_find_by_class(WC_FOOTPATH) == NULL) {
|
|
|
|
window_footpath_open();
|
|
|
|
} else {
|
|
|
|
tool_cancel();
|
|
|
|
window_close_by_class(WC_FOOTPATH);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066CD54
|
|
|
|
*/
|
|
|
|
void toggle_land_window(rct_window *topToolbar, int widgetIndex)
|
|
|
|
{
|
|
|
|
if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 7) {
|
|
|
|
tool_cancel();
|
|
|
|
} else {
|
|
|
|
show_gridlines();
|
|
|
|
tool_set(topToolbar, widgetIndex, 18);
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1;
|
|
|
|
window_land_open();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066CD0C
|
|
|
|
*/
|
|
|
|
void toggle_clear_scenery_window(rct_window *topToolbar, int widgetIndex)
|
|
|
|
{
|
|
|
|
if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 16) {
|
|
|
|
tool_cancel();
|
|
|
|
} else {
|
|
|
|
show_gridlines();
|
|
|
|
tool_set(topToolbar, widgetIndex, 12);
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 2;
|
|
|
|
window_clear_scenery_open();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066CD9C
|
|
|
|
*/
|
|
|
|
void toggle_water_window(rct_window *topToolbar, int widgetIndex)
|
|
|
|
{
|
|
|
|
if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 8) {
|
|
|
|
tool_cancel();
|
|
|
|
} else {
|
|
|
|
show_gridlines();
|
|
|
|
tool_set(topToolbar, widgetIndex, 19);
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1;
|
|
|
|
window_water_open();
|
|
|
|
}
|
2015-05-12 16:13:30 +02:00
|
|
|
}
|
2015-07-02 18:00:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066D104
|
|
|
|
*/
|
|
|
|
bool land_tool_is_active()
|
|
|
|
{
|
|
|
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE))
|
|
|
|
return false;
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) != WC_TOP_TOOLBAR)
|
|
|
|
return false;
|
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, sint16) != WIDX_LAND)
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|