Get fresh bones with entityhitboxcache and fix drawhitboxes issues

This commit is contained in:
BenCat07 2020-05-29 20:14:58 +02:00
parent 76b1a940be
commit 945c88e0ff
5 changed files with 36 additions and 1 deletions

View File

@ -95,6 +95,7 @@ weaponmode GetWeaponMode(CachedEntity *ent);
void FixMovement(CUserCmd &cmd, Vector &viewangles);
void VectorAngles(Vector &forward, Vector &angles);
void AngleVectors2(const QAngle &angles, Vector *forward);
void AngleVectors3(const QAngle &angles, Vector *forward, Vector *right, Vector *up);
extern std::mutex trace_lock;
bool IsEntityVisible(CachedEntity *entity, int hb);
bool IsEntityVectorVisible(CachedEntity *entity, Vector endpos, unsigned int mask = MASK_SHOT_HULL, trace_t *trace = nullptr);

View File

@ -0,0 +1,26 @@
#pragma once
#include "reclasses.hpp"
#include "copypasted/CSignature.h"
#include "e8call.hpp"
namespace re
{
class C_BaseAnimating
{
public:
inline static void InvalidateBoneCache(IClientEntity *self)
{
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(self);
}
inline static bool Interpolate(IClientEntity *self, float time)
{
typedef bool (*fn_t)(IClientEntity *, float);
return vfunc<fn_t>(self, offsets::PlatformOffset(143, offsets::undefined, 143), 0)(self, time);
}
};
} // namespace re

View File

@ -9,6 +9,7 @@
#include "common.hpp"
#include "C_BaseAnimating.hpp"
#include "C_BaseEntity.hpp"
#include "ITFGroupMatchCriteria.hpp"
#include "CTFPlayerShared.hpp"

View File

@ -126,6 +126,13 @@ matrix3x4_t *EntityHitboxCache::GetBones(int numbones)
}
if (!bones_setup)
{
// Reset game cache
if (!bonecache_enabled)
{
re::C_BaseAnimating::InvalidateBoneCache(RAW_ENT(parent_ref));
re::C_BaseAnimating::Interpolate(RAW_ENT(parent_ref), bones_setup_time);
}
// If numbones is not set, get it from some terrible and unnamed variable
if (numbones == -1)
{

View File

@ -731,7 +731,7 @@ void MatrixGetColumn(const matrix3x4_t &in, int column, Vector &out)
out.z = in[2][column];
}
inline void MatrixAngles(const matrix3x4_t &matrix, float *angles)
void MatrixAngles(const matrix3x4_t &matrix, float *angles)
{
float forward[3];
float left[3];