diff --git a/src/interface/screenshot.c b/src/interface/screenshot.c index e00e061a4a..53edadf405 100644 --- a/src/interface/screenshot.c +++ b/src/interface/screenshot.c @@ -46,14 +46,11 @@ void screenshot_check() screenshotIndex = screenshot_dump(); if (screenshotIndex != -1) { - RCT2_GLOBAL(0x009A8C29, uint8) |= 1; - audio_play_sound(SOUND_WINDOW_OPEN, 100, gScreenWidth / 2); } else { window_error_open(STR_SCREENSHOT_FAILED, STR_NONE); } - RCT2_GLOBAL(0x009A8C29, uint8) &= ~1; // redraw_rain(); } } diff --git a/src/interface/window.h b/src/interface/window.h index c07bf8248b..59f223f941 100644 --- a/src/interface/window.h +++ b/src/interface/window.h @@ -547,6 +547,8 @@ extern uint16 gWindowMapFlashingFlags; extern colour_t gCurrentWindowColours[4]; +extern bool gDisableErrorWindowSound; + void window_dispatch_update_all(); void window_update_all_viewports(); void window_update_all(); diff --git a/src/windows/error.c b/src/windows/error.c index 5a9c90db95..8568f46fc7 100644 --- a/src/windows/error.c +++ b/src/windows/error.c @@ -21,6 +21,8 @@ #include "../interface/window.h" #include "error.h" +bool gDisableErrorWindowSound = false; + enum { WIDX_BACKGROUND }; @@ -131,8 +133,9 @@ void window_error_open(rct_string_id title, rct_string_id message) w = window_create(x, y, width, height, &window_error_events, WC_ERROR, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_RESIZABLE); w->widgets = window_error_widgets; w->error.var_480 = 0; - if (!(RCT2_GLOBAL(0x009A8C29, uint8) & 1)) + if (!gDisableErrorWindowSound) { audio_play_sound_panned(SOUND_ERROR, 0, w->x + (w->width / 2), 0, 0); + } } /** diff --git a/src/windows/ride_construction.c b/src/windows/ride_construction.c index 6388630bed..978f15b9d6 100644 --- a/src/windows/ride_construction.c +++ b/src/windows/ride_construction.c @@ -3832,7 +3832,7 @@ void ride_construction_tooldown_construct(int screenX, int screenY) if (w == NULL) break; - RCT2_GLOBAL(0x009A8C29, uint8) |= 1; + gDisableErrorWindowSound = true; gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; RCT2_GLOBAL(0x00F44074, money32) = game_do_command( @@ -3844,7 +3844,7 @@ void ride_construction_tooldown_construct(int screenX, int screenY) _currentTrackBeginZ, 0); - RCT2_GLOBAL(0x009A8C29, uint8) &= ~1; + gDisableErrorWindowSound = false; if (RCT2_GLOBAL(0x00F44074, money32) == MONEY32_UNDEFINED) { rct_string_id errorText = gGameCommandErrorText; @@ -3895,9 +3895,9 @@ void ride_construction_tooldown_construct(int screenX, int screenY) if (w == NULL) break; - RCT2_GLOBAL(0x009A8C29, uint8) |= 1; + gDisableErrorWindowSound = true; window_event_mouse_up_call(w, WIDX_CONSTRUCT); - RCT2_GLOBAL(0x009A8C29, uint8) &= ~1; + gDisableErrorWindowSound = false; if (RCT2_GLOBAL(0x00F44074, money32) == MONEY32_UNDEFINED) { rct_string_id errorText = gGameCommandErrorText; diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c index 6fa0811d3b..8c9882d01c 100644 --- a/src/windows/top_toolbar.c +++ b/src/windows/top_toolbar.c @@ -1496,7 +1496,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w for (; zAttemptRange != 0; zAttemptRange--){ int flags = GAME_COMMAND_FLAG_APPLY | (parameter_1 & 0xFF00); - RCT2_GLOBAL(0x009A8C29, uint8) |= 1; + gDisableErrorWindowSound = true; gGameCommandErrorTitle = STR_CANT_POSITION_THIS_HERE; int cost = game_do_command( cur_grid_x, @@ -1507,7 +1507,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w gSceneryPlaceRotation | (parameter_3 & 0xFFFF0000), gSceneryPlaceZ ); - RCT2_GLOBAL(0x009A8C29, uint8) &= ~1; + gDisableErrorWindowSound = false; if (cost != MONEY32_UNDEFINED){ window_close_by_class(WC_ERROR); @@ -1567,10 +1567,10 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w for (; zAttemptRange != 0; zAttemptRange--) { int flags = (parameter_1 & 0xFF00) | GAME_COMMAND_FLAG_APPLY; - RCT2_GLOBAL(0x009A8C29, uint8) |= 1; + gDisableErrorWindowSound = true; gGameCommandErrorTitle = STR_CANT_BUILD_PARK_ENTRANCE_HERE; int cost = game_do_command(gridX, flags, gridY, parameter_2, GAME_COMMAND_PLACE_FENCE, gSceneryPlaceZ, RCT2_GLOBAL(0x00F64F15, uint16)); - RCT2_GLOBAL(0x009A8C29, uint8) &= ~1; + gDisableErrorWindowSound = false; if (cost != MONEY32_UNDEFINED){ window_close_by_class(WC_ERROR); @@ -1604,10 +1604,10 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w for (; zAttemptRange != 0; zAttemptRange--) { int flags = (parameter_1 & 0xFF00) | GAME_COMMAND_FLAG_APPLY; - RCT2_GLOBAL(0x009A8C29, uint8) |= 1; + gDisableErrorWindowSound = true; gGameCommandErrorTitle = STR_CANT_POSITION_THIS_HERE; int cost = game_do_command(gridX, flags, gridY, parameter_2, GAME_COMMAND_PLACE_LARGE_SCENERY, parameter_3, gSceneryPlaceZ); - RCT2_GLOBAL(0x009A8C29, uint8) &= ~1; + gDisableErrorWindowSound = false; if (cost != MONEY32_UNDEFINED){ window_close_by_class(WC_ERROR); diff --git a/src/windows/track_place.c b/src/windows/track_place.c index 7648524587..3ddfbdee2f 100644 --- a/src/windows/track_place.c +++ b/src/windows/track_place.c @@ -320,9 +320,9 @@ static void window_track_place_tooldown(rct_window* w, int widgetIndex, int x, i // Try increasing Z until a feasible placement is found mapZ = window_track_place_get_base_z(mapX, mapY); for (i = 0; i < 7; i++) { - RCT2_GLOBAL(0x009A8C29, uint8) |= 1; + gDisableErrorWindowSound = true; window_track_place_attempt_placement(_trackDesign, mapX, mapY, mapZ, 1, &cost, &rideIndex); - RCT2_GLOBAL(0x009A8C29, uint8) &= ~1; + gDisableErrorWindowSound = false; if (cost != MONEY32_UNDEFINED) { window_close_by_class(WC_ERROR);