fuck
This commit is contained in:
parent
448f8e6229
commit
75ba2ca36c
@ -32,7 +32,7 @@
|
||||
|
||||
#define DEG2RAD(x) (float)(x) * (PI / 180.0f)
|
||||
|
||||
#define DEBUG_SEGV true
|
||||
#define DEBUG_SEGV false
|
||||
|
||||
#if DEBUG_SEGV == true
|
||||
|
||||
|
@ -37,6 +37,11 @@ IClientEntity* CachedEntity::InternalEntity() {
|
||||
return m_pEntity;
|
||||
}
|
||||
|
||||
void EntityCache::Invalidate() {
|
||||
delete [] m_pArray;
|
||||
m_pArray = new CachedEntity[4096]();
|
||||
}
|
||||
|
||||
void CachedEntity::Update(int idx) {
|
||||
SEGV_BEGIN
|
||||
|
||||
@ -243,7 +248,7 @@ EntityCache::~EntityCache() {
|
||||
|
||||
void EntityCache::Update() {
|
||||
m_nMax = interfaces::entityList->GetHighestEntityIndex();
|
||||
for (int i = 0; i < m_nMax && i < 1024; i++) {
|
||||
for (int i = 0; i < m_nMax && i < 4096; i++) {
|
||||
//logging::Info("Updating %i", i);
|
||||
m_pArray[i].Update(i);
|
||||
//logging::Info("Back!");
|
||||
@ -253,17 +258,19 @@ void EntityCache::Update() {
|
||||
if (time(0) != m_lLastLog) {
|
||||
m_lLastLog = time(0);
|
||||
if (g_vEntityCacheProfiling && g_vEntityCacheProfiling->GetBool()) {
|
||||
logging::Info("[EntityCache] TOTAL: UPS=%i QPS=%i SQPS=%i SAPS=%i REAPS=%i", m_nUpdates, m_nQueues, m_nStringsQueued, m_nStringsAdded, m_nRawEntityAccesses);
|
||||
if (m_nUpdates != 0) logging::Info("[EntityCache] AVG: QPU=%i SQPU=%i SAPU=%i REAPU=%i",
|
||||
logging::Info("[EntityCache] TOTAL: UPS=%i QPS=%i SQPS=%i SAPS=%i REAPS=%i HBPS=%i", m_nUpdates, m_nQueues, m_nStringsQueued, m_nStringsAdded, m_nRawEntityAccesses, m_nHitboxQueued);
|
||||
if (m_nUpdates != 0) logging::Info("[EntityCache] AVG: QPU=%i SQPU=%i SAPU=%i REAPU=%i HBPU=%i",
|
||||
m_nQueues / m_nUpdates,
|
||||
m_nStringsQueued / m_nUpdates,
|
||||
m_nStringsAdded / m_nUpdates,
|
||||
m_nRawEntityAccesses / m_nUpdates);
|
||||
m_nRawEntityAccesses / m_nUpdates,
|
||||
m_nHitboxQueued / m_nUpdates);
|
||||
m_nUpdates = 0;
|
||||
m_nQueues = 0;
|
||||
m_nStringsQueued = 0;
|
||||
m_nStringsAdded = 0;
|
||||
m_nRawEntityAccesses = 0;
|
||||
m_nHitboxQueued = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -158,6 +158,7 @@ public:
|
||||
~EntityCache();
|
||||
|
||||
void Update();
|
||||
void Invalidate();
|
||||
CachedEntity* GetEntity(int idx);
|
||||
|
||||
CachedEntity* m_pArray;
|
||||
@ -167,6 +168,7 @@ public:
|
||||
int m_nUpdates;
|
||||
int m_nStringsAdded;
|
||||
int m_nStringsQueued;
|
||||
int m_nHitboxQueued;
|
||||
unsigned long m_lLastLog;
|
||||
|
||||
int m_nMax;
|
||||
|
@ -59,12 +59,13 @@ bool EntityHitboxCache::VisibilityCheck(int id) {
|
||||
// TODO corners
|
||||
CachedHitbox* hitbox = GetHitbox(id);
|
||||
if (!hitbox) return 0;
|
||||
m_VisCheck[id] = (IsEntityVectorVisible(m_pParentEntity, hitbox->center));
|
||||
SAFE_CALL(m_VisCheck[id] = (IsEntityVectorVisible(m_pParentEntity, hitbox->center)));
|
||||
m_VisCheckValidationFlags[id] = true;
|
||||
return m_VisCheck[id];
|
||||
}
|
||||
|
||||
CachedHitbox* EntityHitboxCache::GetHitbox(int id) {
|
||||
gEntityCache.m_nHitboxQueued++;
|
||||
if (id < 0 || id >= m_nNumHitboxes) return 0;
|
||||
if (!m_bSuccess) return 0;
|
||||
if (!m_CacheValidationFlags[id]) {
|
||||
|
@ -129,6 +129,7 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
g_Settings.bInvalid = true;
|
||||
}
|
||||
if (g_Settings.bInvalid) return;
|
||||
if (CE_BAD(g_pLocalPlayer->entity)) return;
|
||||
if (draw::panel_top == vp) {
|
||||
ResetStrings();
|
||||
if (g_Settings.bShowLogo->GetBool()) {
|
||||
@ -212,7 +213,7 @@ typedef void(Shutdown_t)(void*, const char*);
|
||||
void Hk_Shutdown(void* thisptr, const char* reason) {
|
||||
SEGV_BEGIN;
|
||||
const char* new_reason;
|
||||
if (g_Settings.sDisconnectMsg->m_StringLength > 1) {
|
||||
if (g_Settings.sDisconnectMsg->m_StringLength > 3) {
|
||||
new_reason = g_Settings.sDisconnectMsg->GetString();
|
||||
} else {
|
||||
new_reason = reason;
|
||||
@ -255,41 +256,48 @@ bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
interfaces::gvars->curtime = servertime;
|
||||
time_replaced = true;
|
||||
}
|
||||
if (g_Settings.bInvalid) {
|
||||
gEntityCache.Invalidate();
|
||||
}
|
||||
SAFE_CALL(gEntityCache.Update());
|
||||
SAFE_CALL(g_pPlayerResource->Update());
|
||||
SAFE_CALL(g_pLocalPlayer->Update());
|
||||
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
|
||||
SAFE_CALL(CREATE_MOVE(Bunnyhop));
|
||||
//RunEnginePrediction(g_pLocalPlayer->entity, cmd);
|
||||
SAFE_CALL(CREATE_MOVE(ESP));
|
||||
SAFE_CALL(CREATE_MOVE(Aimbot));
|
||||
SAFE_CALL(CREATE_MOVE(Airstuck));
|
||||
SAFE_CALL(CREATE_MOVE(AntiAim));
|
||||
SAFE_CALL(CREATE_MOVE(AntiDisguise));
|
||||
SAFE_CALL(CREATE_MOVE(AutoHeal));
|
||||
SAFE_CALL(CREATE_MOVE(AutoSticky));
|
||||
SAFE_CALL(CREATE_MOVE(AutoReflect));
|
||||
SAFE_CALL(CREATE_MOVE(AutoStrafe));
|
||||
SAFE_CALL(CREATE_MOVE(FollowBot));
|
||||
SAFE_CALL(CREATE_MOVE(Misc));
|
||||
SAFE_CALL(CREATE_MOVE(Triggerbot));
|
||||
SAFE_CALL(CREATE_MOVE(HuntsmanCompensation));
|
||||
if (time_replaced) interfaces::gvars->curtime = curtime_old;
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
|
||||
SAFE_CALL(CREATE_MOVE(Bunnyhop));
|
||||
//RunEnginePrediction(g_pLocalPlayer->entity, cmd);
|
||||
SAFE_CALL(CREATE_MOVE(ESP));
|
||||
SAFE_CALL(CREATE_MOVE(Aimbot));
|
||||
SAFE_CALL(CREATE_MOVE(Airstuck));
|
||||
SAFE_CALL(CREATE_MOVE(AntiAim));
|
||||
SAFE_CALL(CREATE_MOVE(AntiDisguise));
|
||||
SAFE_CALL(CREATE_MOVE(AutoHeal));
|
||||
SAFE_CALL(CREATE_MOVE(AutoSticky));
|
||||
SAFE_CALL(CREATE_MOVE(AutoReflect));
|
||||
SAFE_CALL(CREATE_MOVE(AutoStrafe));
|
||||
SAFE_CALL(CREATE_MOVE(FollowBot));
|
||||
SAFE_CALL(CREATE_MOVE(Misc));
|
||||
SAFE_CALL(CREATE_MOVE(Triggerbot));
|
||||
SAFE_CALL(CREATE_MOVE(HuntsmanCompensation));
|
||||
if (time_replaced) interfaces::gvars->curtime = curtime_old;
|
||||
}
|
||||
/*for (IHack* i_hack : hack::hacks) {
|
||||
if (!i_hack->CreateMove(thisptr, inputSample, cmd)) {
|
||||
ret = false;
|
||||
}
|
||||
}*/
|
||||
g_Settings.bInvalid = false;
|
||||
if (g_pLocalPlayer->bUseSilentAngles) {
|
||||
Vector vsilent(cmd->forwardmove, cmd->sidemove, cmd->upmove);
|
||||
float speed = sqrt(vsilent.x * vsilent.x + vsilent.y * vsilent.y);
|
||||
Vector ang;
|
||||
VectorAngles(vsilent, ang);
|
||||
float yaw = DEG2RAD(ang.y - g_pLocalPlayer->v_OrigViewangles.y + cmd->viewangles.y);
|
||||
cmd->forwardmove = cos(yaw) * speed;
|
||||
cmd->sidemove = sin(yaw) * speed;
|
||||
ret = false;
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
if (g_pLocalPlayer->bUseSilentAngles) {
|
||||
Vector vsilent(cmd->forwardmove, cmd->sidemove, cmd->upmove);
|
||||
float speed = sqrt(vsilent.x * vsilent.x + vsilent.y * vsilent.y);
|
||||
Vector ang;
|
||||
VectorAngles(vsilent, ang);
|
||||
float yaw = DEG2RAD(ang.y - g_pLocalPlayer->v_OrigViewangles.y + cmd->viewangles.y);
|
||||
cmd->forwardmove = cos(yaw) * speed;
|
||||
cmd->sidemove = sin(yaw) * speed;
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
if (cmd)
|
||||
last_angles = cmd->viewangles;
|
||||
|
@ -238,6 +238,7 @@ float RandFloatRange(float min, float max)
|
||||
}
|
||||
|
||||
bool IsEntityVisible(CachedEntity* entity, int hb) {
|
||||
if (g_Settings.bInvalid) return false;
|
||||
if (entity == g_pLocalPlayer->entity) return true;
|
||||
Vector hit;
|
||||
if (hb == -1) {
|
||||
@ -249,8 +250,10 @@ bool IsEntityVisible(CachedEntity* entity, int hb) {
|
||||
}
|
||||
|
||||
bool IsEntityVectorVisible(CachedEntity* entity, Vector endpos) {
|
||||
if (g_Settings.bInvalid) return false;
|
||||
if (entity == g_pLocalPlayer->entity) return true;
|
||||
if (CE_BAD(g_pLocalPlayer->entity)) return false;
|
||||
if (CE_BAD(entity)) return false;
|
||||
trace_t trace_object;
|
||||
Ray_t ray;
|
||||
trace::g_pFilterDefault->SetSelf(RAW_ENT(g_pLocalPlayer->entity));
|
||||
@ -378,7 +381,7 @@ bool IsProjectileCrit(CachedEntity* ent) {
|
||||
weaponmode GetWeaponMode(CachedEntity* player) {
|
||||
int weapon_handle = CE_INT(player, netvar.hActiveWeapon);
|
||||
if (IDX_BAD((weapon_handle & 0xFFF))) {
|
||||
logging::Info("IDX_BAD: %i", weapon_handle & 0xFFF);
|
||||
//logging::Info("IDX_BAD: %i", weapon_handle & 0xFFF);
|
||||
return weaponmode::weapon_invalid;
|
||||
}
|
||||
CachedEntity* weapon = (ENTITY(weapon_handle & 0xFFF));
|
||||
|
@ -12,7 +12,10 @@ void LocalPlayer::Update() {
|
||||
entity_idx = interfaces::engineClient->GetLocalPlayer();
|
||||
entity = ENTITY(entity_idx);
|
||||
if (!entity) logging::Info("Local Player is NULL!");
|
||||
if (CE_BAD(entity)) logging::Info("Local Player is BAD CACHED ENTITY!");
|
||||
if (CE_BAD(entity)) {
|
||||
logging::Info("Local Player is BAD CACHED ENTITY!");
|
||||
return;
|
||||
}
|
||||
team = CE_INT(entity, netvar.iTeamNum);
|
||||
life_state = CE_BYTE(entity, netvar.iLifeState);
|
||||
v_ViewOffset = CE_VECTOR(entity, netvar.vViewOffset);
|
||||
|
Reference in New Issue
Block a user