Merge branch 'master' of https://github.com/BenCat07/cathook
This commit is contained in:
commit
1aa04e9b97
@ -84,7 +84,6 @@ std::pair<Vector,Vector> VischeckWall(CachedEntity *player, CachedEntity *target
|
|||||||
float vectorMax(Vector i);
|
float vectorMax(Vector i);
|
||||||
Vector vectorAbs(Vector i);
|
Vector vectorAbs(Vector i);
|
||||||
bool canReachVector(Vector loc, Vector dest = { 0, 0, 0 });
|
bool canReachVector(Vector loc, Vector dest = { 0, 0, 0 });
|
||||||
bool isJumping(Vector vec);
|
|
||||||
|
|
||||||
bool LineIntersectsBox(Vector &bmin, Vector &bmax, Vector &lmin, Vector &lmax);
|
bool LineIntersectsBox(Vector &bmin, Vector &bmax, Vector &lmin, Vector &lmax);
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ rm ../install-all # remove install file
|
|||||||
# Install base Dependencies
|
# Install base Dependencies
|
||||||
#
|
#
|
||||||
if [ -f "/etc/arch-release" ]; then
|
if [ -f "/etc/arch-release" ]; then
|
||||||
sudo pacman -S --needed --noconfirm boost cmake make lib32-openssl lib32-libpng gcc gdb lib32-sdl2 lib32-glew freetype2
|
sudo pacman -S --needed --noconfirm boost cmake make lib32-openssl lib32-libpng gcc gdb lib32-sdl2 lib32-glew freetype2 rsync
|
||||||
else
|
else
|
||||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||||
sudo apt update
|
sudo apt update
|
||||||
|
@ -173,6 +173,8 @@ float cur_proj_grav{ 0.0f };
|
|||||||
// If slow aimbot allows autoshoot
|
// If slow aimbot allows autoshoot
|
||||||
bool slow_can_shoot = false;
|
bool slow_can_shoot = false;
|
||||||
bool projectileAimbotRequired;
|
bool projectileAimbotRequired;
|
||||||
|
// Keep track of our zoom time
|
||||||
|
Timer zoomTime{};
|
||||||
|
|
||||||
// This array will store calculated projectile/hitscan predictions
|
// This array will store calculated projectile/hitscan predictions
|
||||||
// for current frame, to avoid performing them again
|
// for current frame, to avoid performing them again
|
||||||
@ -253,15 +255,11 @@ void CreateMove()
|
|||||||
// Auto-Unzoom
|
// Auto-Unzoom
|
||||||
if (auto_unzoom)
|
if (auto_unzoom)
|
||||||
{
|
{
|
||||||
if (g_pLocalPlayer->holding_sniper_rifle)
|
if (g_pLocalPlayer->holding_sniper_rifle && g_pLocalPlayer->bZoomed && zoomTime.check(3000))
|
||||||
{
|
{
|
||||||
if (g_pLocalPlayer->bZoomed)
|
|
||||||
{
|
|
||||||
if (g_GlobalVars->curtime - g_pLocalPlayer->flZoomBegin > 5.0f)
|
|
||||||
g_pUserCmd->buttons |= IN_ATTACK2;
|
g_pUserCmd->buttons |= IN_ATTACK2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// We do this as we need to pass whether the aimkey allows aiming to both
|
// We do this as we need to pass whether the aimkey allows aiming to both
|
||||||
// the find target and aiming system. If we just call the func than toggle
|
// the find target and aiming system. If we just call the func than toggle
|
||||||
// aimkey would break so we save it to a var to use it twice
|
// aimkey would break so we save it to a var to use it twice
|
||||||
@ -277,6 +275,7 @@ void CreateMove()
|
|||||||
{
|
{
|
||||||
if (g_pLocalPlayer->holding_sniper_rifle)
|
if (g_pLocalPlayer->holding_sniper_rifle)
|
||||||
{
|
{
|
||||||
|
zoomTime.update();
|
||||||
if (not g_pLocalPlayer->bZoomed)
|
if (not g_pLocalPlayer->bZoomed)
|
||||||
{
|
{
|
||||||
g_pUserCmd->buttons |= IN_ATTACK2;
|
g_pUserCmd->buttons |= IN_ATTACK2;
|
||||||
|
@ -9,10 +9,6 @@
|
|||||||
#include "hacks/Backtrack.hpp"
|
#include "hacks/Backtrack.hpp"
|
||||||
#include <boost/circular_buffer.hpp>
|
#include <boost/circular_buffer.hpp>
|
||||||
#include <glez/draw.hpp>
|
#include <glez/draw.hpp>
|
||||||
bool IsMelee()
|
|
||||||
{
|
|
||||||
return GetWeaponMode() == weapon_melee;
|
|
||||||
}
|
|
||||||
namespace hacks::shared::backtrack
|
namespace hacks::shared::backtrack
|
||||||
{
|
{
|
||||||
CatVar enable(CV_SWITCH, "backtrack", "0", "Enable backtrack",
|
CatVar enable(CV_SWITCH, "backtrack", "0", "Enable backtrack",
|
||||||
@ -108,6 +104,7 @@ void Run()
|
|||||||
float bestFov = 99999;
|
float bestFov = 99999;
|
||||||
BestTick = 0;
|
BestTick = 0;
|
||||||
iBestTarget = -1;
|
iBestTarget = -1;
|
||||||
|
bool IsMelee = GetWeaponMode() == weapon_melee;
|
||||||
|
|
||||||
float prev_distance = 9999;
|
float prev_distance = 9999;
|
||||||
|
|
||||||
|
@ -64,9 +64,10 @@ static const int crumb_limit = 64; // limit
|
|||||||
|
|
||||||
// Followed entity, externed for highlight color
|
// Followed entity, externed for highlight color
|
||||||
int follow_target = 0;
|
int follow_target = 0;
|
||||||
bool inited;
|
static bool inited;
|
||||||
|
|
||||||
Timer lastTaunt{}; // time since taunt was last executed, used to avoid kicks
|
Timer lastTaunt{}; // time since taunt was last executed, used to avoid kicks
|
||||||
|
Timer lastJump{};
|
||||||
std::array<Timer, 32> afkTicks; // for how many ms the player hasn't been moving
|
std::array<Timer, 32> afkTicks; // for how many ms the player hasn't been moving
|
||||||
|
|
||||||
void checkAFK()
|
void checkAFK()
|
||||||
@ -76,7 +77,7 @@ void checkAFK()
|
|||||||
auto entity = ENTITY(i);
|
auto entity = ENTITY(i);
|
||||||
if (CE_BAD(entity))
|
if (CE_BAD(entity))
|
||||||
continue;
|
continue;
|
||||||
if (!CE_VECTOR(entity, netvar.vVelocity).IsZero(5.0f))
|
if (!CE_VECTOR(entity, netvar.vVelocity).IsZero(60.0f))
|
||||||
{
|
{
|
||||||
afkTicks[i].update();
|
afkTicks[i].update();
|
||||||
}
|
}
|
||||||
@ -344,12 +345,6 @@ void WorldTick()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(!checkPath()) //wip do not merge if you see this
|
|
||||||
// {
|
|
||||||
// follow_target = 0;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Update timer on new target
|
// Update timer on new target
|
||||||
static Timer idle_time{};
|
static Timer idle_time{};
|
||||||
if (breadcrumbs.empty())
|
if (breadcrumbs.empty())
|
||||||
@ -369,7 +364,7 @@ void WorldTick()
|
|||||||
// New crumbs, we add one if its empty so we have something to follow
|
// New crumbs, we add one if its empty so we have something to follow
|
||||||
if ((breadcrumbs.empty() ||
|
if ((breadcrumbs.empty() ||
|
||||||
tar_orig.DistTo(breadcrumbs.at(breadcrumbs.size() - 1)) > 40.0F) &&
|
tar_orig.DistTo(breadcrumbs.at(breadcrumbs.size() - 1)) > 40.0F) &&
|
||||||
DistanceToGround(ENTITY(follow_target)) < 30)
|
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 timer
|
||||||
@ -395,14 +390,24 @@ void WorldTick()
|
|||||||
if (dist_to_target > (float) follow_distance)
|
if (dist_to_target > (float) follow_distance)
|
||||||
{
|
{
|
||||||
// Check for jump
|
// Check for jump
|
||||||
if (autojump && (idle_time.check(2000) || isJumping(breadcrumbs[0])))
|
if (autojump && lastJump.check(1000) && (idle_time.check(2000) || DistanceToGround({breadcrumbs[0].x,breadcrumbs[0].y,breadcrumbs[0].z + 5}) > 47))
|
||||||
|
{
|
||||||
g_pUserCmd->buttons |= IN_JUMP;
|
g_pUserCmd->buttons |= IN_JUMP;
|
||||||
// Check for idle
|
lastJump.update();
|
||||||
|
}
|
||||||
|
// Check if still moving. 70 HU = Sniper Zoomed Speed
|
||||||
|
if (idle_time.check(3000) && CE_VECTOR(g_pLocalPlayer->entity, netvar.vVelocity).IsZero(60.0f))
|
||||||
|
{
|
||||||
|
follow_target = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Basic idle check
|
||||||
if (idle_time.test_and_set(5000))
|
if (idle_time.test_and_set(5000))
|
||||||
{
|
{
|
||||||
follow_target = 0;
|
follow_target = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static float last_slot_check = 0.0f;
|
static float last_slot_check = 0.0f;
|
||||||
if (g_GlobalVars->curtime < last_slot_check)
|
if (g_GlobalVars->curtime < last_slot_check)
|
||||||
last_slot_check = 0.0f;
|
last_slot_check = 0.0f;
|
||||||
|
@ -277,17 +277,11 @@ bool canReachVector(Vector loc, Vector dest)
|
|||||||
int maxiterations = floor(dest.DistTo(loc)) / 40;
|
int maxiterations = floor(dest.DistTo(loc)) / 40;
|
||||||
for (int i = 0; i < maxiterations; i++)
|
for (int i = 0; i < maxiterations; i++)
|
||||||
{
|
{
|
||||||
|
// math to get the next vector 40.0f in the direction of dest
|
||||||
Vector vec =
|
Vector vec =
|
||||||
loc + dist / vectorMax(vectorAbs(dist)) * 40.0f * (i + 1);
|
loc + dist / vectorMax(vectorAbs(dist)) * 40.0f * (i + 1);
|
||||||
|
|
||||||
trace_t trace;
|
if (DistanceToGround({vec.x,vec.y,vec.z + 5}) >= 40)
|
||||||
Ray_t ray;
|
|
||||||
Vector down = vec;
|
|
||||||
down.z = down.z - 50;
|
|
||||||
ray.Init(vec, down);
|
|
||||||
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player,
|
|
||||||
&trace);
|
|
||||||
if (!(trace.startpos.DistTo(trace.endpos) <= 45))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (int j = 0; j < 4; j++)
|
for (int j = 0; j < 4; j++)
|
||||||
@ -309,13 +303,13 @@ bool canReachVector(Vector loc, Vector dest)
|
|||||||
directionalLoc.y = directionalLoc.y - 40;
|
directionalLoc.y = directionalLoc.y - 40;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
trace_t trace2;
|
trace_t trace;
|
||||||
Ray_t ray2;
|
Ray_t ray;
|
||||||
ray2.Init(vec, directionalLoc);
|
ray.Init(vec, directionalLoc);
|
||||||
g_ITrace->TraceRay(ray2, 0x4200400B, &trace::filter_no_player,
|
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player,
|
||||||
&trace2);
|
&trace);
|
||||||
// distance of trace < than 26
|
// distance of trace < than 26
|
||||||
if (trace2.startpos.DistTo(trace2.endpos) < 26.0f)
|
if (trace.startpos.DistTo(trace.endpos) < 26.0f)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -323,17 +317,11 @@ bool canReachVector(Vector loc, Vector dest)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// check if the vector is too high above ground
|
// check if the vector is too high above ground
|
||||||
trace_t trace;
|
// higher to avoid small false positives, player can jump 42 hu according to
|
||||||
Ray_t ray;
|
|
||||||
Vector down = loc;
|
|
||||||
down.z = down.z - 50;
|
|
||||||
ray.Init(loc, down);
|
|
||||||
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace);
|
|
||||||
// higher to avoid small false positives, player can jump 42 hu
|
|
||||||
// according to
|
|
||||||
// the tf2 wiki
|
// the tf2 wiki
|
||||||
if (!(trace.startpos.DistTo(trace.endpos) <= 45))
|
if (DistanceToGround({loc.x,loc.y,loc.z + 5}) >= 40)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// check if there is enough space arround the vector for a player to fit
|
// check if there is enough space arround the vector for a player to fit
|
||||||
// for loop for all 4 directions
|
// for loop for all 4 directions
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
@ -355,37 +343,16 @@ bool canReachVector(Vector loc, Vector dest)
|
|||||||
directionalLoc.y = directionalLoc.y - 40;
|
directionalLoc.y = directionalLoc.y - 40;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
trace_t trace2;
|
|
||||||
Ray_t ray2;
|
|
||||||
ray2.Init(loc, directionalLoc);
|
|
||||||
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player,
|
|
||||||
&trace2);
|
|
||||||
// distance of trace < than 26
|
|
||||||
if (trace2.startpos.DistTo(trace2.endpos) < 26.0f)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns if the player is currently jumping/falling.
|
|
||||||
bool isJumping(Vector vec)
|
|
||||||
{
|
|
||||||
// check if the vector is too high above ground
|
|
||||||
trace_t trace;
|
trace_t trace;
|
||||||
Ray_t ray;
|
Ray_t ray;
|
||||||
Vector down = vec;
|
ray.Init(loc, directionalLoc);
|
||||||
Vector loc = vec;
|
|
||||||
down.z = down.z - 50;
|
|
||||||
loc.z = loc.z + 5;
|
|
||||||
ray.Init(vec, down);
|
|
||||||
// trace::filter_no_player.SetSelf(RAW_ENT(g_pLocalPlayer->entity));
|
|
||||||
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace);
|
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace);
|
||||||
// lower to avoid small false negatives, player can jump 42 hu according to
|
// distance of trace < than 26
|
||||||
// the tf2 wiki, higher because loc.z = loc.z + 5;
|
if (trace.startpos.DistTo(trace.endpos) < 26.0f)
|
||||||
if (trace.startpos.DistTo(trace.endpos) > 45)
|
|
||||||
return true;
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetLevelName()
|
std::string GetLevelName()
|
||||||
@ -1329,8 +1296,7 @@ void PrintChat(const char *fmt, ...)
|
|||||||
va_end(list);
|
va_end(list);
|
||||||
std::unique_ptr<char> str(strfmt("\x07%06X[\x07%06XCAT\x07%06X]\x01 %s",
|
std::unique_ptr<char> str(strfmt("\x07%06X[\x07%06XCAT\x07%06X]\x01 %s",
|
||||||
0x5e3252, 0xba3d9a, 0x5e3252,
|
0x5e3252, 0xba3d9a, 0x5e3252,
|
||||||
buf.get())
|
buf.get()).release());
|
||||||
.get());
|
|
||||||
// FIXME DEBUG LOG
|
// FIXME DEBUG LOG
|
||||||
logging::Info("%s", str.get());
|
logging::Info("%s", str.get());
|
||||||
chat->Printf(str.get());
|
chat->Printf(str.get());
|
||||||
|
Reference in New Issue
Block a user