Update SDKTools sound functionality for hl2sdk-csgo changes.
This commit is contained in:
parent
0a7a01e617
commit
07f8043bce
@ -34,7 +34,10 @@
|
|||||||
|
|
||||||
SH_DECL_HOOK8_void(IVEngineServer, EmitAmbientSound, SH_NOATTRIB, 0, int, const Vector &, const char *, float, soundlevel_t, int, int, float);
|
SH_DECL_HOOK8_void(IVEngineServer, EmitAmbientSound, SH_NOATTRIB, 0, int, const Vector &, const char *, float, soundlevel_t, int, int, float);
|
||||||
|
|
||||||
#if SOURCE_ENGINE >= SE_PORTAL2
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
SH_DECL_HOOK18(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, void *);
|
||||||
|
SH_DECL_HOOK18(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, void *);
|
||||||
|
#elif SOURCE_ENGINE >= SE_PORTAL2
|
||||||
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);
|
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);
|
||||||
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);
|
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);
|
||||||
#elif SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_SDK2013 \
|
#elif SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_SDK2013 \
|
||||||
@ -313,7 +316,12 @@ uint32 GenerateSoundEntryHash(char const *pSoundEntry)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SOURCE_ENGINE >= SE_PORTAL2
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
int SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample,
|
||||||
|
float flVolume, soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
|
||||||
|
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
|
||||||
|
float soundtime, int speakerentity, void *pUnknown)
|
||||||
|
#elif SOURCE_ENGINE >= SE_PORTAL2
|
||||||
int SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample,
|
int SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample,
|
||||||
float flVolume, soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
|
float flVolume, soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
|
||||||
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
|
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
|
||||||
@ -414,7 +422,16 @@ void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChann
|
|||||||
|
|
||||||
CellRecipientFilter crf;
|
CellRecipientFilter crf;
|
||||||
crf.Initialize(players, size);
|
crf.Initialize(players, size);
|
||||||
#if SOURCE_ENGINE >= SE_PORTAL2
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
RETURN_META_VALUE_NEWPARAMS(
|
||||||
|
MRES_IGNORED,
|
||||||
|
-1,
|
||||||
|
static_cast<int (IEngineSound::*)(IRecipientFilter &, int, int, const char*, unsigned int, const char*, float, soundlevel_t,
|
||||||
|
int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int, void *)>(&IEngineSound::EmitSound),
|
||||||
|
(crf, iEntIndex, iChannel, soundEntry, nSoundEntryHash, buffer, flVolume, iSoundlevel, nSeed, iFlags, iPitch, pOrigin,
|
||||||
|
pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity, nullptr)
|
||||||
|
);
|
||||||
|
#elif SOURCE_ENGINE >= SE_PORTAL2
|
||||||
RETURN_META_VALUE_NEWPARAMS(
|
RETURN_META_VALUE_NEWPARAMS(
|
||||||
MRES_IGNORED,
|
MRES_IGNORED,
|
||||||
-1,
|
-1,
|
||||||
@ -450,7 +467,12 @@ void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChann
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SOURCE_ENGINE >= SE_PORTAL2
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
int SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample,
|
||||||
|
float flVolume, float flAttenuation, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
|
||||||
|
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
|
||||||
|
float soundtime, int speakerentity, void *pUnknown)
|
||||||
|
#elif SOURCE_ENGINE >= SE_PORTAL2
|
||||||
int SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample,
|
int SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample,
|
||||||
float flVolume, float flAttenuation, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
|
float flVolume, float flAttenuation, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
|
||||||
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
|
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
|
||||||
@ -552,7 +574,16 @@ void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChan
|
|||||||
|
|
||||||
CellRecipientFilter crf;
|
CellRecipientFilter crf;
|
||||||
crf.Initialize(players, size);
|
crf.Initialize(players, size);
|
||||||
#if SOURCE_ENGINE >= SE_PORTAL2
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
RETURN_META_VALUE_NEWPARAMS(
|
||||||
|
MRES_IGNORED,
|
||||||
|
-1,
|
||||||
|
static_cast<int (IEngineSound::*)(IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, float,
|
||||||
|
int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int, void *)>(&IEngineSound::EmitSound),
|
||||||
|
(crf, iEntIndex, iChannel, soundEntry, nSoundEntryHash, buffer, flVolume, SNDLVL_TO_ATTN(static_cast<soundlevel_t>(sndlevel)),
|
||||||
|
nSeed, iFlags, iPitch, pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity, pUnknown)
|
||||||
|
);
|
||||||
|
#elif SOURCE_ENGINE >= SE_PORTAL2
|
||||||
RETURN_META_VALUE_NEWPARAMS(
|
RETURN_META_VALUE_NEWPARAMS(
|
||||||
MRES_IGNORED,
|
MRES_IGNORED,
|
||||||
-1,
|
-1,
|
||||||
@ -849,7 +880,55 @@ static cell_t EmitSound(IPluginContext *pContext, const cell_t *params)
|
|||||||
player[0] = cl_array[i];
|
player[0] = cl_array[i];
|
||||||
crf.Reset();
|
crf.Reset();
|
||||||
crf.Initialize(player, 1);
|
crf.Initialize(player, 1);
|
||||||
#if SOURCE_ENGINE >= SE_PORTAL2
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
if (g_InSoundHook)
|
||||||
|
{
|
||||||
|
SH_CALL(enginesoundPatch,
|
||||||
|
static_cast<int (IEngineSound::*)(IRecipientFilter &, int, int, const char*, unsigned int, const char*, float,
|
||||||
|
soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int, void *)>
|
||||||
|
|
||||||
|
(&IEngineSound::EmitSound))
|
||||||
|
(crf,
|
||||||
|
player[0],
|
||||||
|
channel,
|
||||||
|
sample,
|
||||||
|
-1,
|
||||||
|
sample,
|
||||||
|
vol,
|
||||||
|
(soundlevel_t)level,
|
||||||
|
0,
|
||||||
|
flags,
|
||||||
|
pitch,
|
||||||
|
pOrigin,
|
||||||
|
pDir,
|
||||||
|
pOrigVec,
|
||||||
|
updatePos,
|
||||||
|
soundtime,
|
||||||
|
speakerentity,
|
||||||
|
nullptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
engsound->EmitSound(crf,
|
||||||
|
player[0],
|
||||||
|
channel,
|
||||||
|
sample,
|
||||||
|
-1,
|
||||||
|
sample,
|
||||||
|
vol,
|
||||||
|
(soundlevel_t)level,
|
||||||
|
0,
|
||||||
|
flags,
|
||||||
|
pitch,
|
||||||
|
pOrigin,
|
||||||
|
pDir,
|
||||||
|
pOrigVec,
|
||||||
|
updatePos,
|
||||||
|
soundtime,
|
||||||
|
speakerentity,
|
||||||
|
nullptr);
|
||||||
|
}
|
||||||
|
#elif SOURCE_ENGINE >= SE_PORTAL2
|
||||||
if (g_InSoundHook)
|
if (g_InSoundHook)
|
||||||
{
|
{
|
||||||
SH_CALL(enginesoundPatch,
|
SH_CALL(enginesoundPatch,
|
||||||
@ -979,7 +1058,54 @@ static cell_t EmitSound(IPluginContext *pContext, const cell_t *params)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#if SOURCE_ENGINE >= SE_PORTAL2
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
if (g_InSoundHook)
|
||||||
|
{
|
||||||
|
SH_CALL(enginesoundPatch,
|
||||||
|
static_cast<int (IEngineSound::*)(IRecipientFilter &, int, int, const char*, unsigned int, const char*, float,
|
||||||
|
soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int, void *)>
|
||||||
|
(&IEngineSound::EmitSound))
|
||||||
|
(crf,
|
||||||
|
entity,
|
||||||
|
channel,
|
||||||
|
sample,
|
||||||
|
-1,
|
||||||
|
sample,
|
||||||
|
vol,
|
||||||
|
(soundlevel_t)level,
|
||||||
|
0,
|
||||||
|
flags,
|
||||||
|
pitch,
|
||||||
|
pOrigin,
|
||||||
|
pDir,
|
||||||
|
pOrigVec,
|
||||||
|
updatePos,
|
||||||
|
soundtime,
|
||||||
|
speakerentity,
|
||||||
|
nullptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
engsound->EmitSound(crf,
|
||||||
|
entity,
|
||||||
|
channel,
|
||||||
|
sample,
|
||||||
|
-1,
|
||||||
|
sample,
|
||||||
|
vol,
|
||||||
|
(soundlevel_t)level,
|
||||||
|
0,
|
||||||
|
flags,
|
||||||
|
pitch,
|
||||||
|
pOrigin,
|
||||||
|
pDir,
|
||||||
|
pOrigVec,
|
||||||
|
updatePos,
|
||||||
|
soundtime,
|
||||||
|
speakerentity,
|
||||||
|
nullptr);
|
||||||
|
}
|
||||||
|
#elif SOURCE_ENGINE >= SE_PORTAL2
|
||||||
if (g_InSoundHook)
|
if (g_InSoundHook)
|
||||||
{
|
{
|
||||||
SH_CALL(enginesoundPatch,
|
SH_CALL(enginesoundPatch,
|
||||||
@ -1219,11 +1345,19 @@ static cell_t EmitSoundEntry(IPluginContext *pContext, const cell_t *params)
|
|||||||
|
|
||||||
if (g_InSoundHook)
|
if (g_InSoundHook)
|
||||||
{
|
{
|
||||||
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
SH_CALL(enginesoundPatch,
|
||||||
|
static_cast<int (IEngineSound::*)(IRecipientFilter &, int, int, const char*, unsigned int, const char*, float,
|
||||||
|
soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int, void *)>
|
||||||
|
(&IEngineSound::EmitSound))(crf, player[0], channel, soundEntry, soundEntryHash, sample, vol, (soundlevel_t)level, seed,
|
||||||
|
flags, pitch, pOrigin, pDir, pOrigVec, updatePos, soundtime, speakerentity, nullptr);
|
||||||
|
#else
|
||||||
SH_CALL(enginesoundPatch,
|
SH_CALL(enginesoundPatch,
|
||||||
static_cast<int (IEngineSound::*)(IRecipientFilter &, int, int, const char*, unsigned int, const char*, float,
|
static_cast<int (IEngineSound::*)(IRecipientFilter &, int, int, const char*, unsigned int, const char*, float,
|
||||||
soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>
|
soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>
|
||||||
(&IEngineSound::EmitSound))(crf, player[0], channel, soundEntry, soundEntryHash, sample, vol, (soundlevel_t)level, seed,
|
(&IEngineSound::EmitSound))(crf, player[0], channel, soundEntry, soundEntryHash, sample, vol, (soundlevel_t)level, seed,
|
||||||
flags, pitch, pOrigin, pDir, pOrigVec, updatePos, soundtime, speakerentity);
|
flags, pitch, pOrigin, pDir, pOrigVec, updatePos, soundtime, speakerentity);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1235,11 +1369,19 @@ static cell_t EmitSoundEntry(IPluginContext *pContext, const cell_t *params)
|
|||||||
else {
|
else {
|
||||||
if (g_InSoundHook)
|
if (g_InSoundHook)
|
||||||
{
|
{
|
||||||
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
SH_CALL(enginesoundPatch,
|
||||||
|
static_cast<int (IEngineSound::*)(IRecipientFilter &, int, int, const char*, unsigned int, const char*, float,
|
||||||
|
soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int, void *)>
|
||||||
|
(&IEngineSound::EmitSound))(crf, entity, channel, soundEntry, soundEntryHash, sample, vol, (soundlevel_t)level,
|
||||||
|
seed, flags, pitch, pOrigin, pDir, pOrigVec, updatePos, soundtime, speakerentity, nullptr);
|
||||||
|
#else
|
||||||
SH_CALL(enginesoundPatch,
|
SH_CALL(enginesoundPatch,
|
||||||
static_cast<int (IEngineSound::*)(IRecipientFilter &, int, int, const char*, unsigned int, const char*, float,
|
static_cast<int (IEngineSound::*)(IRecipientFilter &, int, int, const char*, unsigned int, const char*, float,
|
||||||
soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>
|
soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>
|
||||||
(&IEngineSound::EmitSound))(crf, entity, channel, soundEntry, soundEntryHash, sample, vol, (soundlevel_t)level,
|
(&IEngineSound::EmitSound))(crf, entity, channel, soundEntry, soundEntryHash, sample, vol, (soundlevel_t)level,
|
||||||
seed, flags, pitch, pOrigin, pDir, pOrigVec, updatePos, soundtime, speakerentity);
|
seed, flags, pitch, pOrigin, pDir, pOrigVec, updatePos, soundtime, speakerentity);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,16 @@ public:
|
|||||||
|
|
||||||
void OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float delay);
|
void OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float delay);
|
||||||
|
|
||||||
#if SOURCE_ENGINE >= SE_PORTAL2
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
int OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *, unsigned int, const char *pSample, float flVolume,
|
||||||
|
soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
|
||||||
|
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
|
||||||
|
float soundtime, int speakerentity, void *pUnknown);
|
||||||
|
int OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample,
|
||||||
|
float flVolume, float flAttenuation, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
|
||||||
|
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
|
||||||
|
float soundtime, int speakerentity, void *pUnknown);
|
||||||
|
#elif SOURCE_ENGINE >= SE_PORTAL2
|
||||||
int OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *, unsigned int, const char *pSample, float flVolume,
|
int OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *, unsigned int, const char *pSample, float flVolume,
|
||||||
soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
|
soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
|
||||||
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
|
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
|
||||||
|
Loading…
Reference in New Issue
Block a user