[HL25] Backport flesh hit sound fix
This commit is contained in:
parent
32b8903f58
commit
ae20553127
3 changed files with 23 additions and 6 deletions
|
@ -66,6 +66,7 @@ float EV_HLDM_PlayTextureSound(int idx, pmtrace_t* ptr, float* vecSrc, float* ve
|
||||||
{
|
{
|
||||||
// hit the world, try to play sound based on texture material type
|
// hit the world, try to play sound based on texture material type
|
||||||
char chTextureType = CHAR_TEX_CONCRETE;
|
char chTextureType = CHAR_TEX_CONCRETE;
|
||||||
|
cl_entity_t* cl_entity = NULL;
|
||||||
float fvol;
|
float fvol;
|
||||||
float fvolbar;
|
float fvolbar;
|
||||||
const char* rgsz[4];
|
const char* rgsz[4];
|
||||||
|
@ -84,12 +85,7 @@ float EV_HLDM_PlayTextureSound(int idx, pmtrace_t* ptr, float* vecSrc, float* ve
|
||||||
chTextureType = 0;
|
chTextureType = 0;
|
||||||
|
|
||||||
// Player
|
// Player
|
||||||
if (entity >= 1 && entity <= gEngfuncs.GetMaxClients())
|
if (entity == 0)
|
||||||
{
|
|
||||||
// hit body
|
|
||||||
chTextureType = CHAR_TEX_FLESH;
|
|
||||||
}
|
|
||||||
else if (entity == 0)
|
|
||||||
{
|
{
|
||||||
// get texture from entity or world (world is ent(0))
|
// get texture from entity or world (world is ent(0))
|
||||||
pTextureName = (char*)gEngfuncs.pEventAPI->EV_TraceTexture(ptr->ent, vecSrc, vecEnd);
|
pTextureName = (char*)gEngfuncs.pEventAPI->EV_TraceTexture(ptr->ent, vecSrc, vecEnd);
|
||||||
|
@ -118,6 +114,20 @@ float EV_HLDM_PlayTextureSound(int idx, pmtrace_t* ptr, float* vecSrc, float* ve
|
||||||
chTextureType = PM_FindTextureType(szbuffer);
|
chTextureType = PM_FindTextureType(szbuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// JoshA: Look up the entity and find the EFLAG_FLESH_SOUND flag.
|
||||||
|
// This broke at some point then TF:C added prediction.
|
||||||
|
//
|
||||||
|
// It used to use Classify of pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE
|
||||||
|
// to determine what sound to play, but that's server side and isn't available on the client
|
||||||
|
// and got lost in the translation to that.
|
||||||
|
// Now the server will replicate that state via an eflag.
|
||||||
|
cl_entity = gEngfuncs.GetEntityByIndex(entity);
|
||||||
|
|
||||||
|
if (cl_entity && !!(cl_entity->curstate.eflags & EFLAG_FLESH_SOUND))
|
||||||
|
chTextureType = CHAR_TEX_FLESH;
|
||||||
|
}
|
||||||
|
|
||||||
switch (chTextureType)
|
switch (chTextureType)
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,6 +117,7 @@
|
||||||
|
|
||||||
// entity flags
|
// entity flags
|
||||||
#define EFLAG_SLERP 1 // do studio interpolation of this entity
|
#define EFLAG_SLERP 1 // do studio interpolation of this entity
|
||||||
|
#define EFLAG_FLESH_SOUND 2 // JoshA: Whether this entity should sound like flesh. (ie. pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE)
|
||||||
|
|
||||||
//
|
//
|
||||||
// temp entity events
|
// temp entity events
|
||||||
|
|
|
@ -1418,6 +1418,12 @@ int AddToFullPack(struct entity_state_s* state, int e, edict_t* ent, edict_t* ho
|
||||||
state->health = ent->v.health;
|
state->health = ent->v.health;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CBaseEntity* pEntity = static_cast<CBaseEntity*>(GET_PRIVATE(ent));
|
||||||
|
if (pEntity && pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE)
|
||||||
|
state->eflags |= EFLAG_FLESH_SOUND;
|
||||||
|
else
|
||||||
|
state->eflags &= ~EFLAG_FLESH_SOUND;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue