refactor input (flags in particular) and add sub_6EA73F

This commit is contained in:
IntelOrca 2014-10-15 22:59:26 +01:00
parent dda40cb99a
commit 6fe1bace20
23 changed files with 206 additions and 132 deletions

View File

@ -127,6 +127,7 @@
#define RCT2_ADDRESS_VEHICLE_SOUND_LIST 0x009AF288
#define RCT2_ADDRESS_INPUT_FLAGS 0x009DE518
#define RCT2_ADDRESS_CURENT_CURSOR 0x009DE51C
#define RCT2_ADDRESS_INPUT_STATE 0x009DE51D
#define RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS 0x009DE51F

View File

@ -189,7 +189,7 @@ void update_palette_effects()
void game_update()
{
int eax, tmp;
int i, numUpdates, tmp;
// Handles picked-up peep and rain redraw
RCT2_CALLPROC_EBPSAFE(0x006843DC);
@ -199,51 +199,55 @@ void game_update()
screenshot_check();
game_handle_keyboard_input();
// do game logic
eax = RCT2_GLOBAL(0x009DE588, uint16) / 31;
if (eax == 0)
eax = 1;
if (eax > 4)
eax = 4;
if (gGameSpeed > 1)
eax = 1 << (gGameSpeed - 1);
// Determine how many times we need to update the game
if (gGameSpeed > 1) {
numUpdates = 1 << (gGameSpeed - 1);
} else {
numUpdates = RCT2_GLOBAL(0x009DE588, uint16) / 31;
numUpdates = clamp(1, numUpdates, 4);
}
// Update the game one or more times
if (RCT2_GLOBAL(0x009DEA6E, uint8) == 0) {
for (; eax > 0; eax--) {
for (i = 0; i < numUpdates; i++) {
game_logic_update();
start_title_music(); //RCT2_CALLPROC_EBPSAFE(0x006BD0F8); // play title screen music
start_title_music();
/*
if (rctmem->dword_009E2D74 == 1) {
rctmem->dword_009E2D74 = 0;
break;
if (gGameSpeed > 1)
continue;
// Possibly smooths viewport scrolling, I don't see a difference though
if (RCT2_GLOBAL(0x009E2D74, uint32) == 1) {
RCT2_GLOBAL(0x009E2D74, uint32) = 0;
break;
} else {
if (rctmem->input_state != INPUT_STATE_WIDGET_RESET && rctmem->input_state != INPUT_STATE_WIDGET_NORMAL)
break;
tmp = rctmem->dword_009DE518 & 0x80;
rctmem->dword_009DE518 &= ~0x80;
if (tmp)
break;
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, uint8) == INPUT_STATE_RESET ||
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, uint8) == INPUT_STATE_NORMAL
) {
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32)) {
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~INPUT_FLAG_VIEWPORT_SCROLLING;
break;
}
} else {
break;
}
}
*/
}
}
RCT2_GLOBAL(0x009DE518, uint32) &= ~0x80;
RCT2_GLOBAL(0x009AC861, uint16) &= ~0x8000;
RCT2_GLOBAL(0x009AC861, uint16) &= ~0x02;
tmp = RCT2_GLOBAL(0x009AC861, uint16) & 0x01;
RCT2_GLOBAL(0x009AC861, uint16) &= ~0x01;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~INPUT_FLAG_VIEWPORT_SCROLLING;
RCT2_GLOBAL(0x009AC861, uint16) ^= (1 << 15);
RCT2_GLOBAL(0x009AC861, uint16) &= ~(1 << 1);
tmp = RCT2_GLOBAL(0x009AC861, uint16) & (1 << 0);
RCT2_GLOBAL(0x009AC861, uint16) &= ~(1 << 0);
if (!tmp)
RCT2_GLOBAL(0x009AC861, uint16) |= 0x02;
RCT2_GLOBAL(0x009AC861, uint16) &= ~0x08;
tmp = RCT2_GLOBAL(0x009AC861, uint16) & 0x04;
RCT2_GLOBAL(0x009AC861, uint16) &= ~0x04;
RCT2_GLOBAL(0x009AC861, uint16) |= (1 << 1);
RCT2_GLOBAL(0x009AC861, uint16) &= ~(1 << 3);
tmp = RCT2_GLOBAL(0x009AC861, uint16) & (1 << 2);
RCT2_GLOBAL(0x009AC861, uint16) &= ~(1 << 2);
if (!tmp)
RCT2_GLOBAL(0x009AC861, uint16) |= 0x04;
RCT2_GLOBAL(0x009AC861, uint16) |= (1 << 2);
RCT2_CALLPROC_EBPSAFE(0x006EE77A);
@ -799,9 +803,9 @@ void game_load_or_quit_no_save_prompt()
load_game();
} else if (RCT2_GLOBAL(RCT2_ADDRESS_SAVE_PROMPT_MODE, uint16) == 1) {
game_do_command(0, 1, 0, 1, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 5)) {
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_5) {
RCT2_CALLPROC_EBPSAFE(0x0040705E);
RCT2_GLOBAL(0x009DE518, uint32) &= ~(1 << 5);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~INPUT_FLAG_5;
}
title_load();
rct2_endupdate();

View File

@ -483,7 +483,7 @@ static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex)
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, uint16) = y;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_WINDOWCLASS, rct_windowclass) = windowClass;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_WINDOWNUMBER, rct_windownumber) = windowNumber;
if (!(RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)))
if (!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE))
break;
w = window_find_by_id(RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass), RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber));
@ -491,7 +491,7 @@ static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex)
break;
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_DOWN], x, y, 0, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), (int)w, 0, 0);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 4);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_4;
break;
case WWT_CAPTION:
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, uint8) = INPUT_STATE_DRAGGING;
@ -542,7 +542,7 @@ static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex)
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass) = windowClass;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, rct_windownumber) = windowNumber;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, uint16) = widgetIndex;
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 0);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_WIDGET_PRESSED;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, uint8) = INPUT_STATE_WIDGET_PRESSED;
RCT2_GLOBAL(0x009DE528, uint16) = 1;
@ -740,7 +740,7 @@ static void game_handle_input_mouse(int x, int y, int state)
RCT2_GLOBAL(0x009DE540, sint16) = 0;
// hide cursor
// RCT2_CALLPROC_X(0x00407045, 0, 0, 0, 0, 0, 0, 0);
// RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 5);
// RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_5;
GetCursorPos(&_dragPosition);
ShowCursor(FALSE);
@ -1190,11 +1190,11 @@ void game_handle_edge_scroll()
// Scroll viewport
if (scrollX != 0) {
mainWindow->saved_view_x += scrollX * (12 << mainWindow->viewport->zoom);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 7);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_VIEWPORT_SCROLLING;
}
if (scrollY != 0) {
mainWindow->saved_view_y += scrollY * (12 << mainWindow->viewport->zoom);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 7);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_VIEWPORT_SCROLLING;
}
}
@ -1229,11 +1229,11 @@ void game_handle_key_scroll()
// Scroll viewport
if (scrollX != 0) {
mainWindow->saved_view_x += scrollX * (12 << mainWindow->viewport->zoom);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 7);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_VIEWPORT_SCROLLING;
}
if (scrollY != 0) {
mainWindow->saved_view_y += scrollY * (12 << mainWindow->viewport->zoom);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 7);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_VIEWPORT_SCROLLING;
}
}
@ -1272,7 +1272,7 @@ void handle_shortcut_command(int shortcutIndex)
window = window_find_by_id(WC_ERROR, 0);
if (window != NULL)
window_close(window);
else if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
else if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE)
tool_cancel();
break;
case SHORTCUT_PAUSE_GAME:
@ -1653,6 +1653,7 @@ void game_handle_keyboard_input()
void game_handle_input()
{
rct_window *w;
int x, y, state;
if (RCT2_GLOBAL(0x009DEA64, uint16) & 2) {
RCT2_GLOBAL(0x009DEA64, uint16) &= ~2;
@ -1663,36 +1664,26 @@ void game_handle_input()
for (w = g_window_list; w < RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*); w++)
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_07], 0, 0, 0, 0, (int)w, 0, 0);
RCT2_CALLPROC_EBPSAFE(0x006EA73F);
sub_6EA73F();
RCT2_CALLPROC_EBPSAFE(0x006E8346); // update_cursor_position
{
// int eax, ebx, ecx, edx, esi, edi, ebp;
int eax, ebx, ecx;
for (;;) {
game_get_next_input(&x, &y, &state);
if (state == 0)
break;
for (;;) {
game_get_next_input(&eax, &ebx, &ecx);
if (ecx == 0)
break;
game_handle_input_mouse(x, y, state & 0xFF);
}
game_handle_input_mouse(eax, ebx, ecx & 0xFF);
// RCT2_CALLPROC_X(0x006E8655, eax, ebx, ecx, 0, 0, 0, 0); // window_process_mouse_input
}
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_5) {
game_handle_input_mouse(x, y, state);
} else if (x != 0x80000000) {
x = clamp(0, x, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 1);
y = clamp(0, y, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - 1);
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 5)) {
game_handle_input_mouse(eax, ebx, ecx);
// RCT2_CALLPROC_X(0x006E8655, eax, ebx, 0, 0, 0, 0, 0); // window_process_mouse_input
} else if (eax != 0x80000000) {
eax = clamp(0, eax, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 1);
ebx = clamp(0, ebx, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - 1);
game_handle_input_mouse(eax, ebx, ecx);
// RCT2_CALLPROC_X(0x006E8655, eax, ebx, 0, 0, 0, 0, 0); // window_process_mouse_input
process_mouse_over(eax, ebx);
//RCT2_CALLPROC_X(0x006ED833, eax, ebx, 0, 0, 0, 0, 0);
process_mouse_tool(eax, ebx);
//RCT2_CALLPROC_EBPSAFE(0x006ED801);
}
game_handle_input_mouse(x, y, state);
process_mouse_over(x, y);
process_mouse_tool(x, y);
}
}
@ -1726,7 +1717,7 @@ static void game_get_next_input(int *x, int *y, int *state)
//return;
//int on_tutorial = RCT2_GLOBAL(RCT2_ADDRESS_ON_TUTORIAL, uint8);
//if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 5)) {
//if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_5) {
// if (on_tutorial == 1) {
// } else {

