Start Converting CreateMove's

This commit is contained in:
LightCat 2018-09-15 16:52:09 +02:00
parent d4bc116a57
commit 86f854dac6
15 changed files with 974 additions and 986 deletions

View File

@ -9,7 +9,6 @@
#include "common.hpp" #include "common.hpp"
namespace hacks::shared::autojoin namespace hacks::shared::autojoin
{ {
void update();
void updateSearch(); void updateSearch();
void onShutdown(); void onShutdown();
} // namespace hacks::shared::autojoin } // namespace hacks::shared::autojoin

View File

@ -38,7 +38,6 @@ public:
void Init(); void Init();
extern std::array<ESPData, 2048> data; extern std::array<ESPData, 2048> data;
void CreateMove();
void Draw(); void Draw();
// Entity Processing // Entity Processing

View File

@ -11,7 +11,6 @@ namespace hacks::shared::followbot
{ {
void DrawTick(); void DrawTick();
void WorldTick();
int ClassPriority(CachedEntity *ent); int ClassPriority(CachedEntity *ent);
bool isEnabled(); bool isEnabled();

View File

@ -9,5 +9,4 @@ namespace hacks::tf2::NavBot
{ {
void Init(); void Init();
void initonce(); void initonce();
void CreateMove();
} // namespace hacks::tf2::NavBot } // namespace hacks::tf2::NavBot

View File

@ -16,6 +16,5 @@ void Initialize();
#if ENABLE_VISUALS #if ENABLE_VISUALS
void Draw(); void Draw();
#endif #endif
void Move();
void OnLevelInit(); void OnLevelInit();
} // namespace hacks::shared::walkbot } // namespace hacks::shared::walkbot

View File

@ -9,5 +9,4 @@
class CachedEntity; class CachedEntity;
void UpdateHoovyList();
bool IsHoovy(CachedEntity *entity); bool IsHoovy(CachedEntity *entity);

View File

@ -22,7 +22,6 @@ bool NavTo(Vector dest, bool navToLocalCenter = true, bool persistent = true,
void clearInstructions(); void clearInstructions();
int findClosestNavSquare(Vector vec); int findClosestNavSquare(Vector vec);
bool Prepare(); bool Prepare();
void CreateMove();
void Draw(); void Draw();
int FindInVector(size_t id); int FindInVector(size_t id);

View File

@ -6,6 +6,7 @@
*/ */
#include <settings/Int.hpp> #include <settings/Int.hpp>
#include "HookTools.hpp"
#include <hacks/AutoJoin.hpp> #include <hacks/AutoJoin.hpp>
#include "common.hpp" #include "common.hpp"
@ -157,9 +158,8 @@ void updateSearch()
} }
#endif #endif
} }
static HookedFunction
void update() update(HookedFunctions_types::HF_CreateMove, "Autojoin", 1, []() {
{
#if !LAGBOT_MODE #if !LAGBOT_MODE
if (autoteam_timer.test_and_set(500)) if (autoteam_timer.test_and_set(500))
{ {
@ -171,12 +171,13 @@ void update()
{ {
if (int(autojoin_class) < 10) if (int(autojoin_class) < 10)
g_IEngine->ExecuteClientCmd( g_IEngine->ExecuteClientCmd(
format("join_class ", classnames[int(autojoin_class) - 1]) format("join_class ",
classnames[int(autojoin_class) - 1])
.c_str()); .c_str());
} }
} }
#endif #endif
} });
void onShutdown() void onShutdown()
{ {

View File

@ -247,22 +247,24 @@ void Draw()
} }
// Function called on create move // Function called on create move
void CreateMove() static HookedFunction
{ CreateMove(HookedFunctions_types::HF_CreateMove, "ESP", 18, []() {
// Check usersettings if enabled // Check usersettings if enabled
if (!*enable) if (!*enable)
return; return;
if (CE_BAD(LOCAL_E))
return;
// Something // Something
std::lock_guard<std::mutex> esp_lock(threadsafe_mutex); std::lock_guard<std::mutex> esp_lock(threadsafe_mutex);
ResetEntityStrings(); // Clear any strings entities have ResetEntityStrings(); // Clear any strings entities have
entities_need_repaint.clear(); // Clear data on entities that need redraw entities_need_repaint
.clear(); // Clear data on entities that need redraw
int max_clients = g_IEngine->GetMaxClients(); int max_clients = g_IEngine->GetMaxClients();
int limit = HIGHEST_ENTITY; int limit = HIGHEST_ENTITY;
// If not using any other special esp, we lower the min to the max clients // If not using any other special esp, we lower the min to the max
// clients
if (!buildings && !proj_esp && !item_esp) if (!buildings && !proj_esp && !item_esp)
limit = std::min(max_clients, HIGHEST_ENTITY); limit = std::min(max_clients, HIGHEST_ENTITY);
@ -290,8 +292,8 @@ void CreateMove()
if (show_distance) if (show_distance)
{ {
AddEntityString( AddEntityString(
ent, ent, format((int) (ENTITY(i)->m_flDistance() / 64 *
format((int) (ENTITY(i)->m_flDistance() / 64 * 1.22f), 1.22f),
'm')); 'm'));
} }
} }
@ -304,7 +306,7 @@ void CreateMove()
} }
} }
} }
} });
static glez::texture atlas{ DATA_PATH "/textures/atlas.png" }; static glez::texture atlas{ DATA_PATH "/textures/atlas.png" };
static glez::texture idspec{ DATA_PATH "/textures/idspec.png" }; static glez::texture idspec{ DATA_PATH "/textures/idspec.png" };

