# HG changeset patch # User Adam Kaminski # Date 1625852858 14400 # Fri Jul 09 13:47:38 2021 -0400 # Node ID 1bbdfd4be20f055fdccccefc533f9320c0984e9e # Parent f7dd765a9675dc97ae837bf8810cc198a412e483 Fixed dormant sounds from still playing upon resetting the map. diff -r f7dd765a9675 -r 1bbdfd4be20f src/g_game.cpp --- a/src/g_game.cpp Fri Jul 09 13:43:52 2021 -0400 +++ b/src/g_game.cpp Fri Jul 09 13:47:38 2021 -0400 @@ -3371,6 +3371,10 @@ // [BB] If a PowerTimeFreezer was in effect, the sound could be paused. Make sure that it is resumed. S_ResumeSound( false ); + // [AK] Stop any unattached sounds that are still playing. The server doesn't need to do this. + if ( NETWORK_GetState( ) != NETSTATE_SERVER ) + S_StopAllUnattachedSounds( ); + // [BB] We are going to reset the map now, so any request for a reset is fulfilled. g_bResetMap = false; @@ -3414,7 +3418,12 @@ // [BB] This caused problems on the non-client code, so until we discover what // exactly happnes there, just do the same workaround here. if( !pActor->IsKindOf( RUNTIME_CLASS( ADynamicLight ) ) ) + { + // [AK] Stop any sounds from this actor before destroying it. + S_StopAllSoundsFromActor( pActor ); pActor->Destroy( ); + } + continue; } @@ -3955,12 +3964,17 @@ // If we're the server, tell clients to delete the actor. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) - SERVERCOMMANDS_DestroyThing( pActor ); + SERVERCOMMANDS_DestroyThingAndStopSounds( pActor ); // [BB] Destroying lights here will result in crashes after the countdown // of a duel ends in skirmish. Has to be investigated. if( !pActor->IsKindOf( RUNTIME_CLASS( ADynamicLight ) ) ) + { + // [AK] Stop any sounds from this actor before destroying it. + S_StopAllSoundsFromActor( pActor ); pActor->Destroy( ); + } + continue; } @@ -4105,7 +4119,7 @@ // [BB] The server doesn't tell the clients about indefinitely hidden non-inventory actors during a full update. && ( ( pActor->IsKindOf( RUNTIME_CLASS( AInventory ) ) ) || ( pActor->state != RUNTIME_CLASS( AInventory )->ActorInfo->FindState ("HideIndefinitely") ) ) ) - SERVERCOMMANDS_DestroyThing( pActor ); + SERVERCOMMANDS_DestroyThingAndStopSounds( pActor ); // [BB] A voodoo doll needs to stay assigned to the corresponding player. if ( pActor->IsKindOf( RUNTIME_CLASS( APlayerPawn )) ) @@ -4146,6 +4160,8 @@ SERVERCOMMANDS_SetThingProperty( pNewActor, APROP_RenderStyle ); } + // [AK] Stop any sounds from this actor before destroying it. + S_StopAllSoundsFromActor( pActor ); pActor->Destroy( ); } } diff -r f7dd765a9675 -r 1bbdfd4be20f src/gamemode.cpp --- a/src/gamemode.cpp Fri Jul 09 13:43:52 2021 -0400 +++ b/src/gamemode.cpp Fri Jul 09 13:47:38 2021 -0400 @@ -695,8 +695,10 @@ if ( pOldPlayerBody ) { if ( NETWORK_GetState( ) == NETSTATE_SERVER ) - SERVERCOMMANDS_DestroyThing( pOldPlayerBody ); + SERVERCOMMANDS_DestroyThingAndStopSounds( pOldPlayerBody ); + // [AK] Stop any sounds from this player before destroying them. + S_StopAllSoundsFromActor( pOldPlayerBody ); pOldPlayerBody->Destroy( ); }