Commit MetaInfo

Revision7be198a6bdd4fffec70ca7bd0e1be724d2c65911 (tree)
Time2020-12-21 13:23:43
AuthorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Fixed the StopSound ACS function not working in online games.

Change Summary

Incremental Difference

diff -r 789b013de7c8 -r 7be198a6bdd4 docs/zandronum-history.txt
--- a/docs/zandronum-history.txt Fri Dec 25 13:22:00 2020 -0500
+++ b/docs/zandronum-history.txt Sun Dec 20 23:23:43 2020 -0500
@@ -48,6 +48,7 @@
4848 - - Fixed missiles with the STEPMISSILE flag disappearing in online games. [Kaminsky]
4949 - - Fixed faulty armor behaviour that occurred when the player's inventory was cleared. [Kaminsky]
5050 - - Fixed sound channels containing looped sounds not being synced with newly connected clients. [Kaminsky]
51+- - Fixed the StopSound ACS function not working in online games. [Kaminsky]
5152 ! - sv_forcegldefaults renamed to sv_forcevideodefaults. The old name still exists for compatibility. [Dusk]
5253 ! - r_3dfloors is now forced to be true when sv_forcevideodefaults is true. [Dusk]
5354 ! - 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 789b013de7c8 -r 7be198a6bdd4 protocolspec/spec.sounds.txt
--- a/protocolspec/spec.sounds.txt Fri Dec 25 13:22:00 2020 -0500
+++ b/protocolspec/spec.sounds.txt Sun Dec 20 23:23:43 2020 -0500
@@ -38,3 +38,9 @@
3838 Command AnnouncerSound
3939 String sound
4040 EndCommand
41+
42+Command StopSound
43+ ExtendedCommand
44+ Actor actor
45+ Short channel
46+EndCommand
diff -r 789b013de7c8 -r 7be198a6bdd4 src/cl_main.cpp
--- a/src/cl_main.cpp Fri Dec 25 13:22:00 2020 -0500
+++ b/src/cl_main.cpp Sun Dec 20 23:23:43 2020 -0500
@@ -6769,6 +6769,13 @@
67696769
67706770 //*****************************************************************************
67716771 //
6772+void ServerCommands::StopSound::Execute()
6773+{
6774+ S_StopSound( actor, channel );
6775+}
6776+
6777+//*****************************************************************************
6778+//
67726779 void ServerCommands::StartSectorSequence::Execute()
67736780 {
67746781 SN_StartSequence( sector, channel, sequence.GetChars(), modeNum );
diff -r 789b013de7c8 -r 7be198a6bdd4 src/network_enums.h
--- a/src/network_enums.h Fri Dec 25 13:22:00 2020 -0500
+++ b/src/network_enums.h Sun Dec 20 23:23:43 2020 -0500
@@ -371,6 +371,7 @@
371371 ENUM_ELEMENT ( SVC2_SETMAPSKYSCROLLSPEED ),
372372 ENUM_ELEMENT ( SVC2_SETLOCALPLAYERJUMPTICS ),
373373 ENUM_ELEMENT ( SVC2_SETPLAYERDEATHS ),
374+ ENUM_ELEMENT ( SVC2_STOPSOUND ),
374375 // [BB] Commands necessary for the account system.
375376 ENUM_ELEMENT ( SVC2_SRP_USER_START_AUTHENTICATION ),
376377 ENUM_ELEMENT ( SVC2_SRP_USER_PROCESS_CHALLENGE ),
diff -r 789b013de7c8 -r 7be198a6bdd4 src/p_acs.cpp
--- a/src/p_acs.cpp Fri Dec 25 13:22:00 2020 -0500
+++ b/src/p_acs.cpp Sun Dec 20 23:23:43 2020 -0500
@@ -6205,8 +6205,12 @@
62056205 S_StopSound(activator, chan);
62066206
62076207 // [AK] If we're the server, remove this channel from the list of looping channels.
6208+ // Also tell the clients to stop playing the sound in this channel.
62086209 if ( NETWORK_GetState() == NETSTATE_SERVER )
6210+ {
6211+ SERVERCOMMANDS_StopSound( activator, chan );
62096212 SERVER_UpdateLoopingChannels( activator, chan, 0, 0, 0, true );
6213+ }
62106214 }
62116215 else
62126216 {
@@ -6218,8 +6222,12 @@
62186222 S_StopSound(spot, chan);
62196223
62206224 // [AK] If we're the server, remove this channel from the list of looping channels.
6225+ // Also tell the clients to stop playing the sound in this channel.
62216226 if ( NETWORK_GetState() == NETSTATE_SERVER )
6227+ {
6228+ SERVERCOMMANDS_StopSound( spot, chan );
62226229 SERVER_UpdateLoopingChannels( spot, chan, 0, 0, 0, true );
6230+ }
62236231 }
62246232 }
62256233 }
diff -r 789b013de7c8 -r 7be198a6bdd4 src/sv_commands.cpp
--- a/src/sv_commands.cpp Fri Dec 25 13:22:00 2020 -0500
+++ b/src/sv_commands.cpp Sun Dec 20 23:23:43 2020 -0500
@@ -3185,6 +3185,20 @@
31853185 }
31863186
31873187 //*****************************************************************************
3188+//
3189+void SERVERCOMMANDS_StopSound( AActor *pActor, LONG lChannel, ULONG ulPlayerExtra, ServerCommandFlags flags )
3190+{
3191+ // [AK] The actor must have a NetID so we can tell clients to stop the sound on their channel.
3192+ if ( EnsureActorHasNetID( pActor ) == false )
3193+ return;
3194+
3195+ ServerCommands::StopSound command;
3196+ command.SetActor( pActor );
3197+ command.SetChannel( lChannel );
3198+ command.sendCommandToClients( ulPlayerExtra, flags );
3199+}
3200+
3201+//*****************************************************************************
31883202 //*****************************************************************************
31893203 //
31903204 void SERVERCOMMANDS_StartSectorSequence( sector_t *pSector, const int Channel, const char *pszSequence, const int Modenum, ULONG ulPlayerExtra, ServerCommandFlags flags )
diff -r 789b013de7c8 -r 7be198a6bdd4 src/sv_commands.h
--- a/src/sv_commands.h Fri Dec 25 13:22:00 2020 -0500
+++ b/src/sv_commands.h Sun Dec 20 23:23:43 2020 -0500
@@ -312,6 +312,7 @@
312312 void SERVERCOMMANDS_SoundSector( sector_t *sector, int channel, const char *sound, float volume, float attenuation, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 );
313313 void SERVERCOMMANDS_SoundPoint( LONG lX, LONG lY, LONG lZ, LONG lChannel, const char *pszSound, float fVolume, float fAttenuation, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 );
314314 void SERVERCOMMANDS_AnnouncerSound( const char *pszSound, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 );
315+void SERVERCOMMANDS_StopSound( AActor *pActor, LONG lChannel, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 );
315316
316317 // Sector sequence commands. These handle sector sound sequences.
317318 void SERVERCOMMANDS_StartSectorSequence( sector_t *pSector, const int Channel, const char *pszSequence, const int Modenum, ULONG ulPlayerExtra = MAXPLAYERS, ServerCommandFlags flags = 0 );
Show on old repository browser