Fixed everything

This commit is contained in:
nullifiedcat 2016-12-22 22:14:44 +03:00
parent a32ed831e7
commit 8ea021482b
7 changed files with 40 additions and 17 deletions

View File

@ -30,7 +30,7 @@
#define CON_NAME "cat"
#define CON_PREFIX CON_NAME "_"
#define DEBUG_SEGV false
#define DEBUG_SEGV true
#if DEBUG_SEGV == true

View File

@ -18,6 +18,7 @@ CachedEntity::CachedEntity() {
m_pEntity = nullptr;
m_Strings = new ESPStringCompound[MAX_STRINGS]();
m_nESPStrings = 0;
m_Bones = 0;
}
CachedEntity::~CachedEntity() {
@ -44,6 +45,10 @@ void CachedEntity::Update(int idx) {
m_iClassID = m_pEntity->GetClientClass()->m_ClassID;
m_bGrenadeProjectile = false;
if (m_Bones) {
delete [] m_Bones;
m_Bones = 0;
}
m_bBonesSetup = false;
switch (m_iClassID) {
@ -78,6 +83,19 @@ void CachedEntity::Update(int idx) {
m_flDistance = (g_pLocalPlayer->v_Origin.DistTo(m_vecOrigin));
}
m_bAlivePlayer = false;
// TODO temporary!
/*m_bCritProjectile = false;
m_bIsVisible = false;
m_iTeam = 0;
m_bEnemy = false;
m_bAlivePlayer = false;
m_pPlayerInfo = 0;
m_iHealth = 0;
m_iMaxHealth = 0;
m_lLastSeen = 0;
m_lSeenTicks = 0;*/
if (m_Type == EntityType::ENTITY_PROJECTILE) {
m_bCritProjectile = IsProjectileCrit(this);
m_bIsVisible = IsEntityVisible(this, -1);
@ -117,7 +135,7 @@ void CachedEntity::Update(int idx) {
}
}
SEGV_END_INFO(strfmt("Updating entity %i", m_IDX))
SEGV_END_INFO("Updating entity")
}
void CachedEntity::AddESPString(Color color, Color background, const char* fmt, ...) {

View File

@ -14,7 +14,7 @@
struct matrix3x4_t;
#define ENTITY_CACHE_PROFILER false
#define ENTITY_CACHE_PROFILER true
class IClientEntity;
class Color;
@ -75,7 +75,6 @@ public:
// Entity fields start here.
EntityType m_Type;
Vector m_vecOrigin;
int m_iClassID;
float m_flDistance;
@ -83,6 +82,8 @@ public:
bool m_bCritProjectile;
bool m_bGrenadeProjectile;
Vector m_vecOrigin;
int m_iTeam;
bool m_bAlivePlayer;
bool m_bEnemy;

View File

@ -18,6 +18,7 @@
#include <memory>
#include "segvcatch/segvcatch.h"
#include <csignal>
#include <sys/sysinfo.h>
// All Hacks
#include "hacks/IHack.h"
@ -140,7 +141,7 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
//PROF_BEGIN();
SEGV_BEGIN
i_hack->PaintTraverse(p, vp, fr, ar);
SEGV_END_INFO(strfmt("PaintTraverse: hack %s", i_hack->GetName()))
SEGV_END_INFO("Hack PaintTraverse")
//PROF_END(strfmt("%s PaintTraverse", i_hack->GetName()));
}
Vector screen;

View File

@ -121,7 +121,7 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
// Miniguns should shoot and aim continiously. TODO smg
if (g_pLocalPlayer->weapon->m_iClassID != ClassID::CTFMinigun) {
// Melees are weird, they should aim continiously like miniguns too.
if (GetWeaponMode(g_pLocalPlayer->entity) == weaponmode::weapon_melee) {
if (GetWeaponMode(g_pLocalPlayer->entity) != weaponmode::weapon_melee) {
// Finally, CanShoot() check.
if (!CanShoot()) return true;
}
@ -159,7 +159,7 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
m_iHitbox = this->v_eHitbox->GetInt();
if (this->v_bAutoHitbox->GetBool()) m_iHitbox = 7;
if (g_pLocalPlayer->weapon && this->v_bAutoHitbox->GetBool()) {
if (CE_GOOD(g_pLocalPlayer->weapon) && this->v_bAutoHitbox->GetBool()) {
switch (g_pLocalPlayer->weapon->m_iClassID) {
case ClassID::CTFSniperRifle:
case ClassID::CTFSniperRifleDecap:
@ -193,7 +193,7 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
}
}
if (g_pLocalPlayer->weapon->m_iClassID == 210) return true;
if (g_pLocalPlayer->weapon->m_iClassID == ClassID::CTFGrapplingHook) return true;
m_bProjectileMode = (GetProjectileData(g_pLocalPlayer->weapon, m_flProjSpeed, m_flProjGravity));
// TODO priority modes (FOV, Smart, Distance, etc)
@ -306,10 +306,10 @@ bool Aimbot::ShouldTarget(CachedEntity* entity) {
if (!IsVectorVisible(g_pLocalPlayer->v_Eye, ProjectilePrediction(entity, m_iHitbox, m_flProjSpeed, m_flProjGravity))) return false;
} else {
if (v_bMachinaPenetration->GetBool()) {
if (GetHitbox(entity, m_iHitbox, resultAim)) return false;
if (!GetHitbox(entity, m_iHitbox, resultAim)) return false;
if (!IsEntityVisiblePenetration(entity, v_eHitbox->GetInt())) return false;
} else {
if (GetHitbox(entity, m_iHitbox, resultAim)) return false;
if (!GetHitbox(entity, m_iHitbox, resultAim)) return false;
if (!IsEntityVisible(entity, m_iHitbox)) return false;
}
}
@ -350,7 +350,7 @@ bool Aimbot::Aim(CachedEntity* entity, CUserCmd* cmd) {
//logging::Info("Aiming!");
Vector hit;
Vector angles;
if (!entity) return false;
if (CE_BAD(entity)) return false;
if (entity->m_Type == ENTITY_PLAYER) {
//logging::Info("A");
GetHitbox(entity, m_iHitbox, hit);

View File

@ -185,13 +185,12 @@ bool GetHitbox(CachedEntity* entity, int hb, Vector& out) {
// *max = new float[3];
Vector min, max;
SEGV_BEGIN
if (entity->GetBones() == 0) logging::Info("no bones!");
VectorTransform(box->bbmin, entity->GetBones()[box->bone], min);
VectorTransform(box->bbmax, entity->GetBones()[box->bone], max);
SEGV_END_INFO("VectorTransform()-ing with unsafe Vector casting");
out.x = (min[0] + max[0]) / 2;
out.x = (min[1] + max[1]) / 2;
out.x = (min[2] + max[2]) / 2;
out.y = (min[1] + max[1]) / 2;
out.z = (min[2] + max[2]) / 2;
//delete[] min;
//delete[] max;
return true;
@ -282,7 +281,7 @@ bool IsEntityVisible(CachedEntity* entity, int hb) {
ray.Init(local->m_vecOrigin + g_pLocalPlayer->v_ViewOffset, hit);
interfaces::trace->TraceRay(ray, 0x4200400B, trace_filter, &trace_visible);
if (trace_visible.m_pEnt) {
return ((IClientEntity*)trace_visible.m_pEnt) == RAW_ENT(entity);
return (((IClientEntity*)trace_visible.m_pEnt)->entindex()) == entity->m_IDX;
}
return false;
}
@ -411,7 +410,11 @@ bool IsProjectileCrit(CachedEntity* ent) {
weaponmode GetWeaponMode(CachedEntity* player) {
int weapon_handle = CE_INT(player, netvar.hActiveWeapon);
CachedEntity* weapon = (weapon_handle & 0xFFF < HIGHEST_ENTITY ? ENTITY(weapon_handle & 0xFFF) : 0);
if (IDX_BAD((weapon_handle & 0xFFF))) {
logging::Info("IDX_BAD: %i", weapon_handle & 0xFFF);
return weaponmode::weapon_invalid;
}
CachedEntity* weapon = (ENTITY(weapon_handle & 0xFFF));
if (CE_BAD(weapon)) return weaponmode::weapon_invalid;
if (IsMeleeWeapon(weapon)) return weaponmode::weapon_melee;
switch (weapon->m_iClassID) {

View File

@ -19,7 +19,7 @@ class Vector;
#define PI 3.14159265358979323846f
#define RADPI 57.295779513082f
#define DEG2RAD(x) x * (PI / 180.0f)
//#define DEG2RAD(x) (float)(x) * (float)(PI / 180.0f)
#include "enums.h"