Integrate gDisableErrorWindowSound

This commit is contained in:
Ted John 2016-09-03 14:22:03 +01:00
parent f2dea1832a
commit 73d453228a
6 changed files with 18 additions and 16 deletions

View File

@ -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();
}
}

View File

@ -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();

View File

@ -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);
}
}
/**

View File

@ -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;

View File

@ -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);

View File

@ -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);