mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 03:53:07 +01:00
fix #2076
This commit is contained in:
@@ -41,6 +41,7 @@ rct_ride_music_params gRideMusicParamsList[AUDIO_MAX_RIDE_MUSIC];
|
||||
rct_ride_music_params *gRideMusicParamsListEnd;
|
||||
void *gCrowdSoundChannel = 0;
|
||||
void *gTitleMusicChannel = 0;
|
||||
void *gRainSoundChannel = 0;
|
||||
bool gGameSoundsOff = false;
|
||||
|
||||
void audio_init(int i)
|
||||
@@ -232,6 +233,14 @@ void stop_title_music()
|
||||
}
|
||||
}
|
||||
|
||||
void stop_rain_sound()
|
||||
{
|
||||
if (gRainSoundChannel) {
|
||||
Mixer_Stop_Channel(gRainSoundChannel);
|
||||
gRainSoundChannel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BA8E0
|
||||
@@ -285,6 +294,7 @@ void audio_close()
|
||||
stop_crowd_sound();
|
||||
stop_title_music();
|
||||
stop_ride_music();
|
||||
stop_rain_sound();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) = -1;
|
||||
}
|
||||
|
||||
@@ -309,6 +319,7 @@ void pause_sounds()
|
||||
stop_vehicle_sounds();
|
||||
stop_ride_music();
|
||||
stop_crowd_sound();
|
||||
stop_rain_sound();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -97,6 +97,7 @@ extern rct_ride_music_params gRideMusicParamsList[AUDIO_MAX_RIDE_MUSIC];
|
||||
extern rct_ride_music_params *gRideMusicParamsListEnd;
|
||||
extern void *gCrowdSoundChannel;
|
||||
extern void *gTitleMusicChannel;
|
||||
extern void *gRainSoundChannel;
|
||||
extern bool gGameSoundsOff;
|
||||
|
||||
int sound_play_panned(int sound_id, int ebx, sint16 x, sint16 y, sint16 z);
|
||||
@@ -104,6 +105,7 @@ void start_title_music();
|
||||
void stop_ride_music();
|
||||
void stop_crowd_sound();
|
||||
void stop_title_music();
|
||||
void stop_raid_sound();
|
||||
void audio_init1();
|
||||
void audio_init2(int device);
|
||||
void audio_close();
|
||||
|
||||
@@ -62,7 +62,6 @@ static const rct_weather_transition* climate_transitions[4];
|
||||
|
||||
// Sound data
|
||||
static int _rainVolume = 1;
|
||||
static void* _rainSoundChannel = 0;
|
||||
static unsigned int _lightningTimer, _thunderTimer;
|
||||
static void* _thunderSoundChannels[MAX_THUNDER_INSTANCES];
|
||||
static int _thunderStatus[MAX_THUNDER_INSTANCES] = { THUNDER_STATUS_NULL, THUNDER_STATUS_NULL };
|
||||
@@ -108,9 +107,9 @@ void climate_reset(int climate)
|
||||
_lightningTimer = 0;
|
||||
_thunderTimer = 0;
|
||||
if (_rainVolume != 1){
|
||||
if (_rainSoundChannel) {
|
||||
Mixer_Stop_Channel(_rainSoundChannel);
|
||||
_rainSoundChannel = 0;
|
||||
if (gRainSoundChannel) {
|
||||
Mixer_Stop_Channel(gRainSoundChannel);
|
||||
gRainSoundChannel = 0;
|
||||
}
|
||||
_rainVolume = 1;
|
||||
}
|
||||
@@ -251,30 +250,30 @@ void climate_update_sound()
|
||||
static void climate_update_rain_sound()
|
||||
{
|
||||
if (_climateCurrentWeatherEffect == 1 || _climateCurrentWeatherEffect == 2) {
|
||||
// Start playing the rain sound
|
||||
if (!gRainSoundChannel) {
|
||||
gRainSoundChannel = Mixer_Play_Effect(SOUND_RAIN_1, MIXER_LOOP_INFINITE, DStoMixerVolume(-4000), 0.5f, 1, 0);
|
||||
}
|
||||
if (_rainVolume == 1) {
|
||||
// Start playing the rain sound
|
||||
if (!_rainSoundChannel) {
|
||||
_rainSoundChannel = Mixer_Play_Effect(SOUND_RAIN_1, MIXER_LOOP_INFINITE, DStoMixerVolume(-4000), 0.5f, 1, 0);
|
||||
}
|
||||
_rainVolume = -4000;
|
||||
} else {
|
||||
// Increase rain sound
|
||||
_rainVolume = min(-1400, _rainVolume + 80);
|
||||
if (_rainSoundChannel) {
|
||||
Mixer_Channel_Volume(_rainSoundChannel, DStoMixerVolume(_rainVolume));
|
||||
if (gRainSoundChannel) {
|
||||
Mixer_Channel_Volume(gRainSoundChannel, DStoMixerVolume(_rainVolume));
|
||||
}
|
||||
}
|
||||
} else if (_rainVolume != 1) {
|
||||
// Decrease rain sound
|
||||
_rainVolume -= 80;
|
||||
if (_rainVolume > -4000) {
|
||||
if (_rainSoundChannel) {
|
||||
Mixer_Channel_Volume(_rainSoundChannel, DStoMixerVolume(_rainVolume));
|
||||
if (gRainSoundChannel) {
|
||||
Mixer_Channel_Volume(gRainSoundChannel, DStoMixerVolume(_rainVolume));
|
||||
}
|
||||
} else {
|
||||
if (_rainSoundChannel) {
|
||||
Mixer_Stop_Channel(_rainSoundChannel);
|
||||
_rainSoundChannel = 0;
|
||||
if (gRainSoundChannel) {
|
||||
Mixer_Stop_Channel(gRainSoundChannel);
|
||||
gRainSoundChannel = 0;
|
||||
}
|
||||
_rainVolume = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user