Fix for repeating patterns loaded from a save game file

This commit is contained in:
Simon 2021-04-03 14:41:20 +01:00
parent de8c6056fa
commit b2c8d1320d
3 changed files with 20 additions and 4 deletions

View file

@ -1649,10 +1649,6 @@ void idEntity::StopSound( const s_channelType channel, bool broadcast ) {
if ( refSound.referenceSound ) {
refSound.referenceSound->StopSound( channel );
if (refSound.shader) {
common->HapticStopEvent(refSound.shader->GetName());
}
}
}

View file

@ -151,6 +151,7 @@ idSoundChannel::idSoundChannel
*/
idSoundChannel::idSoundChannel( void ) {
decoder = NULL;
soundShader = NULL;
Clear();
}
@ -212,6 +213,12 @@ idSoundChannel::Stop
void idSoundChannel::Stop( void ) {
triggerState = false;
stopped = true;
if (soundShader != NULL)
{
common->HapticStopEvent(soundShader->GetName());
}
if ( decoder != NULL ) {
idSampleDecoder::Free( decoder );
decoder = NULL;
@ -971,6 +978,8 @@ void idSoundEmitterLocal::StopSound( const s_channelType channel ) {
Sys_EnterCriticalSection();
const char* soundShaderName = NULL;
for( i = 0; i < SOUND_MAX_CHANNELS; i++ ) {
idSoundChannel *chan = &channels[i];

View file

@ -1356,6 +1356,17 @@ void idSoundWorldLocal::ReadFromSaveGame( idFile *savefile ) {
chan->channelFade.fadeEnd44kHz += soundTimeOffset;
}
//Only concerned with registering looping sounds with the haptics service
if (cvarSystem->GetCVarBool("vr_useHapticsService"))
{
bool looping = (def->parms.soundShaderFlags & SSF_LOOPING) != 0;
if (looping)
{
common->Printf("Start Looping: %s", chan->soundShader->GetName());
common->HapticEvent(chan->soundShader->GetName(), 4, 1, 0, 0, 0);
}
}
// next command
savefile->ReadInt( channel );
}