# HG changeset patch # User Adam Kaminski # Date 1606536020 18000 # Fri Nov 27 23:00:20 2020 -0500 # Node ID eee2db0ea2864519b8b6f0bfb252301e294912e9 # Parent 0c661b7b855db02ca5e2bcd21ea73fd0422146d6 Fixed the StopSound ACS function not working in online games. diff -r 0c661b7b855d -r eee2db0ea286 docs/zandronum-history.txt --- a/docs/zandronum-history.txt Fri Nov 27 22:55:23 2020 -0500 +++ b/docs/zandronum-history.txt Fri Nov 27 23:00:20 2020 -0500 @@ -44,6 +44,7 @@ - - Fixed desaturated translations created with CreateTranslation() not syncing with clients in an online game. [Kaminsky] - - Fixed missiles with the STEPMISSILE flag disappearing in online games. [Kaminsky] - - Fixed sound channels containing looped sounds not being synced with newly connected clients. [Kaminsky] +- - Fixed the StopSound ACS function not working in online games. [Kaminsky] ! - sv_forcegldefaults renamed to sv_forcevideodefaults. The old name still exists for compatibility. [Dusk] ! - r_3dfloors is now forced to be true when sv_forcevideodefaults is true. [Dusk] ! - When the wad authentication fails for a connecting client, the client only reports the missing and incompatible PWADS instead of all of them. [Pol Marcet] diff -r 0c661b7b855d -r eee2db0ea286 protocolspec/spec.sounds.txt --- a/protocolspec/spec.sounds.txt Fri Nov 27 22:55:23 2020 -0500 +++ b/protocolspec/spec.sounds.txt Fri Nov 27 23:00:20 2020 -0500 @@ -38,3 +38,9 @@ Command AnnouncerSound String sound EndCommand + +Command StopSound + ExtendedCommand + Actor actor + Short channel +EndCommand diff -r 0c661b7b855d -r eee2db0ea286 src/cl_main.cpp --- a/src/cl_main.cpp Fri Nov 27 22:55:23 2020 -0500 +++ b/src/cl_main.cpp Fri Nov 27 23:00:20 2020 -0500 @@ -6741,6 +6741,13 @@ //***************************************************************************** // +void ServerCommands::StopSound::Execute() +{ + S_StopSound( actor, channel ); +} + +//***************************************************************************** +// void ServerCommands::StartSectorSequence::Execute() { SN_StartSequence( sector, channel, sequence.GetChars(), modeNum ); diff -r 0c661b7b855d -r eee2db0ea286 src/network_enums.h --- a/src/network_enums.h Fri Nov 27 22:55:23 2020 -0500 +++ b/src/network_enums.h Fri Nov 27 23:00:20 2020 -0500 @@ -370,6 +370,7 @@ ENUM_ELEMENT ( SVC2_SECRETMARKSECTORFOUND ), ENUM_ELEMENT ( SVC2_SETMAPSKYSCROLLSPEED ), ENUM_ELEMENT ( SVC2_SETLOCALPLAYERJUMPTICS ), + ENUM_ELEMENT ( SVC2_STOPSOUND ), // [BB] Commands necessary for the account system. ENUM_ELEMENT ( SVC2_SRP_USER_START_AUTHENTICATION ), ENUM_ELEMENT ( SVC2_SRP_USER_PROCESS_CHALLENGE ), diff -r 0c661b7b855d -r eee2db0ea286 src/p_acs.cpp --- a/src/p_acs.cpp Fri Nov 27 22:55:23 2020 -0500 +++ b/src/p_acs.cpp Fri Nov 27 23:00:20 2020 -0500 @@ -6179,8 +6179,12 @@ S_StopSound(activator, chan); // [AK] If we're the server, remove this channel from the list of looping channels. + // Also tell the clients to stop playing the sound in this channel. if ( NETWORK_GetState() == NETSTATE_SERVER ) + { + SERVERCOMMANDS_StopSound( activator, chan ); SERVER_UpdateLoopingChannels( activator, chan, 0, 0, 0, true ); + } } else { @@ -6192,8 +6196,12 @@ S_StopSound(spot, chan); // [AK] If we're the server, remove this channel from the list of looping channels. + // Also tell the clients to stop playing the sound in this channel. if ( NETWORK_GetState() == NETSTATE_SERVER ) + { + SERVERCOMMANDS_StopSound( spot, chan ); SERVER_UpdateLoopingChannels( spot, chan, 0, 0, 0, true ); + } } } } diff -r 0c661b7b855d -r eee2db0ea286 src/sv_commands.cpp --- a/src/sv_commands.cpp Fri Nov 27 22:55:23 2020 -0500 +++ b/src/sv_commands.cpp Fri Nov 27 23:00:20 2020 -0500 @@ -3172,6 +3172,20 @@ } //***************************************************************************** +// +void SERVERCOMMANDS_StopSound( AActor *pActor, LONG lChannel, ULONG ulPlayerExtra, ServerCommandFlags flags ) +{ + // [AK] The actor must have a NetID so we can tell clients to stop the sound on their channel. + if ( pActor == NULL || pActor->lNetID == -1 ) + return; + + NetCommand command( SVC2_STOPSOUND ); + command.addShort( pActor->lNetID ); + command.addShort( lChannel ); + command.sendCommandToClients( ulPlayerExtra, flags ); +} + +//***************************************************************************** //***************************************************************************** // void SERVERCOMMANDS_StartSectorSequence( sector_t *pSector, const int Channel, const char *pszSequence, const int Modenum, ULONG ulPlayerExtra, ServerCommandFlags flags ) diff -r 0c661b7b855d -r eee2db0ea286 src/sv_commands.h --- a/src/sv_commands.h Fri Nov 27 22:55:23 2020 -0500 +++ b/src/sv_commands.h Fri Nov 27 23:00:20 2020 -0500 @@ -311,6 +311,7 @@ void SERVERCOMMANDS_SoundSector( sector_t *sector, int channel, const char *sound, float volume, float attenuation, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 ); void SERVERCOMMANDS_SoundPoint( LONG lX, LONG lY, LONG lZ, LONG lChannel, const char *pszSound, float fVolume, float fAttenuation, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 ); void SERVERCOMMANDS_AnnouncerSound( const char *pszSound, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 ); +void SERVERCOMMANDS_StopSound( AActor *pActor, LONG lChannel, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 ); // Sector sequence commands. These handle sector sound sequences. void SERVERCOMMANDS_StartSectorSequence( sector_t *pSector, const int Channel, const char *pszSequence, const int Modenum, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 );