View File

@ -168,8 +168,9 @@ int ClassPriority(CachedEntity *ent)
} }
Timer waittime{}; Timer waittime{};
int lastent = 0; int lastent = 0;
void WorldTick() #if ENABLE_IPC
{ static HookedFunction
WorldTick(HookedFunctions_types::HF_CreateMove, "followbot", 20, []() {
if (!enable) if (!enable)
{ {
follow_target = 0; follow_target = 0;
@ -222,8 +223,8 @@ void WorldTick()
continue; continue;
if (corneractivate) if (corneractivate)
{ {
Vector indirectOrigin = Vector indirectOrigin = VischeckCorner(
VischeckCorner(LOCAL_E, entity, *follow_activation / 2, LOCAL_E, entity, *follow_activation / 2,
true); // get the corner location that the true); // get the corner location that the
// future target is visible from // future target is visible from
std::pair<Vector, Vector> corners; std::pair<Vector, Vector> corners;
@ -231,7 +232,8 @@ void WorldTick()
entity->m_IDX == lastent) // if we couldn't find it, run entity->m_IDX == lastent) // if we couldn't find it, run
// wallcheck instead // wallcheck instead
{ {
corners = VischeckWall(LOCAL_E, entity, corners =
VischeckWall(LOCAL_E, entity,
float(follow_activation) / 2, true); float(follow_activation) / 2, true);
if (!corners.first.z || !corners.second.z) if (!corners.first.z || !corners.second.z)
continue; continue;
@ -276,8 +278,8 @@ void WorldTick()
if (entity->m_bEnemy()) if (entity->m_bEnemy())
continue; continue;
if (afk && if (afk &&
afkTicks[i].check(int( afkTicks[i].check(int(afktime))) // don't follow target that
afktime))) // don't follow target that was determined afk // was determined afk
continue; continue;
if (IsPlayerDisguised(entity) || IsPlayerInvisible(entity)) if (IsPlayerDisguised(entity) || IsPlayerInvisible(entity))
continue; continue;
@ -313,8 +315,8 @@ void WorldTick()
if (corneractivate) if (corneractivate)
{ {
Vector indirectOrigin = Vector indirectOrigin = VischeckCorner(
VischeckCorner(LOCAL_E, entity, 250, LOCAL_E, entity, 250,
true); // get the corner location that the true); // get the corner location that the
// future target is visible from // future target is visible from
std::pair<Vector, Vector> corners; std::pair<Vector, Vector> corners;
@ -397,8 +399,8 @@ void WorldTick()
DistanceToGround(ENTITY(follow_target)) < 45) DistanceToGround(ENTITY(follow_target)) < 45)
breadcrumbs.push_back(tar_orig); breadcrumbs.push_back(tar_orig);
// Prune old and close crumbs that we wont need anymore, update idle timer // Prune old and close crumbs that we wont need anymore, update idle
// too // timer too
for (int i = 0; i < breadcrumbs.size(); i++) for (int i = 0; i < breadcrumbs.size(); i++)
{ {
if (loc_orig.DistTo(breadcrumbs.at(i)) < 60.f) if (loc_orig.DistTo(breadcrumbs.at(i)) < 60.f)
@ -430,7 +432,8 @@ void WorldTick()
} }
// Check if still moving. 70 HU = Sniper Zoomed Speed // Check if still moving. 70 HU = Sniper Zoomed Speed
if (idle_time.check(3000) && if (idle_time.check(3000) &&
CE_VECTOR(g_pLocalPlayer->entity, netvar.vVelocity).IsZero(60.0f)) CE_VECTOR(g_pLocalPlayer->entity, netvar.vVelocity)
.IsZero(60.0f))
{ {
follow_target = 0; follow_target = 0;
return; return;
@ -456,7 +459,8 @@ void WorldTick()
// Get the follow targets active weapon // Get the follow targets active weapon
int owner_weapon_eid = int owner_weapon_eid =
(CE_INT(ENTITY(follow_target), netvar.hActiveWeapon) & 0xFFF); (CE_INT(ENTITY(follow_target), netvar.hActiveWeapon) &
0xFFF);
IClientEntity *owner_weapon = IClientEntity *owner_weapon =
g_IEntityList->GetClientEntity(owner_weapon_eid); g_IEntityList->GetClientEntity(owner_weapon_eid);
@ -469,7 +473,8 @@ void WorldTick()
// IsBaseCombatWeapon() // IsBaseCombatWeapon()
if (re::C_BaseCombatWeapon::IsBaseCombatWeapon( if (re::C_BaseCombatWeapon::IsBaseCombatWeapon(
RAW_ENT(g_pLocalPlayer->weapon())) && RAW_ENT(g_pLocalPlayer->weapon())) &&
re::C_BaseCombatWeapon::IsBaseCombatWeapon(owner_weapon)) re::C_BaseCombatWeapon::IsBaseCombatWeapon(
owner_weapon))
{ {
// Get the players slot numbers and store in some vars // Get the players slot numbers and store in some vars
@ -478,9 +483,8 @@ void WorldTick()
int owner_slot = int owner_slot =
re::C_BaseCombatWeapon::GetSlot(owner_weapon); re::C_BaseCombatWeapon::GetSlot(owner_weapon);
// If the local player is a medic and user settings allow, // If the local player is a medic and user settings
// then // allow, then keep the medigun out
// keep the medigun out
if (g_pLocalPlayer->clazz == tf_medic && always_medigun) if (g_pLocalPlayer->clazz == tf_medic && always_medigun)
{ {
if (my_slot != 1) if (my_slot != 1)
@ -488,9 +492,8 @@ void WorldTick()
g_IEngine->ExecuteClientCmd("slot2"); g_IEngine->ExecuteClientCmd("slot2");
} }
// Else we attemt to keep our weapon mimiced with our // Else we attemt to keep our weapon mimiced with
// follow // our follow target
// target
} }
else else
{ {
@ -507,8 +510,8 @@ void WorldTick()
} }
else else
idle_time.update(); idle_time.update();
} });
#endif
void DrawTick() void DrawTick()
{ {
#if ENABLE_VISUALS #if ENABLE_VISUALS

View File

@ -436,9 +436,10 @@ CatCommand debug_tele("navbot_debug", "debug", []() {
CE_FLOAT(ent, netvar.m_flTeleYawToExit), g_GlobalVars->curtime, CE_FLOAT(ent, netvar.m_flTeleYawToExit), g_GlobalVars->curtime,
g_GlobalVars->curtime * g_GlobalVars->interval_per_tick); g_GlobalVars->curtime * g_GlobalVars->interval_per_tick);
}); });
int follow_target = 0; int follow_target = 0;
void CreateMove() static HookedFunction
{ CreateMove(HookedFunctions_types::HF_CreateMove, "NavBot", 16, []() {
if ((!enable && !enable_fb) || !nav::Prepare()) if ((!enable && !enable_fb) || !nav::Prepare())
return; return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer()) if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
@ -471,7 +472,8 @@ void CreateMove()
if ((!HasLowHealth() && nav::priority == 7) || if ((!HasLowHealth() && nav::priority == 7) ||
(!HasLowAmmo() && nav::priority == 6)) (!HasLowAmmo() && nav::priority == 6))
nav::clearInstructions(); nav::clearInstructions();
static int waittime = (spy_mode || heavy_mode || engi_mode) ? 100 : 2000; static int waittime =
(spy_mode || heavy_mode || engi_mode) ? 100 : 2000;
if (*take_tele) if (*take_tele)
{ {
int idx = GetClosestTeleporter(); int idx = GetClosestTeleporter();
@ -493,7 +495,8 @@ void CreateMove()
} }
if (enable) if (enable)
{ {
if (!nav::ReadyForCommands && !spy_mode && !heavy_mode && !engi_mode) if (!nav::ReadyForCommands && !spy_mode && !heavy_mode &&
!engi_mode)
cd3.update(); cd3.update();
if (target_sentry && NavToSentry(3)) if (target_sentry && NavToSentry(3))
return; return;
@ -533,10 +536,11 @@ void CreateMove()
{ {
int bestscr = INT_MAX; int bestscr = INT_MAX;
hacks::shared::backtrack::BacktrackData besttick{}; hacks::shared::backtrack::BacktrackData besttick{};
for (auto i : hacks::shared::backtrack::headPositions for (auto i : hacks::shared::backtrack::
[tar->m_IDX]) headPositions[tar->m_IDX])
{ {
if (!hacks::shared::backtrack::ValidTick(i, tar)) if (!hacks::shared::backtrack::ValidTick(i,
tar))
{ {
int scr = i.tickcount; int scr = i.tickcount;
if (scr < bestscr) if (scr < bestscr)
@ -562,7 +566,8 @@ void CreateMove()
// If No spots set just return // If No spots set just return
if (nest_spots.empty()) if (nest_spots.empty())
return; return;
// Get Metal (offset of MAX metal is +8 and current metal +12) // Get Metal (offset of MAX metal is +8 and current metal
// +12)
int metal = CE_INT(LOCAL_E, netvar.m_iAmmo + 12); int metal = CE_INT(LOCAL_E, netvar.m_iAmmo + 12);
// Best spot storage // Best spot storage
static Vector best_spot{}; static Vector best_spot{};
@ -599,7 +604,8 @@ void CreateMove()
{ {
CachedEntity *ent = ENTITY(ClosestBuilding); CachedEntity *ent = ENTITY(ClosestBuilding);
// If we have more than 25 metal and the building is // If we have more than 25 metal and the building is
// damaged or not fully upgraded hit it with the wrench // damaged or not fully upgraded hit it with the
// wrench
if (metal > 25 && if (metal > 25 &&
(CE_INT(ent, netvar.iUpgradeLevel) < 3 || (CE_INT(ent, netvar.iUpgradeLevel) < 3 ||
CE_INT(ent, netvar.iBuildingHealth) < CE_INT(ent, netvar.iBuildingHealth) <
@ -622,9 +628,12 @@ void CreateMove()
re::C_TFWeaponBaseMelee::GetSwingRange( re::C_TFWeaponBaseMelee::GetSwingRange(
RAW_ENT(LOCAL_W))) RAW_ENT(LOCAL_W)))
{ {
float minf = min.DistTo(g_pLocalPlayer->v_Eye); float minf =
float maxf = max.DistTo(g_pLocalPlayer->v_Eye); min.DistTo(g_pLocalPlayer->v_Eye);
float center = GetBuildingPosition(ent).DistTo( float maxf =
max.DistTo(g_pLocalPlayer->v_Eye);
float center =
GetBuildingPosition(ent).DistTo(
g_pLocalPlayer->v_Eye); g_pLocalPlayer->v_Eye);
float closest = float closest =
fminf(minf, fminf(maxf, center)); fminf(minf, fminf(maxf, center));
@ -660,7 +669,8 @@ void CreateMove()
return; return;
} }
// Ammo is dormant, go and find it! // Ammo is dormant, go and find it!
else if (sniper_spots.size() && nav::ReadyForCommands) else if (sniper_spots.size() &&
nav::ReadyForCommands)
{ {
if (cd2.test_and_set(5000)) if (cd2.test_and_set(5000))
Init(); Init();
@ -675,10 +685,11 @@ void CreateMove()
// Make ENgi look slightly down // Make ENgi look slightly down
current_user_cmd->viewangles.x = 20.0f; current_user_cmd->viewangles.x = 20.0f;
// Build buildings in a 360° angle around player // Build buildings in a 360° angle around player
current_user_cmd->viewangles.y = 90.0f * (tobuild + 1); current_user_cmd->viewangles.y =
90.0f * (tobuild + 1);
// Build new one // Build new one
g_IEngine->ServerCmd(format("build ", tobuild).c_str(), g_IEngine->ServerCmd(
true); format("build ", tobuild).c_str(), true);
current_user_cmd->buttons |= IN_ATTACK; current_user_cmd->buttons |= IN_ATTACK;
g_pLocalPlayer->bUseSilentAngles = true; g_pLocalPlayer->bUseSilentAngles = true;
} }
@ -724,7 +735,8 @@ void CreateMove()
break; break;
if (entity->m_Type() != ENTITY_PLAYER) if (entity->m_Type() != ENTITY_PLAYER)
continue; continue;
if (steamid != entity->player_info.friendsID) // steamid check if (steamid !=
entity->player_info.friendsID) // steamid check
continue; continue;
if (!entity->m_bAlivePlayer()) // Dont follow dead players if (!entity->m_bAlivePlayer()) // Dont follow dead players
@ -733,11 +745,11 @@ void CreateMove()
break; break;
} }
} }
// If we dont have a follow target from that, we look again for someone // If we dont have a follow target from that, we look again for
// else who is suitable // someone else who is suitable
if ((!follow_target || change_tar || if ((!follow_target || change_tar ||
(hacks::shared::followbot::ClassPriority(ENTITY(follow_target)) < (hacks::shared::followbot::ClassPriority(
6 && ENTITY(follow_target)) < 6 &&
ENTITY(follow_target)->player_info.friendsID != steamid)) && ENTITY(follow_target)->player_info.friendsID != steamid)) &&
roambot) roambot)
{ {
@ -754,8 +766,8 @@ void CreateMove()
continue; continue;
if (entity->m_bEnemy()) if (entity->m_bEnemy())
continue; continue;
if (afk && if (afk && afkTicks[i].check(
afkTicks[i].check(int(afktime))) // don't follow target that int(afktime))) // don't follow target that
// was determined afk // was determined afk
continue; continue;
if (IsPlayerDisguised(entity) || IsPlayerInvisible(entity)) if (IsPlayerDisguised(entity) || IsPlayerInvisible(entity))
@ -785,7 +797,8 @@ void CreateMove()
ENTITY(follow_target)->m_flDistance() < ENTITY(follow_target)->m_flDistance() <
entity->m_flDistance()) // favor closer entitys entity->m_flDistance()) // favor closer entitys
continue; continue;
// check if new target has a higher priority than current target // check if new target has a higher priority than current
// target
if (hacks::shared::followbot::ClassPriority( if (hacks::shared::followbot::ClassPriority(
ENTITY(follow_target)) >= ENTITY(follow_target)) >=
hacks::shared::followbot::ClassPriority(ENTITY(i))) hacks::shared::followbot::ClassPriority(ENTITY(i)))
@ -853,7 +866,8 @@ void CreateMove()
} }
// Check if still moving. 70 HU = Sniper Zoomed Speed // Check if still moving. 70 HU = Sniper Zoomed Speed
if (idle_time.check(3000) && if (idle_time.check(3000) &&
CE_VECTOR(g_pLocalPlayer->entity, netvar.vVelocity).IsZero(60.0f)) CE_VECTOR(g_pLocalPlayer->entity, netvar.vVelocity)
.IsZero(60.0f))
{ {
follow_target = 0; follow_target = 0;
nav::NavTo(LOCAL_E->m_vecOrigin(), true, false, 4); nav::NavTo(LOCAL_E->m_vecOrigin(), true, false, 4);
@ -881,7 +895,8 @@ void CreateMove()
// Get the follow targets active weapon // Get the follow targets active weapon
int owner_weapon_eid = int owner_weapon_eid =
(CE_INT(ENTITY(follow_target), netvar.hActiveWeapon) & 0xFFF); (CE_INT(ENTITY(follow_target), netvar.hActiveWeapon) &
0xFFF);
IClientEntity *owner_weapon = IClientEntity *owner_weapon =
g_IEntityList->GetClientEntity(owner_weapon_eid); g_IEntityList->GetClientEntity(owner_weapon_eid);
@ -894,7 +909,8 @@ void CreateMove()
// IsBaseCombatWeapon() // IsBaseCombatWeapon()
if (re::C_BaseCombatWeapon::IsBaseCombatWeapon( if (re::C_BaseCombatWeapon::IsBaseCombatWeapon(
RAW_ENT(g_pLocalPlayer->weapon())) && RAW_ENT(g_pLocalPlayer->weapon())) &&
re::C_BaseCombatWeapon::IsBaseCombatWeapon(owner_weapon)) re::C_BaseCombatWeapon::IsBaseCombatWeapon(
owner_weapon))
{ {
// Get the players slot numbers and store in some vars // Get the players slot numbers and store in some vars
@ -903,9 +919,8 @@ void CreateMove()
int owner_slot = int owner_slot =
re::C_BaseCombatWeapon::GetSlot(owner_weapon); re::C_BaseCombatWeapon::GetSlot(owner_weapon);
// If the local player is a medic and user settings allow, // If the local player is a medic and user settings
// then // allow, then keep the medigun out
// keep the medigun out
if (g_pLocalPlayer->clazz == tf_medic && always_medigun) if (g_pLocalPlayer->clazz == tf_medic && always_medigun)
{ {
if (my_slot != 1) if (my_slot != 1)
@ -913,9 +928,8 @@ void CreateMove()
g_IEngine->ExecuteClientCmd("slot2"); g_IEngine->ExecuteClientCmd("slot2");
} }
// Else we attemt to keep our weapon mimiced with our // Else we attemt to keep our weapon mimiced with
// follow // our follow target
// target
} }
else else
{ {
@ -930,5 +944,5 @@ void CreateMove()
} }
nav::NavTo(tar_orig, false, true, 5); nav::NavTo(tar_orig, false, true, 5);
} }
} });
} // namespace hacks::tf2::NavBot } // namespace hacks::tf2::NavBot

View File

@ -1216,8 +1216,10 @@ void OnLevelInit()
Timer quit_timer{}; Timer quit_timer{};
Timer map_check{}; Timer map_check{};
int erasedelay = 0; int erasedelay = 0;
void Move() static HookedFunction
{ Move(HookedFunctions_types::HF_CreateMove, "Walkbot", 16, []() {
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
return;
if (state::state == WB_DISABLED) if (state::state == WB_DISABLED)
return; return;
switch (state::state) switch (state::state)
@ -1240,7 +1242,8 @@ void Move()
{ {
if (leave_if_empty) if (leave_if_empty)
{ {
if (nodes.size() == 0 || g_IEngine->GetLevelName() != prevlvlname) if (nodes.size() == 0 ||
g_IEngine->GetLevelName() != prevlvlname)
{ {
prevlvlname = g_IEngine->GetLevelName(); prevlvlname = g_IEngine->GetLevelName();
if (!boost::contains(prevlvlname, "pl_")) if (!boost::contains(prevlvlname, "pl_"))
@ -1286,5 +1289,5 @@ void Move()
} }
break; break;
} }
} });
} // namespace hacks::shared::walkbot } // namespace hacks::shared::walkbot

View File

@ -109,7 +109,13 @@ static int attackticks = 0;
namespace hooked_methods namespace hooked_methods
{ {
static HookedFunction viewangs(HookedFunctions_types::HF_CreateMove, "set_ang",
21, []() {
if (CE_BAD(LOCAL_E))
return;
g_pLocalPlayer->v_OrigViewangles =
current_user_cmd->viewangles;
});
DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
CUserCmd *cmd) CUserCmd *cmd)
{ {
@ -249,9 +255,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
g_pLocalPlayer->Update(); g_pLocalPlayer->Update();
} }
g_Settings.bInvalid = false; g_Settings.bInvalid = false;
hacks::shared::autojoin::update();
{ {
PROF_SECTION(CM_AAA); PROF_SECTION(CM_AAA);
hacks::shared::anti_anti_aim::createMove(); hacks::shared::anti_anti_aim::createMove();
@ -261,45 +264,11 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
PROF_SECTION(CM_WRAPPER); PROF_SECTION(CM_WRAPPER);
HookTools::CM(); HookTools::CM();
} }
#if ENABLE_IPC
#if !LAGBOT_MODE
if (hacks::shared::followbot::isEnabled())
{
hacks::shared::followbot::WorldTick();
}
#endif
#endif
if (CE_GOOD(g_pLocalPlayer->entity)) if (CE_GOOD(g_pLocalPlayer->entity))
{ {
#if !LAGBOT_MODE
IF_GAME(IsTF2())
{
UpdateHoovyList();
}
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
#if ENABLE_VISUALS
{
PROF_SECTION(CM_esp);
hacks::shared::esp::CreateMove();
}
#endif
#endif
if (!g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->weapon())) if (!g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->weapon()))
{ {
#if !LAGBOT_MODE #if !LAGBOT_MODE
{
PROF_SECTION(CM_walkbot);
hacks::shared::walkbot::Move();
}
{
PROF_SECTION(CM_navparse);
nav::CreateMove();
}
{
PROF_SECTION(CM_navbot);
hacks::tf2::NavBot::CreateMove();
}
// Walkbot can leave game. // Walkbot can leave game.
if (!g_IEngine->IsInGame()) if (!g_IEngine->IsInGame())
{ {

13
src/hoovy.cpp Executable file → Normal file
View File

@ -37,11 +37,14 @@ bool IsHoovyHelper(CachedEntity *entity)
return false; return false;
} }
void UpdateHoovyList() static HookedFunction UpdateHoovyList(
{ HookedFunctions_types::HF_CreateMove, "HoovyList", 19, []() {
static CachedEntity *ent; if (CE_BAD(LOCAL_E))
return;
for (int i = 1; i < 32 && i < g_IEntityList->GetHighestEntityIndex(); i++) static CachedEntity *ent;
for (int i = 1; i < 32 && i < g_IEntityList->GetHighestEntityIndex();
i++)
{ {
ent = ENTITY(i); ent = ENTITY(i);
if (CE_GOOD(ent) && CE_BYTE(ent, netvar.iLifeState) == LIFE_ALIVE) if (CE_GOOD(ent) && CE_BYTE(ent, netvar.iLifeState) == LIFE_ALIVE)
@ -58,7 +61,7 @@ void UpdateHoovyList()
} }
} }
} }
} });
bool IsHoovy(CachedEntity *entity) bool IsHoovy(CachedEntity *entity)
{ {

View File

@ -367,8 +367,8 @@ void Repath()
} }
// Main movement function, gets path from NavTo // Main movement function, gets path from NavTo
void CreateMove() static HookedFunction
{ CreateMove(HookedFunctions_types::HF_CreateMove, "NavParser", 17, []() {
if (!enabled || !threadingFinished.load()) if (!enabled || !threadingFinished.load())
return; return;
if (CE_BAD(LOCAL_E)) if (CE_BAD(LOCAL_E))
@ -390,8 +390,8 @@ void CreateMove()
} }
ReadyForCommands = false; ReadyForCommands = false;
// Remove old crumbs // Remove old crumbs
if (g_pLocalPlayer->v_Origin.DistTo(Vector{ crumbs.at(0).x, crumbs.at(0).y, if (g_pLocalPlayer->v_Origin.DistTo(Vector{
g_pLocalPlayer->v_Origin.z }) < crumbs.at(0).x, crumbs.at(0).y, g_pLocalPlayer->v_Origin.z }) <
30.0f) 30.0f)
{ {
lastArea = crumbs.at(0); lastArea = crumbs.at(0);
@ -428,8 +428,8 @@ void CreateMove()
{ {
// Ignore connection // Ignore connection
bool resetPather = false; bool resetPather = false;
TF2MAP->inactiveTracker.AddTime({ lastArea, crumbs.at(0) }, inactivity, TF2MAP->inactiveTracker.AddTime({ lastArea, crumbs.at(0) },
resetPather); inactivity, resetPather);
if (resetPather) if (resetPather)
TF2MAP->pather->Reset(); TF2MAP->pather->Reset();
Repath(); Repath();
@ -438,7 +438,7 @@ void CreateMove()
} }
// Walk to next crumb // Walk to next crumb
WalkTo(crumbs.at(0)); WalkTo(crumbs.at(0));
} });
void Draw() void Draw()
{ {