From 28112bab77c40bbea88be9f16d13e85a07520230 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin <15944199+nekonomicon@users.noreply.github.com> Date: Sun, 4 Feb 2024 17:46:45 +0500 Subject: [PATCH] Fix bullet impact sounds and interpolation artifacts. --- cl_dll/ev_hldm.cpp | 4 +++- common/const.h | 3 ++- dlls/client.cpp | 12 ++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index 381ee25b..7ece6ad2 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -99,6 +99,7 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v int cnt; float fattn = ATTN_NORM; int entity; + cl_entity_t *ent; char *pTextureName; char texname[64]; char szbuffer[64]; @@ -110,7 +111,8 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v chTextureType = 0; // Player - if( entity >= 1 && entity <= gEngfuncs.GetMaxClients() ) + if( entity >= 1 && entity <= gEngfuncs.GetMaxClients() + || ( ( ent = gEngfuncs.GetEntityByIndex( entity )) && ( ent->curstate.eflags & EFLAG_MONSTER ))) { // hit body chTextureType = CHAR_TEX_FLESH; diff --git a/common/const.h b/common/const.h index 3708371b..5b7e1737 100644 --- a/common/const.h +++ b/common/const.h @@ -127,7 +127,8 @@ // entity flags #define EFLAG_SLERP 1 // do studio interpolation of this entity - +#define EFLAG_MONSTER 2 + // // temp entity events // diff --git a/dlls/client.cpp b/dlls/client.cpp index 3ce82cfb..4e269eae 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -1123,6 +1123,7 @@ we could also use the pas/ pvs that we set in SetupVisibility, if we wanted to. int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet ) { int i; + CBaseEntity *Entity; // don't send if flagged for NODRAW and it's not the host getting the message if( ( ent->v.effects & EF_NODRAW ) && ( ent != host ) ) @@ -1308,6 +1309,17 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h state->health = (int)ent->v.health; } + if( ( Entity = CBaseEntity::Instance( ent )) + && Entity->Classify() != CLASS_NONE + && Entity->Classify() != CLASS_MACHINE ) + { + SetBits( state->eflags, EFLAG_MONSTER ); + } + else + { + ClearBits( state->eflags, EFLAG_SLERP | EFLAG_MONSTER ); + } + return 1; }