From 8aefd166cfa37987d3b5d4a7c849705708078ed6 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Tue, 29 Jan 2019 21:12:57 +0100 Subject: [PATCH] Force textmode/novisuals clients to use SetupBones --- src/entityhitboxcache.cpp | 11 +++++++++-- src/hacks/FollowBot.cpp | 3 ++- src/hooks/CreateMove.cpp | 14 -------------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/entityhitboxcache.cpp b/src/entityhitboxcache.cpp index 55320c3a..31f86977 100644 --- a/src/entityhitboxcache.cpp +++ b/src/entityhitboxcache.cpp @@ -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; diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index 5bf063a7..2af9c6dc 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -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)) diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index 240d588d..e59bceca 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -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)