extensions/sdktools/vsound.cpp
changeset 3132 176125f4c329
parent 3129 76208f2e5ef0
child 3384 24c6057b2fda
     1.1 --- a/extensions/sdktools/vsound.cpp	Sat Oct 02 17:58:06 2010 -0400
     1.2 +++ b/extensions/sdktools/vsound.cpp	Mon Oct 04 19:45:21 2010 -0700
     1.3 @@ -630,179 +630,6 @@
     1.4  	return 1;
     1.5  }
     1.6  
     1.7 -static cell_t EmitSound2(IPluginContext *pContext, const cell_t *params)
     1.8 -{
     1.9 -	cell_t *addr, *cl_array;
    1.10 -	CellRecipientFilter crf;
    1.11 -	unsigned int numClients;
    1.12 -	int client;
    1.13 -	IGamePlayer *pPlayer = NULL;
    1.14 -
    1.15 -	pContext->LocalToPhysAddr(params[1], &cl_array);
    1.16 -	numClients = params[2];
    1.17 -
    1.18 -	/* Client validation */
    1.19 -	for (unsigned int i = 0; i < numClients; i++)
    1.20 -	{
    1.21 -		client = cl_array[i];
    1.22 -		pPlayer = playerhelpers->GetGamePlayer(client);
    1.23 -
    1.24 -		if (!pPlayer)
    1.25 -		{
    1.26 -			return pContext->ThrowNativeError("Client index %d is invalid", client);
    1.27 -		} else if (!pPlayer->IsInGame()) {
    1.28 -			return pContext->ThrowNativeError("Client %d is not connected", client);
    1.29 -		}
    1.30 -	}
    1.31 -
    1.32 -	crf.Initialize(cl_array, numClients);
    1.33 -
    1.34 -	char *sample;
    1.35 -	pContext->LocalToString(params[3], &sample);
    1.36 -	
    1.37 -	int entity = SoundReferenceToIndex(params[4]);
    1.38 -	int channel = params[5];
    1.39 -	float level = sp_ctof(params[6]);
    1.40 -	int flags = params[7];
    1.41 -	float vol = sp_ctof(params[8]);
    1.42 -	int pitch = params[9];
    1.43 -	int speakerentity = params[10];
    1.44 -
    1.45 -	Vector *pOrigin = NULL, origin;
    1.46 -	Vector *pDir = NULL, dir;
    1.47 -
    1.48 -	pContext->LocalToPhysAddr(params[11], &addr);
    1.49 -	if (addr != pContext->GetNullRef(SP_NULL_VECTOR))
    1.50 -	{
    1.51 -		pOrigin = &origin;
    1.52 -		origin.x = sp_ctof(addr[0]);
    1.53 -		origin.y = sp_ctof(addr[1]);
    1.54 -		origin.z = sp_ctof(addr[2]);
    1.55 -	}
    1.56 -
    1.57 -	pContext->LocalToPhysAddr(params[12], &addr);
    1.58 -	if (addr != pContext->GetNullRef(SP_NULL_VECTOR))
    1.59 -	{
    1.60 -		pDir = &dir;
    1.61 -		dir.x = sp_ctof(addr[0]);
    1.62 -		dir.y = sp_ctof(addr[1]);
    1.63 -		dir.z = sp_ctof(addr[2]);
    1.64 -	}
    1.65 -
    1.66 -	bool updatePos = params[13] ? true : false;
    1.67 -	float soundtime = sp_ctof(params[14]);
    1.68 -
    1.69 -	CUtlVector<Vector> *pOrigVec = NULL;
    1.70 -	CUtlVector<Vector> origvec;
    1.71 -	if (params[0] > 14)
    1.72 -	{
    1.73 -		pOrigVec = &origvec;
    1.74 -		for (cell_t i = 15; i <= params[0]; i++)
    1.75 -		{
    1.76 -			Vector vec;
    1.77 -			pContext->LocalToPhysAddr(params[i], &addr);
    1.78 -			vec.x = sp_ctof(addr[0]);
    1.79 -			vec.y = sp_ctof(addr[1]);
    1.80 -			vec.z = sp_ctof(addr[2]);
    1.81 -			origvec.AddToTail(vec);
    1.82 -		}
    1.83 -	}
    1.84 -
    1.85 -	/* If we're going to a "local player" and this is a dedicated server,
    1.86 -	 * intelligently redirect each sound.
    1.87 -	 */
    1.88 -
    1.89 -	if (entity == -2 && engine->IsDedicatedServer())
    1.90 -	{
    1.91 -		for (unsigned int i = 0; i < numClients; i++)
    1.92 -		{
    1.93 -			cell_t player[1];
    1.94 -			player[0] = cl_array[i];
    1.95 -			crf.Reset();
    1.96 -			crf.Initialize(player, 1);
    1.97 -			if (g_InSoundHook)
    1.98 -			{
    1.99 -				SH_CALL(enginesoundPatch, 
   1.100 -					static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char*, float, 
   1.101 -					float, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>
   1.102 -					(&IEngineSound::EmitSound))
   1.103 -					(crf, 
   1.104 -					player[0], 
   1.105 -					channel, 
   1.106 -					sample, 
   1.107 -					vol, 
   1.108 -					level, 
   1.109 -					flags, 
   1.110 -					pitch, 
   1.111 -					pOrigin,
   1.112 -					pDir,
   1.113 -					pOrigVec,
   1.114 -					updatePos,
   1.115 -					soundtime,
   1.116 -					speakerentity);
   1.117 -			}
   1.118 -			else
   1.119 -			{
   1.120 -				engsound->EmitSound(crf, 
   1.121 -					player[0], 
   1.122 -					channel, 
   1.123 -					sample, 
   1.124 -					vol, 
   1.125 -					level, 
   1.126 -					flags, 
   1.127 -					pitch, 
   1.128 -					pOrigin,
   1.129 -					pDir,
   1.130 -					pOrigVec,
   1.131 -					updatePos,
   1.132 -					soundtime,
   1.133 -					speakerentity);
   1.134 -			}
   1.135 -		}
   1.136 -	} else {
   1.137 -		if (g_InSoundHook)
   1.138 -		{
   1.139 -			SH_CALL(enginesoundPatch, 
   1.140 -				static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char*, float, 
   1.141 -				float, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>
   1.142 -				(&IEngineSound::EmitSound))
   1.143 -				(crf, 
   1.144 -				entity, 
   1.145 -				channel, 
   1.146 -				sample, 
   1.147 -				vol, 
   1.148 -				level, 
   1.149 -				flags, 
   1.150 -				pitch, 
   1.151 -				pOrigin,
   1.152 -				pDir,
   1.153 -				pOrigVec,
   1.154 -				updatePos,
   1.155 -				soundtime,
   1.156 -				speakerentity);
   1.157 -		}
   1.158 -		else
   1.159 -		{
   1.160 -			engsound->EmitSound(crf, 
   1.161 -				entity, 
   1.162 -				channel, 
   1.163 -				sample, 
   1.164 -				vol, 
   1.165 -				level, 
   1.166 -				flags, 
   1.167 -				pitch, 
   1.168 -				pOrigin,
   1.169 -				pDir,
   1.170 -				pOrigVec,
   1.171 -				updatePos,
   1.172 -				soundtime,
   1.173 -				speakerentity);
   1.174 -		}
   1.175 -	}
   1.176 -
   1.177 -	return 1;
   1.178 -}
   1.179 -
   1.180  static cell_t EmitSentence(IPluginContext *pContext, const cell_t *params)
   1.181  {
   1.182  	cell_t *addr;
   1.183 @@ -959,7 +786,6 @@
   1.184  {
   1.185  	{"EmitAmbientSound",		EmitAmbientSound},
   1.186  	{"EmitSentence",			EmitSentence},
   1.187 -	{"EmitSound2",				EmitSound2},
   1.188  	{"EmitSound",				EmitSound},
   1.189  	{"FadeClientVolume",		FadeClientVolume},
   1.190  	{"GetSoundDuration",		GetSoundDuration},