Force textmode/novisuals clients to use SetupBones

This commit is contained in:
TotallyNotElite 2019-01-29 21:12:57 +01:00
parent 07f7e6ad05
commit 8aefd166cf
3 changed files with 11 additions and 17 deletions

View File

@ -101,6 +101,7 @@ bool EntityHitboxCache::VisibilityCheck(int id)
}
static settings::Int setupbones_time{ "source.setupbones-time", "1" };
static settings::Bool bonecache_enabled{ "source.use-bone-cache", "true" };
static std::mutex setupbones_mutex;
@ -127,10 +128,11 @@ matrix3x4_t *EntityHitboxCache::GetBones()
{
if (g_Settings.is_create_move)
{
if (IsPlayerInvisible(parent_ref))
#if ENABLE_VISUALS
if (!*bonecache_enabled || IsPlayerInvisible(parent_ref))
{
PROF_SECTION(bone_setup);
parent_ref->InternalEntity()->SetupBones(bones, MAXSTUDIOBONES, 0x7FF00, bones_setup_time);
bones_setup = RAW_ENT(parent_ref)->SetupBones(bones, MAXSTUDIOBONES, 0x7FF00, bones_setup_time);
}
else
{
@ -148,6 +150,11 @@ matrix3x4_t *EntityHitboxCache::GetBones()
bones_setup = RAW_ENT(parent_ref)->SetupBones(bones, MAXSTUDIOBONES, 0x7FF00, bones_setup_time);
}
}
#else
// Textmode bots miss/shoot at nothing when the tf2 bonecache is used
PROF_SECTION(bone_setup);
bones_setup = RAW_ENT(parent_ref)->SetupBones(bones, MAXSTUDIOBONES, 0x7FF00, bones_setup_time);
#endif
}
}
return bones;

View File

@ -299,7 +299,8 @@ static void cm()
continue;
if (steamid != entity->player_info.friendsID) // steamid check
continue;
if (entity == LOCAL_E)
continue;
if (!entity->m_bAlivePlayer()) // Dont follow dead players
continue;
if (startFollow(entity, isNavBotCM))

View File

@ -115,20 +115,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
if (CE_GOOD(LOCAL_W) && minigun_jump && LOCAL_W->m_iClassID() == CL_CLASS(CTFMinigun))
CE_INT(LOCAL_W, netvar.iWeaponState) = 0;
}
{
PROF_SECTION(ResetInternalBonecache)
for (int i = 1; i < g_IEngine->GetMaxClients(); i++)
{
auto ent = ENTITY(i);
if (CE_BAD(ent))
continue;
typedef int (*InvalidateBoneCache_t)(IClientEntity *);
static uintptr_t addr = gSignatures.GetClientSignature("55 8B 0D ? ? ? ? 89 E5 8B 45 ? 8D 51");
static InvalidateBoneCache_t InvalidateBoneCache = InvalidateBoneCache_t(addr);
InvalidateBoneCache(RAW_ENT(ent));
}
}
ret = original::CreateMove(this_, input_sample_time, cmd);
if (!cmd)