diff --git a/include/entitycache.hpp b/include/entitycache.hpp index 3113f36b..01d437f5 100644 --- a/include/entitycache.hpp +++ b/include/entitycache.hpp @@ -21,6 +21,7 @@ #include #include "playerresource.h" #include "globals.h" +#include "classinfo.hpp" struct matrix3x4_t; @@ -57,7 +58,7 @@ struct mstudiobbox_t; #define HIGHEST_ENTITY (entity_cache::max) #define ENTITY(idx) (&entity_cache::Get(idx)) -bool IsProjectileACrit(CachedEntity* ent); +bool IsProjectileACrit(CachedEntity *ent); class CachedEntity { public: @@ -74,7 +75,7 @@ public: } __attribute__((always_inline, hot, const)) inline bool Good() const { - if (!RAW_ENT(this) || !RAW_ENT(this)->GetClientClass() || !RAW_ENT(this)->GetClientClass()->m_ClassID || !RAW_ENT(this)->GetClientClass()->m_ClassID) + if (!RAW_ENT(this) || !RAW_ENT(this)->GetClientClass()->m_ClassID) return false; IClientEntity *const entity = InternalEntity(); return entity && !entity->IsDormant(); @@ -90,11 +91,11 @@ public: int m_iClassID() { - if (RAW_ENT(this)) - if (RAW_ENT(this)->GetClientClass()) - if (RAW_ENT(this)->GetClientClass()->m_ClassID) - return RAW_ENT(this)->GetClientClass()->m_ClassID; - return 0; + if (RAW_ENT(this)) + if (RAW_ENT(this)->GetClientClass()) + if (RAW_ENT(this)->GetClientClass()->m_ClassID) + return RAW_ENT(this)->GetClientClass()->m_ClassID; + return 0; }; Vector m_vecOrigin() { @@ -116,25 +117,52 @@ public: }; int m_iMaxHealth() { - if (m_Type == ENTITY_PLAYER) + if (m_Type() == ENTITY_PLAYER) return g_pPlayerResource->GetMaxHealth(this); - else if (m_Type == ENTITY_BUILDING) + else if (m_Type() == ENTITY_BUILDING) return NET_INT(RAW_ENT(this), netvar.iBuildingMaxHealth); else return 0.0f; }; int m_iHealth() { - if (m_Type == ENTITY_PLAYER) + if (m_Type() == ENTITY_PLAYER) return NET_INT(RAW_ENT(this), netvar.iHealth); - else if (m_Type == ENTITY_BUILDING) + else if (m_Type() == ENTITY_BUILDING) return NET_INT(RAW_ENT(this), netvar.iBuildingHealth); else return 0.0f; }; // Entity fields start here - EntityType m_Type{ ENTITY_GENERIC }; + EntityType m_Type() + { + EntityType ret = ENTITY_GENERIC; + int classid = m_iClassID(); + if (classid == CL_CLASS(CTFPlayer)) + ret = ENTITY_PLAYER; + else if (classid == CL_CLASS(CTFGrenadePipebombProjectile) || + classid == CL_CLASS(CTFProjectile_Cleaver) || + classid == CL_CLASS(CTFProjectile_Jar) || + classid == CL_CLASS(CTFProjectile_JarMilk) || + classid == CL_CLASS(CTFProjectile_Arrow) || + classid == CL_CLASS(CTFProjectile_EnergyBall) || + classid == CL_CLASS(CTFProjectile_EnergyRing) || + classid == CL_CLASS(CTFProjectile_GrapplingHook) || + classid == CL_CLASS(CTFProjectile_HealingBolt) || + classid == CL_CLASS(CTFProjectile_Rocket) || + classid == CL_CLASS(CTFProjectile_SentryRocket) || + classid == CL_CLASS(CTFProjectile_BallOfFire) || + classid == CL_CLASS(CTFProjectile_Flare)) + ret = ENTITY_PROJECTILE; + else if (classid == CL_CLASS(CObjectTeleporter) || + classid == CL_CLASS(CObjectSentrygun) || + classid == CL_CLASS(CObjectDispenser)) + ret = ENTITY_BUILDING; + else + ret = ENTITY_GENERIC; + return ret; + }; float m_flDistance() { @@ -146,17 +174,29 @@ public: bool m_bCritProjectile() { - if (m_Type == EntityType::ENTITY_PROJECTILE) + if (m_Type() == EntityType::ENTITY_PROJECTILE) return IsProjectileACrit(this); else return false; }; - bool m_bGrenadeProjectile{ false }; + bool m_bGrenadeProjectile() + { + return m_iClassID() == CL_CLASS(CTFGrenadePipebombProjectile) || + m_iClassID() == CL_CLASS(CTFProjectile_Cleaver) || + m_iClassID() == CL_CLASS(CTFProjectile_Jar) || + m_iClassID() == CL_CLASS(CTFProjectile_JarMilk); + }; bool m_bAnyHitboxVisible{ false }; bool m_bVisCheckComplete{ false }; - k_EItemType m_ItemType{ ITEM_NONE }; + k_EItemType m_ItemType() + { + if (m_Type() == ENTITY_GENERIC) + return g_ItemManager.GetItemType(this); + else + return ITEM_NONE; + }; unsigned long m_lSeenTicks{ 0 }; unsigned long m_lLastSeen{ 0 }; diff --git a/include/hacks/Backtrack.hpp b/include/hacks/Backtrack.hpp index 4521c119..47e5d278 100644 --- a/include/hacks/Backtrack.hpp +++ b/include/hacks/Backtrack.hpp @@ -25,9 +25,13 @@ struct BacktrackData }; void Init(); void Run(); +void Backtrack(CachedEntity *, int); +int Besttick(CachedEntity *); +CachedEntity *BestTarget(); void Draw(); void AddLatencyToNetchan(INetChannel *, float); void UpdateIncomingSequences(); +extern bool dontbacktrack; extern int lastincomingsequencenumber; extern int BestTick; struct CIncomingSequence diff --git a/src/entitycache.cpp b/src/entitycache.cpp old mode 100755 new mode 100644 index 9b9870d0..f4cc6b03 --- a/src/entitycache.cpp +++ b/src/entitycache.cpp @@ -11,7 +11,7 @@ bool IsProjectileACrit(CachedEntity *ent) { - if (ent->m_bGrenadeProjectile) + if (ent->m_bGrenadeProjectile()) return CE_BYTE(ent, netvar.Grenade_bCritical); return CE_BYTE(ent, netvar.Rocket_bCritical); } @@ -29,13 +29,10 @@ CachedEntity::CachedEntity() void CachedEntity::Reset() { - m_Type = ENTITY_GENERIC; - m_bGrenadeProjectile = false; - m_bAnyHitboxVisible = false; - m_bVisCheckComplete = false; - m_ItemType = ITEM_NONE; - m_lLastSeen = 0; - m_lSeenTicks = 0; + m_bAnyHitboxVisible = false; + m_bVisCheckComplete = false; + m_lLastSeen = 0; + m_lSeenTicks = 0; memset(&player_info, 0, sizeof(player_info_s)); m_vecAcceleration.Zero(); m_vecVOrigin.Zero(); @@ -67,105 +64,15 @@ void CachedEntity::Update() #endif bool dormant = raw->IsDormant(); bool dormant_state_changed = dormant != was_dormant(); - /*float simtime = CE_FLOAT(this, netvar.m_flSimulationTime); - float deltat = (simtime - m_fLastUpdate); - if (ve_smooth) { - // - if (dormant_state_changed) { - velocity_averager.reset(0); - velocity_is_valid = false; - } - if (size_t(int(ve_averager_size)) != velocity_averager.size()) { - velocity_averager.resize(size_t(int(ve_averager_size))); - velocity_averager.reset(0); - } - } - if (!dormant && deltat > (float)ve_window) { - ICollideable* ca = RAW_ENT(this)->GetCollideable(); - Vector origin = m_vecOrigin; - if (ca) { - origin = ca->GetCollisionOrigin(); - } - Vector delta = origin - m_vecVOrigin; - Vector velnew = delta / deltat; - m_vecAcceleration = velnew - m_vecVelocity; - if (ve_smooth) { - if (velocity_is_valid) { - static Vector zero {0.0f, 0.0f, 0.0f}; - float length = velnew.Length(); - velocity_averager.push(length); - Vector normalized = (length ? (velnew / length) : zero); - m_vecVelocity = normalized * velocity_averager.average(); - //m_vecVelocity = velocity_averager.average(); - } else { - EstimateAbsVelocity(RAW_ENT(this), m_vecVelocity); - //velocity_averager.push(m_vecVelocity); - velocity_is_valid = true; - } - } else - m_vecVelocity = velnew; - m_vecVOrigin = origin; - m_fLastUpdate = simtime; - }*/ - - m_ItemType = ITEM_NONE; m_lSeenTicks = 0; m_lLastSeen = 0; hitboxes.Update(); - m_bGrenadeProjectile = false; - m_bVisCheckComplete = false; + m_bVisCheckComplete = false; - if (m_iClassID() == RCC_PLAYER) - { - m_Type = EntityType::ENTITY_PLAYER; - } - else if (m_iClassID() == CL_CLASS(CTFGrenadePipebombProjectile) || - m_iClassID() == CL_CLASS(CTFProjectile_Cleaver) || - m_iClassID() == CL_CLASS(CTFProjectile_Jar) || - m_iClassID() == CL_CLASS(CTFProjectile_JarMilk)) - { - m_Type = EntityType::ENTITY_PROJECTILE; - m_bGrenadeProjectile = true; - } - else if (m_iClassID() == CL_CLASS(CObjectTeleporter) || - m_iClassID() == CL_CLASS(CObjectSentrygun) || - m_iClassID() == CL_CLASS(CObjectDispenser)) - { - m_Type = EntityType::ENTITY_BUILDING; - } - else if (m_iClassID() == CL_CLASS(CTFProjectile_Arrow) || - m_iClassID() == CL_CLASS(CTFProjectile_EnergyBall) || - m_iClassID() == CL_CLASS(CTFProjectile_EnergyRing) || - m_iClassID() == CL_CLASS(CTFProjectile_GrapplingHook) || - m_iClassID() == CL_CLASS(CTFProjectile_HealingBolt) || - m_iClassID() == CL_CLASS(CTFProjectile_Rocket) || - m_iClassID() == CL_CLASS(CTFProjectile_SentryRocket) || - m_iClassID() == CL_CLASS(CTFProjectile_BallOfFire) || - m_iClassID() == CL_CLASS(CTFProjectile_Flare)) - { - m_Type = EntityType::ENTITY_PROJECTILE; - } - else - { - m_ItemType = g_ItemManager.GetItemType(this); - m_Type = EntityType::ENTITY_GENERIC; - } - // 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_PLAYER) + if (m_Type() == EntityType::ENTITY_PLAYER) g_IEngine->GetPlayerInfo(m_IDX, &player_info); } @@ -192,7 +99,7 @@ bool CachedEntity::IsVisible() return true; } - if (m_Type == ENTITY_PLAYER && fast_vischeck) + if (m_Type() == ENTITY_PLAYER && fast_vischeck) { for (int i = 0; i < 4; i++) { @@ -232,6 +139,8 @@ CachedEntity array[MAX_ENTITIES]{}; void Update() { + PROF_SECTION(CACHE_UPDATE) + { max = g_IEntityList->GetHighestEntityIndex(); if (max >= MAX_ENTITIES) max = MAX_ENTITIES - 1; @@ -239,6 +148,7 @@ void Update() { array[i].Update(); } + } } void Invalidate() diff --git a/src/hack.cpp b/src/hack.cpp index 2e760dcc..8696a139 100644 --- a/src/hack.cpp +++ b/src/hack.cpp @@ -151,7 +151,8 @@ public: PrintChat( "\x07%06X%s\x01 hurt \x07%06X%s\x01 down to \x07%06X%d\x01hp", colors::chat::team(att->m_iTeam()), kinfo.name, - colors::chat::team(vic->m_iTeam()), vinfo.name, 0x2aaf18, health); + colors::chat::team(vic->m_iTeam()), vinfo.name, 0x2aaf18, + health); } else if (!strcmp(name, "player_death")) { @@ -185,8 +186,8 @@ public: g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(id), &info); CachedEntity *player = ENTITY(g_IEngine->GetPlayerForUserID(id)); PrintChat("\x07%06X%s\x01 changed to \x07%06X%s\x01", - colors::chat::team(player->m_iTeam()), info.name, 0xa06ba0, - classname(event->GetInt("class"))); + colors::chat::team(player->m_iTeam()), info.name, + 0xa06ba0, classname(event->GetInt("class"))); } else if (!strcmp(name, "vote_cast")) { diff --git a/src/hacks/AntiAim.cpp b/src/hacks/AntiAim.cpp index 96ec6205..86c3501a 100644 --- a/src/hacks/AntiAim.cpp +++ b/src/hacks/AntiAim.cpp @@ -260,20 +260,21 @@ bool ShouldAA(CUserCmd *cmd) return false; if (cmd->buttons & IN_USE) return false; + int classid = LOCAL_W->m_iClassID(); if ((cmd->buttons & IN_ATTACK) && !(IsTF2() && - g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFCompoundBow)) && + classid == CL_CLASS(CTFCompoundBow)) && CanShoot()) { return false; } if ((cmd->buttons & IN_ATTACK2) && - g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFLunchBox)) + classid == CL_CLASS(CTFLunchBox)) return false; switch (GetWeaponMode()) { case weapon_projectile: - if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFCompoundBow)) + if (classid == CL_CLASS(CTFCompoundBow)) { if (!(cmd->buttons & IN_ATTACK)) { diff --git a/src/hacks/AntiDisguise.cpp b/src/hacks/AntiDisguise.cpp index e6763ea1..128805ea 100644 --- a/src/hacks/AntiDisguise.cpp +++ b/src/hacks/AntiDisguise.cpp @@ -28,7 +28,7 @@ void Draw() ent = ENTITY(i); if (CE_BAD(ent)) continue; - if (ent->m_Type == ENTITY_PLAYER) + if (ent->m_Type() == ENTITY_PLAYER) { if (CE_INT(ent, netvar.iClass) == tf_class::tf_spy) { @@ -44,7 +44,7 @@ void Draw() ent = ENTITY(i); if (CE_BAD(ent)) continue; - if (ent->m_Type == ENTITY_PLAYER) + if (ent->m_Type() == ENTITY_PLAYER) { if (CE_INT(ent, netvar.iClass) == tf_class::tf_spy) { diff --git a/src/hacks/AutoBackstab.cpp b/src/hacks/AutoBackstab.cpp index 6a9eaae1..d5b37180 100644 --- a/src/hacks/AutoBackstab.cpp +++ b/src/hacks/AutoBackstab.cpp @@ -58,7 +58,7 @@ void CreateMove() CachedEntity *pEnt = ENTITY(i); if (!CE_GOOD(pEnt)) continue; - if (pEnt->m_Type != ENTITY_PLAYER) + if (pEnt->m_Type() != ENTITY_PLAYER) continue; if (!pEnt->m_bAlivePlayer()) continue; @@ -67,12 +67,9 @@ void CreateMove() if (LOCAL_E->m_iTeam() == pEnt->m_iTeam()) continue; scr = 4096.0f - pEnt->m_vecOrigin().DistTo(LOCAL_E->m_vecOrigin()); - if (pEnt->m_vecOrigin().DistTo(LOCAL_E->m_vecOrigin()) > 90.0f) - continue; scr -= abs(g_pLocalPlayer->v_Eye.y - NET_VECTOR(pEnt, netvar.m_angEyeAngles).y); - if ((scr > scr_best) && - LOCAL_E->m_vecOrigin().DistTo(pEnt->m_vecOrigin()) < (int) value) + if (scr > scr_best) { scr_best = scr; ent = pEnt; @@ -90,10 +87,10 @@ void CreateMove() // Get a vector from my origin to my targets origin Vector vecToTarget; - vecToTarget = hacks::shared::backtrack::headPositions - [ent->m_IDX][hacks::shared::backtrack::BestTick] - .origin - - GetWorldSpaceCenter(LOCAL_E); + int tick = hacks::shared::backtrack::Besttick(ent); + vecToTarget = + hacks::shared::backtrack::headPositions[ent->m_IDX][tick].origin - + GetWorldSpaceCenter(LOCAL_E); vecToTarget.z = 0.0f; vecToTarget.NormalizeInPlace(); @@ -101,9 +98,14 @@ void CreateMove() bool isbehind = flDot > -0.1; if (isbehind && - abs(g_pLocalPlayer->v_Eye.y - - NET_VECTOR(ent, netvar.m_angEyeAngles).y) <= 90.0f) + hacks::shared::backtrack::headPositions[ent->m_IDX][tick] + .origin.DistTo(g_pLocalPlayer->v_Eye) <= + re::C_TFWeaponBaseMelee::GetSwingRange(LOCAL_W)) + { + hacks::shared::backtrack::dontbacktrack = true; + hacks::shared::backtrack::Backtrack(ent, tick); g_pUserCmd->buttons |= IN_ATTACK; + } } } } diff --git a/src/hacks/AutoDetonator.cpp b/src/hacks/AutoDetonator.cpp index 8a5305aa..5ca87539 100644 --- a/src/hacks/AutoDetonator.cpp +++ b/src/hacks/AutoDetonator.cpp @@ -52,7 +52,7 @@ bool IsTarget(CachedEntity *ent) return false; // Player specific - if (ent->m_Type == ENTITY_PLAYER) + if (ent->m_Type() == ENTITY_PLAYER) { // Dont detonate on dead players if (!ent->m_bAlivePlayer()) diff --git a/src/hacks/AutoHeal.cpp b/src/hacks/AutoHeal.cpp index c35a1302..0665b5ee 100644 --- a/src/hacks/AutoHeal.cpp +++ b/src/hacks/AutoHeal.cpp @@ -193,7 +193,7 @@ int BlastDangerValue(CachedEntity *patient) continue; if (!ent->m_bEnemy()) continue; - if (ent->m_Type != ENTITY_PROJECTILE) + if (ent->m_Type() != ENTITY_PROJECTILE) continue; if (patient->m_vecOrigin().DistTo(ent->m_vecOrigin()) > (int) auto_vacc_proj_danger_range) @@ -323,7 +323,7 @@ static CatCommand heal_steamid( CachedEntity *ent = ENTITY(i); if (CE_BAD(ent)) continue; - if (ent->m_Type != ENTITY_PLAYER) + if (ent->m_Type() != ENTITY_PLAYER) continue; if (ent->player_info.friendsID == strtol(args.Arg(1), nullptr, 10)) { @@ -580,7 +580,7 @@ bool CanHeal(int idx) return false; if (CE_BAD(ent)) return false; - if (ent->m_Type != ENTITY_PLAYER) + if (ent->m_Type() != ENTITY_PLAYER) return false; if (g_IEngine->GetLocalPlayer() == idx) return false; diff --git a/src/hacks/AutoReflect.cpp b/src/hacks/AutoReflect.cpp index 98b7b804..0547f86c 100644 --- a/src/hacks/AutoReflect.cpp +++ b/src/hacks/AutoReflect.cpp @@ -160,7 +160,7 @@ void CreateMove() bool ShouldReflect(CachedEntity *ent) { // Check if the entity is a projectile - if (ent->m_Type != ENTITY_PROJECTILE) + if (ent->m_Type() != ENTITY_PROJECTILE) return false; if (!teammates) @@ -174,7 +174,7 @@ bool ShouldReflect(CachedEntity *ent) if (!dodgeball) { // If projectile is already deflected, don't deflect it again. - if (CE_INT(ent, (ent->m_bGrenadeProjectile + if (CE_INT(ent, (ent->m_bGrenadeProjectile() ? /* NetVar for grenades */ netvar.Grenade_iDeflected : diff --git a/src/hacks/AutoSticky.cpp b/src/hacks/AutoSticky.cpp index 6f96dbf5..65360dc1 100644 --- a/src/hacks/AutoSticky.cpp +++ b/src/hacks/AutoSticky.cpp @@ -57,7 +57,7 @@ bool IsTarget(CachedEntity *ent) return false; // Player specific - if (ent->m_Type == ENTITY_PLAYER) + if (ent->m_Type() == ENTITY_PLAYER) { // Dont detonate on dead players if (!ent->m_bAlivePlayer()) @@ -86,7 +86,7 @@ bool IsTarget(CachedEntity *ent) // Building specific } - else if (ent->m_Type == ENTITY_BUILDING) + else if (ent->m_Type() == ENTITY_BUILDING) { return buildings; } diff --git a/src/hacks/Backtrack.cpp b/src/hacks/Backtrack.cpp index 72148ca4..f3017830 100644 --- a/src/hacks/Backtrack.cpp +++ b/src/hacks/Backtrack.cpp @@ -49,7 +49,7 @@ void AddLatencyToNetchan(INetChannel *ch, float Latency) Latency -= ch->GetLatency(MAX_FLOWS); for (auto &seq : sequences) { - if (g_GlobalVars->realtime - seq.curtime > Latency / 1000.0f) + if (g_GlobalVars->realtime - seq.curtime >= Latency / 1000.0f) { ch->m_nInReliableState = seq.inreliablestate; ch->m_nInSequenceNr = seq.sequencenr; @@ -57,8 +57,9 @@ void AddLatencyToNetchan(INetChannel *ch, float Latency) } } } -bool installed = false; -int ticks = 12; +bool installed = false; +int ticks = 12; +bool dontbacktrack = false; void Init() { for (int i = 0; i < 32; i++) @@ -75,6 +76,12 @@ void Init() installed = true; } } +std::pair backtracked; +void setbesttick(CachedEntity *ent, int tick) +{ + backtracked.first = ent->m_IDX; + backtracked.second = tick; +} bool disabled = true; int BestTick = 0; int iBestTarget = -1; @@ -88,7 +95,6 @@ void Run() return; } disabled = true; - CUserCmd *cmd = g_pUserCmd; float bestFov = 99999; if (CE_BAD(LOCAL_E)) @@ -108,48 +114,87 @@ void Run() } if (pEntity->m_iTeam() == LOCAL_E->m_iTeam()) continue; - if (pEntity->m_Type != ENTITY_PLAYER) + if (pEntity->m_Type() != ENTITY_PLAYER) continue; if (!pEntity->hitboxes.GetHitbox(0)) continue; Vector hitboxpos = pEntity->hitboxes.GetHitbox(0)->center; Vector min = pEntity->hitboxes.GetHitbox(0)->min; Vector max = pEntity->hitboxes.GetHitbox(0)->max; - headPositions[i][cmd->command_number % ticks + 1] = - BacktrackData{ cmd->tick_count, hitboxpos, min, max, + headPositions[i][g_pUserCmd->command_number % ticks + 1] = + BacktrackData{ g_pUserCmd->tick_count, hitboxpos, min, max, pEntity->m_vecOrigin() }; - float FOVDistance = GetFov(g_pLocalPlayer->v_OrigViewangles, - g_pLocalPlayer->v_Eye, hitboxpos); - iBestTarget = -1; - if (bestFov > FOVDistance && FOVDistance < 10.0f) - { - bestFov = FOVDistance; - iBestTarget = i; - } - if (iBestTarget != -1 && (g_pUserCmd->buttons & IN_ATTACK || - g_pUserCmd->buttons & IN_ATTACK2)) - { - int bestTick = 0; - float tempFOV = 9999; - float bestFOV = 40.0f; - for (int t = 0; t < ticks; ++t) - { - if (GetWeaponMode() == weapon_melee) - if (g_pLocalPlayer->v_Eye.DistTo( - headPositions[iBestTarget][t].hitboxpos) > 90.0f) - return; - tempFOV = GetFov(g_pLocalPlayer->v_OrigViewangles, - g_pLocalPlayer->v_Eye, - headPositions[iBestTarget][t].hitboxpos); - if (bestFOV > tempFOV) - bestTick = t, bestFOV = tempFOV; - } + } - BestTick = bestTick; - if (cmd->buttons & IN_ATTACK) - cmd->tick_count = headPositions[i][bestTick].tickcount; + if ((g_pUserCmd->buttons & IN_ATTACK || g_pUserCmd->buttons & IN_ATTACK2) && + !dontbacktrack && CanShoot()) + { + CachedEntity *target = BestTarget(); + if (CE_BAD(target)) + return; + int tick = Besttick(target); + Backtrack(target, tick); + } + dontbacktrack = false; +} +int Besttick(CachedEntity *ent) +{ + float tempFOV = 9999; + float bestFOV = 40.0f; + int bestTick = 0; + for (int t = 0; t < ticks; ++t) + { + if (!IsVectorVisible(g_pLocalPlayer->v_Eye, + headPositions[ent->m_IDX][t].hitboxpos)) + continue; + if (GetWeaponMode() == weapon_melee) + if (g_pLocalPlayer->v_Eye.DistTo( + headPositions[ent->m_IDX][t].hitboxpos) > + re::C_TFWeaponBaseMelee::GetSwingRange(LOCAL_W)) + continue; + tempFOV = + GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, + headPositions[ent->m_IDX][t].hitboxpos); + if (bestFOV > tempFOV) + bestTick = t, bestFOV = tempFOV; + } + BestTick = bestTick; + return BestTick; +} +CachedEntity *BestTarget() +{ + float bestFov = 99999; + iBestTarget = -1; + for (int i = 0; i < 32; i++) + { + for (int t = 0; t < ticks; ++t) + { + if (!IsVectorVisible(g_pLocalPlayer->v_Eye, + headPositions[iBestTarget][t].hitboxpos)) + continue; + Vector hitboxpos = headPositions[i][t].hitboxpos; + float FOVDistance = GetFov(g_pLocalPlayer->v_OrigViewangles, + g_pLocalPlayer->v_Eye, hitboxpos); + if (bestFov > FOVDistance && FOVDistance < 40.0f) + { + bestFov = FOVDistance; + iBestTarget = i; + } } } + if (iBestTarget != -1) + return ENTITY(iBestTarget); + else + return nullptr; +} +void Backtrack(CachedEntity *ent, int tick) +{ + if (CE_GOOD(ent)) + { + backtracked.first = ent->m_IDX; + backtracked.second = tick; + g_pUserCmd->tick_count = headPositions[ent->m_IDX][tick].tickcount; + } } void Draw() { @@ -173,7 +218,7 @@ void Draw() else size = abs(max.y - min.y); Vector out; - if (i == iBestTarget && j == BestTick) + if (i == backtracked.first && j == backtracked.second) { if (draw::WorldToScreen(hbpos, out)) draw_api::draw_rect(out.x, out.y, size / 2, size / 2, diff --git a/src/hacks/ESP.cpp b/src/hacks/ESP.cpp index 0d9fe228..f17d3417 100644 --- a/src/hacks/ESP.cpp +++ b/src/hacks/ESP.cpp @@ -358,7 +358,7 @@ void CreateMove() { for (int j = 0; j < 18; ++j) hitboxcache[i][j] = ent->hitboxes.GetHitbox(j); - if (draw_bones && ent->m_Type == ENTITY_PLAYER) + if (draw_bones && ent->m_Type() == ENTITY_PLAYER) { modelcache[i] = RAW_ENT(ent)->GetModel(); if (modelcache[i]) @@ -379,9 +379,10 @@ void CreateMove() // If snow distance, add string here if (show_distance) { - AddEntityString(ent, format((int) (ENTITY(i)->m_flDistance() / - 64 * 1.22f), - 'm')); + AddEntityString( + ent, + format((int) (ENTITY(i)->m_flDistance() / 64 * 1.22f), + 'm')); } } // No idea, this is confusing @@ -401,7 +402,7 @@ void Init() draw_api::destroy_font(fonts::esp_font); fonts::esp_font = draw_api::create_font( DATA_PATH "/fonts/verasans.ttf", esp_font_scale); - }); + }); textur = glez_texture_load_png_rgba(DATA_PATH "/textures/atlas.png"); idspecific = glez_texture_load_png_rgba(DATA_PATH "/textures/idspec.png"); if (textur == GLEZ_TEXTURE_INVALID) @@ -445,7 +446,7 @@ void _FASTCALL emoji(CachedEntity *ent) // Emoji esp if (emoji_esp) { - if (ent->m_Type == ENTITY_PLAYER) + if (ent->m_Type() == ENTITY_PLAYER) { if (emoji_ok) @@ -522,6 +523,8 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent) if (CE_BAD(ent)) return; + int classid = ent->m_iClassID(); + EntityType type = ent->m_Type(); // Grab esp data ESPData &ent_data = data[ent->m_IDX]; @@ -546,7 +549,7 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent) transparent = true; // Bone esp - if (draw_bones && ent->m_Type == ENTITY_PLAYER) + if (draw_bones && type == ENTITY_PLAYER) { const model_t *model = modelcache[ent->m_IDX]; if (model) @@ -557,7 +560,7 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent) } // Tracers - if (tracers && ent->m_Type == ENTITY_PLAYER) + if (tracers && type == ENTITY_PLAYER) { // Grab the screen resolution and save to some vars @@ -580,7 +583,7 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent) } // Sightline esp - if (sightlines && ent->m_Type == ENTITY_PLAYER) + if (sightlines && type == ENTITY_PLAYER) { // Logic for using the enum to sort out snipers @@ -685,7 +688,7 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent) // Box esp if (box_esp || box_3d_player || box_3d_building) { - switch (ent->m_Type) + switch (type) { case ENTITY_PLAYER: if (vischeck && !ent->IsVisible()) @@ -722,7 +725,7 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent) { // We only want health bars on players and buildings - if (ent->m_Type == ENTITY_PLAYER || ent->m_Type == ENTITY_BUILDING) + if (type == ENTITY_PLAYER || type == ENTITY_BUILDING) { // Get collidable from the cache @@ -738,7 +741,7 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent) // Get health values int health = 0; int healthmax = 0; - switch (ent->m_Type) + switch (type) { case ENTITY_PLAYER: health = CE_INT(ent, netvar.iHealth); @@ -754,7 +757,8 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent) rgba_t hp = colors::Transparent( colors::Health(health, healthmax), fg.a); rgba_t border = - ((ent->m_iClassID() == RCC_PLAYER) && IsPlayerInvisible(ent)) + ((classid == RCC_PLAYER) && + IsPlayerInvisible(ent)) ? colors::FromRGBA8(160, 160, 160, fg.a * 255.0f) : colors::Transparent(colors::black, fg.a); // Get bar height @@ -779,7 +783,7 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent) bool origin_is_zero = true; // Only get collidable for players and buildings - if (ent->m_Type == ENTITY_PLAYER || ent->m_Type == ENTITY_BUILDING) + if (type == ENTITY_PLAYER || type == ENTITY_BUILDING) { // Get collidable from the cache @@ -881,7 +885,7 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent) // TODO Add Rotation matix // TODO Currently crashes, needs null check somewhere // Draw Hitboxes - /*if (draw_hitbox && ent->m_Type == ENTITY_PLAYER) { + /*if (draw_hitbox && type == ENTITY_PLAYER) { PROF_SECTION(PT_esp_drawhitbboxes); // Loop through hitboxes @@ -934,12 +938,13 @@ void _FASTCALL ProcessEntity(CachedEntity *ent) if (CE_BAD(ent)) return; // CE_BAD check to prevent crashes + int classid = ent->m_iClassID(); // Entity esp if (entity_info) { AddEntityString(ent, format(RAW_ENT(ent)->GetClientClass()->m_pNetworkName, - " [", ent->m_iClassID(), "]")); + " [", classid, "]")); if (entity_id) { AddEntityString(ent, std::to_string(ent->m_IDX)); @@ -957,13 +962,13 @@ void _FASTCALL ProcessEntity(CachedEntity *ent) ESPData &espdata = data[ent->m_IDX]; // Projectile esp - if (ent->m_Type == ENTITY_PROJECTILE && proj_esp && + if (ent->m_Type() == ENTITY_PROJECTILE && proj_esp && (ent->m_bEnemy() || (teammates && !proj_enemy))) { // Rockets - if (ent->m_iClassID() == CL_CLASS(CTFProjectile_Rocket) || - ent->m_iClassID() == CL_CLASS(CTFProjectile_SentryRocket)) + if (classid == CL_CLASS(CTFProjectile_Rocket) || + classid == CL_CLASS(CTFProjectile_SentryRocket)) { if (proj_rockets) { @@ -975,7 +980,7 @@ void _FASTCALL ProcessEntity(CachedEntity *ent) // Pills/Stickys } - else if (ent->m_iClassID() == CL_CLASS(CTFGrenadePipebombProjectile)) + else if (classid == CL_CLASS(CTFGrenadePipebombProjectile)) { // Switch based on pills/stickys switch (CE_INT(ent, netvar.iPipeType)) @@ -997,7 +1002,7 @@ void _FASTCALL ProcessEntity(CachedEntity *ent) // Huntsman } - else if (ent->m_iClassID() == CL_CLASS(CTFProjectile_Arrow)) + else if (classid == CL_CLASS(CTFProjectile_Arrow)) { if ((int) proj_arrows != 2 || ent->m_bCritProjectile()) { @@ -1014,27 +1019,27 @@ void _FASTCALL ProcessEntity(CachedEntity *ent) if (CE_BYTE(ent, netvar.hOwner) == (unsigned char) -1) { int string_count_backup = data[ent->m_IDX].string_count; - if (ent->m_iClassID() == CL_CLASS(CWeapon_SLAM)) + if (classid == CL_CLASS(CWeapon_SLAM)) AddEntityString(ent, "SLAM"); - else if (ent->m_iClassID() == CL_CLASS(CWeapon357)) + else if (classid == CL_CLASS(CWeapon357)) AddEntityString(ent, ".357"); - else if (ent->m_iClassID() == CL_CLASS(CWeaponAR2)) + else if (classid == CL_CLASS(CWeaponAR2)) AddEntityString(ent, "AR2"); - else if (ent->m_iClassID() == CL_CLASS(CWeaponAlyxGun)) + else if (classid == CL_CLASS(CWeaponAlyxGun)) AddEntityString(ent, "Alyx Gun"); - else if (ent->m_iClassID() == CL_CLASS(CWeaponAnnabelle)) + else if (classid == CL_CLASS(CWeaponAnnabelle)) AddEntityString(ent, "Annabelle"); - else if (ent->m_iClassID() == CL_CLASS(CWeaponBinoculars)) + else if (classid == CL_CLASS(CWeaponBinoculars)) AddEntityString(ent, "Binoculars"); - else if (ent->m_iClassID() == CL_CLASS(CWeaponBugBait)) + else if (classid == CL_CLASS(CWeaponBugBait)) AddEntityString(ent, "Bug Bait"); - else if (ent->m_iClassID() == CL_CLASS(CWeaponCrossbow)) + else if (classid == CL_CLASS(CWeaponCrossbow)) AddEntityString(ent, "Crossbow"); - else if (ent->m_iClassID() == CL_CLASS(CWeaponShotgun)) + else if (classid == CL_CLASS(CWeaponShotgun)) AddEntityString(ent, "Shotgun"); - else if (ent->m_iClassID() == CL_CLASS(CWeaponSMG1)) + else if (classid == CL_CLASS(CWeaponSMG1)) AddEntityString(ent, "SMG"); - else if (ent->m_iClassID() == CL_CLASS(CWeaponRPG)) + else if (classid == CL_CLASS(CWeaponRPG)) AddEntityString(ent, "RPG"); if (string_count_backup != data[ent->m_IDX].string_count) { @@ -1044,14 +1049,15 @@ void _FASTCALL ProcessEntity(CachedEntity *ent) } } + int itemtype = ent->m_ItemType(); // Tank esp - if (ent->m_iClassID() == CL_CLASS(CTFTankBoss) && tank) + if (classid == CL_CLASS(CTFTankBoss) && tank) { AddEntityString(ent, "Tank"); // Dropped weapon esp } - else if (ent->m_iClassID() == CL_CLASS(CTFDroppedWeapon) && item_esp && + else if (classid == CL_CLASS(CTFDroppedWeapon) && item_esp && item_dropped_weapons) { AddEntityString( @@ -1059,7 +1065,7 @@ void _FASTCALL ProcessEntity(CachedEntity *ent) // MVM Money esp } - else if (ent->m_iClassID() == CL_CLASS(CCurrencyPack) && item_money) + else if (classid == CL_CLASS(CCurrencyPack) && item_money) { if (CE_BYTE(ent, netvar.bDistributed)) { @@ -1075,68 +1081,69 @@ void _FASTCALL ProcessEntity(CachedEntity *ent) // Other item esp } - else if (ent->m_ItemType != ITEM_NONE && item_esp) + else if (itemtype != ITEM_NONE && item_esp) { // Health pack esp - if (item_health_packs && (ent->m_ItemType >= ITEM_HEALTH_SMALL && - ent->m_ItemType <= ITEM_HEALTH_LARGE || - ent->m_ItemType == ITEM_HL_BATTERY)) + if (item_health_packs && (itemtype >= ITEM_HEALTH_SMALL && + itemtype <= ITEM_HEALTH_LARGE || + itemtype == ITEM_HL_BATTERY)) { - if (ent->m_ItemType == ITEM_HEALTH_SMALL) + if (itemtype == ITEM_HEALTH_SMALL) AddEntityString(ent, "[+]"); - if (ent->m_ItemType == ITEM_HEALTH_MEDIUM) + if (itemtype == ITEM_HEALTH_MEDIUM) AddEntityString(ent, "[++]"); - if (ent->m_ItemType == ITEM_HEALTH_LARGE) + if (itemtype == ITEM_HEALTH_LARGE) AddEntityString(ent, "[+++]"); - if (ent->m_ItemType == ITEM_HL_BATTERY) + if (itemtype == ITEM_HL_BATTERY) AddEntityString(ent, "[Z]"); // TF2C Adrenaline esp } - else if (item_adrenaline && ent->m_ItemType == ITEM_TF2C_PILL) + else if (item_adrenaline && itemtype == ITEM_TF2C_PILL) { AddEntityString(ent, "[a]"); // Ammo pack esp } - else if (item_ammo_packs && ent->m_ItemType >= ITEM_AMMO_SMALL && - ent->m_ItemType <= ITEM_AMMO_LARGE) + else if (item_ammo_packs && itemtype >= ITEM_AMMO_SMALL && + itemtype <= ITEM_AMMO_LARGE) { - if (ent->m_ItemType == ITEM_AMMO_SMALL) + if (itemtype == ITEM_AMMO_SMALL) AddEntityString(ent, "{i}"); - if (ent->m_ItemType == ITEM_AMMO_MEDIUM) + if (itemtype == ITEM_AMMO_MEDIUM) AddEntityString(ent, "{ii}"); - if (ent->m_ItemType == ITEM_AMMO_LARGE) + if (itemtype == ITEM_AMMO_LARGE) AddEntityString(ent, "{iii}"); // Powerup esp } - else if (item_powerups && ent->m_ItemType >= ITEM_POWERUP_FIRST && - ent->m_ItemType <= ITEM_POWERUP_LAST) + else if (item_powerups && itemtype >= ITEM_POWERUP_FIRST && + itemtype <= ITEM_POWERUP_LAST) { AddEntityString( - ent, format(powerups[ent->m_ItemType - ITEM_POWERUP_FIRST], + ent, format(powerups[itemtype - ITEM_POWERUP_FIRST], " PICKUP")); // TF2C weapon spawner esp } - else if (item_weapon_spawners && ent->m_ItemType >= ITEM_TF2C_W_FIRST && - ent->m_ItemType <= ITEM_TF2C_W_LAST) + else if (item_weapon_spawners && + itemtype >= ITEM_TF2C_W_FIRST && + itemtype <= ITEM_TF2C_W_LAST) { AddEntityString( ent, - format(tf2c_weapon_names[ent->m_ItemType - ITEM_TF2C_W_FIRST], + format(tf2c_weapon_names[itemtype - ITEM_TF2C_W_FIRST], " SPAWNER")); if (CE_BYTE(ent, netvar.bRespawning)) AddEntityString(ent, "-- RESPAWNING --"); // Halloween spell esp } - else if (item_spellbooks && (ent->m_ItemType == ITEM_SPELL || - ent->m_ItemType == ITEM_SPELL_RARE)) + else if (item_spellbooks && (itemtype == ITEM_SPELL || + itemtype == ITEM_SPELL_RARE)) { - if (ent->m_ItemType == ITEM_SPELL) + if (itemtype == ITEM_SPELL) { AddEntityString(ent, "Spell", colors::green); } @@ -1149,7 +1156,7 @@ void _FASTCALL ProcessEntity(CachedEntity *ent) // Building esp } - else if (ent->m_Type == ENTITY_BUILDING && buildings) + else if (ent->m_Type() == ENTITY_BUILDING && buildings) { // Check if enemy building @@ -1167,9 +1174,9 @@ void _FASTCALL ProcessEntity(CachedEntity *ent) if (show_name || show_class) { const std::string &name = - (ent->m_iClassID() == CL_CLASS(CObjectTeleporter) + (classid == CL_CLASS(CObjectTeleporter) ? "Teleporter" - : (ent->m_iClassID() == CL_CLASS(CObjectSentrygun) + : (classid == CL_CLASS(CObjectSentrygun) ? "Sentry Gun" : "Dispenser")); int level = CE_INT(ent, netvar.iUpgradeLevel); @@ -1188,7 +1195,7 @@ void _FASTCALL ProcessEntity(CachedEntity *ent) // Player esp } - else if (ent->m_Type == ENTITY_PLAYER && ent->m_bAlivePlayer()) + else if (ent->m_Type() == ENTITY_PLAYER && ent->m_bAlivePlayer()) { // Local player handling @@ -1263,7 +1270,8 @@ void _FASTCALL ProcessEntity(CachedEntity *ent) if ((int) show_health == 1 || (int) show_health == 3) { AddEntityString( - ent, format(ent->m_iHealth(), '/', ent->m_iMaxHealth(), " HP"), + ent, + format(ent->m_iHealth(), '/', ent->m_iMaxHealth(), " HP"), colors::Health(ent->m_iHealth(), ent->m_iMaxHealth())); } IF_GAME(IsTF()) @@ -1495,9 +1503,10 @@ void _FASTCALL DrawBox(CachedEntity *ent, const rgba_t &clr) // Depending on whether the player is cloaked, we change the color // acordingly - rgba_t border = ((ent->m_iClassID() == RCC_PLAYER) && IsPlayerInvisible(ent)) - ? colors::FromRGBA8(160, 160, 160, clr.a * 255.0f) - : colors::Transparent(colors::black, clr.a); + rgba_t border = + ((ent->m_iClassID() == RCC_PLAYER) && IsPlayerInvisible(ent)) + ? colors::FromRGBA8(160, 160, 160, clr.a * 255.0f) + : colors::Transparent(colors::black, clr.a); // With box corners, we draw differently if ((int) box_esp == 2) diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index 28c51bd2..9ed301ca 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -87,7 +87,7 @@ void WorldTick() auto entity = ENTITY(i); if (CE_BAD(entity)) // Exist + dormant continue; - if (entity->m_Type != ENTITY_PLAYER) + if (entity->m_Type() != ENTITY_PLAYER) continue; if ((int) follow_steam + 18 != entity->player_info.friendsID) // steamid check @@ -114,7 +114,7 @@ void WorldTick() if (CE_BAD(entity)) // Exist + dormant continue; if (!followcart) - if (entity->m_Type != ENTITY_PLAYER) + if (entity->m_Type() != ENTITY_PLAYER) continue; if (entity == LOCAL_E) // Follow self lol continue; @@ -137,7 +137,7 @@ void WorldTick() model == lagexploit::pointarr[3] || model == lagexploit::pointarr[4])) follow_target = entity->m_IDX; - if (entity->m_Type != ENTITY_PLAYER) + if (entity->m_Type() != ENTITY_PLAYER) continue; if (follow_target && ENTITY(follow_target)->m_flDistance() > diff --git a/src/hacks/LagExploit.cpp b/src/hacks/LagExploit.cpp index 76350f27..eadaf21d 100644 --- a/src/hacks/LagExploit.cpp +++ b/src/hacks/LagExploit.cpp @@ -101,7 +101,7 @@ void CreateMove() return; if (exticks > 0) exticks--; - + int classid = LOCAL_W->m_iClassID(); if (!exticks) { // Infinite pickups (health and ammo) @@ -138,9 +138,9 @@ void CreateMove() // Lag for health if (LOCAL_E->m_iHealth() < LOCAL_E->m_iMaxHealth() && - (e->m_ItemType == ITEM_HEALTH_SMALL || - e->m_ItemType == ITEM_HEALTH_MEDIUM || - e->m_ItemType == ITEM_HEALTH_LARGE)) + (e->m_ItemType() == ITEM_HEALTH_SMALL || + e->m_ItemType() == ITEM_HEALTH_MEDIUM || + e->m_ItemType() == ITEM_HEALTH_LARGE)) { AddExploitTicks(3); } @@ -149,9 +149,9 @@ void CreateMove() // LOCAL_E->m_iMaxAmmo That is pseudocode but checking each // weapon for ammo + engie for metal would be ideal if (CE_INT(g_pLocalPlayer->weapon(), netvar.m_iAmmo) < 5 && - (e->m_ItemType == ITEM_AMMO_SMALL || - e->m_ItemType == ITEM_AMMO_MEDIUM || - e->m_ItemType == ITEM_AMMO_LARGE)) + (e->m_ItemType() == ITEM_AMMO_SMALL || + e->m_ItemType() == ITEM_AMMO_MEDIUM || + e->m_ItemType() == ITEM_AMMO_LARGE)) { AddExploitTicks(3); } @@ -301,10 +301,12 @@ void CreateMove() amount = 2 * 90; } else if (CanShoot() && bIsHolding && !bWasHolding && - g_pLocalPlayer->weapon()->m_iClassID() != CL_CLASS(CTFFlareGun)) + classid != + CL_CLASS(CTFFlareGun)) amount = 1 * 90; else if (CanShoot() && bIsHolding && !bWasHolding && - g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFFlareGun)) + classid == + CL_CLASS(CTFFlareGun)) amount = 2 * 90; else if (bWasHolding && !bIsHolding) amount = 1 * 90; @@ -319,11 +321,11 @@ void CreateMove() if (not g_pLocalPlayer->holding_sniper_rifle) { if (CanShoot() && bIsHolding && !bWasHolding && - g_pLocalPlayer->weapon()->m_iClassID() != + classid != CL_CLASS(CTFFlareGun)) amount = 1 * 90; else if (CanShoot() && bIsHolding && !bWasHolding && - g_pLocalPlayer->weapon()->m_iClassID() == + classid == CL_CLASS(CTFFlareGun)) amount = 2 * 90; else if (bWasHolding && !bIsHolding) @@ -370,8 +372,8 @@ void CreateMove() // Thanks Wheaties For help! if (stickyspam) { - if (g_pLocalPlayer->weapon()->m_iClassID() == (CL_CLASS(CTFCannon)) || - g_pLocalPlayer->weapon()->m_iClassID() == + if (classid == (CL_CLASS(CTFCannon)) || + classid == (CL_CLASS(CTFPipebombLauncher))) { static bool bSwitch = false; @@ -385,7 +387,7 @@ void CreateMove() } static int charge = 0; if (g_pLocalPlayer->bAttackLastTick && infinitecharge && - g_pLocalPlayer->weapon()->m_iClassID() == + classid == (CL_CLASS(CTFPipebombLauncher)) && (g_pUserCmd->buttons & IN_ATTACK) && CE_BYTE(LOCAL_W, netvar.m_flChargeLevel)) @@ -398,10 +400,10 @@ void CreateMove() charge = 0; if (instant_weapon_switch && not HasCondition(LOCAL_E)) { - if (lastwep != g_pLocalPlayer->weapon()->m_iClassID()) + if (lastwep != classid) { amount = 4 * 66; - lastwep = g_pLocalPlayer->weapon()->m_iClassID(); + lastwep = classid; } } // SHOUTOUTS TO BLACKFIRE @@ -418,11 +420,11 @@ void CreateMove() // than 0.1f // Get a new nextattack(2) if (!nextattack || i < 0.1f || - g_pLocalPlayer->weapon()->m_iClassID() != lastwep) + classid != lastwep) nextattack = CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flNextPrimaryAttack); if (!nextattack2 || i2 < 0.1f || - g_pLocalPlayer->weapon()->m_iClassID() != lastwep) + classid != lastwep) nextattack2 = CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flNextSecondaryAttack); // If the next attack (2) time would exceed 75 seconds, set it to 75 to @@ -485,7 +487,7 @@ void CreateMove() if (CE_BAD(snoiper)) return; // Only works with knife out obviously - if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFKnife)) + if (classid == CL_CLASS(CTFKnife)) { if (!i) i = 3; @@ -498,7 +500,7 @@ void CreateMove() if (i > 0.1f) i -= 1.0f; // Set last weapon classid - lastwep = g_pLocalPlayer->weapon()->m_iClassID(); + lastwep = classid; } // if Jarate spam active if (piss) @@ -510,11 +512,11 @@ void CreateMove() // Get nextattack when it's invalid or the player selected another // weapon (which is a tick, not a time like 1 second, but servertime + 1 // second) - if (!nextattack || g_pLocalPlayer->weapon()->m_iClassID() != lastwep) + if (!nextattack || classid != lastwep) nextattack = CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flNextPrimaryAttack); // Set last weapon since it's not needed anymore this cycle - lastwep = g_pLocalPlayer->weapon()->m_iClassID(); + lastwep = classid; // Check if holding JARAAATE if (CE_INT(g_pLocalPlayer->weapon(), netvar.iItemDefinitionIndex) == 58) { diff --git a/src/hacks/Misc.cpp b/src/hacks/Misc.cpp index 7e6d0736..a2d0b3d4 100644 --- a/src/hacks/Misc.cpp +++ b/src/hacks/Misc.cpp @@ -403,7 +403,7 @@ void DrawText() CachedEntity *ent = ENTITY(i); player_info_s info; if (!CE_BAD(ent) && ent != LOCAL_E && - ent->m_Type == ENTITY_PLAYER && + ent->m_Type() == ENTITY_PLAYER && (CE_INT(ent, netvar.hObserverTarget) & 0xFFF) == LOCAL_E->m_IDX && CE_INT(ent, netvar.iObserverMode) >= 4 && @@ -503,7 +503,7 @@ void DrawText() for (int i = 0; i < HIGHEST_ENTITY; i++) { CachedEntity* e = ENTITY(i); if (CE_GOOD(e)) { - if (e->m_Type == EntityType::ENTITY_PROJECTILE) { + if (e->m_Type() == EntityType::ENTITY_PROJECTILE) { //logging::Info("Entity %i [%s]: V %.2f (X: %.2f, Y: %.2f, Z: %.2f) ACC %.2f (X: %.2f, Y: %.2f, Z: %.2f)", i, RAW_ENT(e)->GetClientClass()->GetName(), e->m_vecVelocity.Length(), diff --git a/src/hacks/Radar.cpp b/src/hacks/Radar.cpp index 3d6014a8..f61ae810 100644 --- a/src/hacks/Radar.cpp +++ b/src/hacks/Radar.cpp @@ -124,7 +124,7 @@ void DrawEntity(int x, int y, CachedEntity *ent) if (CE_GOOD(ent)) { - if (ent->m_Type == ENTITY_PLAYER) + if (ent->m_Type() == ENTITY_PLAYER) { if (CE_BYTE(ent, netvar.iLifeState)) return; // DEAD. not big surprise. @@ -159,8 +159,9 @@ void DrawEntity(int x, int y, CachedEntity *ent) if (ent->m_iMaxHealth() && healthbar) { - healthp = (float) ent->m_iHealth() / (float) ent->m_iMaxHealth(); - clr = colors::Health(ent->m_iHealth(), ent->m_iMaxHealth()); + healthp = + (float) ent->m_iHealth() / (float) ent->m_iMaxHealth(); + clr = colors::Health(ent->m_iHealth(), ent->m_iMaxHealth()); if (healthp > 1.0f) healthp = 1.0f; draw_api::draw_rect_outlined( @@ -171,7 +172,7 @@ void DrawEntity(int x, int y, CachedEntity *ent) ((float) icon_size - 2.0f) * healthp, 2, clr); } } - else if (ent->m_Type == ENTITY_BUILDING) + else if (ent->m_Type() == ENTITY_BUILDING) { /*if (ent->m_iClassID() == CL_CLASS(CObjectDispenser)) { const int& team = CE_INT(ent, netvar.iTeamNum); @@ -182,7 +183,8 @@ void DrawEntity(int x, int y, CachedEntity *ent) wtr.second, (int)icon_size, (int)icon_size, idx ? colors::blu : colors::red ); draw::OutlineRect(x + wtr.first, y + wtr.second, (int)icon_size, (int)icon_size, idx ? colors::blu_v : - colors::red_v); if (ent->m_iMaxHealth() && healthbar) { float healthp + colors::red_v); if (ent->m_iMaxHealth() && healthbar) { float + healthp = (float)ent->m_iHealth() / (float)ent->m_iMaxHealth(); int clr = colors::Health(ent->m_iHealth(), ent->m_iMaxHealth()); if (healthp > 1.0f) healthp = 1.0f; draw::OutlineRect(x + wtr.first, y + @@ -192,11 +194,11 @@ void DrawEntity(int x, int y, CachedEntity *ent) } }*/ } - else if (ent->m_Type == ENTITY_GENERIC) + else if (ent->m_Type() == ENTITY_GENERIC) { - if (show_healthpacks && (ent->m_ItemType == ITEM_HEALTH_LARGE || - ent->m_ItemType == ITEM_HEALTH_MEDIUM || - ent->m_ItemType == ITEM_HEALTH_SMALL)) + if (show_healthpacks && (ent->m_ItemType() == ITEM_HEALTH_LARGE || + ent->m_ItemType() == ITEM_HEALTH_MEDIUM || + ent->m_ItemType() == ITEM_HEALTH_SMALL)) { const auto &wtr = WorldToRadar(ent->m_vecOrigin().x, ent->m_vecOrigin().y); @@ -205,9 +207,9 @@ void DrawEntity(int x, int y, CachedEntity *ent) tx_items[1].sprite.draw(x + wtr.first + sz, y + wtr.second + sz, sz2, sz2, colors::white); } - else if (show_ammopacks && (ent->m_ItemType == ITEM_AMMO_LARGE || - ent->m_ItemType == ITEM_AMMO_MEDIUM || - ent->m_ItemType == ITEM_AMMO_SMALL)) + else if (show_ammopacks && (ent->m_ItemType() == ITEM_AMMO_LARGE || + ent->m_ItemType() == ITEM_AMMO_MEDIUM || + ent->m_ItemType() == ITEM_AMMO_SMALL)) { const auto &wtr = WorldToRadar(ent->m_vecOrigin().x, ent->m_vecOrigin().y); @@ -254,13 +256,13 @@ void Draw() continue; if (i == g_IEngine->GetLocalPlayer()) continue; - if (ent->m_Type == ENTITY_PLAYER) + if (ent->m_Type() == ENTITY_PLAYER) { if (!ent->m_bEnemy() && !show_teammates) continue; } if (!enemies_over_teammates || !show_teammates || - ent->m_Type != ENTITY_PLAYER) + ent->m_Type() != ENTITY_PLAYER) DrawEntity(x, y, ent); else { diff --git a/src/hacks/Trigger.cpp b/src/hacks/Trigger.cpp index 04343065..279898c2 100644 --- a/src/hacks/Trigger.cpp +++ b/src/hacks/Trigger.cpp @@ -85,14 +85,11 @@ bool CanBacktrack(CachedEntity *entity) { if (CE_BAD(entity)) return false; - if (entity->m_Type != ENTITY_PLAYER) + if (entity->m_Type() != ENTITY_PLAYER) return false; - auto min = hacks::shared::backtrack::headPositions - [entity->m_IDX][hacks::shared::backtrack::BestTick] - .min; - auto max = hacks::shared::backtrack::headPositions - [entity->m_IDX][hacks::shared::backtrack::BestTick] - .max; + int tick = hacks::shared::backtrack::Besttick(entity); + auto min = hacks::shared::backtrack::headPositions[entity->m_IDX][tick].min; + auto max = hacks::shared::backtrack::headPositions[entity->m_IDX][tick].max; if (!min.x && !max.x) return false; @@ -117,15 +114,11 @@ bool CanBacktrack(CachedEntity *entity) if (!IsVectorVisible(g_pLocalPlayer->v_Eye, minz) && !IsVectorVisible(g_pLocalPlayer->v_Eye, maxz)) - { return false; - } if (CheckLineBox(minz, maxz, g_pLocalPlayer->v_Eye, forward, hit)) { - g_pUserCmd->tick_count = - hacks::shared::backtrack::headPositions - [entity->m_IDX][hacks::shared::backtrack::BestTick] - .tickcount; + hacks::shared::backtrack::dontbacktrack = true; + hacks::shared::backtrack::Backtrack(entity, tick); return true; } return false; @@ -273,7 +266,7 @@ bool IsTargetStateGood(CachedEntity *entity) { // Check for Players - if (entity->m_Type == ENTITY_PLAYER) + if (entity->m_Type() == ENTITY_PLAYER) { // Check if target is The local player if (entity == LOCAL_E) @@ -384,7 +377,7 @@ bool IsTargetStateGood(CachedEntity *entity) // Check for buildings } - else if (entity->m_Type == ENTITY_BUILDING) + else if (entity->m_Type() == ENTITY_BUILDING) { // Check if building aimbot is enabled if (!(buildings_other || buildings_sentry)) @@ -640,7 +633,8 @@ float EffectiveTargetingRange() return re::C_TFWeaponBaseMelee::GetSwingRange(LOCAL_W); // Pyros only have so much untill their flames hit } - else if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFFlameThrower)) + else if (g_pLocalPlayer->weapon()->m_iClassID() == + CL_CLASS(CTFFlameThrower)) { return 185.0f; } diff --git a/src/helpers.cpp b/src/helpers.cpp index 4222bd0e..d0af3f05 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -149,11 +149,12 @@ const char *GetBuildingName(CachedEntity *ent) { if (!ent) return "[NULL]"; - if (ent->m_iClassID() == CL_CLASS(CObjectSentrygun)) + int classid = ent->m_iClassID(); + if (classid == CL_CLASS(CObjectSentrygun)) return "Sentry"; - if (ent->m_iClassID() == CL_CLASS(CObjectDispenser)) + if (classid == CL_CLASS(CObjectDispenser)) return "Dispenser"; - if (ent->m_iClassID() == CL_CLASS(CObjectTeleporter)) + if (classid == CL_CLASS(CObjectTeleporter)) return "Teleporter"; return "[NULL]"; } @@ -513,11 +514,12 @@ Vector GetBuildingPosition(CachedEntity *ent) { Vector res; res = ent->m_vecOrigin(); - if (ent->m_iClassID() == CL_CLASS(CObjectDispenser)) + int classid = ent->m_iClassID(); + if (classid == CL_CLASS(CObjectDispenser)) res.z += 30; - if (ent->m_iClassID() == CL_CLASS(CObjectTeleporter)) + if (classid == CL_CLASS(CObjectTeleporter)) res.z += 8; - if (ent->m_iClassID() == CL_CLASS(CObjectSentrygun)) + if (classid == CL_CLASS(CObjectSentrygun)) { switch (CE_INT(ent, netvar.iUpgradeLevel)) { @@ -574,7 +576,7 @@ void Patch(void *address, void *patch, size_t length) bool IsProjectileCrit(CachedEntity *ent) { - if (ent->m_bGrenadeProjectile) + if (ent->m_bGrenadeProjectile()) return CE_BYTE(ent, netvar.Grenade_bCritical); return CE_BYTE(ent, netvar.Rocket_bCritical); } @@ -595,6 +597,7 @@ weaponmode GetWeaponMode() weapon = (ENTITY(weapon_handle & 0xFFF)); if (CE_BAD(weapon)) return weaponmode::weapon_invalid; + int classid = weapon->m_iClassID(); slot = re::C_BaseCombatWeapon::GetSlot(RAW_ENT(weapon)); if (slot == 2) return weaponmode::weapon_melee; @@ -602,34 +605,34 @@ weaponmode GetWeaponMode() { return weaponmode::weapon_pda; } - else if (weapon->m_iClassID() == CL_CLASS(CTFLunchBox) || - weapon->m_iClassID() == CL_CLASS(CTFLunchBox_Drink) || - weapon->m_iClassID() == CL_CLASS(CTFBuffItem)) + else if (classid == CL_CLASS(CTFLunchBox) || + classid == CL_CLASS(CTFLunchBox_Drink) || + classid == CL_CLASS(CTFBuffItem)) { return weaponmode::weapon_consumable; } - else if (weapon->m_iClassID() == CL_CLASS(CTFRocketLauncher_DirectHit) || - weapon->m_iClassID() == CL_CLASS(CTFRocketLauncher) || - weapon->m_iClassID() == CL_CLASS(CTFGrenadeLauncher) || - weapon->m_iClassID() == CL_CLASS(CTFPipebombLauncher) || - weapon->m_iClassID() == CL_CLASS(CTFCompoundBow) || - weapon->m_iClassID() == CL_CLASS(CTFBat_Wood) || - weapon->m_iClassID() == CL_CLASS(CTFBat_Giftwrap) || - weapon->m_iClassID() == CL_CLASS(CTFFlareGun) || - weapon->m_iClassID() == CL_CLASS(CTFFlareGun_Revenge) || - weapon->m_iClassID() == CL_CLASS(CTFSyringeGun) || - weapon->m_iClassID() == CL_CLASS(CTFCrossbow) || - weapon->m_iClassID() == CL_CLASS(CTFShotgunBuildingRescue) || - weapon->m_iClassID() == CL_CLASS(CTFDRGPomson)) + else if (classid == CL_CLASS(CTFRocketLauncher_DirectHit) || + classid == CL_CLASS(CTFRocketLauncher) || + classid == CL_CLASS(CTFGrenadeLauncher) || + classid == CL_CLASS(CTFPipebombLauncher) || + classid == CL_CLASS(CTFCompoundBow) || + classid == CL_CLASS(CTFBat_Wood) || + classid == CL_CLASS(CTFBat_Giftwrap) || + classid == CL_CLASS(CTFFlareGun) || + classid == CL_CLASS(CTFFlareGun_Revenge) || + classid == CL_CLASS(CTFSyringeGun) || + classid == CL_CLASS(CTFCrossbow) || + classid == CL_CLASS(CTFShotgunBuildingRescue) || + classid == CL_CLASS(CTFDRGPomson)) { return weaponmode::weapon_projectile; } - else if (weapon->m_iClassID() == CL_CLASS(CTFJar) || - weapon->m_iClassID() == CL_CLASS(CTFJarMilk)) + else if (classid == CL_CLASS(CTFJar) || + classid == CL_CLASS(CTFJarMilk)) { return weaponmode::weapon_throwable; } - else if (weapon->m_iClassID() == CL_CLASS(CWeaponMedigun)) + else if (classid == CL_CLASS(CWeaponMedigun)) { return weaponmode::weapon_medigun; } @@ -667,15 +670,16 @@ bool GetProjectileData(CachedEntity *weapon, float &speed, float &gravity) rgrav = 0.0f; typedef float(GetProjectileData)(IClientEntity *); - if (weapon->m_iClassID() == CL_CLASS(CTFRocketLauncher_DirectHit)) + int classid = weapon->m_iClassID(); + if (classid == CL_CLASS(CTFRocketLauncher_DirectHit)) { rspeed = 1980.0f; } - else if (weapon->m_iClassID() == CL_CLASS(CTFRocketLauncher)) + else if (classid == CL_CLASS(CTFRocketLauncher)) { rspeed = 1100.0f; } - else if (weapon->m_iClassID() == CL_CLASS(CTFGrenadeLauncher)) + else if (classid == CL_CLASS(CTFGrenadeLauncher)) { IF_GAME(IsTF2()) { @@ -688,7 +692,7 @@ bool GetProjectileData(CachedEntity *weapon, float &speed, float &gravity) rgrav = 0.5f; } } - else if (weapon->m_iClassID() == CL_CLASS(CTFCompoundBow)) + else if (classid == CL_CLASS(CTFCompoundBow)) { float chargetime = g_GlobalVars->curtime - CE_FLOAT(weapon, netvar.flChargeBeginTime); @@ -698,36 +702,36 @@ bool GetProjectileData(CachedEntity *weapon, float &speed, float &gravity) -0.40000001) + 0.5); } - else if (weapon->m_iClassID() == CL_CLASS(CTFBat_Wood)) + else if (classid == CL_CLASS(CTFBat_Wood)) { rspeed = 3000.0f; rgrav = 0.5f; } - else if (weapon->m_iClassID() == CL_CLASS(CTFFlareGun)) + else if (classid == CL_CLASS(CTFFlareGun)) { rspeed = 2000.0f; rgrav = 0.25f; } - else if (weapon->m_iClassID() == CL_CLASS(CTFSyringeGun)) + else if (classid == CL_CLASS(CTFSyringeGun)) { rgrav = 0.2f; rspeed = 990.0f; } - else if (weapon->m_iClassID() == CL_CLASS(CTFCrossbow)) + else if (classid == CL_CLASS(CTFCrossbow)) { rgrav = 0.2f; rspeed = 2400.0f; } - else if (weapon->m_iClassID() == CL_CLASS(CTFShotgunBuildingRescue)) + else if (classid == CL_CLASS(CTFShotgunBuildingRescue)) { rgrav = 0.2f; rspeed = 2400.0f; } - else if (weapon->m_iClassID() == CL_CLASS(CTFDRGPomson)) + else if (classid == CL_CLASS(CTFDRGPomson)) { rspeed = 1200.0f; } - else if (weapon->m_iClassID() == CL_CLASS(CTFWeaponFlameBall)) + else if (classid == CL_CLASS(CTFWeaponFlameBall)) { // ?? rspeed = 2500.0f; @@ -816,7 +820,7 @@ void WhatIAmLookingAt(int *result_eindex, Vector *result_pos) bool IsSentryBuster(CachedEntity *entity) { - return (entity->m_Type == EntityType::ENTITY_PLAYER && + return (entity->m_Type() == EntityType::ENTITY_PLAYER && CE_INT(entity, netvar.iClass) == tf_class::tf_demoman && g_pPlayerResource->GetMaxHealth(entity) == 2500); } diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index a85012fa..488b1608 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -524,9 +524,8 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, ch->SendNetMsg(senddata); ch->Transmit(); } - if (serverlag_amount || - (votelogger::active && - !votelogger::antikick.test_and_set(antikick_time * 1000))) + if (serverlag_amount || (votelogger::active && + !votelogger::antikick.check(antikick_time * 1000))) { if (adjust && !votelogger::active) { @@ -546,7 +545,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, } } else if (votelogger::active && - !votelogger::antikick.test_and_set(antikick_time * 1000)) + !votelogger::antikick.check(antikick_time * 1000)) { static int additionallag = 1; if (ch->GetAvgData(FLOW_INCOMING) == prevflow) diff --git a/src/hooks/GetFriendPersonaName.cpp b/src/hooks/GetFriendPersonaName.cpp index 7f11a376..7a9d9fea 100644 --- a/src/hooks/GetFriendPersonaName.cpp +++ b/src/hooks/GetFriendPersonaName.cpp @@ -37,7 +37,7 @@ bool StolenName() continue; if (ent == LOCAL_E) continue; - if (!ent->m_Type == ENTITY_PLAYER) + if (!ent->m_Type() == ENTITY_PLAYER) continue; if (ent->m_bEnemy()) continue; diff --git a/src/prediction.cpp b/src/prediction.cpp index 785db734..0d86afe7 100644 --- a/src/prediction.cpp +++ b/src/prediction.cpp @@ -67,7 +67,7 @@ void Prediction_CreateMove() predicted_players[i].clear(); for (int j = 0; j < 20; j++) { - Vector r = EnginePrediction(ent, 0.05f); + Vector r = EnginePrediction(ent, 0.05f); ent->m_vecOrigin() = r; predicted_players[i].push_back(std::move(r)); } @@ -216,7 +216,7 @@ Vector ProjectilePrediction_Engine(CachedEntity *ent, int hb, float speed, Vector current = origin; int maxsteps = 40; bool onground = false; - if (ent->m_Type == ENTITY_PLAYER) + if (ent->m_Type() == ENTITY_PLAYER) { if (CE_INT(ent, netvar.iFlags) & FL_ONGROUND) onground = true; @@ -225,7 +225,7 @@ Vector ProjectilePrediction_Engine(CachedEntity *ent, int hb, float speed, for (int steps = 0; steps < maxsteps; steps++, currenttime += steplength) { ent->m_vecOrigin() = current; - current = EnginePrediction(ent, steplength); + current = EnginePrediction(ent, steplength); if (onground) { @@ -326,16 +326,16 @@ Vector ProjectilePrediction(CachedEntity *ent, int hb, float speed, float DistanceToGround(CachedEntity *ent) { - if (ent->m_Type == ENTITY_PLAYER) + if (ent->m_Type() == ENTITY_PLAYER) { if (CE_INT(ent, netvar.iFlags) & FL_ONGROUND) return 0; } Vector origin = ent->m_vecOrigin(); - float v1 = DistanceToGround(origin + Vector(10.0f, 10.0f, 0.0f)); - float v2 = DistanceToGround(origin + Vector(-10.0f, 10.0f, 0.0f)); - float v3 = DistanceToGround(origin + Vector(10.0f, -10.0f, 0.0f)); - float v4 = DistanceToGround(origin + Vector(-10.0f, -10.0f, 0.0f)); + float v1 = DistanceToGround(origin + Vector(10.0f, 10.0f, 0.0f)); + float v2 = DistanceToGround(origin + Vector(-10.0f, 10.0f, 0.0f)); + float v3 = DistanceToGround(origin + Vector(10.0f, -10.0f, 0.0f)); + float v4 = DistanceToGround(origin + Vector(-10.0f, -10.0f, 0.0f)); return MIN(v1, MIN(v2, MIN(v3, v4))); } diff --git a/src/projlogging.cpp b/src/projlogging.cpp index 52b26837..d66c1acf 100755 --- a/src/projlogging.cpp +++ b/src/projlogging.cpp @@ -18,7 +18,7 @@ void Update() CachedEntity *ent = ENTITY(i); if (CE_BAD(ent)) continue; - if (ent->m_Type == ENTITY_PROJECTILE) + if (ent->m_Type() == ENTITY_PROJECTILE) { int owner = CE_INT(ent, 0x894) & 0xFFF; if (owner != LOCAL_W->m_IDX) diff --git a/src/targethelper.cpp b/src/targethelper.cpp old mode 100755 new mode 100644 index ca5dc7a4..55d8ae6c --- a/src/targethelper.cpp +++ b/src/targethelper.cpp @@ -23,7 +23,7 @@ int GetScoreForEntity(CachedEntity *entity) if (!entity) return 0; // TODO - if (entity->m_Type == ENTITY_BUILDING) + if (entity->m_Type() == ENTITY_BUILDING) { if (entity->m_iClassID() == CL_CLASS(CObjectSentrygun)) { @@ -31,14 +31,15 @@ int GetScoreForEntity(CachedEntity *entity) } return 0; } - int clazz = CE_INT(entity, netvar.iClass); - int health = CE_INT(entity, netvar.iHealth); - float distance = (g_pLocalPlayer->v_Origin - entity->m_vecOrigin()).Length(); - bool zoomed = HasCondition(entity); - bool pbullet = HasCondition(entity); - bool special = false; - bool kritz = IsPlayerCritBoosted(entity); - int total = 0; + int clazz = CE_INT(entity, netvar.iClass); + int health = CE_INT(entity, netvar.iHealth); + float distance = + (g_pLocalPlayer->v_Origin - entity->m_vecOrigin()).Length(); + bool zoomed = HasCondition(entity); + bool pbullet = HasCondition(entity); + bool special = false; + bool kritz = IsPlayerCritBoosted(entity); + int total = 0; switch (clazz) { case tf_sniper: diff --git a/src/visual/EffectChams.cpp b/src/visual/EffectChams.cpp index 674a7048..ee303a32 100644 --- a/src/visual/EffectChams.cpp +++ b/src/visual/EffectChams.cpp @@ -126,7 +126,7 @@ rgba_t EffectChams::ChamsColor(IClientEntity *entity) return ChamsColor(owner); } } - switch (ent->m_Type) + switch (ent->m_Type()) { case ENTITY_BUILDING: if (!ent->m_bEnemy() && !(teammates || teammate_buildings) && @@ -169,7 +169,7 @@ bool EffectChams::ShouldRenderChams(IClientEntity *entity) return false; if (ent->m_IDX == LOCAL_E->m_IDX && !chamsself) return false; - switch (ent->m_Type) + switch (ent->m_Type()) { case ENTITY_BUILDING: if (!buildings) @@ -201,7 +201,7 @@ bool EffectChams::ShouldRenderChams(IClientEntity *entity) } break; case ENTITY_GENERIC: - switch (ent->m_ItemType) + switch (ent->m_ItemType()) { case ITEM_HEALTH_LARGE: case ITEM_HEALTH_MEDIUM: diff --git a/src/visual/EffectGlow.cpp b/src/visual/EffectGlow.cpp index 296ff87d..182c6398 100644 --- a/src/visual/EffectGlow.cpp +++ b/src/visual/EffectGlow.cpp @@ -244,7 +244,7 @@ rgba_t EffectGlow::GlowColor(IClientEntity *entity) return GlowColor(owner); } } - switch (ent->m_Type) + switch (ent->m_Type()) { case ENTITY_BUILDING: if (health) @@ -283,7 +283,7 @@ bool EffectGlow::ShouldRenderGlow(IClientEntity *entity) return false; if (ent->m_IDX == LOCAL_E->m_IDX && !glowself) return false; - switch (ent->m_Type) + switch (ent->m_Type()) { case ENTITY_BUILDING: if (!buildings) @@ -310,7 +310,7 @@ bool EffectGlow::ShouldRenderGlow(IClientEntity *entity) } break; case ENTITY_GENERIC: - const auto &type = ent->m_ItemType; + const auto &type = ent->m_ItemType(); if (type >= ITEM_HEALTH_SMALL && type <= ITEM_HEALTH_LARGE) { return medkits; diff --git a/src/visual/colors.cpp b/src/visual/colors.cpp index ecdae731..ea4a2555 100644 --- a/src/visual/colors.cpp +++ b/src/visual/colors.cpp @@ -30,7 +30,7 @@ rgba_t colors::EntityF(CachedEntity *ent) using namespace colors; result = white; - type = ent->m_ItemType; + type = ent->m_ItemType(); if (type) { if ((type >= ITEM_HEALTH_SMALL && type <= ITEM_HEALTH_LARGE) || @@ -71,7 +71,7 @@ rgba_t colors::EntityF(CachedEntity *ent) result = green; } - if (ent->m_Type == ENTITY_PROJECTILE) + if (ent->m_Type() == ENTITY_PROJECTILE) { if (ent->m_iTeam() == TEAM_BLU) result = blu; @@ -86,7 +86,7 @@ rgba_t colors::EntityF(CachedEntity *ent) } } - if (ent->m_Type == ENTITY_PLAYER || ent->m_Type == ENTITY_BUILDING) + if (ent->m_Type() == ENTITY_PLAYER || ent->m_Type() == ENTITY_BUILDING) { if (ent->m_iTeam() == TEAM_BLU) result = blu; @@ -114,7 +114,7 @@ rgba_t colors::EntityF(CachedEntity *ent) break; } } - if (ent->m_Type == ENTITY_PLAYER) + if (ent->m_Type() == ENTITY_PLAYER) { if (IsPlayerInvulnerable(ent)) {