View File

@ -21,6 +21,29 @@
#ifndef _INPUT_H_
#define _INPUT_H_
enum {
INPUT_FLAG_WIDGET_PRESSED = (1 << 0),
// Related to dropdowns, set on flag 0x80
INPUT_FLAG_1 = (1 << 1),
// Related to dropdowns
INPUT_FLAG_2 = (1 << 2),
INPUT_FLAG_TOOL_ACTIVE = (1 << 3),
// Left click on a viewport
INPUT_FLAG_4 = (1 << 4),
INPUT_FLAG_5 = (1 << 5),
// Some of the map tools (clear, footpath, scenery)
// never read as far as I know.
INPUT_FLAG_6 = (1 << 6),
INPUT_FLAG_VIEWPORT_SCROLLING = (1 << 7)
};
void game_handle_input();
void game_handle_keyboard_input();
void handle_shortcut_command(int shortcutIndex);

View File

@ -87,7 +87,7 @@ void viewport_init_all()
RCT2_NEW_VIEWPORT = NULL;
// ?
RCT2_GLOBAL(0x009DE518, sint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, sint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, sint8) = INPUT_STATE_RESET;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass) = -1;
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, sint32) = -1;

View File

@ -23,6 +23,7 @@
#include <stdlib.h>
#include "../addresses.h"
#include "../drawing/drawing.h"
#include "../input.h"
#include "../sprites.h"
#include "widget.h"
#include "window.h"
@ -971,7 +972,7 @@ int widget_is_pressed(rct_window *w, int widgetIndex)
return 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, rct_windownumber) != w->number)
return 0;
if (!(RCT2_GLOBAL(0x009DE518, uint32) & 1))
if (!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_WIDGET_PRESSED))
return 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, sint32) == widgetIndex)
return 1;
@ -992,7 +993,7 @@ int widget_is_highlighted(rct_window *w, int widgetIndex)
int widget_is_active_tool(rct_window *w, int widgetIndex)
{
if (!(RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)))
if (!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE))
return 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) != w->classification)
return 0;

