Fix bullet impact sounds and interpolation artifacts.

This commit is contained in:
Andrey Akhmichin 2024-02-04 17:46:45 +05:00
parent b91043602e
commit 28112bab77
3 changed files with 17 additions and 2 deletions

View File

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

View File

@ -127,7 +127,8 @@
// entity flags
#define EFLAG_SLERP 1 // do studio interpolation of this entity
#define EFLAG_MONSTER 2
//
// temp entity events
//

View File

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