mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- fixed ambient sounds not restarting in DN3D and RR.
This commit is contained in:
parent
d6c129b825
commit
2b95808d42
5 changed files with 28 additions and 12 deletions
|
@ -52,6 +52,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "st_start.h"
|
#include "st_start.h"
|
||||||
#include "s_music.h"
|
#include "s_music.h"
|
||||||
#include "i_video.h"
|
#include "i_video.h"
|
||||||
|
#include "c_dispatch.h"
|
||||||
#include "glbackend/glbackend.h"
|
#include "glbackend/glbackend.h"
|
||||||
#ifndef NETCODE_DISABLE
|
#ifndef NETCODE_DISABLE
|
||||||
#include "enet.h"
|
#include "enet.h"
|
||||||
|
@ -603,7 +604,8 @@ int RunGame()
|
||||||
M_Init();
|
M_Init();
|
||||||
SetDefaultStrings();
|
SetDefaultStrings();
|
||||||
if (g_gameType & GAMEFLAG_RR) InitRREndMap(); // this needs to be done better later
|
if (g_gameType & GAMEFLAG_RR) InitRREndMap(); // this needs to be done better later
|
||||||
//C_DoCommand("stat sounddebug");
|
if (Args->CheckParm("-sounddebug"))
|
||||||
|
C_DoCommand("stat sounddebug");
|
||||||
|
|
||||||
if (enginePreInit())
|
if (enginePreInit())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1736,7 +1736,7 @@ extern ReverbContainer* ForcedEnvironment;
|
||||||
CVAR(Bool, snd_reverb, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
CVAR(Bool, snd_reverb, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
void FX_SetReverb(int strength)
|
void FX_SetReverb(int strength)
|
||||||
{
|
{
|
||||||
if (snd_reverb)
|
if (snd_reverb && strength > 0)
|
||||||
{
|
{
|
||||||
// todo: optimize environments. The original "reverb" was garbage and not usable as reference.
|
// todo: optimize environments. The original "reverb" was garbage and not usable as reference.
|
||||||
if (strength < 64) strength = 0x1400;
|
if (strength < 64) strength = 0x1400;
|
||||||
|
@ -1744,6 +1744,7 @@ void FX_SetReverb(int strength)
|
||||||
else strength = 0x1900;
|
else strength = 0x1900;
|
||||||
ForcedEnvironment = S_FindEnvironment(strength);
|
ForcedEnvironment = S_FindEnvironment(strength);
|
||||||
}
|
}
|
||||||
|
else ForcedEnvironment = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -475,8 +475,8 @@ int S_PlaySound(int num, int channel, EChanFlags flags)
|
||||||
|
|
||||||
int A_PlaySound(int soundNum, int spriteNum, int channel, EChanFlags flags)
|
int A_PlaySound(int soundNum, int spriteNum, int channel, EChanFlags flags)
|
||||||
{
|
{
|
||||||
return (unsigned)spriteNum >= MAXSPRITES ? S_PlaySound(soundNum, flags) :
|
return (unsigned)spriteNum >= MAXSPRITES ? S_PlaySound(soundNum, channel, flags) :
|
||||||
S_PlaySound3D(soundNum, spriteNum, &sprite[spriteNum].pos, flags);
|
S_PlaySound3D(soundNum, spriteNum, &sprite[spriteNum].pos, channel, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_StopEnvSound(int sndNum, int sprNum, int channel)
|
void S_StopEnvSound(int sndNum, int sprNum, int channel)
|
||||||
|
@ -484,8 +484,15 @@ void S_StopEnvSound(int sndNum, int sprNum, int channel)
|
||||||
if (sprNum < -1 || sprNum >= MAXSPRITES) return;
|
if (sprNum < -1 || sprNum >= MAXSPRITES) return;
|
||||||
|
|
||||||
if (sprNum == -1) soundEngine->StopSoundID(sndNum+1);
|
if (sprNum == -1) soundEngine->StopSoundID(sndNum+1);
|
||||||
else if (channel == -1) soundEngine->StopSound(SOURCE_Actor, &sprite[sprNum], -1, sndNum+1);
|
else
|
||||||
else soundEngine->StopSound(SOURCE_Actor, &sprite[sprNum], channel, -1);
|
{
|
||||||
|
if (channel == -1) soundEngine->StopSound(SOURCE_Actor, &sprite[sprNum], -1, sndNum + 1);
|
||||||
|
else soundEngine->StopSound(SOURCE_Actor, &sprite[sprNum], channel, -1);
|
||||||
|
|
||||||
|
// StopSound kills the actor reference so this cannot be delayed until ChannelEnded gets called. At that point the actor may also not be valid anymore.
|
||||||
|
if ( S_IsAmbientSFX(sprNum) && sector[SECT(sprNum)].lotag < 3) // ST_2_UNDERWATER
|
||||||
|
actor[sprNum].t_data[0] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_ChangeSoundPitch(int soundNum, int spriteNum, int pitchoffset)
|
void S_ChangeSoundPitch(int soundNum, int spriteNum, int pitchoffset)
|
||||||
|
|
|
@ -1843,7 +1843,6 @@ void CheckCommandLine(int argc, char const* const* argv, int &doTitle)
|
||||||
|
|
||||||
int GameInterface::app_main()
|
int GameInterface::app_main()
|
||||||
{
|
{
|
||||||
C_DoCommand("stat sounddebug");
|
|
||||||
int i;
|
int i;
|
||||||
//int esi = 1;
|
//int esi = 1;
|
||||||
//int edi = esi;
|
//int edi = esi;
|
||||||
|
|
|
@ -473,17 +473,24 @@ int S_PlaySound(int sndnum, int channel, EChanFlags flags)
|
||||||
|
|
||||||
int A_PlaySound(int soundNum, int spriteNum, int channel, EChanFlags flags)
|
int A_PlaySound(int soundNum, int spriteNum, int channel, EChanFlags flags)
|
||||||
{
|
{
|
||||||
return (unsigned)spriteNum >= MAXSPRITES ? S_PlaySound(soundNum, flags) :
|
return (unsigned)spriteNum >= MAXSPRITES ? S_PlaySound(soundNum, channel, flags) :
|
||||||
S_PlaySound3D(soundNum, spriteNum, &sprite[spriteNum].pos, flags);
|
S_PlaySound3D(soundNum, spriteNum, &sprite[spriteNum].pos, channel, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_StopEnvSound(int sndNum, int sprNum, int flags)
|
void S_StopEnvSound(int sndNum, int sprNum, int channel)
|
||||||
{
|
{
|
||||||
if (sprNum < -1 || sprNum >= MAXSPRITES) return;
|
if (sprNum < -1 || sprNum >= MAXSPRITES) return;
|
||||||
|
|
||||||
if (sprNum == -1) soundEngine->StopSoundID(sndNum+1);
|
if (sprNum == -1) soundEngine->StopSoundID(sndNum+1);
|
||||||
else if (flags == -1) soundEngine->StopSound(SOURCE_Actor, &sprite[sprNum], -1, sndNum+1);
|
else
|
||||||
else soundEngine->StopSound(SOURCE_Actor, &sprite[sprNum], flags, -1);
|
{
|
||||||
|
if (channel == -1) soundEngine->StopSound(SOURCE_Actor, &sprite[sprNum], -1, sndNum + 1);
|
||||||
|
else soundEngine->StopSound(SOURCE_Actor, &sprite[sprNum], channel, -1);
|
||||||
|
|
||||||
|
// StopSound kills the actor reference so this cannot be delayed until ChannelEnded gets called. At that point the actor may also not be valid anymore.
|
||||||
|
if (S_IsAmbientSFX(sprNum) && sector[SECT(sprNum)].lotag < 3) // ST_2_UNDERWATER
|
||||||
|
actor[sprNum].t_data[0] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_ChangeSoundPitch(int soundNum, int spriteNum, int pitchoffset)
|
void S_ChangeSoundPitch(int soundNum, int spriteNum, int pitchoffset)
|
||||||
|
|
Loading…
Reference in a new issue