View File

@ -23,6 +23,7 @@
#include "../audio/audio.h"
#include "../game.h"
#include "../drawing/drawing.h"
#include "../input.h"
#include "../platform/osinterface.h"
#include "../world/map.h"
#include "../world/sprite.h"
@ -315,7 +316,7 @@ static void window_all_wheel_input()
return;
// Check window cursor is over
if (!(RCT2_GLOBAL(0x009DE518, uint32) & (1 << 5))) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_5)) {
w = window_find_from_point(gCursorState.x, gCursorState.y);
if (w != NULL) {
// Check if main window
@ -1439,7 +1440,7 @@ void window_set_resize(rct_window *w, int minWidth, int minHeight, int maxWidth,
*/
int tool_set(rct_window *w, int widgetIndex, int tool)
{
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) {
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) {
if (
w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) &&
w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber) &&
@ -1450,8 +1451,8 @@ int tool_set(rct_window *w, int widgetIndex, int tool)
}
}
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 3);
RCT2_GLOBAL(0x009DE518, uint32) &= ~(1 << 6);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_TOOL_ACTIVE;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~INPUT_FLAG_6;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TOOL, uint8) = tool;
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) = w->classification;
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber) = w->number;
@ -1467,8 +1468,8 @@ void tool_cancel()
{
rct_window *w;
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) {
RCT2_GLOBAL(0x009DE518, uint32) &= ~(1 << 3);
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) {
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~INPUT_FLAG_TOOL_ACTIVE;
//
RCT2_CALLPROC_EBPSAFE(0x0068AAE1);
@ -1697,4 +1698,41 @@ void window_close_construction_windows()
window_close_by_id(WC_FOOTPATH, 0);
window_close_by_id(WC_TRACK_DESIGN_LIST, 0);
window_close_by_id(WC_TRACK_DESIGN_PLACE, 0);
}
/**
*
* rct2: 0x006EA776
*/
void window_invalidate_pressed_image_buttons(rct_window *w)
{
int widgetIndex;
rct_widget *widget;
widgetIndex = 0;
for (widget = w->widgets; widget->type != WWT_LAST; widget++, widgetIndex++) {
if (widget->type != WWT_5 && widget->type != WWT_IMGBTN)
continue;
if (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex))
gfx_set_dirty_blocks(w->x, w->y, w->x + w->width, w->y + w->height);
}
}
/**
*
* rct2: 0x006EA73F
*/
void sub_6EA73F()
{
rct_window *w;
if (RCT2_GLOBAL(0x009DEA6E, uint8) != 0)
RCT2_GLOBAL(0x01423604, uint32)++;
for (w = RCT2_LAST_WINDOW; w >= g_window_list; w--) {
window_update_scroll_widgets(w);
window_invalidate_pressed_image_buttons(w);
RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0);
}
}

