From e71170334fd30bfa8ee39cfd57b88b9309c98bc5 Mon Sep 17 00:00:00 2001 From: ddevrien Date: Tue, 13 May 2014 00:13:23 +0200 Subject: [PATCH] options window mouseup code --- src/addresses.h | 1 + src/config.h | 3 ++- src/window_options.c | 57 ++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index 67d32db6a3..77e174086d 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -48,6 +48,7 @@ #define RCT2_ADDRESS_APP_PATH 0x009AA214 +#define RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER 0x009AAC6E #define RCT2_ADDRESS_CONFIG_MUSIC 0x009AAC72 #define RCT2_ADDRESS_CONFIG_FLAGS 0x009AAC74 #define RCT2_ADDRESS_CONFIG_SOUND_QUALITY 0x009AAC77 diff --git a/src/config.h b/src/config.h index 65ee7b4752..35b4b1e0b2 100644 --- a/src/config.h +++ b/src/config.h @@ -27,7 +27,8 @@ enum { CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES = (1 << 0), CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS = (1 << 1), - CONFIG_FLAG_DISABLE_SMOOTH_LANDSCAPE = (1 << 2) + CONFIG_FLAG_DISABLE_SMOOTH_LANDSCAPE = (1 << 2), + CONFIG_FLAG_SAVE_PLUGIN_DATA = (1 << 3) }; enum { diff --git a/src/window_options.c b/src/window_options.c index 2eb28707ab..a9de1ffd6b 100644 --- a/src/window_options.c +++ b/src/window_options.c @@ -19,9 +19,11 @@ *****************************************************************************/ #include "addresses.h" +#include "audio.h" #include "config.h" #include "gfx.h" #include "strings.h" +#include "viewport.h" #include "widget.h" #include "window.h" #include "window_dropdown.h" @@ -194,7 +196,59 @@ void window_options_open() */ static void window_options_mouseup() { - RCT2_CALLPROC_EBPSAFE(0x006BAFCA); + short widgetIndex; + rct_window *w; + + __asm mov widgetIndex, dx + __asm mov w, esi + + switch (widgetIndex) { + case WIDX_CLOSE: + window_close(w); + break; + case WIDX_HOTKEY_DROPDOWN: + RCT2_CALLPROC_EBPSAFE(0x006E3884); + break; + case WIDX_SCREEN_EDGE_SCROLLING: + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_EDGE_SCROLLING, uint8) ^= 1; + config_save(); + window_invalidate(w); + break; + case WIDX_REAL_NAME_CHECKBOX: + RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; + + if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES) + __asm xor al, al + else + __asm mov al, 1 + + RCT2_CALLPROC_EBPSAFE(0x0069C52F); + break; + case WIDX_TILE_SMOOTHING_CHECKBOX: + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) ^= CONFIG_FLAG_DISABLE_SMOOTH_LANDSCAPE; + config_save(); + gfx_invalidate_screen(); + break; + case WIDX_GRIDLINES_CHECKBOX: + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) ^= CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES; + config_save(); + gfx_invalidate_screen(); + + if ((w = window_get_main()) != NULL) { + if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES) + w->viewport->flags |= VIEWPORT_FLAG_GRIDLINES; + else + w->viewport->flags &= ~VIEWPORT_FLAG_GRIDLINES; + } + break; + case WIDX_SOUND_SW_BUFFER_CHECKBOX: + pause_sounds(); + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER, uint8) ^= 1; + config_save(); + unpause_sounds(); + window_invalidate(w); + break; + } } /** @@ -323,7 +377,6 @@ static void window_options_mousedown() */ static void window_options_dropdown() { - //RCT2_CALLPROC_EBPSAFE(0x006BB076); short dropdownIndex; short widgetIndex; rct_window *w;