mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-23 23:04:36 +01:00
refactor input widgets and keyboard_shortcut screen flags
This commit is contained in:
@@ -94,7 +94,7 @@ static void shortcut_close_top_most_window()
|
||||
|
||||
static void shortcut_close_all_floating_windows()
|
||||
{
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2))
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR))
|
||||
window_close_all();
|
||||
else if (RCT2_GLOBAL(0x0141F570, uint8) == 1)
|
||||
window_close_top();
|
||||
@@ -115,7 +115,7 @@ static void shortcut_pause_game()
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 10)) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_MANAGER))) {
|
||||
window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
@@ -128,8 +128,8 @@ static void shortcut_zoom_view_out()
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER)) {
|
||||
window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
@@ -143,8 +143,8 @@ static void shortcut_zoom_view_in()
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER)) {
|
||||
window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
@@ -158,8 +158,8 @@ static void shortcut_rotate_view()
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER)) {
|
||||
window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
@@ -228,8 +228,8 @@ static void shortcut_adjust_land()
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
||||
window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
@@ -243,8 +243,8 @@ static void shortcut_adjust_water()
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
||||
window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
@@ -258,8 +258,8 @@ static void shortcut_build_scenery()
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
||||
window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
@@ -273,8 +273,8 @@ static void shortcut_build_paths()
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
||||
window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
@@ -288,8 +288,8 @@ static void shortcut_build_new_ride()
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
||||
window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
@@ -301,7 +301,7 @@ static void shortcut_build_new_ride()
|
||||
|
||||
static void shortcut_show_financial_information()
|
||||
{
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C))
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY))
|
||||
window_finances_open();
|
||||
}
|
||||
@@ -310,12 +310,12 @@ static void shortcut_show_research_information()
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
||||
// Open new ride window
|
||||
RCT2_CALLPROC_EBPSAFE(0x006B3CFF);
|
||||
window = window_find_by_class(WC_CONSTRUCT_RIDE);
|
||||
if (window != NULL)
|
||||
RCT2_CALLPROC_WE_MOUSE_DOWN(window->event_handlers[WE_MOUSE_DOWN], 10, window, NULL);
|
||||
window_event_helper(window, 10, WE_MOUSE_DOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ static void shortcut_show_rides_list()
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
||||
window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
@@ -336,7 +336,7 @@ static void shortcut_show_park_information()
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
||||
window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
@@ -349,7 +349,7 @@ static void shortcut_show_guest_list()
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
||||
window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
@@ -362,7 +362,7 @@ static void shortcut_show_staff_list()
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
||||
window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
@@ -373,7 +373,7 @@ static void shortcut_show_staff_list()
|
||||
|
||||
static void shortcut_show_recent_messages()
|
||||
{
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E))
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
|
||||
window_news_open();
|
||||
}
|
||||
|
||||
@@ -381,8 +381,8 @@ static void shortcut_show_map()
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
|
||||
window = window_find_by_class(WC_TOP_TOOLBAR);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
|
||||
@@ -1590,7 +1590,7 @@ void window_guest_list_init_vars_b()
|
||||
*/
|
||||
void window_event_helper(rct_window* w, short widgetIndex, WINDOW_EVENTS event)
|
||||
{
|
||||
RCT2_CALLPROC_X(w->event_handlers[event], 0, 0, 0, widgetIndex, (int)w, 0, 0);
|
||||
RCT2_CALLPROC_X(w->event_handlers[event], 0, 0, 0, widgetIndex, (int)w, (int)&(w->event_handlers[widgetIndex]), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1704,37 +1704,6 @@ void window_resize_gui_scenario_editor(int width, int height)
|
||||
|
||||
}
|
||||
|
||||
void RCT2_CALLPROC_WE_MOUSE_DOWN(int address, int widgetIndex, rct_window*w, rct_widget* widget )
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
__asm {
|
||||
push address
|
||||
push widget
|
||||
push w
|
||||
push widgetIndex
|
||||
mov edi, widget
|
||||
mov edx, widgetIndex
|
||||
mov esi, w
|
||||
call[esp + 12]
|
||||
add esp, 16
|
||||
}
|
||||
#else
|
||||
__asm__("\
|
||||
push %[address]\n\
|
||||
mov edi, %[widget] \n\
|
||||
mov eax, %[w] \n\
|
||||
mov edx, %[widgetIndex] \n\
|
||||
push edi \n\
|
||||
push eax \n\
|
||||
push edx \n\
|
||||
mov esi, %[w] \n\
|
||||
call [esp+12] \n\
|
||||
add esp, 16 \n\
|
||||
" :[address] "+m" (address), [w] "+m" (w), [widget] "+m" (widget), [widgetIndex] "+m" (widgetIndex): : "eax", "esi", "edx", "edi"
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Based on rct2: 0x6987ED and another version from window_park */
|
||||
void window_align_tabs(rct_window *w, uint8 start_tab_id, uint8 end_tab_id)
|
||||
{
|
||||
|
||||
@@ -539,7 +539,6 @@ void window_map_tooltip_update_visibility();
|
||||
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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user