View File

@ -517,6 +517,8 @@ void window_staff_list_init_vars();
void window_event_helper(rct_window* w, short widgetIndex, WINDOW_EVENTS event);
void RCT2_CALLPROC_WE_MOUSE_DOWN(int address, int widgetIndex, rct_window*w, rct_widget* widget);
void sub_6EA73F();
#ifdef _MSC_VER
#define window_get_register(w) \
__asm mov w, esi

View File

@ -21,6 +21,7 @@
#include <string.h>
#include "../addresses.h"
#include "../audio/audio.h"
#include "../input.h"
#include "../interface/window.h"
#include "../localisation/date.h"
#include "../localisation/localisation.h"
@ -321,7 +322,7 @@ void news_item_open_subject(int type, int subject)
if (tool_set(window, 9, 0)){
RCT2_CALLPROC_X(0x006E1172, (subject & 0xFFFF), 0, subject, 0, 0, 0, 0);
}
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
window_scenery_open();
}
}

View File

@ -263,7 +263,7 @@ void title_update()
start_title_music();//title_play_music();
}
RCT2_GLOBAL(0x009DE518, uint32) &= ~0x80;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~0x80;
RCT2_GLOBAL(0x009AC861, uint16) &= ~0x8000;
RCT2_GLOBAL(0x009AC861, uint16) &= ~0x02;
tmp = RCT2_GLOBAL(0x009AC861, uint16) & 0x01;

