# HG changeset patch # User Adam Kaminski # Date 1626033302 14400 # Sun Jul 11 15:55:02 2021 -0400 # Node ID 4888a2e8d98c75510f79e939277262a95f5af852 # Parent a235cb68a06718f8dcdc5dffcae8d821434901e3 Fixed dormant sounds from still playing upon resetting the map. diff -r a235cb68a067 -r 4888a2e8d98c src/g_game.cpp --- a/src/g_game.cpp Sun Jul 11 15:45:38 2021 -0400 +++ b/src/g_game.cpp Sun Jul 11 15:55:02 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; } @@ -3954,13 +3963,22 @@ level.total_items--; // If we're the server, tell clients to delete the actor. + // [AK] Also tell them to stop all sounds on the actor. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) + { + SERVERCOMMANDS_StopAllSoundsOnThing( pActor ); SERVERCOMMANDS_DestroyThing( 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 +4123,11 @@ // [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") ) ) ) + { + // [AK] Also tell the clients to stop all sounds on the old actor. + SERVERCOMMANDS_StopAllSoundsOnThing( pActor ); SERVERCOMMANDS_DestroyThing( pActor ); + } // [BB] A voodoo doll needs to stay assigned to the corresponding player. if ( pActor->IsKindOf( RUNTIME_CLASS( APlayerPawn )) ) @@ -4146,6 +4168,8 @@ SERVERCOMMANDS_SetThingProperty( pNewActor, APROP_RenderStyle ); } + // [AK] Stop any sounds from this actor before destroying it. + S_StopAllSoundsFromActor( pActor ); pActor->Destroy( ); } } diff -r a235cb68a067 -r 4888a2e8d98c src/gamemode.cpp --- a/src/gamemode.cpp Sun Jul 11 15:45:38 2021 -0400 +++ b/src/gamemode.cpp Sun Jul 11 15:55:02 2021 -0400 @@ -778,8 +778,14 @@ if ( pOldPlayerBody ) { if ( NETWORK_GetState( ) == NETSTATE_SERVER ) + { + // [AK] Also tell the clients to stop all sounds on the player. + SERVERCOMMANDS_StopAllSoundsOnThing( pOldPlayerBody ); SERVERCOMMANDS_DestroyThing( pOldPlayerBody ); + } + // [AK] Stop any sounds from this player before destroying them. + S_StopAllSoundsFromActor( pOldPlayerBody ); pOldPlayerBody->Destroy( ); }