2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-04-09 11:00:08 +03:00

SV_EmitSound2: Add new flag SND_EMIT2_USE_ORIGIN for using custom origin instead of entity origin

This commit is contained in:
s1lentq 2025-04-05 02:20:58 +07:00
parent 7bc5d86add
commit 44e510a25c
2 changed files with 2 additions and 1 deletions

View File

@ -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

View File

@ -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];