Fix catbot hitbox stuff maybe

Textmode doesnt refresh the hitbox cache as often or something and therefore bots miss a lot
This commit is contained in:
TotallyNotElite 2019-01-29 11:41:35 +01:00
parent 5bd5ca4603
commit 07f7e6ad05
3 changed files with 31 additions and 11 deletions

View File

@ -125,23 +125,29 @@ matrix3x4_t *EntityHitboxCache::GetBones()
}
if (!bones_setup)
{
// std::lock_guard<std::mutex> lock(setupbones_mutex);
if (g_Settings.is_create_move)
{
if (IsPlayerInvisible(parent_ref))
{
PROF_SECTION(bone_setup);
parent_ref->InternalEntity()->SetupBones(bones, MAXSTUDIOBONES, 0x7FF00, bones_setup_time);
}
PROF_SECTION(bone_cache);
auto to_copy = CE_VAR(parent_ref, 0x838, matrix3x4_t *);
if (to_copy)
{
bones->Invalidate();
memcpy((matrix3x4_t *) bones, to_copy, 48 * (CE_INT(parent_ref, 0x844)));
bones_setup = true;
}
else
bones_setup = RAW_ENT(parent_ref)->SetupBones(bones, MAXSTUDIOBONES, 0x7FF00, bones_setup_time);
{
PROF_SECTION(bone_cache);
auto to_copy = CE_VAR(parent_ref, 0x838, matrix3x4_t *);
if (to_copy)
{
bones->Invalidate();
memcpy((matrix3x4_t *) bones, to_copy, 48 * (CE_INT(parent_ref, 0x844)));
bones_setup = true;
}
else
{
PROF_SECTION(bone_setup);
bones_setup = RAW_ENT(parent_ref)->SetupBones(bones, MAXSTUDIOBONES, 0x7FF00, bones_setup_time);
}
}
}
}
return bones;

View File

@ -115,6 +115,20 @@ 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)

View File

@ -10,7 +10,7 @@ namespace hooked_methods
{
DEFINE_HOOKED_METHOD(SendDatagram, int, INetChannel *ch, bf_write *buf)
{
if (!round(*hacks::shared::backtrack::latency))
if (!round(*hacks::shared::backtrack::latency) || !isHackActive())
return original::SendDatagram(ch, buf);
int in = 0;
int state = 0;