diff --git a/rehlds/common/const.h b/rehlds/common/const.h index 721a8da..f498db1 100644 --- a/rehlds/common/const.h +++ b/rehlds/common/const.h @@ -74,6 +74,7 @@ // SV_EmitSound2 flags #define SND_EMIT2_NOPAS (1<<0) // never to do check PAS #define SND_EMIT2_INVOKER (1<<1) // do not send to the client invoker +#define SND_EMIT2_USE_ORIGIN (1<<2) // use given origin instead of entity origin // Engine edict->spawnflags #define SF_NOTINDEATHMATCH 0x0800 // Do not spawn when deathmatch and loading entities from a file diff --git a/rehlds/rehlds/rehlds_api_impl.cpp b/rehlds/rehlds/rehlds_api_impl.cpp index e4f0e00..9cdd7e1 100644 --- a/rehlds/rehlds/rehlds_api_impl.cpp +++ b/rehlds/rehlds/rehlds_api_impl.cpp @@ -579,7 +579,7 @@ bool EXT_FUNC SV_EmitSound2_internal(edict_t *entity, IGameClient *pReceiver, in bool bSendPAS = (channel != CHAN_STATIC && !(flags & SND_FL_STOP) && !(emitFlags & SND_EMIT2_NOPAS)); vec3_t origin = {0, 0, 0}; - if (entity && entity != g_psv.edicts) + if ((!pOrigin || !(emitFlags & SND_EMIT2_USE_ORIGIN)) && entity && entity != g_psv.edicts) { for (int i = 0; i < 3; ++i) origin[i] = (entity->v.maxs[i] + entity->v.mins[i]) * 0.5f + entity->v.origin[i];