View File

@ -20,6 +20,7 @@
#include "../addresses.h"
#include "../world/map.h"
#include "../input.h"
#include "../localisation/localisation.h"
#include "../sprites.h"
#include "../interface/widget.h"
@ -218,7 +219,7 @@ static void window_clear_scenery_paint()
*/
static int window_clear_scenery_should_close()
{
if (!(RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)))
if (!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE))
return 1;
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) != WC_TOP_TOOLBAR)
return 1;

View File

@ -21,6 +21,7 @@
#include <windows.h>
#include <memory.h>
#include "../addresses.h"
#include "../input.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../localisation/localisation.h"
@ -137,9 +138,9 @@ void window_dropdown_show_text_custom_width(int x, int y, int extray, uint8 colo
memcpy((void*)0x009DEBA4, gDropdownItemsFormat, 40 * 2);
memcpy((void*)0x009DEBF4, gDropdownItemsArgs, 40 * 8);
RCT2_GLOBAL(0x009DE518, uint32) &= ~((1 << 2) | (1 << 1));
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~(INPUT_FLAG_1 | INPUT_FLAG_2);
if (flags & 0x80)
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 1);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_1;
window_dropdown_close();
_dropdown_num_columns = 1;
@ -206,9 +207,9 @@ void window_dropdown_show_image(int x, int y, int extray, uint8 colour, uint8 fl
memcpy((void*)0x009DEBA4, gDropdownItemsFormat, 40 * 2);
memcpy((void*)0x009DEBF4, gDropdownItemsArgs, 40 * 8);
RCT2_GLOBAL(0x009DE518, uint32) &= ~((1 << 2) | (1 << 1));
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~(INPUT_FLAG_1 | INPUT_FLAG_2);
if (flags & 0x80)
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 1);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_1;
// Close existing dropdown
window_dropdown_close();

View File

@ -22,6 +22,7 @@
#include "../addresses.h"
#include "../audio/audio.h"
#include "../game.h"
#include "../input.h"
#include "../world/map.h"
#include "../localisation/localisation.h"
#include "../sprites.h"
@ -210,7 +211,7 @@ void window_footpath_open()
tool_cancel();
RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) = PATH_CONSTRUCTION_MODE_LAND;
tool_set(window, WIDX_CONSTRUCT_ON_LAND, 17);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
RCT2_GLOBAL(RCT2_ADDRESS_PATH_ERROR_OCCURED, uint8) = 0;
RCT2_CALLPROC_EBPSAFE(0x006A855C);
}
@ -265,7 +266,7 @@ static void window_footpath_mouseup()
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~2;
RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) = PATH_CONSTRUCTION_MODE_LAND;
tool_set(w, WIDX_CONSTRUCT_ON_LAND, 17);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
RCT2_GLOBAL(RCT2_ADDRESS_PATH_ERROR_OCCURED, uint8) = 0;
RCT2_CALLPROC_EBPSAFE(0x006A855C);
break;
@ -280,7 +281,7 @@ static void window_footpath_mouseup()
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~2;
RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) = PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL;
tool_set(w, WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL, 12);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
RCT2_GLOBAL(RCT2_ADDRESS_PATH_ERROR_OCCURED, uint8) = 0;
RCT2_CALLPROC_EBPSAFE(0x006A855C);
break;
@ -461,14 +462,14 @@ static void window_footpath_update(rct_window *w)
// Check tool
if (RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) == PATH_CONSTRUCTION_MODE_LAND) {
if (!(RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)))
if (!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE))
window_close(w);
else if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) != WC_FOOTPATH)
window_close(w);
else if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) != WIDX_CONSTRUCT_ON_LAND)
window_close(w);
} else if (RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) == PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL) {
if (!(RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)))
if (!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE))
window_close(w);
else if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) != WC_FOOTPATH)
window_close(w);

