# HG changeset patch # User Adam Kaminski # Date 1625845436 14400 # Fri Jul 09 11:43:56 2021 -0400 # Node ID eb90011ecb6022b24be2a9bf69692dd12da05bb7 # Parent 3fc442998a25ff2529a3ceb0ed2fa27e8f4c5303 Added a new command: "DestroyThingAndStopSounds" to the network protocol. diff -r 3fc442998a25 -r eb90011ecb60 protocolspec/spec.things.txt --- a/protocolspec/spec.things.txt Thu Jul 08 06:57:23 2021 -0400 +++ b/protocolspec/spec.things.txt Fri Jul 09 11:43:56 2021 -0400 @@ -173,6 +173,11 @@ Actor actor EndCommand +Command DestroyThingAndStopSounds + ExtendedCommand + Actor actor +EndCommand + Command SetThingAngle Actor actor AproxAngle angle diff -r 3fc442998a25 -r eb90011ecb60 src/cl_main.cpp --- a/src/cl_main.cpp Thu Jul 08 06:57:23 2021 -0400 +++ b/src/cl_main.cpp Fri Jul 09 11:43:56 2021 -0400 @@ -5078,25 +5078,41 @@ //***************************************************************************** // -void ServerCommands::DestroyThing::Execute() +static void client_DestroyThing( AActor *pActor ) { // [BB] If we spied the actor we are supposed to destory, reset our camera. - if ( actor->CheckLocalView( consoleplayer ) ) + if ( pActor->CheckLocalView( consoleplayer ) ) CLIENT_ResetConsolePlayerCamera( ); // [BB] If we are destroying a player's body here, we must NULL the corresponding pointer. - if ( actor->player && ( actor->player->mo == actor ) ) + if ( pActor->player && ( pActor->player->mo == pActor ) ) { // [BB] We also have to stop all its associated CLIENTSIDE scripts. Otherwise // they would get disassociated and continue to run even if the player disconnects later. if ( !( zacompatflags & ZACOMPATF_DONT_STOP_PLAYER_SCRIPTS_ON_DISCONNECT ) ) - FBehavior::StaticStopMyScripts ( actor->player->mo ); - - actor->player->mo = NULL; + FBehavior::StaticStopMyScripts ( pActor->player->mo ); + + pActor->player->mo = NULL; } // Destroy the thing. - actor->Destroy( ); + pActor->Destroy( ); +} + +//***************************************************************************** +// +void ServerCommands::DestroyThing::Execute() +{ + client_DestroyThing( actor ); +} + +//***************************************************************************** +// +void ServerCommands::DestroyThingAndStopSounds::Execute() +{ + // [AK] Stop all sounds that this actor is playing before destroying it. + S_StopAllSoundsFromActor( actor ); + client_DestroyThing( actor ); } //***************************************************************************** diff -r 3fc442998a25 -r eb90011ecb60 src/network_enums.h --- a/src/network_enums.h Thu Jul 08 06:57:23 2021 -0400 +++ b/src/network_enums.h Fri Jul 09 11:43:56 2021 -0400 @@ -378,6 +378,7 @@ ENUM_ELEMENT ( SVC2_SYNCMAPROTATION ), ENUM_ELEMENT ( SVC2_ADDTOMAPROTATION ), ENUM_ELEMENT ( SVC2_DELFROMMAPROTATION ), + ENUM_ELEMENT ( SVC2_DESTROYTHINGANDSTOPSOUNDS ), // [BB] Commands necessary for the account system. ENUM_ELEMENT ( SVC2_SRP_USER_START_AUTHENTICATION ), ENUM_ELEMENT ( SVC2_SRP_USER_PROCESS_CHALLENGE ), diff -r 3fc442998a25 -r eb90011ecb60 src/sv_commands.cpp --- a/src/sv_commands.cpp Thu Jul 08 06:57:23 2021 -0400 +++ b/src/sv_commands.cpp Fri Jul 09 11:43:56 2021 -0400 @@ -1503,6 +1503,18 @@ //***************************************************************************** // +void SERVERCOMMANDS_DestroyThingAndStopSounds( AActor *pActor ) +{ + if ( !EnsureActorHasNetID (pActor) ) + return; + + ServerCommands::DestroyThingAndStopSounds command; + command.SetActor( pActor ); + command.sendCommandToClients(); +} + +//***************************************************************************** +// void SERVERCOMMANDS_SetThingAngle( AActor *pActor, ULONG ulPlayerExtra, ServerCommandFlags flags ) { if ( !EnsureActorHasNetID (pActor) ) diff -r 3fc442998a25 -r eb90011ecb60 src/sv_commands.h --- a/src/sv_commands.h Thu Jul 08 06:57:23 2021 -0400 +++ b/src/sv_commands.h Fri Jul 09 11:43:56 2021 -0400 @@ -181,6 +181,7 @@ void SERVERCOMMANDS_SetThingState( AActor *pActor, NetworkActorState state, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 ); void SERVERCOMMANDS_SetThingTarget( AActor *pActor ); void SERVERCOMMANDS_DestroyThing( AActor *pActor ); +void SERVERCOMMANDS_DestroyThingAndStopSounds( AActor *pActor ); void SERVERCOMMANDS_SetThingAngle( AActor *pActor, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 ); void SERVERCOMMANDS_SetThingAngleExact( AActor *pActor, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 ); void SERVERCOMMANDS_SetThingWaterLevel( AActor *pActor, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 );