mirror of https://github.com/OpenRCT2/OpenRCT2.git
fix #1155
This commit is contained in:
parent
689f7c9f1d
commit
ca6c3d68aa
|
@ -39,6 +39,7 @@ rct_ride_music_params gRideMusicParamsList[AUDIO_MAX_RIDE_MUSIC];
|
|||
rct_ride_music_params *gRideMusicParamsListEnd;
|
||||
void *gCrowdSoundChannel = 0;
|
||||
void *gTitleMusicChannel = 0;
|
||||
bool gGameSoundsOff = false;
|
||||
|
||||
void audio_init(int i)
|
||||
{
|
||||
|
@ -1423,7 +1424,7 @@ int get_dsound_devices()
|
|||
int sound_play_panned(int sound_id, int ebx, sint16 x, sint16 y, sint16 z)
|
||||
{
|
||||
int result = 0;
|
||||
if (RCT2_GLOBAL(0x009AF59D, uint8) & 1) {
|
||||
if (gConfigSound.sound) {
|
||||
RCT2_GLOBAL(0x00F438AD, uint8) = 0;
|
||||
int volume = 0;
|
||||
if (ebx == 0x8001) {
|
||||
|
@ -1557,7 +1558,7 @@ void start_title_music()
|
|||
break;
|
||||
}
|
||||
|
||||
if ((RCT2_GLOBAL(0x009AF284, uint32) & (1 << 0)) && RCT2_GLOBAL(0x009AF59D, uint8) & 1
|
||||
if ((RCT2_GLOBAL(0x009AF284, uint32) & (1 << 0)) && gConfigSound.sound
|
||||
&& RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TITLE_DEMO) {
|
||||
if (!RCT2_GLOBAL(0x009AF600, uint8)) {
|
||||
#ifdef USE_MIXER
|
||||
|
@ -1809,13 +1810,11 @@ void audio_close()
|
|||
|
||||
/* rct2: 0x006BAB8A */
|
||||
void toggle_all_sounds(){
|
||||
// When all sound code is reversed replace with gConfigSound.sound
|
||||
RCT2_GLOBAL(0x009AF59D, uint8) ^= 1;
|
||||
if (RCT2_GLOBAL(0x009AF59D, uint8) == 0) {
|
||||
gConfigSound.sound = !gConfigSound.sound;
|
||||
if (!gConfigSound.sound) {
|
||||
stop_title_music();
|
||||
pause_sounds();
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
unpause_sounds();
|
||||
}
|
||||
}
|
||||
|
@ -1826,15 +1825,11 @@ void toggle_all_sounds(){
|
|||
*/
|
||||
void pause_sounds()
|
||||
{
|
||||
// When all sound code is reversed replace with gConfigSound.sound
|
||||
RCT2_GLOBAL(0x009AF59C, uint8) = 1;
|
||||
if (RCT2_GLOBAL(0x009AF59C, uint8) == 1) {
|
||||
stop_other_sounds();
|
||||
stop_vehicle_sounds();
|
||||
stop_ride_music();
|
||||
stop_crowd_sound();
|
||||
}
|
||||
gConfigSound.sound = 0;
|
||||
gGameSoundsOff = 1;
|
||||
stop_other_sounds();
|
||||
stop_vehicle_sounds();
|
||||
stop_ride_music();
|
||||
stop_crowd_sound();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1843,9 +1838,7 @@ void pause_sounds()
|
|||
*/
|
||||
void unpause_sounds()
|
||||
{
|
||||
// When all sound code is reversed replace with gConfigSound.sound
|
||||
RCT2_GLOBAL(0x009AF59C, uint8) = 0;
|
||||
gConfigSound.sound = 1;
|
||||
gGameSoundsOff = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -156,6 +156,7 @@ extern rct_ride_music_params gRideMusicParamsList[AUDIO_MAX_RIDE_MUSIC];
|
|||
extern rct_ride_music_params *gRideMusicParamsListEnd;
|
||||
extern void *gCrowdSoundChannel;
|
||||
extern void *gTitleMusicChannel;
|
||||
extern bool gGameSoundsOff;
|
||||
|
||||
void audio_timefunc(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2, int channel);
|
||||
int CALLBACK audio_timer_callback(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
|
||||
|
|
|
@ -568,7 +568,7 @@ void SDLCALL Mixer::Callback(void* arg, uint8* stream, int length)
|
|||
|
||||
void Mixer::MixChannel(Channel& channel, uint8* data, int length)
|
||||
{
|
||||
if (channel.source && channel.source->Length() > 0 && !channel.done) {
|
||||
if (channel.source && channel.source->Length() > 0 && !channel.done && gConfigSound.sound) {
|
||||
AudioFormat streamformat = channel.source->Format();
|
||||
int loaded = 0;
|
||||
SDL_AudioCVT cvt;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "../localisation/localisation.h"
|
||||
#include "../management/finance.h"
|
||||
#include "../management/news_item.h"
|
||||
#include "../config.h"
|
||||
#include "../openrct2.h"
|
||||
#include "../ride/ride.h"
|
||||
#include "../scenario.h"
|
||||
|
@ -4494,10 +4495,10 @@ void peep_update_crowd_noise()
|
|||
if (!(RCT2_GLOBAL(0x009AF284, uint32) & (1 << 0)))
|
||||
return;
|
||||
|
||||
if (RCT2_GLOBAL(0x009AF59C, uint8) != 0)
|
||||
if (gGameSoundsOff)
|
||||
return;
|
||||
|
||||
if (!(RCT2_GLOBAL(0x009AF59D, uint8) & (1 << 0)))
|
||||
if (!gConfigSound.sound)
|
||||
return;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2)
|
||||
|
|
|
@ -3143,7 +3143,7 @@ void ride_set_map_tooltip(rct_map_element *mapElement)
|
|||
*/
|
||||
int ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint16 sampleRate, uint32 position, uint8 *tuneId)
|
||||
{
|
||||
if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !RCT2_GLOBAL(0x009AF59C, uint8) && RCT2_GLOBAL(0x00F438A4, rct_viewport*) != (rct_viewport*)-1) {
|
||||
if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gGameSoundsOff && RCT2_GLOBAL(0x00F438A4, rct_viewport*) != (rct_viewport*)-1) {
|
||||
RCT2_GLOBAL(0x009AF47C, uint16) = sampleRate;
|
||||
sint16 v11;
|
||||
sint16 v12;
|
||||
|
@ -3373,7 +3373,7 @@ void ride_music_update_final()
|
|||
int ebx;
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2)) {
|
||||
if ((RCT2_GLOBAL(0x009AF284, uint32) & (1 << 0))) {
|
||||
if (!RCT2_GLOBAL(0x009AF59C, uint8) && RCT2_GLOBAL(0x009AF59D, uint8) & 1 && RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8) && !(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 1)) {
|
||||
if (!gGameSoundsOff && gConfigSound.sound && RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8) && !(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 1)) {
|
||||
// set to stop music if volume <= 1 ?
|
||||
while (1) {
|
||||
int v8 = 0;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "../addresses.h"
|
||||
#include "../audio/audio.h"
|
||||
#include "../audio/mixer.h"
|
||||
#include "../config.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../world/sprite.h"
|
||||
#include "ride.h"
|
||||
|
@ -166,7 +167,7 @@ int sub_6BC2F3(rct_vehicle* vehicle)
|
|||
*/
|
||||
void vehicle_sounds_update()
|
||||
{
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) != -1 && !RCT2_GLOBAL(0x009AF59C, uint8) && RCT2_GLOBAL(0x009AF59D, uint8) & 1) {
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) != -1 && !gGameSoundsOff && gConfigSound.sound) {
|
||||
RCT2_GLOBAL(0x00F438A4, rct_viewport*) = (rct_viewport*)-1;
|
||||
rct_viewport* viewport = (rct_viewport*)-1;
|
||||
rct_window* window = RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "../addresses.h"
|
||||
#include "../audio/audio.h"
|
||||
#include "../audio/mixer.h"
|
||||
#include "../config.h"
|
||||
#include "../drawing/drawing.h"
|
||||
#include "../localisation/date.h"
|
||||
#include "../scenario.h"
|
||||
|
@ -242,9 +243,9 @@ void climate_update_sound()
|
|||
{
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) == 0xFFFFFFFF)
|
||||
return;
|
||||
if (RCT2_GLOBAL(0x009AF59C, uint8) != 0)
|
||||
if (gGameSoundsOff)
|
||||
return;
|
||||
if (!(RCT2_GLOBAL(0x009AF59D, uint8) & 1))
|
||||
if (!gConfigSound.sound)
|
||||
return;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue