# HG changeset patch # User Adam Kaminski # Date 1615155027 18000 # Sun Mar 07 17:10:27 2021 -0500 # Node ID c84af20d7bd45e3f40b6c80c9e7c8ec61cd44d65 # Parent b9e4a3ae9689740ba4793be9f6fe535be8a824e7 Fixed A_StopSound or A_StopSoundEx not working properly in a CustomInventory item's pickup state in online games. diff -r b9e4a3ae9689 -r c84af20d7bd4 src/thingdef/thingdef_codeptr.cpp --- a/src/thingdef/thingdef_codeptr.cpp Sun Mar 07 17:06:39 2021 -0500 +++ b/src/thingdef/thingdef_codeptr.cpp Sun Mar 07 17:10:27 2021 -0500 @@ -492,6 +492,16 @@ ACTION_PARAM_START(1); ACTION_PARAM_INT(slot, 0); + // [AK] We need to handle this differently if the calling actor is a CustomInventory item + // being picked up. Let the server tell the clients to stop the sound. + if (( stateowner != NULL ) && ( stateowner != self ) && ( stateowner->IsKindOf( RUNTIME_CLASS( ACustomInventory )))) + { + if (( NETWORK_InClientMode( )) && (( stateowner->ulNetworkFlags & NETFL_CLIENTSIDEONLY ) == false )) + return; + else if ( NETWORK_GetState( ) == NETSTATE_SERVER ) + SERVERCOMMANDS_StopSound( self, slot ); + } + S_StopSound(self, slot); // [AK] If we're the server, remove this channel from the list of looping channels. @@ -588,6 +598,16 @@ if (channel > NAME_Auto && channel <= NAME_SoundSlot7) { + // [AK] We need to handle this differently if the calling actor is a CustomInventory item + // being picked up. Let the server tell the clients to stop the sound. + if (( stateowner != NULL ) && ( stateowner != self ) && ( stateowner->IsKindOf( RUNTIME_CLASS( ACustomInventory )))) + { + if (( NETWORK_InClientMode( )) && (( stateowner->ulNetworkFlags & NETFL_CLIENTSIDEONLY ) == false )) + return; + else if ( NETWORK_GetState( ) == NETSTATE_SERVER ) + SERVERCOMMANDS_StopSound( self, int(channel) - NAME_Auto ); + } + S_StopSound (self, int(channel) - NAME_Auto); // [AK] If we're the server, remove this channel from the list of looping channels.