View File

@ -21,6 +21,7 @@
#include <string.h>
#include "../addresses.h"
#include "../game.h"
#include "../input.h"
#include "../sprites.h"
#include "../localisation/localisation.h"
#include "../interface/widget.h"
@ -221,41 +222,41 @@ static void window_game_top_toolbar_mouseup()
window_rotate_camera(mainWindow);
break;
case WIDX_CLEAR_SCENERY:
if ((RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 16) {
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(w, WIDX_CLEAR_SCENERY, 12);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 2;
window_clear_scenery_open();
}
break;
case WIDX_LAND:
if ((RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 7) {
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(w, WIDX_LAND, 18);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1;
window_land_open();
}
break;
case WIDX_WATER:
if ((RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 8) {
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(w, WIDX_WATER, 19);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1;
window_water_open();
}
break;
case WIDX_SCENERY:
if (!tool_set(w, WIDX_SCENERY, 0)) {
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
window_scenery_open();
}
break;

View File

@ -19,11 +19,12 @@
*****************************************************************************/
#include "../addresses.h"
#include "../world/map.h"
#include "../localisation/localisation.h"
#include "../sprites.h"
#include "../input.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../localisation/localisation.h"
#include "../sprites.h"
#include "../world/map.h"
#include "dropdown.h"
enum WINDOW_LAND_WIDGET_IDX {
@ -389,7 +390,7 @@ static void window_land_paint()
*/
static int window_land_should_close()
{
if (!(RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)))
if (!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE))
return 1;
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) != WC_TOP_TOOLBAR)
return 1;

View File

@ -20,12 +20,14 @@
#include <string.h>
#include "../addresses.h"
#include "../sprites.h"
#include "../localisation/localisation.h"
#include "../input.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../windows/scenery.h"
#include "../interface/viewport.h"
#include "../interface/window.h"
#include "../sprites.h"
#include "../windows/scenery.h"
enum WINDOW_MAP_WIDGET_IDX {
WIDX_BACKGROUND,
@ -190,7 +192,7 @@ static void window_map_close()
window_get_register(w);
rct2_free(RCT2_GLOBAL(RCT2_ADDRESS_MAP_IMAGE_DATA, uint32*));
if ((RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) &&
if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == w->classification &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == w->number) {
tool_cancel();
@ -472,7 +474,7 @@ static void window_map_invalidate()
if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)) {
// scenario editor: build park entrance selected, show rotate button
if ((RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) &&
if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == WC_MAP &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint8) == WIDX_BUILD_PARK_ENTRANCE) {
w->widgets[WIDX_ROTATE_90].type = WWT_FLATBTN;
@ -481,7 +483,7 @@ static void window_map_invalidate()
// always show set land rights button
w->widgets[WIDX_SET_LAND_RIGHTS].type = WWT_FLATBTN;
if ((RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) &&
if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == WC_MAP) {
// if not in set land rights mode: show the default scenario editor buttons

View File

@ -24,6 +24,7 @@
#include "../game.h"
#include "../localisation/date.h"
#include "../localisation/localisation.h"
#include "../input.h"
#include "../interface/graph.h"
#include "../interface/viewport.h"
#include "../interface/widget.h"
@ -653,7 +654,7 @@ static void window_park_entrance_close()
window_get_register(w);
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE)
if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
tool_cancel();
}
@ -1060,7 +1061,7 @@ void window_park_rating_open()
window->viewport_focus_coordinates.y = -1;
}
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE)
if (window->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && window->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
tool_cancel();
@ -1194,9 +1195,9 @@ void window_park_guests_open()
window->viewport_focus_coordinates.y = -1;
}
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (window->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && window->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
tool_cancel();
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE)
if (window->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && window->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
tool_cancel();
window->viewport = NULL;
window->page = WINDOW_PARK_PAGE_GUESTS;
@ -1600,7 +1601,7 @@ void window_park_objective_open()
window->viewport_focus_coordinates.y = -1;
}
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE)
if (window->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && window->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
tool_cancel();
@ -1763,7 +1764,7 @@ void window_park_awards_open()
window->viewport_focus_coordinates.y = -1;
}
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE)
if (window->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && window->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
tool_cancel();
@ -1891,7 +1892,7 @@ static void window_park_set_page(rct_window *w, int page)
{
int listen;
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE)
if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
tool_cancel();

View File

@ -21,6 +21,7 @@
#include <string.h>
#include "../addresses.h"
#include "../game.h"
#include "../input.h"
#include "../interface/viewport.h"
#include "../interface/widget.h"
#include "../interface/window.h"
@ -1151,7 +1152,7 @@ void window_ride_main_open(int rideIndex)
w->ride.var_482 = -1;
}
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) {
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) {
if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) &&
w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber)
) {
@ -1182,7 +1183,7 @@ static void window_ride_set_page(rct_window *w, int page)
{
int listen;
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE)
if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
tool_cancel();
@ -3433,7 +3434,7 @@ static void window_ride_colour_close()
window_get_register(w);
if (!(RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)))
if (!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE))
return;
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) != w->classification)

