mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- Blood: Don't let Caleb's voice overlap if spamming the use key on a locked door.
* Fixes #113.
This commit is contained in:
parent
4ef0d20e0e
commit
01c494e29d
3 changed files with 34 additions and 4 deletions
|
@ -1493,14 +1493,20 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
if (pXSector->locked && pPlayer == gMe)
|
||||
{
|
||||
viewSetMessage(GStrings("TXTB_LOCKED"));
|
||||
sndStartSample(3062, 255, 2, 0);
|
||||
auto snd = 3062;
|
||||
if (sndCheckPlaying(snd))
|
||||
sndStopSample(snd);
|
||||
sndStartSample(snd, 255, 2, 0);
|
||||
}
|
||||
if (!key || pPlayer->hasKey[key])
|
||||
trTriggerSector(a2, pXSector, kCmdSpritePush);
|
||||
else if (pPlayer == gMe)
|
||||
{
|
||||
viewSetMessage(GStrings("TXTB_KEY"));
|
||||
sndStartSample(3063, 255, 2, 0);
|
||||
auto snd = 3063;
|
||||
if (sndCheckPlaying(snd))
|
||||
sndStopSample(snd);
|
||||
sndStartSample(snd, 255, 2, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1511,14 +1517,20 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
if (pXWall->locked && pPlayer == gMe)
|
||||
{
|
||||
viewSetMessage(GStrings("TXTB_LOCKED"));
|
||||
sndStartSample(3062, 255, 2, 0);
|
||||
auto snd = 3062;
|
||||
if (sndCheckPlaying(snd))
|
||||
sndStopSample(snd);
|
||||
sndStartSample(snd, 255, 2, 0);
|
||||
}
|
||||
if (!key || pPlayer->hasKey[key])
|
||||
trTriggerWall(a2, pXWall, kCmdWallPush);
|
||||
else if (pPlayer == gMe)
|
||||
{
|
||||
viewSetMessage(GStrings("TXTB_KEY"));
|
||||
sndStartSample(3063, 255, 2, 0);
|
||||
auto snd = 3063;
|
||||
if (sndCheckPlaying(snd))
|
||||
sndStopSample(snd);
|
||||
sndStartSample(snd, 255, 2, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -144,6 +144,22 @@ void SoundCallback(intptr_t val)
|
|||
pChannel->TotalKills = 0;
|
||||
}
|
||||
|
||||
bool sndCheckPlaying(unsigned int nSound)
|
||||
{
|
||||
auto snd = soundEngine->FindSoundByResID(nSound);
|
||||
return snd > 0 ? soundEngine->GetSoundPlayingInfo(SOURCE_Any, nullptr, snd) : false;
|
||||
}
|
||||
|
||||
void sndStopSample(unsigned int nSound)
|
||||
{
|
||||
auto snd = soundEngine->FindSoundByResID(nSound);
|
||||
|
||||
if (snd > 0)
|
||||
{
|
||||
soundEngine->StopSoundID(snd);
|
||||
}
|
||||
}
|
||||
|
||||
void sndStartSample(const char *pzSound, int nVolume, int nChannel)
|
||||
{
|
||||
if (!SoundEnabled())
|
||||
|
|
|
@ -45,6 +45,8 @@ struct SFX
|
|||
};
|
||||
|
||||
int sndGetRate(int format);
|
||||
bool sndCheckPlaying(unsigned int nSound);
|
||||
void sndStopSample(unsigned int nSound);
|
||||
void sndStartSample(const char *pzSound, int nVolume, int nChannel = -1);
|
||||
void sndStartSample(unsigned int nSound, int nVolume, int nChannel = -1, bool bLoop = false, EChanFlags soundflags = CHANF_NONE);
|
||||
void sndStartWavID(unsigned int nSound, int nVolume, int nChannel = -1);
|
||||
|
|
Loading…
Reference in a new issue