mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- do not allow playing sounds during PlayerFinishLevel.
This gets called right before the level ends, any sound in here would play during the intermission or at the start of the next level.
This commit is contained in:
parent
c9833a811e
commit
b41ae2dfdd
3 changed files with 10 additions and 1 deletions
|
@ -378,7 +378,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
|
|||
FVector3 pos, vel;
|
||||
FRolloffInfo *rolloff;
|
||||
|
||||
if (sound_id <= 0 || volume <= 0 || nosfx || nosound )
|
||||
if (sound_id <= 0 || volume <= 0 || nosfx || nosound || blockNewSounds)
|
||||
return NULL;
|
||||
|
||||
// prevent crashes.
|
||||
|
|
|
@ -238,6 +238,7 @@ protected:
|
|||
TArray<uint8_t> S_SoundCurve;
|
||||
TMap<int, int> ResIdMap;
|
||||
TArray<FRandomSoundList> S_rnd;
|
||||
bool blockNewSounds = false;
|
||||
|
||||
private:
|
||||
void LinkChannel(FSoundChan* chan, FSoundChan** head);
|
||||
|
@ -268,6 +269,11 @@ public:
|
|||
}
|
||||
void EvictAllChannels();
|
||||
|
||||
void BlockNewSounds(bool on)
|
||||
{
|
||||
blockNewSounds = on;
|
||||
}
|
||||
|
||||
virtual int SoundSourceIndex(FSoundChan* chan) { return 0; }
|
||||
virtual void SetSource(FSoundChan* chan, int index) {}
|
||||
|
||||
|
|
|
@ -954,6 +954,8 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo)
|
|||
// Intermission stats for entire hubs
|
||||
G_LeavingHub(this, mode, thiscluster, &wminfo);
|
||||
|
||||
// Do not allow playing sounds in here - they'd never be able to play properly.
|
||||
soundEngine->BlockNewSounds(true);
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
|
@ -961,6 +963,7 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo)
|
|||
G_PlayerFinishLevel (i, mode, changeflags);
|
||||
}
|
||||
}
|
||||
soundEngine->BlockNewSounds(false);
|
||||
|
||||
if (mode == FINISH_SameHub)
|
||||
{ // Remember the level's state for re-entry.
|
||||
|
|
Loading…
Reference in a new issue