Skip to content

Commit

Permalink
Claned up all remaining hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
lnx00 committed Jan 7, 2024
1 parent 280b048 commit e58f77e
Show file tree
Hide file tree
Showing 32 changed files with 208 additions and 202 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

MAKE_HOOK(
CRendering3dView_EnableWorldFog, Signatures::CRendering3dView_EnableWorldFog.Get(),
void, __fastcall, void *ecx, void *edx)
void, __fastcall, void* ecx, void* edx)
{
if (CFG::Misc_Clean_Screenshot && I::EngineClient->IsTakingScreenshot())
{
Expand Down Expand Up @@ -35,7 +35,7 @@ MAKE_SIGNATURE(CSkyboxView_GetSkyboxFogEnable, "client.dll", "55 8B EC 83 EC 10

MAKE_HOOK(
CSkyboxView_GetSkyboxFogEnable, Signatures::CSkyboxView_GetSkyboxFogEnable.Get(),
bool, __fastcall, void *ecx, void *edx)
bool, __fastcall, void* ecx, void* edx)
{
if (CFG::Misc_Clean_Screenshot && I::EngineClient->IsTakingScreenshot())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

MAKE_HOOK(
CTFGameMovement_PlayerMove, Signatures::CTFGameMovement_PlayerMove.Get(),
void, __fastcall, void* ecx, void* edx)
void, __fastcall, CTFGameMovement* ecx, void* edx)
{
if (F::MovementSimulation->IsRunning())
{
Expand Down
16 changes: 8 additions & 8 deletions SEOwnedDE/SEOwnedDE/src/App/Hooks/CTFPlayerShared_InCond.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

MAKE_HOOK(
CTFPlayerShared_InCond, Signatures::CTFPlayerShared_InCond.Get(),
bool, __fastcall, void *ecx, void *edx, ETFCond cond)
bool, __fastcall, void* ecx, void* edx, ETFCond cond)
{
if (cond == TF_COND_DISGUISED || cond == TF_COND_DISGUISING)
{
if (CFG::Misc_Accuracy_Improvements)
{
if (C_TFPlayer *pOuter = *reinterpret_cast<C_TFPlayer **>(reinterpret_cast<DWORD>(ecx) + 392))
if (C_TFPlayer* pOuter = *reinterpret_cast<C_TFPlayer**>(reinterpret_cast<DWORD>(ecx) + 392))
{
if (auto pLocal = H::Entities->GetLocal())
if (const auto pLocal = H::Entities->GetLocal())
{
if (pOuter->m_iTeamNum() != pLocal->m_iTeamNum())
return false;
Expand All @@ -23,11 +23,11 @@ MAKE_HOOK(

if (cond == TF_COND_ZOOMED)
{
auto ShouldDoOverrides = [&]() -> bool
auto shouldDoOverrides = [&]() -> bool
{
if (CFG::Visuals_Removals_Mode == 1)
{
if (auto pLocal = H::Entities->GetLocal())
if (const auto pLocal = H::Entities->GetLocal())
{
if (pLocal->m_iObserverMode() == OBS_MODE_IN_EYE)
return false;
Expand All @@ -37,9 +37,9 @@ MAKE_HOOK(
return true;
};

if (ShouldDoOverrides())
if (shouldDoOverrides())
{
DWORD dwRetAddr = reinterpret_cast<DWORD>(_ReturnAddress());
const DWORD dwRetAddr = reinterpret_cast<DWORD>(_ReturnAddress());

if (CFG::Visuals_Remove_Scope)
{
Expand All @@ -62,4 +62,4 @@ MAKE_HOOK(
}

return CALL_ORIGINAL(ecx, edx, cond);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

MAKE_HOOK(
CTFPlayerShared_IsPlayerDominated, Signatures::CTFPlayerShared_IsPlayerDominated.Get(),
bool, __fastcall, void *ecx, void *edx, int index)
bool, __fastcall, void* ecx, void* edx, int index)
{
bool bResult = CALL_ORIGINAL(ecx, edx, index);
const bool bResult = CALL_ORIGINAL(ecx, edx, index);

if (!bResult)
{
if (CFG::Visuals_Reveal_Scoreboard)
{
if (reinterpret_cast<DWORD>(_ReturnAddress()) == Signatures::RevealScoreboard_CTFPlayerShared_IsPlayerDominated_Desired.Get())
*reinterpret_cast<uintptr_t *>(_AddressOfReturnAddress()) = Signatures::RevealScoreboard_CTFPlayerShared_IsPlayerDominated_Jump.Get();
*static_cast<uintptr_t*>(_AddressOfReturnAddress()) = Signatures::RevealScoreboard_CTFPlayerShared_IsPlayerDominated_Jump.Get();
}
}

return bResult;
}
}
6 changes: 4 additions & 2 deletions SEOwnedDE/SEOwnedDE/src/App/Hooks/CTFPlayer_FireBullet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

MAKE_HOOK(
CTFPlayer_FireBullet, Signatures::CTFPlayer_FireBullet.Get(),
void, __fastcall, void *ecx, void *edx, C_TFWeaponBase *pWpn, FireBulletsInfo_t &info, bool bDoEffects, int nDamageType, int nCustomDamageType)
void, __fastcall, C_TFPlayer* ecx, void* edx, C_TFWeaponBase* pWpn, FireBulletsInfo_t& info, bool bDoEffects, int nDamageType, int nCustomDamageType)
{
if (auto pLocal = H::Entities->GetLocal())
{
Expand All @@ -13,7 +13,9 @@ MAKE_HOOK(
if (CFG::Visuals_Tracer_Type)
{
if (nDamageType & DMG_CRITICAL)
{
nDamageType &= ~DMG_CRITICAL;
}

info.m_iTracerFreq = 1;
}
Expand Down Expand Up @@ -87,4 +89,4 @@ MAKE_HOOK(
}

CALL_ORIGINAL(ecx, edx, pWpn, info, bDoEffects, nDamageType, nCustomDamageType);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

MAKE_HOOK(
CTFPlayer_MaybeDrawRailgunBeam, Signatures::CTFPlayer_MaybeDrawRailgunBeam.Get(),
void, __fastcall, void *ecx, void *edx, void *pFilter, C_TFWeaponBase *pWeapon, const Vector &vStartPos, const Vector &vEndPos)
void, __fastcall, C_TFPlayer* ecx, void* edx, void* pFilter, C_TFWeaponBase* pWeapon, const Vector& vStartPos, const Vector& vEndPos)
{
if (CFG::Visuals_Tracer_Type)
{
if (auto pLocal = H::Entities->GetLocal())
if (const auto pLocal = H::Entities->GetLocal())
{
if (ecx == pLocal)
return;
}
}

CALL_ORIGINAL(ecx, edx, pFilter, pWeapon, vStartPos, vEndPos);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ MAKE_HOOK(
CTFViewModel_CalcViewModelView, Signatures::CTFViewModel_CalcViewModelView.Get(),
void, __fastcall, void *ecx, void *edx, C_BasePlayer *owner, const Vector &eyePosition, const QAngle &eyeAngles)
{
auto pLocal = H::Entities->GetLocal();
const auto pLocal = H::Entities->GetLocal();

if (pLocal && !pLocal->deadflag() && CFG::Visuals_ViewModel_Active)
{
Vec3 vForward = {}, vRight = {}, vUp = {};
Math::AngleVectors(eyeAngles, &vForward, &vRight, &vUp);

Vec3 vEyePosition = eyePosition + (
const Vec3 vEyePosition = eyePosition + (
(vForward * CFG::Visuals_ViewModel_Offset_Forward) +
(vRight * CFG::Visuals_ViewModel_Offset_Right) +
(vUp * CFG::Visuals_ViewModel_Offset_Up)
);

CALL_ORIGINAL(ecx, edx, owner, vEyePosition, eyeAngles);
}

else CALL_ORIGINAL(ecx, edx, owner, eyePosition, eyeAngles);
}
else
{
CALL_ORIGINAL(ecx, edx, owner, eyePosition, eyeAngles);
}
}
24 changes: 12 additions & 12 deletions SEOwnedDE/SEOwnedDE/src/App/Hooks/CTFWeaponBase_GetShootSound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,36 @@

MAKE_HOOK(
CTFWeaponBase_GetShootSound, Signatures::CTFWeaponBase_GetShootSound.Get(),
const char *, __fastcall, void *ecx, void *edx, int iIndex)
const char*, __fastcall, C_TFWeaponBase* ecx, void* edx, int iIndex)
{
if (CFG::Misc_MVM_Giant_Weapon_Sounds)
{
if (auto pWeapon = reinterpret_cast<C_TFWeaponBase *>(ecx))
if (const auto pWeapon = ecx)
{
if (auto pLocal = H::Entities->GetLocal())
if (const auto pLocal = H::Entities->GetLocal())
{
if (pWeapon->m_hOwner().Get() == pLocal)
{
int nOldTeam = pWeapon->m_iTeamNum();
const int nOldTeam = pWeapon->m_iTeamNum();
pWeapon->m_iTeamNum() = TF_TEAM_PVE_INVADERS_GIANTS;
auto ret = CALL_ORIGINAL(ecx, edx, iIndex);
const auto ret = CALL_ORIGINAL(ecx, edx, iIndex);
pWeapon->m_iTeamNum() = nOldTeam;

//credits: KGB

static auto FireHash = HASH_CT("Weapon_FlameThrower.Fire");
static auto fireHash = HASH_CT("Weapon_FlameThrower.Fire");

if (HASH_RT(ret) == FireHash)
if (HASH_RT(ret) == fireHash)
return "MVM.GiantPyro_FlameStart";

static auto FireLoopHash = HASH_CT("Weapon_FlameThrower.FireLoop");
static auto fireLoopHash = HASH_CT("Weapon_FlameThrower.FireLoop");

if (HASH_RT(ret) == FireLoopHash)
if (HASH_RT(ret) == fireLoopHash)
return "MVM.GiantPyro_FlameLoop";

static auto GrenadeHash = HASH_CT("Weapon_GrenadeLauncher.Single");
static auto grenadeHash = HASH_CT("Weapon_GrenadeLauncher.Single");

if (HASH_RT(ret) == GrenadeHash)
if (HASH_RT(ret) == grenadeHash)
return "MVM.GiantDemoman_Grenadeshoot";

return ret;
Expand All @@ -43,4 +43,4 @@ MAKE_HOOK(
}

return CALL_ORIGINAL(ecx, edx, iIndex);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

MAKE_HOOK(
CTFWeaponBase_GetTracerType, Signatures::CTFWeaponBase_GetTracerType.Get(),
const char *, __fastcall, void *ecx, void *edx)
const char*, __fastcall, C_TFWeaponBase* ecx, void* edx)
{
if (auto nType = CFG::Visuals_Tracer_Type)
if (const auto nType = CFG::Visuals_Tracer_Type)
{
if (auto pLocal = H::Entities->GetLocal())
if (const auto pLocal = H::Entities->GetLocal())
{
if (auto pWeapon = reinterpret_cast<C_TFWeaponBase *>(ecx))
if (const auto pWeapon = ecx)
{
if (pWeapon->m_hOwner().Get() == pLocal)
{
auto GetTracerName = [&](int nIndex)
auto getTracerName = [&](int nIndex)
{
switch (nIndex)
{
Expand All @@ -28,14 +28,14 @@ MAKE_HOOK(
}
};

bool bIsTF2DevsHorribleCode = pWeapon->m_iItemDefinitionIndex() == Sniper_m_TheMachina
const bool bIsTF2DevsHorribleCode = pWeapon->m_iItemDefinitionIndex() == Sniper_m_TheMachina
|| pWeapon->m_iItemDefinitionIndex() == Sniper_m_ShootingStar;

return GetTracerName((nType > 6) ? SDKUtils::RandomInt(bIsTF2DevsHorribleCode ? 1 : 0, (nType == 8) ? 5 : 6) : nType);
return getTracerName((nType > 6) ? SDKUtils::RandomInt(bIsTF2DevsHorribleCode ? 1 : 0, (nType == 8) ? 5 : 6) : nType);
}
}
}
}

return CALL_ORIGINAL(ecx, edx);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

MAKE_HOOK(
CUserMessages_DispatchUserMessage, Signatures::CUserMessages_DispatchUserMessage.Get(),
bool, __fastcall, void *ecx, void *edx, int msg_type, bf_read &msg_data)
bool, __fastcall, void* ecx, void* edx, int msg_type, bf_read& msg_data)
{
if (msg_type == 10 && CFG::Visuals_Remove_Screen_Shake)
{
Expand All @@ -23,4 +23,4 @@ MAKE_HOOK(
}

return CALL_ORIGINAL(ecx, edx, msg_type, msg_data);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

MAKE_HOOK(
CViewRender_DrawViewModels, Signatures::CViewRender_DrawViewModels.Get(),
void, __fastcall, void *ecx, void *edx, const CViewSetup &viewRender, bool drawViewmodel)
void, __fastcall, void* ecx, void* edx, const CViewSetup& viewRender, bool drawViewmodel)
{
CALL_ORIGINAL(ecx, edx, viewRender, drawViewmodel);

F::Outlines->Run();
F::Paint->Run();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

MAKE_HOOK(
CViewRender_PerformScreenOverlay, Memory::RelToAbs(Signatures::CViewRender_PerformScreenOverlay.Get()),
void, __fastcall, void *ecx, void *edx, int x, int y, int w, int h)
void, __fastcall, void* ecx, void* edx, int x, int y, int w, int h)
{
if (CFG::Visuals_Remove_Screen_Overlay)
{
auto ShouldDoOverrides = [&]()
auto shouldDoOverrides = [&]()
{
if (CFG::Visuals_Removals_Mode == 1)
{
if (auto pLocal = H::Entities->GetLocal())
if (const auto pLocal = H::Entities->GetLocal())
{
if (pLocal->m_iObserverMode() == OBS_MODE_IN_EYE)
{
Expand All @@ -24,7 +24,7 @@ MAKE_HOOK(
return true;
};

if (ShouldDoOverrides())
if (shouldDoOverrides())
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

MAKE_HOOK(
CViewRender_RenderView, Signatures::CViewRender_RenderView.Get(),
void, __fastcall, void *ecx, void *edx, const CViewSetup &view, int nClearFlags, int whatToDraw)
void, __fastcall, void* ecx, void* edx, const CViewSetup& view, int nClearFlags, int whatToDraw)
{
I::ViewRender = static_cast<IViewRender*>(ecx);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ MAKE_HOOK(
return;

CALL_ORIGINAL(x, y, w, h, bFlashlightIsOn, bPostVGui);
}
}
4 changes: 2 additions & 2 deletions SEOwnedDE/SEOwnedDE/src/App/Hooks/FX_FireBullets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

MAKE_HOOK(
FX_FireBullets, Signatures::FX_FireBullets.Get(),
void, __cdecl, void *pWpn, int iPlayer, const Vector &vecOrigin, const QAngle &vecAngles,
void, __cdecl, void* pWpn, int iPlayer, const Vector& vecOrigin, const QAngle& vecAngles,
int iWeapon, int iMode, int iSeed, float flSpread, float flDamage, bool bCritical)
{
if (CFG::Exploits_SeedPred_Active)
Expand All @@ -14,4 +14,4 @@ MAKE_HOOK(
}

CALL_ORIGINAL(pWpn, iPlayer, vecOrigin, vecAngles, iWeapon, iMode, iSeed, flSpread, flDamage, bCritical);
}
}
Loading

0 comments on commit e58f77e

Please sign in to comment.