Skip to content

Commit

Permalink
Cleaned up CreateMove hook
Browse files Browse the repository at this point in the history
  • Loading branch information
lnx00 committed Jan 5, 2024
1 parent 4d698f0 commit f27d848
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
13 changes: 7 additions & 6 deletions SEOwnedDE/SEOwnedDE/src/App/Hooks/CL_SendMove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

MAKE_HOOK(
CL_SendMove, Signatures::CL_SendMove.Get(),
void, __fastcall, void *ecx, void *edx)
void, __fastcall, void* ecx, void* edx)
{
F::SeedPred->AskForPlayerPerf();

if (Shifting::nAvailableTicks < MAX_COMMANDS)
{
if (auto pWeapon = H::Entities->GetWeapon())
if (H::Entities->GetWeapon())
{
if (!Shifting::bRecharging && !Shifting::bShifting && !Shifting::bShiftingWarp)
{
Expand All @@ -25,12 +25,13 @@ MAKE_HOOK(
if (Shifting::bRecharging)
{
Shifting::nAvailableTicks++;

return;
}
}

else Shifting::bRecharging = false;
else
{
Shifting::bRecharging = false;
}

CALL_ORIGINAL(ecx, edx);
}
}
37 changes: 25 additions & 12 deletions SEOwnedDE/SEOwnedDE/src/App/Hooks/ClientModeShared_CreateMove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "../Features/Aimbot/Aimbot.h"
#include "../Features/EnginePrediction/EnginePrediction.h"
#include "../Features/Misc/Misc.h"
#include "../Features/NetworkFix/NetworkFix.h"
#include "../Features/RapidFire/RapidFire.h"
#include "../Features/Triggerbot/Triggerbot.h"
#include "../Features/Triggerbot/AutoVaccinator/AutoVaccinator.h"
Expand All @@ -15,7 +14,7 @@

MAKE_HOOK(
ClientModeShared_CreateMove, Memory::GetVFunc(I::ClientModeShared, 21),
bool, __fastcall, void *ecx, void *edx, float flInputSampleTime, CUserCmd *pCmd)
bool, __fastcall, CClientModeShared* ecx, void* edx, float flInputSampleTime, CUserCmd* pCmd)
{
G::bSilentAngles = false;
G::bPSilentAngles = false;
Expand Down Expand Up @@ -53,8 +52,9 @@ MAKE_HOOK(
return CALL_ORIGINAL(ecx, edx, flInputSampleTime, pCmd);
}

uintptr_t _bp; __asm mov _bp, ebp;
bool *pSendPacket = (bool *)(***(uintptr_t ***)_bp - 0x1);
uintptr_t _bp;
__asm mov _bp, ebp;
auto pSendPacket = reinterpret_cast<bool*>(***reinterpret_cast<uintptr_t***>(_bp) - 0x1);

Vec3 vOldAngles = pCmd->viewangles;
float flOldSide = pCmd->sidemove;
Expand All @@ -75,7 +75,8 @@ MAKE_HOOK(
{
static bool bOldCanFire = G::bCanPrimaryAttack;

if (G::bCanPrimaryAttack != bOldCanFire) {
if (G::bCanPrimaryAttack != bOldCanFire)
{
G::nTicksSinceCanFire = 0;
bOldCanFire = G::bCanPrimaryAttack;
}
Expand All @@ -102,7 +103,7 @@ MAKE_HOOK(
{
if (CFG::Misc_Choke_On_Bhop && CFG::Misc_Bunnyhop)
{
if (C_TFPlayer *const local{ H::Entities->GetLocal() })
if (C_TFPlayer* const local{ H::Entities->GetLocal() })
{
if ((local->m_fFlags() & FL_ONGROUND) && !(F::EnginePrediction->flags & FL_ONGROUND))
{
Expand All @@ -117,7 +118,6 @@ MAKE_HOOK(
}
F::EnginePrediction->End();

//F::AutoVaccinator->Run(pCmd);
F::SeedPred->AdjustAngles(pCmd);
F::StickyJump->Run(pCmd);

Expand All @@ -127,17 +127,22 @@ MAKE_HOOK(
{
static int nOldTargetIndex = G::nTargetIndexEarly;

if (G::nTargetIndexEarly != nOldTargetIndex) {
if (G::nTargetIndexEarly != nOldTargetIndex)
{
G::nTicksTargetSame = 0;
nOldTargetIndex = G::nTargetIndexEarly;
}

else G::nTicksTargetSame++;
else
{
G::nTicksTargetSame++;
}

if (G::nTargetIndexEarly <= 1)
G::nTicksTargetSame = 0;
}

/* Taunt Slide */
if (CFG::Misc_Taunt_Slide)
{
if (auto pLocal = H::Entities->GetLocal())
Expand All @@ -161,7 +166,10 @@ MAKE_HOOK(
pCmd->viewangles.y = flYaw;
}

else flYaw = pCmd->viewangles.y;
else
{
flYaw = pCmd->viewangles.y;
}

if (CFG::Misc_Taunt_Slide_Control)
pCmd->viewangles.x = (pCmd->buttons & IN_BACK) ? 91.0f : (pCmd->buttons & IN_FORWARD) ? 0.0f : 90.0f;
Expand All @@ -171,6 +179,7 @@ MAKE_HOOK(
}
}

/* Warp */
if (CFG::Exploits_Warp_Exploit && CFG::Exploits_Warp_Mode == 1 && Shifting::bShiftingWarp)
{
if (auto pLocal = H::Entities->GetLocal())
Expand Down Expand Up @@ -207,7 +216,8 @@ MAKE_HOOK(
{
static bool bWasSet = false;

if (G::bPSilentAngles) {
if (G::bPSilentAngles)
{
*pSendPacket = false;
bWasSet = true;
}
Expand All @@ -225,13 +235,16 @@ MAKE_HOOK(
}
}

// Don't choke too much
if (I::ClientState->chokedcommands > 22)
{
*pSendPacket = true;
}

F::RapidFire->Run(pCmd, pSendPacket);

G::nOldButtons = pCmd->buttons;
G::vUserCmdAngles = pCmd->viewangles;

return (G::bSilentAngles || G::bPSilentAngles) ? false : CALL_ORIGINAL(ecx, edx, flInputSampleTime, pCmd);
}
}

0 comments on commit f27d848

Please sign in to comment.