View File

@ -24,6 +24,7 @@
#include "../audio/audio.h"
#include "../drawing/drawing.h"
#include "../game.h"
#include "../input.h"
#include "../interface/viewport.h"
#include "../interface/widget.h"
#include "../interface/window.h"
@ -445,7 +446,7 @@ bool window_scenery_is_scenery_tool_active() {
int toolWindowClassification = RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass);
int toolWidgetIndex = RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, rct_windownumber);
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE)
if (toolWindowClassification == WC_TOP_TOOLBAR && toolWidgetIndex == 9) // 9 is WIDX_SCENERY
return true;

View File

@ -22,6 +22,7 @@
#include "../addresses.h"
#include "../game.h"
#include "../drawing/drawing.h"
#include "../input.h"
#include "../interface/viewport.h"
#include "../interface/widget.h"
#include "../interface/window.h"
@ -175,7 +176,7 @@ void window_staff_list_open()
void window_staff_list_cancel_tools(rct_window *w) {
int toolWindowClassification = RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass);
int toolWindowNumber = RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber);
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE)
if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
tool_cancel();
}

View File

@ -78,7 +78,7 @@ void window_tooltip_reset(int x, int y)
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint8) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_CLASS, uint8) = 255;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, uint8) = 1;
RCT2_GLOBAL(0x009DE518, uint32) &= ~(1 << 4);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~(1 << 4);
}
/**

View File

@ -22,12 +22,13 @@
#include "../addresses.h"
#include "../audio/audio.h"
#include "../game.h"
#include "../sprites.h"
#include "../localisation/localisation.h"
#include "../ride/track.h"
#include "../input.h"
#include "../interface/viewport.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../localisation/localisation.h"
#include "../sprites.h"
#include "../ride/track.h"
#define TRACK_MINI_PREVIEW_WIDTH 168
#define TRACK_MINI_PREVIEW_HEIGHT 78
@ -436,7 +437,7 @@ void window_track_place_open()
w->colours[1] = 24;
w->colours[2] = 24;
tool_set(w, 6, 12);
RCT2_GLOBAL(0x009DE518, uint32) |= 6;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= 6;
window_push_others_right(w);
show_gridlines();
_window_track_place_last_cost = MONEY32_UNDEFINED;
@ -501,7 +502,7 @@ static void window_track_place_mouseup()
*/
static void window_track_place_update(rct_window *w)
{
if (!(RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)))
if (!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE))
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) != WC_TRACK_DESIGN_PLACE)
window_close(w);
}

View File

@ -19,11 +19,12 @@
*****************************************************************************/
#include "../addresses.h"
#include "../world/map.h"
#include "../localisation/localisation.h"
#include "../sprites.h"
#include "../input.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../localisation/localisation.h"
#include "../sprites.h"
#include "../world/map.h"
enum WINDOW_WATER_WIDGET_IDX {
WIDX_BACKGROUND,
@ -244,7 +245,7 @@ static void window_water_paint()
*/
static int window_water_should_close()
{
if (!(RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)))
if (!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE))
return 1;
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) != WC_TOP_TOOLBAR)
return 1;