From a02eb834a708f38d14c9ad7b4ef004fc5b67f1ed Mon Sep 17 00:00:00 2001 From: Sam V Date: Mon, 28 Mar 2022 12:37:15 +0200 Subject: [PATCH] Fix monster_tentacle not interpolating ValveSoftware/halflife#3228 --- dlls/cbase.cpp | 1 + dlls/cbase.h | 5 +++++ dlls/client.cpp | 4 ++++ dlls/tentacle.cpp | 3 +++ 4 files changed, 13 insertions(+) diff --git a/dlls/cbase.cpp b/dlls/cbase.cpp index a83b35327..56e1be452 100644 --- a/dlls/cbase.cpp +++ b/dlls/cbase.cpp @@ -617,6 +617,7 @@ CBaseEntity* CBaseEntity::GetNextTarget() TYPEDESCRIPTION CBaseEntity::m_SaveData[] = { DEFINE_FIELD(CBaseEntity, m_pGoalEnt, FIELD_CLASSPTR), + DEFINE_FIELD(CBaseEntity, m_EFlags, FIELD_CHARACTER), DEFINE_FIELD(CBaseEntity, m_pfnThink, FIELD_FUNCTION), // UNDONE: Build table of these!!! DEFINE_FIELD(CBaseEntity, m_pfnTouch, FIELD_FUNCTION), diff --git a/dlls/cbase.h b/dlls/cbase.h index a2a279ec9..8c54697a9 100644 --- a/dlls/cbase.h +++ b/dlls/cbase.h @@ -152,6 +152,11 @@ class CBaseEntity CBaseEntity* m_pGoalEnt; // path corner we are heading towards CBaseEntity* m_pLink; // used for temporary link-list operations. + /** + * @brief Entity flags sent to the client in ::AddToFullPack + */ + byte m_EFlags = 0; + virtual ~CBaseEntity() {} // initialization functions diff --git a/dlls/client.cpp b/dlls/client.cpp index 399b17a86..19b816cc5 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -1086,6 +1086,8 @@ int AddToFullPack(struct entity_state_s* state, int e, edict_t* ent, edict_t* ho { int i; + auto entity = reinterpret_cast(GET_PRIVATE(ent)); + // don't send if flagged for NODRAW and it's not the host getting the message if ((ent->v.effects & EF_NODRAW) != 0 && (ent != host)) @@ -1201,6 +1203,8 @@ int AddToFullPack(struct entity_state_s* state, int e, edict_t* ent, edict_t* ho state->eflags &= ~EFLAG_SLERP; } + state->eflags |= entity->m_EFlags; + state->scale = ent->v.scale; state->solid = ent->v.solid; state->colormap = ent->v.colormap; diff --git a/dlls/tentacle.cpp b/dlls/tentacle.cpp index 65a2edf8a..bb1159056 100644 --- a/dlls/tentacle.cpp +++ b/dlls/tentacle.cpp @@ -257,6 +257,9 @@ void CTentacle::Spawn() pev->health = 75; pev->sequence = 0; + //Always interpolate tentacles since they don't actually move. + m_EFlags |= EFLAG_SLERP; + SET_MODEL(ENT(pev), "models/tentacle2.mdl"); UTIL_SetSize(pev, Vector(-32, -32, 0), Vector(32, 32, 64));