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.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2014-05-19 21:10:32 +02:00
|
|
|
#include <string.h>
|
2014-10-06 18:36:58 +02:00
|
|
|
#include "../addresses.h"
|
|
|
|
#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"
|
|
|
|
#include "../localisation/localisation.h"
|
|
|
|
#include "../interface/widget.h"
|
|
|
|
#include "../interface/window.h"
|
|
|
|
#include "dropdown.h"
|
|
|
|
#include "../interface/viewport.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,
|
|
|
|
|
2014-08-15 23:05:35 +02:00
|
|
|
WIDX_FASTFORWARD,
|
|
|
|
WIDX_RESEARCH
|
2014-04-11 03:42:39 +02:00
|
|
|
};
|
|
|
|
|
2014-08-10 10:34:27 +02:00
|
|
|
typedef enum {
|
|
|
|
DDIDX_LOAD_GAME = 0,
|
|
|
|
DDIDX_SAVE_GAME = 1,
|
|
|
|
DDIDX_ABOUT = 3,
|
|
|
|
DDIDX_OPTIONS = 4,
|
|
|
|
DDIDX_SCREENSHOT = 5,
|
|
|
|
DDIDX_QUIT_GAME = 7,
|
|
|
|
} FILE_MENU_DDIDX;
|
|
|
|
|
|
|
|
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,
|
|
|
|
} VIEW_MENU_DDIDX;
|
|
|
|
|
2014-04-11 04:58:17 +02:00
|
|
|
static rct_widget window_game_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
|
|
|
|
|
2014-08-15 23:05:35 +02:00
|
|
|
{ WWT_TRNBTN, 0, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, STR_NONE }, // Fast forward
|
|
|
|
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, 2275 }, // Research
|
2014-04-11 03:42:39 +02:00
|
|
|
{ WIDGETS_END },
|
|
|
|
};
|
|
|
|
|
2014-04-11 04:58:17 +02:00
|
|
|
static void window_game_top_toolbar_emptysub() { }
|
|
|
|
static void window_game_top_toolbar_mouseup();
|
2014-05-28 23:22:09 +02:00
|
|
|
static void window_game_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widget* widget);
|
2014-04-11 04:58:17 +02:00
|
|
|
static void window_game_top_toolbar_dropdown();
|
|
|
|
static void window_game_top_toolbar_invalidate();
|
|
|
|
static void window_game_top_toolbar_paint();
|
|
|
|
|
2014-05-12 03:18:08 +02:00
|
|
|
static void* window_game_top_toolbar_events[] = {
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_mouseup,
|
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_mousedown,
|
|
|
|
window_game_top_toolbar_dropdown,
|
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_emptysub,
|
2014-05-12 03:18:08 +02:00
|
|
|
(void*)0x0066CB25,
|
|
|
|
(void*)0x0066CB73,
|
|
|
|
(void*)0x0066CB4E,
|
|
|
|
(void*)0x0066CC5B,
|
|
|
|
(void*)0x0066CA58,
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_emptysub,
|
|
|
|
window_game_top_toolbar_invalidate,
|
|
|
|
window_game_top_toolbar_paint,
|
|
|
|
window_game_top_toolbar_emptysub
|
2014-04-11 03:42:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates the main game top toolbar window.
|
|
|
|
* rct2: 0x0066B485 (part of 0x0066B3E8)
|
|
|
|
*/
|
2014-04-11 04:58:17 +02:00
|
|
|
void window_game_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,
|
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16), 28,
|
2014-05-12 03:18:08 +02:00
|
|
|
(uint32*)window_game_top_toolbar_events,
|
2014-04-24 21:26:05 +02:00
|
|
|
WC_TOP_TOOLBAR,
|
|
|
|
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_5
|
|
|
|
);
|
2014-04-11 04:58:17 +02:00
|
|
|
window->widgets = window_game_top_toolbar_widgets;
|
2014-08-17 11:11:19 +02:00
|
|
|
|
|
|
|
window->enabled_widgets |=
|
|
|
|
(1 << WIDX_PAUSE) |
|
|
|
|
(1 << WIDX_FILE_MENU) |
|
|
|
|
(1 << WIDX_ZOOM_OUT) |
|
|
|
|
(1 << WIDX_ZOOM_IN) |
|
|
|
|
(1 << WIDX_ROTATE) |
|
|
|
|
(1 << WIDX_VIEW_MENU) |
|
|
|
|
(1 << WIDX_MAP) |
|
|
|
|
(1 << WIDX_LAND) |
|
|
|
|
(1 << WIDX_WATER) |
|
|
|
|
(1 << WIDX_SCENERY) |
|
|
|
|
(1 << WIDX_PATH) |
|
|
|
|
(1 << WIDX_CONSTRUCT_RIDE) |
|
|
|
|
(1 << WIDX_RIDES) |
|
|
|
|
(1 << WIDX_PARK) |
|
|
|
|
(1 << WIDX_STAFF) |
|
2014-08-30 15:29:14 +02:00
|
|
|
(1 << WIDX_GUESTS) |
|
2014-08-17 11:11:19 +02:00
|
|
|
(1 << WIDX_CLEAR_SCENERY) |
|
|
|
|
(1ULL << WIDX_FASTFORWARD) |
|
|
|
|
(1ULL << WIDX_RESEARCH);
|
|
|
|
|
2014-04-11 03:42:39 +02:00
|
|
|
window_init_scroll_widgets(window);
|
|
|
|
window->colours[0] = 7;
|
|
|
|
window->colours[1] = 12;
|
|
|
|
window->colours[2] = 24;
|
|
|
|
window->colours[3] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066C957
|
|
|
|
*/
|
2014-04-11 04:58:17 +02:00
|
|
|
static void window_game_top_toolbar_mouseup()
|
2014-04-11 03:42:39 +02:00
|
|
|
{
|
|
|
|
short widgetIndex;
|
|
|
|
rct_window *w, *mainWindow;
|
|
|
|
|
2014-08-19 19:47:12 +02:00
|
|
|
window_widget_get_registers(w, widgetIndex);
|
2014-04-11 03:42:39 +02:00
|
|
|
|
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_PAUSE:
|
2014-08-06 21:06:51 +02:00
|
|
|
game_do_command(0, 1, 0, 0, GAME_COMMAND_TOGGLE_PAUSE, 0, 0);
|
2014-08-17 11:11:19 +02:00
|
|
|
// Not sure where this was done in the original code
|
|
|
|
w->pressed_widgets ^= (1 << WIDX_PAUSE);
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
|
|
|
case WIDX_FASTFORWARD:
|
2014-05-28 10:39:58 +02:00
|
|
|
// This is an excellent place to add in debugging statements and
|
|
|
|
// print routines, that will be triggered when you press the
|
|
|
|
// button in the game. Use "git update-index --skip-worktree
|
|
|
|
// src/window_game_top_toolbar" to avoid committing these changes to
|
|
|
|
// version control.
|
2014-10-12 16:48:21 +02:00
|
|
|
window_cheats_open();
|
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_ROTATE:
|
|
|
|
if ((mainWindow = window_get_main()) != NULL)
|
|
|
|
window_rotate_camera(mainWindow);
|
|
|
|
break;
|
|
|
|
case WIDX_CLEAR_SCENERY:
|
2014-10-15 23:59:26 +02:00
|
|
|
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) {
|
2014-04-30 17:57:27 +02:00
|
|
|
tool_cancel();
|
2014-04-11 03:42:39 +02:00
|
|
|
} else {
|
|
|
|
show_gridlines();
|
2014-04-30 17:57:27 +02:00
|
|
|
tool_set(w, WIDX_CLEAR_SCENERY, 12);
|
2014-10-15 23:59:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
|
2014-04-11 03:42:39 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 2;
|
2014-04-18 20:51:18 +02:00
|
|
|
window_clear_scenery_open();
|
2014-04-11 03:42:39 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WIDX_LAND:
|
2014-10-15 23:59:26 +02:00
|
|
|
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) {
|
2014-04-30 17:57:27 +02:00
|
|
|
tool_cancel();
|
2014-04-11 03:42:39 +02:00
|
|
|
} else {
|
|
|
|
show_gridlines();
|
2014-04-30 17:57:27 +02:00
|
|
|
tool_set(w, WIDX_LAND, 18);
|
2014-10-15 23:59:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
|
2014-04-11 03:42:39 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1;
|
2014-04-13 23:23:56 +02:00
|
|
|
window_land_open();
|
2014-04-11 03:42:39 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WIDX_WATER:
|
2014-10-15 23:59:26 +02:00
|
|
|
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) {
|
2014-04-30 17:57:27 +02:00
|
|
|
tool_cancel();
|
2014-04-11 03:42:39 +02:00
|
|
|
} else {
|
|
|
|
show_gridlines();
|
2014-04-30 17:57:27 +02:00
|
|
|
tool_set(w, WIDX_WATER, 19);
|
2014-10-15 23:59:26 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
|
2014-04-11 03:42:39 +02:00
|
|
|
RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1;
|
2014-04-14 04:09:51 +02:00
|
|
|
window_water_open();
|
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-10-16 03:02:43 +02:00
|
|
|
if (window_find_by_class(WC_FOOTPATH) == NULL) {
|
2014-04-28 18:35:12 +02:00
|
|
|
window_footpath_open();
|
2014-04-11 03:42:39 +02:00
|
|
|
} else {
|
2014-04-30 17:57:27 +02:00
|
|
|
tool_cancel();
|
2014-10-16 03:02:43 +02:00
|
|
|
window_close_by_class(WC_FOOTPATH);
|
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;
|
2014-08-15 23:05:35 +02:00
|
|
|
case WIDX_RESEARCH:
|
|
|
|
window_research_open();
|
|
|
|
break;
|
2014-04-11 03:42:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066CA3B
|
|
|
|
*/
|
2014-05-28 23:22:09 +02:00
|
|
|
static void window_game_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widget* widget)
|
2014-04-11 03:42:39 +02:00
|
|
|
{
|
|
|
|
rct_viewport *mainViewport;
|
|
|
|
|
2014-10-12 16:48:21 +02:00
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_FILE_MENU:
|
2014-04-11 03:42:39 +02:00
|
|
|
gDropdownItemsFormat[0] = 882;
|
|
|
|
gDropdownItemsFormat[1] = 883;
|
|
|
|
gDropdownItemsFormat[2] = 0;
|
|
|
|
gDropdownItemsFormat[3] = 847;
|
|
|
|
gDropdownItemsFormat[4] = 2327;
|
|
|
|
gDropdownItemsFormat[5] = 891;
|
|
|
|
gDropdownItemsFormat[6] = 0;
|
|
|
|
gDropdownItemsFormat[7] = 886;
|
|
|
|
window_dropdown_show_text(
|
|
|
|
w->x + widget->left,
|
|
|
|
w->y + widget->top,
|
|
|
|
widget->bottom - widget->top + 1,
|
|
|
|
w->colours[0] | 0x80,
|
|
|
|
0x80,
|
|
|
|
8
|
|
|
|
);
|
2014-10-12 16:48:21 +02:00
|
|
|
break;
|
|
|
|
case WIDX_VIEW_MENU:
|
2014-04-11 03:42:39 +02:00
|
|
|
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] = 939;
|
|
|
|
gDropdownItemsArgs[1] = 940;
|
|
|
|
gDropdownItemsArgs[2] = 941;
|
|
|
|
gDropdownItemsArgs[4] = 942;
|
|
|
|
gDropdownItemsArgs[5] = 943;
|
|
|
|
gDropdownItemsArgs[6] = 1051;
|
|
|
|
gDropdownItemsArgs[7] = 1052;
|
|
|
|
gDropdownItemsArgs[9] = 1154;
|
|
|
|
gDropdownItemsArgs[10] = 1153;
|
|
|
|
gDropdownItemsArgs[11] = 1155;
|
|
|
|
|
|
|
|
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
|
|
|
|
mainViewport = window_get_main()->viewport;
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE)
|
|
|
|
gDropdownItemsChecked |= (1 << 0);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_HIDE_BASE)
|
|
|
|
gDropdownItemsChecked |= (1 << 1);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_HIDE_VERTICAL)
|
|
|
|
gDropdownItemsChecked |= (1 << 2);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_SEETHROUGH_RIDES)
|
|
|
|
gDropdownItemsChecked |= (1 << 4);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_SEETHROUGH_SCENERY)
|
|
|
|
gDropdownItemsChecked |= (1 << 5);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS)
|
|
|
|
gDropdownItemsChecked |= (1 << 6);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_INVISIBLE_PEEPS)
|
|
|
|
gDropdownItemsChecked |= (1 << 7);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_LAND_HEIGHTS)
|
|
|
|
gDropdownItemsChecked |= (1 << 9);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_TRACK_HEIGHTS)
|
|
|
|
gDropdownItemsChecked |= (1 << 10);
|
|
|
|
if (mainViewport->flags & VIEWPORT_FLAG_PATH_HEIGHTS)
|
|
|
|
gDropdownItemsChecked |= (1 << 11);
|
2014-08-10 10:34:27 +02:00
|
|
|
|
|
|
|
RCT2_GLOBAL(0x9DEBA2, uint16) = 0;
|
2014-10-12 16:48:21 +02:00
|
|
|
break;
|
|
|
|
case WIDX_MAP:
|
|
|
|
gDropdownItemsFormat[0] = 2523;
|
|
|
|
gDropdownItemsFormat[1] = 2780;
|
|
|
|
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;
|
|
|
|
break;
|
2014-04-11 03:42:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066C9EA
|
|
|
|
*/
|
2014-04-11 04:58:17 +02:00
|
|
|
static void window_game_top_toolbar_dropdown()
|
2014-04-11 03:42:39 +02:00
|
|
|
{
|
|
|
|
short widgetIndex, dropdownIndex;
|
2014-10-14 04:38:46 +02:00
|
|
|
rct_window* w, *mainWindow;
|
2014-04-11 03:42:39 +02:00
|
|
|
|
2014-08-19 19:47:12 +02:00
|
|
|
window_dropdown_get_registers(w, widgetIndex, dropdownIndex);
|
2014-04-11 03:42:39 +02:00
|
|
|
|
2014-10-12 16:48:21 +02:00
|
|
|
switch (widgetIndex) {
|
|
|
|
case WIDX_FILE_MENU:
|
2014-04-11 03:42:39 +02:00
|
|
|
switch (dropdownIndex) {
|
2014-08-10 10:34:27 +02:00
|
|
|
case DDIDX_LOAD_GAME: // 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;
|
2014-08-10 10:34:27 +02:00
|
|
|
case DDIDX_SAVE_GAME: // save game
|
2014-04-30 17:57:27 +02:00
|
|
|
tool_cancel();
|
2014-05-27 23:33:16 +02:00
|
|
|
save_game();
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
2014-08-10 10:34:27 +02:00
|
|
|
case DDIDX_ABOUT: // about
|
2014-04-28 03:35:37 +02:00
|
|
|
window_about_open();
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
2014-08-10 10:34:27 +02:00
|
|
|
case DDIDX_OPTIONS: // options
|
2014-05-11 17:24:52 +02:00
|
|
|
window_options_open();
|
2014-04-11 03:42:39 +02:00
|
|
|
break;
|
2014-08-10 10:34:27 +02:00
|
|
|
case DDIDX_SCREENSHOT: // 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;
|
2014-08-10 10:34:27 +02:00
|
|
|
case DDIDX_QUIT_GAME: // quit game
|
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;
|
|
|
|
}
|
2014-10-14 04:38:46 +02:00
|
|
|
break;
|
2014-10-12 16:48:21 +02:00
|
|
|
case WIDX_VIEW_MENU:
|
2014-08-10 10:34:27 +02:00
|
|
|
if (dropdownIndex == -1) dropdownIndex = RCT2_GLOBAL(0x9DEBA2, uint16);
|
2014-10-14 04:38:46 +02:00
|
|
|
mainWindow = window_get_main();
|
|
|
|
if (mainWindow) {
|
2014-08-10 10:34:27 +02:00
|
|
|
switch (dropdownIndex){
|
|
|
|
case DDIDX_UNDERGROUND_INSIDE:
|
2014-10-14 04:38:46 +02:00
|
|
|
mainWindow->viewport->flags ^= VIEWPORT_FLAG_UNDERGROUND_INSIDE;
|
2014-08-10 10:34:27 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_HIDE_BASE:
|
2014-10-14 04:38:46 +02:00
|
|
|
mainWindow->viewport->flags ^= VIEWPORT_FLAG_HIDE_BASE;
|
2014-08-10 10:34:27 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_HIDE_VERTICAL:
|
2014-10-14 04:38:46 +02:00
|
|
|
mainWindow->viewport->flags ^= VIEWPORT_FLAG_HIDE_VERTICAL;
|
2014-08-10 10:34:27 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_SEETHROUGH_RIDES:
|
2014-10-14 04:38:46 +02:00
|
|
|
mainWindow->viewport->flags ^= VIEWPORT_FLAG_SEETHROUGH_RIDES;
|
2014-08-10 10:34:27 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_SEETHROUGH_SCENARY:
|
2014-10-14 04:38:46 +02:00
|
|
|
mainWindow->viewport->flags ^= VIEWPORT_FLAG_SEETHROUGH_SCENERY;
|
2014-08-10 10:34:27 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_INVISIBLE_SUPPORTS:
|
2014-10-14 04:38:46 +02:00
|
|
|
mainWindow->viewport->flags ^= VIEWPORT_FLAG_INVISIBLE_SUPPORTS;
|
2014-08-10 10:34:27 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_INVISIBLE_PEEPS:
|
2014-10-14 04:38:46 +02:00
|
|
|
mainWindow->viewport->flags ^= VIEWPORT_FLAG_INVISIBLE_PEEPS;
|
2014-08-10 10:34:27 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_LAND_HEIGHTS:
|
2014-10-14 04:38:46 +02:00
|
|
|
mainWindow->viewport->flags ^= VIEWPORT_FLAG_LAND_HEIGHTS;
|
2014-08-10 10:34:27 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_TRACK_HEIGHTS:
|
2014-10-14 04:38:46 +02:00
|
|
|
mainWindow->viewport->flags ^= VIEWPORT_FLAG_TRACK_HEIGHTS;
|
2014-08-10 10:34:27 +02:00
|
|
|
break;
|
|
|
|
case DDIDX_PATH_HEIGHTS:
|
2014-10-14 04:38:46 +02:00
|
|
|
mainWindow->viewport->flags ^= VIEWPORT_FLAG_PATH_HEIGHTS;
|
2014-08-10 10:34:27 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2014-10-16 03:02:43 +02:00
|
|
|
window_invalidate(mainWindow);
|
2014-08-10 10:34:27 +02:00
|
|
|
}
|
2014-10-14 04:38:46 +02:00
|
|
|
break;
|
2014-10-12 16:48:21 +02:00
|
|
|
case WIDX_MAP:
|
|
|
|
if (dropdownIndex == -1)
|
|
|
|
dropdownIndex = RCT2_GLOBAL(0x9DEBA2, uint16);
|
|
|
|
switch (dropdownIndex) {
|
|
|
|
case 0:
|
|
|
|
window_map_open();
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
window_viewport_open();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2014-04-11 03:42:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066C810
|
|
|
|
*/
|
2014-04-11 04:58:17 +02:00
|
|
|
static void window_game_top_toolbar_invalidate()
|
2014-04-11 03:42:39 +02:00
|
|
|
{
|
|
|
|
int x;
|
|
|
|
rct_window *w;
|
|
|
|
|
2014-08-19 19:47:12 +02:00
|
|
|
window_get_register(w);
|
2014-04-11 03:42:39 +02:00
|
|
|
|
|
|
|
// Anchor the right half of the buttons to the right
|
|
|
|
x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16);
|
|
|
|
if (x < 640)
|
|
|
|
x = 640;
|
|
|
|
x--;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_GUESTS].right = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 29;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_GUESTS].left = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 1;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_STAFF].right = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 29;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_STAFF].left = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 1;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_PARK].right = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 29;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_PARK].left = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 1;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_RIDES].right = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 29;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_RIDES].left = x;
|
2014-08-15 23:05:35 +02:00
|
|
|
x -= 1;
|
|
|
|
window_game_top_toolbar_widgets[WIDX_RESEARCH].right = x;
|
|
|
|
x -= 29;
|
|
|
|
window_game_top_toolbar_widgets[WIDX_RESEARCH].left = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 11;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_CONSTRUCT_RIDE].right = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 29;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_CONSTRUCT_RIDE].left = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 1;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_PATH].right = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 29;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_PATH].left = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 1;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_SCENERY].right = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 29;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_SCENERY].left = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 1;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_WATER].right = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 29;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_WATER].left = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 1;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_LAND].right = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 29;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_LAND].left = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 1;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_CLEAR_SCENERY].right = x;
|
2014-04-11 03:42:39 +02:00
|
|
|
x -= 29;
|
2014-04-11 04:58:17 +02:00
|
|
|
window_game_top_toolbar_widgets[WIDX_CLEAR_SCENERY].left = x;
|
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);
|
|
|
|
|
|
|
|
// Fast forward button pressed down
|
|
|
|
if (0)
|
|
|
|
w->pressed_widgets |= (1 << WIDX_FASTFORWARD);
|
|
|
|
else
|
|
|
|
w->pressed_widgets &= ~(1 << WIDX_FASTFORWARD);
|
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);
|
|
|
|
}
|
|
|
|
else if (window_get_main()->viewport->zoom == 3){
|
|
|
|
w->disabled_widgets |= (1 << WIDX_ZOOM_OUT);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
w->disabled_widgets &= ~((1 << WIDX_ZOOM_IN) | (1 << WIDX_ZOOM_OUT));
|
|
|
|
}
|
2014-04-11 03:42:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066C8EC
|
|
|
|
*/
|
2014-04-11 04:58:17 +02:00
|
|
|
static void window_game_top_toolbar_paint()
|
2014-04-11 03:42:39 +02:00
|
|
|
{
|
|
|
|
int x, y, imgId;
|
|
|
|
rct_window *w;
|
|
|
|
rct_drawpixelinfo *dpi;
|
|
|
|
|
2014-08-19 19:47:12 +02:00
|
|
|
window_paint_get_registers(w, dpi);
|
2014-04-11 03:42:39 +02:00
|
|
|
|
|
|
|
window_draw_widgets(w, dpi);
|
|
|
|
|
|
|
|
// Draw staff button image (setting masks to the staff colours)
|
2014-04-11 04:58:17 +02:00
|
|
|
x = w->x + window_game_top_toolbar_widgets[WIDX_STAFF].left;
|
|
|
|
y = w->y + window_game_top_toolbar_widgets[WIDX_STAFF].top;
|
2014-04-11 03:42:39 +02:00
|
|
|
imgId = 5627;
|
|
|
|
if (widget_is_pressed(w, WIDX_STAFF))
|
|
|
|
imgId++;
|
2014-05-13 23:37:45 +02:00
|
|
|
imgId |= (RCT2_GLOBAL(RCT2_ADDRESS_HANDYMAN_COLOUR, uint8) << 19) | 0xA0000000 | (RCT2_GLOBAL(RCT2_ADDRESS_MECHANIC_COLOUR, uint8) << 24);
|
2014-08-08 20:16:57 +02:00
|
|
|
gfx_draw_sprite(dpi, imgId, x, y, 0);
|
2014-08-15 23:05:35 +02:00
|
|
|
|
|
|
|
// Draw research button
|
|
|
|
x = w->x + window_game_top_toolbar_widgets[WIDX_RESEARCH].left - 1;
|
|
|
|
y = w->y + window_game_top_toolbar_widgets[WIDX_RESEARCH].top - 1;
|
|
|
|
imgId = SPR_TAB_FINANCES_RESEARCH_0;
|
|
|
|
gfx_draw_sprite(dpi, imgId, x, y, 0);
|
2014-04-21 11:27:48 +02:00
|
|
|
}
|