From 0d787e24ce3277cb8ff364eced3d67e5fafff36a Mon Sep 17 00:00:00 2001
From: Nicholas Hastings <nshastings@gmail.com>
Date: Wed, 25 Nov 2015 17:25:35 -0500
Subject: [PATCH 1/2] Converted NormalSHook to typeset and added old prototype.

New prototype was added in PR #247
---
 plugins/include/sdktools_sound.inc | 70 +++++++++++++++++-------------
 1 file changed, 39 insertions(+), 31 deletions(-)

diff --git a/plugins/include/sdktools_sound.inc b/plugins/include/sdktools_sound.inc
index 820b0cd2..488e796a 100644
--- a/plugins/include/sdktools_sound.inc
+++ b/plugins/include/sdktools_sound.inc
@@ -336,37 +336,45 @@ typedef AmbientSHook = function Action (
   float &delay
 );
 
-/**
- * Called when a sound is going to be emitted to one or more clients.
- * NOTICE: all params can be overwritten to modify the default behavior.
- *
- * @param clients		Array of client indexes.
- * @param numClients		Number of clients in the array (modify this value if you add/remove elements from the client array).
- * @param sample		Sound file name relative to the "sounds" folder.
- * @param entity		Entity emitting the sound.
- * @param channel		Channel emitting the sound.
- * @param volume		Sound volume.
- * @param level			Sound level.
- * @param pitch			Sound pitch.
- * @param flags			Sound flags.
- * @param soundEntry		Game sound entry name. (Used in engines newer than Portal 2)
- * @param seed			Sound seed. (Used in engines newer than Portal 2)
- * @return			Plugin_Continue to allow the sound to be played, Plugin_Stop to block it, 
- *				  Plugin_Changed when any parameter has been modified.
- */
-typedef NormalSHook = function Action (
-  int clients[64],
-  int &numClients,
-  char sample[PLATFORM_MAX_PATH],
-  int &entity,
-  int &channel,
-  float &volume,
-  int &level,
-  int &pitch,
-  int &flags,
-  char soundEntry[PLATFORM_MAX_PATH],
-  int &seed
-);
+typeset NormalSHook
+{
+	// Called when a sound is going to be emitted to one or more clients.
+	// NOTICE: all params can be overwritten to modify the default behavior.
+	//
+	// @param clients       Array of client indexes.
+	// @param numClients    Number of clients in the array (modify this value if you add/remove elements from the client array).
+	// @param sample        Sound file name relative to the "sounds" folder.
+	// @param entity        Entity emitting the sound.
+	// @param channel       Channel emitting the sound.
+	// @param volume        Sound volume.
+	// @param level         Sound level.
+	// @param pitch         Sound pitch.
+	// @param flags         Sound flags.
+	// @param soundEntry    Game sound entry name. (Used in engines newer than Portal 2)
+	// @param seed          Sound seed. (Used in engines newer than Portal 2)
+	// @return              Plugin_Continue to allow the sound to be played, Plugin_Stop to block it, 
+	//                      Plugin_Changed when any parameter has been modified.
+	function Action (int clients[64], int &numClients, char sample[PLATFORM_MAX_PATH],
+	  int &entity, int &channel, float &volume, int &level, int &pitch, int &flags,
+	  char soundEntry[PLATFORM_MAX_PATH], int &seed);
+	
+	// Called when a sound is going to be emitted to one or more clients.
+	// NOTICE: all params can be overwritten to modify the default behaviour.
+	//
+	// @param clients       Array of client indexes.
+	// @param numClients    Number of clients in the array (modify this value if you add/remove elements from the client array).
+	// @param sample        Sound file name relative to the "sounds" folder.
+	// @param entity        Entity emitting the sound.
+	// @param channel       Channel emitting the sound.
+	// @param volume        Sound volume.
+	// @param level         Sound level.
+	// @param pitch         Sound pitch.
+	// @param flags         Sound flags.
+	// @return              Plugin_Continue to allow the sound to be played, Plugin_Stop to block it, 
+	//                      Plugin_Changed when any parameter has been modified.
+	function Action (int clients[64], int &numClients, char sample[PLATFORM_MAX_PATH],
+	  int &entity, int &channel, float &volume, int &level, int &pitch, int &flags);
+};
 
 /**
  * Hooks all played ambient sounds.

From 126ce99cd9d350413e95489e623cf70f3a32f807 Mon Sep 17 00:00:00 2001
From: Nicholas Hastings <nshastings@gmail.com>
Date: Thu, 26 Nov 2015 09:43:08 -0500
Subject: [PATCH 2/2] Resize clients array in newest NormalSHook prototype to
 MAXPLAYERS.

The old version of the newer one is left as a third typeset member to not break
compilation for users opting into it on dev branch. Both typeset members with
old array size are however marked as deprecated, since they can be missing
a client.
---
 plugins/include/sdktools_sound.inc | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/plugins/include/sdktools_sound.inc b/plugins/include/sdktools_sound.inc
index 488e796a..a68d8c31 100644
--- a/plugins/include/sdktools_sound.inc
+++ b/plugins/include/sdktools_sound.inc
@@ -354,24 +354,16 @@ typeset NormalSHook
 	// @param seed          Sound seed. (Used in engines newer than Portal 2)
 	// @return              Plugin_Continue to allow the sound to be played, Plugin_Stop to block it, 
 	//                      Plugin_Changed when any parameter has been modified.
+	function Action (int clients[MAXPLAYERS], int &numClients, char sample[PLATFORM_MAX_PATH],
+	  int &entity, int &channel, float &volume, int &level, int &pitch, int &flags,
+	  char soundEntry[PLATFORM_MAX_PATH], int &seed);
+	
+	// Deprecated. Use other prototype.
 	function Action (int clients[64], int &numClients, char sample[PLATFORM_MAX_PATH],
 	  int &entity, int &channel, float &volume, int &level, int &pitch, int &flags,
 	  char soundEntry[PLATFORM_MAX_PATH], int &seed);
 	
-	// Called when a sound is going to be emitted to one or more clients.
-	// NOTICE: all params can be overwritten to modify the default behaviour.
-	//
-	// @param clients       Array of client indexes.
-	// @param numClients    Number of clients in the array (modify this value if you add/remove elements from the client array).
-	// @param sample        Sound file name relative to the "sounds" folder.
-	// @param entity        Entity emitting the sound.
-	// @param channel       Channel emitting the sound.
-	// @param volume        Sound volume.
-	// @param level         Sound level.
-	// @param pitch         Sound pitch.
-	// @param flags         Sound flags.
-	// @return              Plugin_Continue to allow the sound to be played, Plugin_Stop to block it, 
-	//                      Plugin_Changed when any parameter has been modified.
+	// Deprecated. Use other prototype.
 	function Action (int clients[64], int &numClients, char sample[PLATFORM_MAX_PATH],
 	  int &entity, int &channel, float &volume, int &level, int &pitch, int &flags);
 };