extensions/sdktools/vsound.cpp
changeset 3942 7aaa00382627
parent 3918 312fa627bf21
child 3961 0dc477c29792
     1.1 --- a/extensions/sdktools/vsound.cpp	Wed Jul 10 20:46:00 2013 -0400
     1.2 +++ b/extensions/sdktools/vsound.cpp	Fri Jul 12 02:31:41 2013 -0400
     1.3 @@ -32,7 +32,12 @@
     1.4  #include "vsound.h"
     1.5  #include <IForwardSys.h>
     1.6  
     1.7 +#if SOURCE_ENGINE == SE_DOTA
     1.8 +SH_DECL_HOOK8_void(IVEngineServer, EmitAmbientSound, SH_NOATTRIB, 0, CEntityIndex, const Vector &, const char *, float, soundlevel_t, int, int, float);
     1.9 +#else
    1.10  SH_DECL_HOOK8_void(IVEngineServer, EmitAmbientSound, SH_NOATTRIB, 0, int, const Vector &, const char *, float, soundlevel_t, int, int, float);
    1.11 +#endif
    1.12 +
    1.13  #if SOURCE_ENGINE >= SE_PORTAL2
    1.14  SH_DECL_HOOK17(IEngineSound, EmitSound, SH_NOATTRIB, 0, int, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, float, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
    1.15  SH_DECL_HOOK17(IEngineSound, EmitSound, SH_NOATTRIB, 1, int, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
    1.16 @@ -70,7 +75,7 @@
    1.17  	{
    1.18  		int index;
    1.19  #if SOURCE_ENGINE == SE_DOTA
    1.20 -		pFilter->GetRecipientIndex(&index, i);
    1.21 +		index = pFilter->GetRecipientIndex(i).Get();
    1.22  #else
    1.23  		index = pFilter->GetRecipientIndex(i);
    1.24  #endif
    1.25 @@ -221,9 +226,16 @@
    1.26  	return false;
    1.27  }
    1.28  
    1.29 +#if SOURCE_ENGINE == SE_DOTA
    1.30 +void SoundHooks::OnEmitAmbientSound(CEntityIndex index, const Vector &pos, const char *samp, float vol, 
    1.31 +									soundlevel_t soundlevel, int fFlags, int pitch, float delay)
    1.32 +{
    1.33 +	int entindex = index.Get();
    1.34 +#else
    1.35  void SoundHooks::OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol, 
    1.36  									soundlevel_t soundlevel, int fFlags, int pitch, float delay)
    1.37  {
    1.38 +#endif
    1.39  	SoundHookIter iter;
    1.40  	IPluginFunction *pFunc;
    1.41  	cell_t vec[3] = {sp_ftoc(pos.x), sp_ftoc(pos.y), sp_ftoc(pos.z)};
    1.42 @@ -259,8 +271,13 @@
    1.43  				vec2.x = sp_ctof(vec[0]);
    1.44  				vec2.y = sp_ctof(vec[1]);
    1.45  				vec2.z = sp_ctof(vec[2]);
    1.46 +#if SOURCE_ENGINE == SE_DOTA
    1.47  				RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::EmitAmbientSound, 
    1.48 +										(CEntityIndex(entindex), vec2, buffer, vol, soundlevel, fFlags, pitch, delay));
    1.49 +#else
    1.50 +				RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::EmitAmbientSound,
    1.51  										(entindex, vec2, buffer, vol, soundlevel, fFlags, pitch, delay));
    1.52 +#endif
    1.53  			}
    1.54  		}
    1.55  	}