|
|
|
@@ -33,8 +33,13 @@
|
|
|
|
|
#include <IForwardSys.h>
|
|
|
|
|
|
|
|
|
|
SH_DECL_HOOK8_void(IVEngineServer, EmitAmbientSound, SH_NOATTRIB, 0, int, const Vector &, const char *, float, soundlevel_t, int, int, float);
|
|
|
|
|
SH_DECL_HOOK14_void(IEngineSound, EmitSound, SH_NOATTRIB, 0, IRecipientFilter &, int, int, const char *, float, float, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
|
|
|
|
|
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
|
|
|
|
SH_DECL_HOOK15_void(IEngineSound, EmitSound, SH_NOATTRIB, 0, IRecipientFilter &, int, int, const char *, float, float, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
|
|
|
|
|
SH_DECL_HOOK15_void(IEngineSound, EmitSound, SH_NOATTRIB, 1, IRecipientFilter &, int, int, const char *, float, soundlevel_t, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
|
|
|
|
|
#else
|
|
|
|
|
SH_DECL_HOOK14_void(IEngineSound, EmitSound, SH_NOATTRIB, 0, IRecipientFilter &, int, int, const char *, float, float, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
|
|
|
|
|
SH_DECL_HOOK14_void(IEngineSound, EmitSound, SH_NOATTRIB, 1, IRecipientFilter &, int, int, const char *, float, soundlevel_t, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
bool g_InSoundHook = false;
|
|
|
|
|
|
|
|
|
@@ -252,10 +257,17 @@ void SoundHooks::OnEmitAmbientSound(int entindex, const Vector &pos, const char
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
|
|
|
|
void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSample,
|
|
|
|
|
float flVolume, soundlevel_t iSoundlevel, int iFlags, int iPitch, int iSpecialDSP, const Vector *pOrigin,
|
|
|
|
|
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
|
|
|
|
|
float soundtime, int speakerentity)
|
|
|
|
|
#else
|
|
|
|
|
void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSample,
|
|
|
|
|
float flVolume, soundlevel_t iSoundlevel, int iFlags, int iPitch, const Vector *pOrigin,
|
|
|
|
|
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
|
|
|
|
|
float soundtime, int speakerentity)
|
|
|
|
|
#endif
|
|
|
|
|
{
|
|
|
|
|
SoundHookIter iter;
|
|
|
|
|
IPluginFunction *pFunc;
|
|
|
|
@@ -293,6 +305,15 @@ void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChann
|
|
|
|
|
{
|
|
|
|
|
CellRecipientFilter crf;
|
|
|
|
|
crf.Initialize(players, size);
|
|
|
|
|
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
|
|
|
|
RETURN_META_NEWPARAMS(
|
|
|
|
|
MRES_IGNORED,
|
|
|
|
|
static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char*, float, soundlevel_t,
|
|
|
|
|
int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>(&IEngineSound::EmitSound),
|
|
|
|
|
(crf, iEntIndex, iChannel, buffer, flVolume, iSoundlevel, iFlags, iPitch, iSpecialDSP, pOrigin,
|
|
|
|
|
pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity)
|
|
|
|
|
);
|
|
|
|
|
#else
|
|
|
|
|
RETURN_META_NEWPARAMS(
|
|
|
|
|
MRES_IGNORED,
|
|
|
|
|
static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char*, float, soundlevel_t,
|
|
|
|
@@ -300,15 +321,23 @@ void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChann
|
|
|
|
|
(crf, iEntIndex, iChannel, buffer, flVolume, iSoundlevel, iFlags, iPitch, pOrigin,
|
|
|
|
|
pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity)
|
|
|
|
|
);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
|
|
|
|
void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSample,
|
|
|
|
|
float flVolume, float flAttenuation, int iFlags, int iPitch, int iSpecialDSP, const Vector *pOrigin,
|
|
|
|
|
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
|
|
|
|
|
float soundtime, int speakerentity)
|
|
|
|
|
#else
|
|
|
|
|
void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSample,
|
|
|
|
|
float flVolume, float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin,
|
|
|
|
|
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
|
|
|
|
|
float soundtime, int speakerentity)
|
|
|
|
|
#endif
|
|
|
|
|
{
|
|
|
|
|
SoundHookIter iter;
|
|
|
|
|
IPluginFunction *pFunc;
|
|
|
|
@@ -347,6 +376,15 @@ void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChan
|
|
|
|
|
{
|
|
|
|
|
CellRecipientFilter crf;
|
|
|
|
|
crf.Initialize(players, size);
|
|
|
|
|
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
|
|
|
|
RETURN_META_NEWPARAMS(
|
|
|
|
|
MRES_IGNORED,
|
|
|
|
|
static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char*, float, float,
|
|
|
|
|
int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>(&IEngineSound::EmitSound),
|
|
|
|
|
(crf, iEntIndex, iChannel, buffer, flVolume, SNDLVL_TO_ATTN(static_cast<soundlevel_t>(sndlevel)),
|
|
|
|
|
iFlags, iPitch, iSpecialDSP, pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity)
|
|
|
|
|
);
|
|
|
|
|
#else
|
|
|
|
|
RETURN_META_NEWPARAMS(
|
|
|
|
|
MRES_IGNORED,
|
|
|
|
|
static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char*, float, float,
|
|
|
|
@@ -354,6 +392,7 @@ void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChan
|
|
|
|
|
(crf, iEntIndex, iChannel, buffer, flVolume, SNDLVL_TO_ATTN(static_cast<soundlevel_t>(sndlevel)),
|
|
|
|
|
iFlags, iPitch, pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity)
|
|
|
|
|
);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -547,6 +586,7 @@ static cell_t EmitSound(IPluginContext *pContext, const cell_t *params)
|
|
|
|
|
player[0] = cl_array[i];
|
|
|
|
|
crf.Reset();
|
|
|
|
|
crf.Initialize(player, 1);
|
|
|
|
|
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
|
|
|
|
if (g_InSoundHook)
|
|
|
|
|
{
|
|
|
|
|
SH_CALL(enginesoundPatch,
|
|
|
|
@@ -585,8 +625,92 @@ static cell_t EmitSound(IPluginContext *pContext, const cell_t *params)
|
|
|
|
|
soundtime,
|
|
|
|
|
speakerentity);
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
if (g_InSoundHook)
|
|
|
|
|
{
|
|
|
|
|
SH_CALL(enginesoundPatch,
|
|
|
|
|
static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char*, float,
|
|
|
|
|
soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>
|
|
|
|
|
(&IEngineSound::EmitSound))
|
|
|
|
|
(crf,
|
|
|
|
|
player[0],
|
|
|
|
|
channel,
|
|
|
|
|
sample,
|
|
|
|
|
vol,
|
|
|
|
|
(soundlevel_t)level,
|
|
|
|
|
flags,
|
|
|
|
|
pitch,
|
|
|
|
|
0,
|
|
|
|
|
pOrigin,
|
|
|
|
|
pDir,
|
|
|
|
|
pOrigVec,
|
|
|
|
|
updatePos,
|
|
|
|
|
soundtime,
|
|
|
|
|
speakerentity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
engsound->EmitSound(crf,
|
|
|
|
|
player[0],
|
|
|
|
|
channel,
|
|
|
|
|
sample,
|
|
|
|
|
vol,
|
|
|
|
|
(soundlevel_t)level,
|
|
|
|
|
flags,
|
|
|
|
|
pitch,
|
|
|
|
|
0,
|
|
|
|
|
pOrigin,
|
|
|
|
|
pDir,
|
|
|
|
|
pOrigVec,
|
|
|
|
|
updatePos,
|
|
|
|
|
soundtime,
|
|
|
|
|
speakerentity);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
|
|
|
|
if (g_InSoundHook)
|
|
|
|
|
{
|
|
|
|
|
SH_CALL(enginesoundPatch,
|
|
|
|
|
static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char*, float,
|
|
|
|
|
soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>
|
|
|
|
|
(&IEngineSound::EmitSound))
|
|
|
|
|
(crf,
|
|
|
|
|
entity,
|
|
|
|
|
channel,
|
|
|
|
|
sample,
|
|
|
|
|
vol,
|
|
|
|
|
(soundlevel_t)level,
|
|
|
|
|
flags,
|
|
|
|
|
pitch,
|
|
|
|
|
0,
|
|
|
|
|
pOrigin,
|
|
|
|
|
pDir,
|
|
|
|
|
pOrigVec,
|
|
|
|
|
updatePos,
|
|
|
|
|
soundtime,
|
|
|
|
|
speakerentity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
engsound->EmitSound(crf,
|
|
|
|
|
entity,
|
|
|
|
|
channel,
|
|
|
|
|
sample,
|
|
|
|
|
vol,
|
|
|
|
|
(soundlevel_t)level,
|
|
|
|
|
flags,
|
|
|
|
|
pitch,
|
|
|
|
|
0,
|
|
|
|
|
pOrigin,
|
|
|
|
|
pDir,
|
|
|
|
|
pOrigVec,
|
|
|
|
|
updatePos,
|
|
|
|
|
soundtime,
|
|
|
|
|
speakerentity);
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
if (g_InSoundHook)
|
|
|
|
|
{
|
|
|
|
|
SH_CALL(enginesoundPatch,
|
|
|
|
@@ -625,6 +749,7 @@ static cell_t EmitSound(IPluginContext *pContext, const cell_t *params)
|
|
|
|
|
soundtime,
|
|
|
|
|
speakerentity);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|