- added CHANF_FORCE flag for forcing non-looped sounds to start, even when sound is paused.

Blood needs this for its PlayerSound controller, which is run right on map load - so without this it wouldn't start the sound when a map is initiated from the console.
This commit is contained in:
Christoph Oelckers 2021-04-11 21:13:24 +02:00
parent fd6a71cac5
commit 6142f9d795
3 changed files with 3 additions and 2 deletions

View file

@ -31,6 +31,7 @@ enum EChanFlag
CHANF_OVERLAP = 8192, // [MK] Does not stop any sounds in the channel and instead plays over them. CHANF_OVERLAP = 8192, // [MK] Does not stop any sounds in the channel and instead plays over them.
CHANF_LOCAL = 16384, // only plays locally for the calling actor CHANF_LOCAL = 16384, // only plays locally for the calling actor
CHANF_TRANSIENT = 32768, // Do not record in savegames - used for sounds that get restarted outside the sound system (e.g. ambients in SW and Blood) CHANF_TRANSIENT = 32768, // Do not record in savegames - used for sounds that get restarted outside the sound system (e.g. ambients in SW and Blood)
CHANF_FORCE = 65536, // Start, even if sound is paused.
}; };
typedef TFlags<EChanFlag> EChanFlags; typedef TFlags<EChanFlag> EChanFlags;

View file

@ -528,7 +528,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
// sound is paused and a non-looped sound is being started. // sound is paused and a non-looped sound is being started.
// Such a sound would play right after unpausing which wouldn't sound right. // Such a sound would play right after unpausing which wouldn't sound right.
if (!(chanflags & CHANF_LOOP) && !(chanflags & (CHANF_UI|CHANF_NOPAUSE)) && SoundPaused) if (!(chanflags & CHANF_LOOP) && !(chanflags & (CHANF_UI|CHANF_NOPAUSE|CHANF_FORCE)) && SoundPaused)
{ {
return NULL; return NULL;
} }

View file

@ -595,7 +595,7 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event)
break; break;
gMe->restTime = 0; gMe->restTime = 0;
} }
sndStartSample(pXSprite->data1, -1, 1, 0); sndStartSample(pXSprite->data1, -1, 1, 0, CHANF_FORCE);
break; break;
case kThingObjectGib: case kThingObjectGib:
case kThingObjectExplode: case kThingObjectExplode: