diff --git a/Amalgam/Amalgam.vcxproj b/Amalgam/Amalgam.vcxproj index d7219ee8..10037148 100644 --- a/Amalgam/Amalgam.vcxproj +++ b/Amalgam/Amalgam.vcxproj @@ -964,6 +964,7 @@ + @@ -1274,6 +1275,7 @@ + diff --git a/Amalgam/Amalgam.vcxproj.filters b/Amalgam/Amalgam.vcxproj.filters index dd5c82f5..e1075495 100644 --- a/Amalgam/Amalgam.vcxproj.filters +++ b/Amalgam/Amalgam.vcxproj.filters @@ -199,6 +199,7 @@ + @@ -583,6 +584,7 @@ + diff --git a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp index bc502595..6efdc0dc 100644 --- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp @@ -9,7 +9,6 @@ static inline std::vector GetTargets(CTFPlayer* pLocal, CTFWeaponBase* pWeapon) { std::vector vTargets; - const auto iSort = Vars::Aimbot::General::TargetSelection.Value; Vec3 vLocalPos = F::Ticks.GetShootPos(); Vec3 vLocalAngles = I::EngineClient->GetViewAngles(); diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp index c4066efb..464bb497 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp @@ -9,19 +9,17 @@ //#define SPLASH_DEBUG1 // normal splash visualization //#define SPLASH_DEBUG2 // obstructed splash visualization -//#define SPLASH_DEBUG3 // simple splash visualization -//#define SPLASH_DEBUG4 // points visualization -//#define SPLASH_DEBUG5 // trace visualization -//#define SPLASH_DEBUG6 // trace count +//#define SPLASH_DEBUG3 // points visualization +//#define SPLASH_DEBUG4 // trace visualization +//#define SPLASH_DEBUG5 // trace count -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 static std::unordered_map s_mTraceCount = {}; #endif static inline std::vector GetTargets(CTFPlayer* pLocal, CTFWeaponBase* pWeapon) { std::vector vTargets; - const auto iSort = Vars::Aimbot::General::TargetSelection.Value; const Vec3 vLocalPos = F::Ticks.GetShootPos(); const Vec3 vLocalAngles = I::EngineClient->GetViewAngles(); @@ -189,12 +187,12 @@ float CAimbotProjectile::GetSplashRadius(CTFWeaponBase* pWeapon, CTFPlayer* pPla case TF_WEAPON_ROCKETLAUNCHER_DIRECTHIT: case TF_WEAPON_PARTICLE_CANNON: case TF_WEAPON_PIPEBOMBLAUNCHER: - flRadius = 146.f; + flRadius = TF_ROCKET_RADIUS; break; case TF_WEAPON_FLAREGUN: case TF_WEAPON_FLAREGUN_REVENGE: if (pWeapon->As()->GetFlareGunType() == FLAREGUN_SCORCHSHOT) - flRadius = 110.f; + flRadius = TF_FLARE_DET_RADIUS; } if (!flRadius) return 0.f; @@ -226,15 +224,15 @@ float CAimbotProjectile::GetSplashRadius(CBaseEntity* pProjectile, CTFWeaponBase case ETFClassID::CTFProjectile_Rocket: case ETFClassID::CTFProjectile_SentryRocket: case ETFClassID::CTFProjectile_EnergyBall: - flRadius = 146.f; + flRadius = TF_ROCKET_RADIUS; break; case ETFClassID::CTFGrenadePipebombProjectile: if (pProjectile->As()->HasStickyEffects()) - flRadius = 146.f; + flRadius = TF_ROCKET_RADIUS; break; case ETFClassID::CTFProjectile_Flare: if (pWeapon && pWeapon->As()->GetFlareGunType() == FLAREGUN_SCORCHSHOT) - flRadius = 110.f; + flRadius = TF_FLARE_DET_RADIUS; } if (pPlayer && pWeapon) { @@ -446,7 +444,7 @@ static inline void TracePoint(Vec3& vPoint, int& iType, Vec3& vTargetEye, Info_t if (iType & PointTypeEnum::Regular) { SDK::TraceHull(vTargetEye, vPoint, tInfo.m_vHull * -1, tInfo.m_vHull, MASK_SOLID, &filter, &trace); -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 s_mTraceCount["Splash regular"]++; #endif @@ -480,7 +478,7 @@ static inline void TracePoint(Vec3& vPoint, int& iType, Vec3& vTargetEye, Info_t if (!(iOriginalType & PointTypeEnum::Regular)) // don't do the same trace over again { SDK::Trace(vTargetEye, vPoint, MASK_SOLID, &filter, &trace); -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 s_mTraceCount["Splash rocket (2)"]++; #endif bNormal = !trace.m_pEnt || trace.fraction == 1.f; @@ -494,7 +492,7 @@ static inline void TracePoint(Vec3& vPoint, int& iType, Vec3& vTargetEye, Info_t filter.pSkip = trace.m_pEnt->GetClassID() != ETFClassID::CWorld || trace.hitbox ? trace.m_pEnt : nullptr; // make sure we get past entity or prop SDK::Trace(trace.endpos - (vTargetEye - vPoint).Normalized(), vPoint, MASK_SOLID | CONTENTS_NOSTARTSOLID, &filter, &trace); filter.pSkip = nullptr; -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 s_mTraceCount["Splash rocket (2, 2)"]++; #endif bNormal = trace.fraction == 1.f || trace.allsolid || (trace.startpos - trace.endpos).IsZero() || trace.surface.flags & (/*SURF_NODRAW |*/ SURF_SKY); @@ -507,7 +505,7 @@ static inline void TracePoint(Vec3& vPoint, int& iType, Vec3& vTargetEye, Info_t if (checkPoint(trace, bErase, bNormal)) { SDK::Trace(trace.endpos + trace.plane.normal, vTargetEye, MASK_SHOT, &filter, &trace); -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 s_mTraceCount["Splash rocket check (2)"]++; #endif #ifdef SPLASH_DEBUG2 @@ -535,7 +533,7 @@ static inline void TracePoint(Vec3& vPoint, int& iType, Vec3& vTargetEye, Info_t if (tInfo.m_iSplashMode == Vars::Aimbot::Projectile::RocketSplashModeEnum::Regular) // just do this for non rockets, it's less expensive { SDK::Trace(vPoint, vTargetEye, MASK_SHOT, &filter, &trace); -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 s_mTraceCount["Splash grate check"]++; #endif bNormal = trace.DidHit(); @@ -546,7 +544,7 @@ static inline void TracePoint(Vec3& vPoint, int& iType, Vec3& vTargetEye, Info_t goto breakOut; SDK::TraceHull(vPoint, vTargetEye, tInfo.m_vHull * -1, tInfo.m_vHull, MASK_SOLID, &filter, &trace); -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 s_mTraceCount["Splash grate"]++; #endif @@ -558,7 +556,7 @@ static inline void TracePoint(Vec3& vPoint, int& iType, Vec3& vTargetEye, Info_t else // currently experimental, there may be a more efficient way to do this? { SDK::Trace(vPoint, vTargetEye, MASK_SOLID | CONTENTS_NOSTARTSOLID, &filter, &trace); -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 s_mTraceCount["Splash rocket (1)"]++; #endif bNormal = trace.fraction == 1.f || trace.allsolid || trace.surface.flags & SURF_SKY; @@ -572,7 +570,7 @@ static inline void TracePoint(Vec3& vPoint, int& iType, Vec3& vTargetEye, Info_t CGameTrace trace2 = {}; SDK::Trace(trace.endpos - (vPoint - vTargetEye).Normalized(), vTargetEye, MASK_SOLID | CONTENTS_NOSTARTSOLID, &filter, &trace2); -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 s_mTraceCount["Splash rocket (1, 2)"]++; #endif bNormal = trace2.fraction == 1.f || trace.allsolid || (trace2.startpos - trace2.endpos).IsZero() || trace2.surface.flags & (SURF_NODRAW | SURF_SKY); @@ -588,7 +586,7 @@ static inline void TracePoint(Vec3& vPoint, int& iType, Vec3& vTargetEye, Info_t if (checkPoint(trace, bErase, bNormal)) { SDK::Trace(trace.endpos + trace.plane.normal, vTargetEye, MASK_SHOT, &filter, &trace); -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 s_mTraceCount["Splash rocket check (1)"]++; #endif #ifdef SPLASH_DEBUG2 @@ -703,7 +701,7 @@ std::vector CAimbotProjectile::GetSplashPoints(Target_t& tTarget, std:: return vPoints; } -void CAimbotProjectile::SetupSplashPoints(Target_t& tTarget, std::vector>& vSpherePoints, std::vector>& vSimplePoints) +void CAimbotProjectile::SetupSplashPoints(Target_t& tTarget, std::vector>& vSpherePoints, std::vector& vSimplePoints) { vSimplePoints.clear(); Vec3 vTargetEye = tTarget.m_vPos + m_tInfo.m_vTargetEye; @@ -735,7 +733,7 @@ void CAimbotProjectile::SetupSplashPoints(Target_t& tTarget, std::vector CAimbotProjectile::GetSplashPointsSimple(Target_t& tTarget, std::vector>& vSpherePoints, int iSimTime) +std::vector CAimbotProjectile::GetSplashPointsSimple(Target_t& tTarget, std::vector& vSpherePoints, int iSimTime) { std::vector> vPointDistances = {}; Vec3 vTargetEye = tTarget.m_vPos + m_tInfo.m_vTargetEye; -#if defined(SPLASH_DEBUG3) - auto drawTrace = [](bool bSuccess, Color_t tColor, CGameTrace& trace) - { - Vec3 vMins = Vec3(-1, -1, -1) / (bSuccess ? 1 : 2), vMaxs = Vec3(1, 1, 1) / (bSuccess ? 1 : 2); - Vec3 vAngles = Math::VectorAngles(trace.plane.normal); - G::BoxStorage.emplace_back(trace.endpos, vMins, vMaxs, vAngles, I::GlobalVars->curtime + 60.f, tColor.Alpha(tColor.a / (bSuccess ? 1 : 10)), Color_t(0, 0, 0, 0)); - G::LineStorage.emplace_back(std::pair(trace.startpos, trace.endpos), I::GlobalVars->curtime + 60.f, tColor.Alpha(tColor.a / (bSuccess ? 1 : 10))); - }; -#endif - auto checkPoint = [&](Vec3& vPoint, bool& bErase) { Point_t tPoint = { vPoint, {} }; @@ -784,31 +772,9 @@ std::vector CAimbotProjectile::GetSplashPointsSimple(Target_t& tTarget, }; for (auto it = vSpherePoints.begin(); it != vSpherePoints.end();) { - Vec3& vPoint = it->first; - Vec3& vNormal = it->second; bool bErase = false; - if (checkPoint(vPoint, bErase)) - { -#ifdef SPLASH_DEBUG3 - drawTrace(bErase, Vars::Colors::Halloween.Value, trace); -#endif - - /* - CGameTrace trace = {}; - CTraceFilterWorldAndPropsOnly filter = {}; - - SDK::Trace(vPoint + vNormal, vTargetEye, MASK_SHOT, &filter, &trace); -#ifdef SPLASH_DEBUG6 - s_mTraceCount["Splash trace check"]++; -#endif -#ifdef SPLASH_DEBUG3 - drawTrace(bErase, Vars::Colors::Powerup.Value, trace); -#endif - if (trace.fraction < 1.f) - vPointDistances.pop_back(); - */ - } + checkPoint(*it, bErase); if (bErase) it = vSpherePoints.erase(it); @@ -956,9 +922,9 @@ static inline void SolveProjectileSpeed(CTFWeaponBase* pWeapon, const Vec3& vLoc flDragTime = powf(flTime, 2) * flDrag / (flOverride ? flOverride : 1.5f); // rough estimate to prevent m_flTime being too low flVelocity = flVelocity - flVelocity * flTime * flDrag; } -void CAimbotProjectile::CalculateAngle(const Vec3& vLocalPos, const Vec3& vTargetPos, int iSimTime, Solution_t& out, bool bAccuracy) +void CAimbotProjectile::CalculateAngle(const Vec3& vLocalPos, const Vec3& vTargetPos, int iSimTime, Solution_t& tOut, bool bAccuracy) { - if (out.m_iCalculated != CalculatedEnum::Pending) + if (tOut.m_iCalculated != CalculatedEnum::Pending) return; const float flGrav = m_tInfo.m_flGravity * 800.f; @@ -982,29 +948,29 @@ void CAimbotProjectile::CalculateAngle(const Vec3& vLocalPos, const Vec3& vTarge else { // arch float flRoot = pow(flVelocity, 4) - flGrav * (flGrav * pow(flDist, 2) + 2.f * vDelta.z * pow(flVelocity, 2)); - if (out.m_iCalculated = flRoot < 0.f ? CalculatedEnum::Bad : CalculatedEnum::Pending) + if (tOut.m_iCalculated = flRoot < 0.f ? CalculatedEnum::Bad : CalculatedEnum::Pending) return; flPitch = atan((pow(flVelocity, 2) - sqrt(flRoot)) / (flGrav * flDist)); } - out.m_flTime = flDist / (cos(flPitch) * flVelocity) - m_tInfo.m_flOffsetTime + flDragTime; - out.m_flPitch = flPitch = -RAD2DEG(flPitch) - m_tInfo.m_vAngFix.x; - out.m_flYaw = flYaw = vAngleTo.y - m_tInfo.m_vAngFix.y; + tOut.m_flTime = flDist / (cos(flPitch) * flVelocity) - m_tInfo.m_flOffsetTime + flDragTime; + tOut.m_flPitch = flPitch = -RAD2DEG(flPitch) - m_tInfo.m_vAngFix.x; + tOut.m_flYaw = flYaw = vAngleTo.y - m_tInfo.m_vAngFix.y; } - int iTimeTo = int(out.m_flTime / TICK_INTERVAL) + 1; + int iTimeTo = int(tOut.m_flTime / TICK_INTERVAL) + 1; if (!m_tInfo.m_vOffset.IsZero()) { - if (out.m_iCalculated = iTimeTo > iSimTime ? CalculatedEnum::Time : CalculatedEnum::Pending) + if (tOut.m_iCalculated = iTimeTo > iSimTime ? CalculatedEnum::Time : CalculatedEnum::Pending) return; } else { - out.m_iCalculated = iTimeTo > iSimTime ? CalculatedEnum::Time : CalculatedEnum::Good; + tOut.m_iCalculated = iTimeTo > iSimTime ? CalculatedEnum::Time : CalculatedEnum::Good; return; } int iFlags = (bAccuracy ? ProjSimEnum::Trace : ProjSimEnum::None) | ProjSimEnum::NoRandomAngles | ProjSimEnum::PredictCmdNum; -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 if (iFlags & ProjSimEnum::Trace) { if (Vars::Visuals::Trajectory::Override.Value) @@ -1034,7 +1000,7 @@ void CAimbotProjectile::CalculateAngle(const Vec3& vLocalPos, const Vec3& vTarge } #endif ProjectileInfo tProjInfo = {}; - if (out.m_iCalculated = !F::ProjSim.GetInfo(m_tInfo.m_pLocal, m_tInfo.m_pWeapon, { flPitch, flYaw, 0 }, tProjInfo, iFlags) ? CalculatedEnum::Bad : CalculatedEnum::Pending) + if (tOut.m_iCalculated = !F::ProjSim.GetInfo(m_tInfo.m_pLocal, m_tInfo.m_pWeapon, { flPitch, flYaw, 0 }, tProjInfo, iFlags) ? CalculatedEnum::Bad : CalculatedEnum::Pending) return; { // calculate trajectory from projectile origin @@ -1046,15 +1012,15 @@ void CAimbotProjectile::CalculateAngle(const Vec3& vLocalPos, const Vec3& vTarge Vec3 vAngleTo = Math::CalcAngle(tProjInfo.m_vPos, vTargetPos); if (!flGrav) - out.m_flPitch = -DEG2RAD(vAngleTo.x); + tOut.m_flPitch = -DEG2RAD(vAngleTo.x); else { // arch float flRoot = pow(flVelocity, 4) - flGrav * (flGrav * pow(flDist, 2) + 2.f * vDelta.z * pow(flVelocity, 2)); - if (out.m_iCalculated = flRoot < 0.f ? CalculatedEnum::Bad : CalculatedEnum::Pending) + if (tOut.m_iCalculated = flRoot < 0.f ? CalculatedEnum::Bad : CalculatedEnum::Pending) return; - out.m_flPitch = atan((pow(flVelocity, 2) - sqrt(flRoot)) / (flGrav * flDist)); + tOut.m_flPitch = atan((pow(flVelocity, 2) - sqrt(flRoot)) / (flGrav * flDist)); } - out.m_flTime = flDist / (cos(out.m_flPitch) * flVelocity) + flDragTime; + tOut.m_flTime = flDist / (cos(tOut.m_flPitch) * flVelocity) + flDragTime; } { // correct yaw @@ -1067,7 +1033,7 @@ void CAimbotProjectile::CalculateAngle(const Vec3& vLocalPos, const Vec3& vTarge if (!vSolutions.empty()) { vShootPos += vForward * vSolutions.front(); - out.m_flYaw = flYaw - (RAD2DEG(atan2(vShootPos.y, vShootPos.x)) - flYaw); + tOut.m_flYaw = flYaw - (RAD2DEG(atan2(vShootPos.y, vShootPos.x)) - flYaw); flYaw = RAD2DEG(atan2(vShootPos.y, vShootPos.x)); } } @@ -1076,7 +1042,7 @@ void CAimbotProjectile::CalculateAngle(const Vec3& vLocalPos, const Vec3& vTarge if (flGrav) { flPitch -= tProjInfo.m_vAng.x; - out.m_flPitch = -RAD2DEG(out.m_flPitch) + flPitch - m_tInfo.m_vAngFix.x; + tOut.m_flPitch = -RAD2DEG(tOut.m_flPitch) + flPitch - m_tInfo.m_vAngFix.x; } else { @@ -1089,13 +1055,13 @@ void CAimbotProjectile::CalculateAngle(const Vec3& vLocalPos, const Vec3& vTarge if (!vSolutions.empty()) { vShootPos += vForward * vSolutions.front(); - out.m_flPitch = flPitch - (RAD2DEG(atan2(-vShootPos.z, vShootPos.x)) - flPitch); + tOut.m_flPitch = flPitch - (RAD2DEG(atan2(-vShootPos.z, vShootPos.x)) - flPitch); } } } - iTimeTo = int(out.m_flTime / TICK_INTERVAL) + 1; - out.m_iCalculated = iTimeTo > iSimTime ? CalculatedEnum::Time : CalculatedEnum::Good; + iTimeTo = int(tOut.m_flTime / TICK_INTERVAL) + 1; + tOut.m_iCalculated = iTimeTo > iSimTime ? CalculatedEnum::Time : CalculatedEnum::Good; } @@ -1103,7 +1069,7 @@ void CAimbotProjectile::CalculateAngle(const Vec3& vLocalPos, const Vec3& vTarge bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Target_t& tTarget, Vec3& vPoint, Vec3& vAngles, int iSimTime, bool bSplash, bool* pHitSolid, std::vector* pProjectilePath) { int iFlags = ProjSimEnum::Trace | ProjSimEnum::InitCheck | ProjSimEnum::NoRandomAngles | ProjSimEnum::PredictCmdNum; -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 if (Vars::Visuals::Trajectory::Override.Value) { if (!Vars::Visuals::Trajectory::Pipes.Value) @@ -1156,7 +1122,7 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar } F::ProjSim.SetupTrace(filter, nMask, pWeapon); -#ifdef SPLASH_DEBUG5 +#ifdef SPLASH_DEBUG4 Vec3 vHull = tProjInfo.m_vHull.Max(1); G::BoxStorage.emplace_back(vPoint, vHull * -1, vHull, Vec3(), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 0), Color_t(0, 0, 0, 0)); #endif @@ -1164,11 +1130,11 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar if (!tProjInfo.m_flGravity) { SDK::TraceHull(tProjInfo.m_vPos, vPoint, tProjInfo.m_vHull * -1, tProjInfo.m_vHull, nMask, &filter, &trace); -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 s_mTraceCount["Nograv trace"]++; #endif -#ifdef SPLASH_DEBUG5 - G::LineStorage.emplace_back(std::pair(tProjInfo.m_vPos, vPoint), I::GlobalVars->curtime + 5.f, Color_t(0, 0, 0)); +#ifdef SPLASH_DEBUG4 + G::LineStorage.emplace_back(std::pair(tProjInfo.m_vPos, trace.endpos), I::GlobalVars->curtime + 5.f, Color_t(0, 0, 0)); #endif if (trace.fraction < 0.999f && trace.m_pEnt != tTarget.m_pEntity) return false; @@ -1194,12 +1160,11 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar if (!bSplash) { SDK::TraceHull(vOld, vNew, tProjInfo.m_vHull * -1, tProjInfo.m_vHull, nMask, &filter, &trace); -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 s_mTraceCount["Direct trace"]++; #endif - -#ifdef SPLASH_DEBUG5 - G::LineStorage.emplace_back(std::pair(vOld, vNew), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 0)); +#ifdef SPLASH_DEBUG4 + G::LineStorage.emplace_back(std::pair(vOld, trace.endpos), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 0)); #endif } else @@ -1211,11 +1176,11 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar continue; SDK::TraceHull(vStaticPos, vNew, tProjInfo.m_vHull * -1, tProjInfo.m_vHull, nMask, &filter, &trace); -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 s_mTraceCount["Splash trace"]++; #endif -#ifdef SPLASH_DEBUG5 - G::LineStorage.emplace_back(std::pair(vStaticPos, vNew), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 0)); +#ifdef SPLASH_DEBUG4 + G::LineStorage.emplace_back(std::pair(vStaticPos, trace.endpos), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 0)); #endif vStaticPos = vNew; } @@ -1232,8 +1197,11 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar if (bValid && bSplash) { bValid = SDK::VisPosWorld(nullptr, tTarget.m_pEntity, trace.endpos, vPoint, nMask); -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 s_mTraceCount["Splash vispos"]++; +#endif +#ifdef SPLASH_DEBUG4 + G::LineStorage.emplace_back(std::pair(trace.endpos, vPoint), I::GlobalVars->curtime + 5.f, Color_t(0, 0, 255)); #endif if (bValid) { @@ -1249,13 +1217,16 @@ bool CAimbotProjectile::TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Tar CGameTrace eyeTrace = {}; SDK::Trace(vFrom, tTarget.m_vPos + tTarget.m_pEntity->As()->GetViewOffset(), MASK_SHOT, &filter, &eyeTrace); bValid = eyeTrace.fraction == 1.f; -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 s_mTraceCount["Eye trace"]++; +#endif +#ifdef SPLASH_DEBUG4 + G::LineStorage.emplace_back(std::pair(vFrom, trace.endpos), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 255)); #endif } } -#ifdef SPLASH_DEBUG5 +#ifdef SPLASH_DEBUG4 G::BoxStorage.pop_back(); if (bValid) G::BoxStorage.emplace_back(vPoint, vHull * -1, vHull, Vec3(), I::GlobalVars->curtime + 5.f, Color_t(0, 255, 0), Color_t(0, 0, 0, 0)); @@ -1397,7 +1368,7 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas auto mDirectPoints = iSplash == Vars::Aimbot::Projectile::SplashPredictionEnum::Only ? std::unordered_map() : GetDirectPoints(tTarget); auto vSpherePoints = !iSplash ? std::vector>() : ComputeSphere(m_tInfo.m_flRadius + flSize, iPoints); -#ifdef SPLASH_DEBUG4 +#ifdef SPLASH_DEBUG3 for (auto& [vPoint, _] : vSpherePoints) G::BoxStorage.emplace_back(tTarget.m_pEntity->m_vecOrigin() + m_tInfo.m_vTargetEye + vPoint, Vec3(-1, -1, -1), Vec3(1, 1, 1), Vec3(), I::GlobalVars->curtime + 60.f, Color_t(0, 0, 0, 0), Vars::Colors::Local.Value); #endif @@ -1419,15 +1390,15 @@ int CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBas std::vector vSplashPoints = {}; if (iSplash) { - Solution_t solution; CalculateAngle(m_tInfo.m_vLocalEye, tTarget.m_vPos, i, solution, false); - if (solution.m_iCalculated != CalculatedEnum::Bad) + Solution_t tSolution; CalculateAngle(m_tInfo.m_vLocalEye, tTarget.m_vPos, i, tSolution, false); + if (tSolution.m_iCalculated != CalculatedEnum::Bad) { bDirectBreaks = false; - const float flTimeTo = solution.m_flTime - TICKS_TO_TIME(i); + const float flTimeTo = tSolution.m_flTime - TICKS_TO_TIME(i); if (flTimeTo < m_tInfo.m_flBoundingTime) { - static std::vector> vSimplePoints = {}; + static std::vector vSimplePoints = {}; if (iMulti == Vars::Aimbot::Projectile::SplashModeEnum::Single) { SetupSplashPoints(tTarget, vSpherePoints, vSimplePoints); @@ -1758,10 +1729,10 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser if (!G::AimTarget.m_iEntIndex) G::AimTarget = { vTargets.front().m_pEntity->entindex(), I::GlobalVars->tickcount, 0 }; -#if defined(SPLASH_DEBUG1) || defined(SPLASH_DEBUG2) || defined(SPLASH_DEBUG3) || defined(SPLASH_DEBUG5) +#if defined(SPLASH_DEBUG1) || defined(SPLASH_DEBUG2) || defined(SPLASH_DEBUG4) G::LineStorage.clear(); #endif -#if defined(SPLASH_DEBUG1) || defined(SPLASH_DEBUG2) || defined(SPLASH_DEBUG3) || defined(SPLASH_DEBUG4) || defined(SPLASH_DEBUG5) +#if defined(SPLASH_DEBUG1) || defined(SPLASH_DEBUG2) || defined(SPLASH_DEBUG3) || defined(SPLASH_DEBUG4) G::BoxStorage.clear(); #endif for (auto& tTarget : vTargets) @@ -1885,7 +1856,7 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser void CAimbotProjectile::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) { const bool bSuccess = RunMain(pLocal, pWeapon, pCmd); -#ifdef SPLASH_DEBUG6 +#ifdef SPLASH_DEBUG5 if (Vars::Aimbot::General::AimType.Value && !s_mTraceCount.empty()) { int iTraceCount = 0; @@ -2136,7 +2107,7 @@ bool CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBa const float flTimeTo = solution.m_flTime - TICKS_TO_TIME(i); if (flTimeTo < m_tInfo.m_flBoundingTime) { - static std::vector> vSimplePoints = {}; + static std::vector vSimplePoints = {}; if (iMulti == Vars::Aimbot::Projectile::SplashModeEnum::Single) { SetupSplashPoints(tTarget, vSpherePoints, vSimplePoints); diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h index 43938f76..5dcd66b5 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h @@ -48,10 +48,10 @@ class CAimbotProjectile private: std::unordered_map GetDirectPoints(Target_t& tTarget, CBaseEntity* pProjectile = nullptr); std::vector GetSplashPoints(Target_t& tTarget, std::vector>& vSpherePoints, int iSimTime); - void SetupSplashPoints(Target_t& tTarget, std::vector>& vSpherePoints, std::vector>& vSimplePoints); - std::vector GetSplashPointsSimple(Target_t& tTarget, std::vector>& vSpherePoints, int iSimTime); + void SetupSplashPoints(Target_t& tTarget, std::vector>& vSpherePoints, std::vector& vSimplePoints); + std::vector GetSplashPointsSimple(Target_t& tTarget, std::vector& vSpherePoints, int iSimTime); - void CalculateAngle(const Vec3& vLocalPos, const Vec3& vTargetPos, int iSimTime, Solution_t& out, bool bAccuracy = true); + void CalculateAngle(const Vec3& vLocalPos, const Vec3& vTargetPos, int iSimTime, Solution_t& tOut, bool bAccuracy = true); bool TestAngle(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, Target_t& tTarget, Vec3& vPoint, Vec3& vAngles, int iSimTime, bool bSplash, bool* pHitSolid = nullptr, std::vector* pProjectilePath = nullptr); int CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, bool bVisuals = true); @@ -75,7 +75,7 @@ private: public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); float GetSplashRadius(CTFWeaponBase* pWeapon, CTFPlayer* pPlayer); - + bool AutoAirblast(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, CBaseEntity* pProjectile); float GetSplashRadius(CBaseEntity* pProjectile, CTFWeaponBase* pWeapon = nullptr, CTFPlayer* pPlayer = nullptr, float flScale = 1.f, CTFWeaponBase* pAirblast = nullptr); diff --git a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp index a2b2b07a..8ba05b28 100644 --- a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp +++ b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp @@ -45,7 +45,7 @@ static inline bool GetRadius(EntityEnum::EntityEnum iGroup, CBaseEntity* pProjec if (!pPipebomb->m_flCreationTime() || I::GlobalVars->curtime < pPipebomb->m_flCreationTime() + SDK::AttribHookValue(0.8f, "sticky_arm_time", pWeapon)) return false; - flRadius *= 146.f; + flRadius *= TF_ROCKET_RADIUS; if (!pPipebomb->m_bTouched()) { static auto tf_grenadelauncher_livetime = H::ConVars.FindVar("tf_grenadelauncher_livetime"); @@ -58,7 +58,7 @@ static inline bool GetRadius(EntityEnum::EntityEnum iGroup, CBaseEntity* pProjec } } else - flRadius *= 110.f; + flRadius *= TF_FLARE_DET_RADIUS; flRadius = SDK::AttribHookValue(flRadius, "mult_explosion_radius", pWeapon); return true; } diff --git a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp index c0fefae5..10e7fdba 100644 --- a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp +++ b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.cpp @@ -72,10 +72,9 @@ bool CAutoRocketJump::SetAngles(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser Vec3 vShootPos = (tProjInfo.m_vPos - vLocalPos).To2D(); Vec3 vTarget = vPoint - vLocalPos; Vec3 vForward; Math::AngleVectors(tProjInfo.m_vAng, &vForward); vForward.Normalize2D(); - float flA = 1.f; float flB = 2 * (vShootPos.x * vForward.x + vShootPos.y * vForward.y); float flC = vShootPos.Length2DSqr() - vTarget.Length2DSqr(); - auto vSolutions = Math::SolveQuadratic(flA, flB, flC); + auto vSolutions = Math::SolveQuadratic(1.f, flB, flC); if (!vSolutions.empty()) { vShootPos += vForward * vSolutions.front(); @@ -88,10 +87,9 @@ bool CAutoRocketJump::SetAngles(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser Vec3 vShootPos = Math::RotatePoint(tProjInfo.m_vPos - vLocalPos, {}, { 0, -flYaw, 0 }); vShootPos.y = 0; Vec3 vTarget = Math::RotatePoint(vPoint - vLocalPos, {}, { 0, -flYaw, 0 }); Vec3 vForward; Math::AngleVectors(tProjInfo.m_vAng - Vec3(0, flYaw, 0), &vForward); vForward.y = 0; vForward.Normalize(); - float flA = 1.f; float flB = 2 * (vShootPos.x * vForward.x + vShootPos.z * vForward.z); float flC = (powf(vShootPos.x, 2) + powf(vShootPos.z, 2)) - (powf(vTarget.x, 2) + powf(vTarget.z, 2)); - auto vSolutions = Math::SolveQuadratic(flA, flB, flC); + auto vSolutions = Math::SolveQuadratic(1.f, flB, flC); if (!vSolutions.empty()) { vShootPos += vForward * vSolutions.front(); @@ -120,7 +118,7 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p return; } - bool bValidWeapon = false; + bool bValidWeapon = false, bBeggars = pWeapon->m_iItemDefinitionIndex() == Soldier_m_TheBeggarsBazooka; { switch (pWeapon->GetWeaponID()) { @@ -137,7 +135,7 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p else if (Vars::Misc::Movement::AutoRocketJump.Value || Vars::Misc::Movement::AutoCTap.Value) pCmd->buttons &= ~IN_ATTACK2; // fix for retarded issue - if (m_iFrame == -1 && (pWeapon->m_iItemDefinitionIndex() == Soldier_m_TheBeggarsBazooka ? G::Attacking == 1 : G::CanPrimaryAttack || G::Reloading) + if (m_iFrame == -1 && (bCurrGrounded && bBeggars ? G::Attacking == 1 : G::CanPrimaryAttack || G::Reloading) && SetAngles(pLocal, pWeapon, pCmd)) { bool bWillHit = false; @@ -151,10 +149,14 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p if (bMoveSimSetup && bProjSimSetup) { Vec3 vOriginal = F::ProjSim.GetOrigin(); + int iSkip = bCurrGrounded ? Vars::Misc::Movement::AutoRocketJumpSkipGround.Value : Vars::Misc::Movement::AutoRocketJumpSkipAir.Value; for (int n = 1; n < 10; n++) { - Vec3 Old = F::ProjSim.GetOrigin(); F::MoveSim.RunTick(tStorage); + if (n <= iSkip) + continue; + + Vec3 Old = F::ProjSim.GetOrigin(); F::ProjSim.RunTick(tProjInfo); Vec3 New = F::ProjSim.GetOrigin(); @@ -174,21 +176,26 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p Vec3 vPos; pLocal->m_Collision()->CalcNearestPoint(vPoint, &vPos); pLocal->SetAbsOrigin(vOriginal); - return vPoint.DistTo(vPos) < 120.f && SDK::VisPosWorld(pLocal, pLocal, vPoint, vOrigin + pLocal->m_vecViewOffset(), MASK_SHOT); + return vPoint.DistTo(vPos) < TF_ROCKET_RADIUS_FOR_RJS && SDK::VisPosWorld(pLocal, pLocal, vPoint, vOrigin + pLocal->m_vecViewOffset(), MASK_SHOT); }; bWillHit = WillHit(pLocal, tStorage.m_MoveData.m_vecAbsOrigin, trace.endpos + trace.plane.normal); - m_iDelay = std::max(n + (n > Vars::Misc::Movement::ApplyAbove.Value ? Vars::Misc::Movement::TimingOffset.Value : 0), 0); - - if (bWillHit && G::CanPrimaryAttack) + if (bWillHit) { - SDK::Output("Auto jump", std::format("Ticks to hit: {} ({})", m_iDelay, n).c_str(), { 255, 0, 0 }, Vars::Debug::Logging.Value); - if (Vars::Debug::Info.Value) + m_iDelay = n; + if (Vars::Misc::Movement::AutoRocketJumpTimingOffset.Value && n > Vars::Misc::Movement::AutoRocketJumpApplyAbove.Value) + m_iDelay = std::max(m_iDelay + Vars::Misc::Movement::AutoRocketJumpTimingOffset.Value, 0); + + if (G::CanPrimaryAttack) { - //G::LineStorage.clear(); G::BoxStorage.clear(); - Vec3 vAngles = Math::VectorAngles(trace.plane.normal); - G::BoxStorage.emplace_back(trace.endpos + trace.plane.normal, Vec3(-1.f, -1.f, -1.f), Vec3(1.f, 1.f, 1.f), vAngles, I::GlobalVars->curtime + 5.f, Color_t(), Color_t(0, 0, 0, 0), true); - G::LineStorage.emplace_back(std::pair(tStorage.m_MoveData.m_vecAbsOrigin + pLocal->m_vecViewOffset(), trace.endpos + trace.plane.normal), I::GlobalVars->curtime + 5.f, Color_t(), true); + SDK::Output("Auto jump", std::format("Ticks to hit: {} ({})", m_iDelay, n).c_str(), { 255, 0, 0 }, Vars::Debug::Logging.Value); + if (Vars::Debug::Info.Value) + { + //G::LineStorage.clear(); G::BoxStorage.clear(); + Vec3 vAngles = Math::VectorAngles(trace.plane.normal); + G::BoxStorage.emplace_back(trace.endpos + trace.plane.normal, Vec3(-1.f, -1.f, -1.f), Vec3(1.f, 1.f, 1.f), vAngles, I::GlobalVars->curtime + 5.f, Color_t(), Color_t(0, 0, 0, 0), true); + G::LineStorage.emplace_back(std::pair(tStorage.m_MoveData.m_vecAbsOrigin + pLocal->m_vecViewOffset(), trace.endpos + trace.plane.normal), I::GlobalVars->curtime + 5.f, Color_t(), true); + } } } @@ -206,30 +213,24 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p if (bWillHit) { if (bCurrGrounded && bCurrGrounded == bLastGrounded) - { - if (Vars::Misc::Movement::AutoRocketJump.Value || Vars::Misc::Movement::AutoCTap.Value) - m_iFrame = 0; - if (Vars::Misc::Movement::AutoRocketJump.Value) - m_bFull = true; - } + m_iFrame = 0; else if (!bCurrGrounded) - { - if (pWeapon->m_iItemDefinitionIndex() != Soldier_m_TheBeggarsBazooka) - pCmd->buttons |= IN_ATTACK; + m_iFrame = m_iDelay = 0; - if (Vars::Misc::Movement::AutoRocketJump.Value && G::CanPrimaryAttack) + if (m_iFrame != -1) + { + m_bFull = Vars::Misc::Movement::AutoRocketJump.Value; + m_iChoke = bCurrGrounded ? Vars::Misc::Movement::AutoRocketJumpChokeGrounded.Value : Vars::Misc::Movement::AutoRocketJumpChokeAir.Value; + + if (G::Reloading) { - G::SilentAngles = true; - pCmd->viewangles = m_vAngles; + m_iFrame = -1; + if (!bBeggars) + pCmd->buttons |= IN_ATTACK; + else + pCmd->buttons &= ~IN_ATTACK; } } - - if (m_iFrame != -1 && G::Reloading) - { - m_iFrame = -1; - m_bFull = false; - pCmd->buttons |= IN_ATTACK; - } } if (m_iFrame == -1 && pWeapon->GetWeaponID() == TF_WEAPON_PARTICLE_CANNON && G::OriginalCmd.buttons & IN_ATTACK2) @@ -243,7 +244,7 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p if (m_iFrame == 1) { - if (pWeapon->m_iItemDefinitionIndex() != Soldier_m_TheBeggarsBazooka) + if (!bBeggars) pCmd->buttons |= IN_ATTACK; if (m_bFull) @@ -253,7 +254,7 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p } } - if (m_iFrame <= Vars::Misc::Movement::ChokeCount.Value) + if (m_iFrame <= m_iChoke) G::PSilentAngles = true, G::SilentAngles = false; // only con to this is that you may not be able to choke depending on the ticks charged if (m_iDelay > 1) @@ -271,10 +272,7 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p pCmd->buttons |= IN_DUCK | IN_JUMP; if (m_iFrame == m_iDelay + 3) - { m_iFrame = -1; - m_bFull = false; - } } m_bRunning = m_iFrame != -1; // prevent stuff like antiaim messing with timing diff --git a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.h b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.h index c153f64d..6afeaa35 100644 --- a/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.h +++ b/Amalgam/src/Features/Aimbot/AutoRocketJump/AutoRocketJump.h @@ -10,6 +10,7 @@ private: bool m_bFull = false; int m_iFrame = -1; int m_iDelay = 0; + int m_iChoke = 0; bool m_bRunning = false; public: diff --git a/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp b/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp index 7d621535..0b2d5df5 100644 --- a/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp +++ b/Amalgam/src/Features/EnginePrediction/EnginePrediction.cpp @@ -38,7 +38,7 @@ void CEnginePrediction::Simulate(CTFPlayer* pLocal, CUserCmd* pCmd) I::MoveHelper->SetHost(pLocal); pLocal->m_pCurrentCommand() = pCmd; - *G::RandomSeed() = MD5_PseudoRandom(pCmd->command_number) & std::numeric_limits::max(); + G::RandomSeed() = MD5_PseudoRandom(pCmd->command_number) & std::numeric_limits::max(); I::Prediction->m_bFirstTimePredicted = false; I::Prediction->m_bInPrediction = true; @@ -52,7 +52,7 @@ void CEnginePrediction::Simulate(CTFPlayer* pLocal, CUserCmd* pCmd) I::MoveHelper->SetHost(nullptr); pLocal->m_pCurrentCommand() = nullptr; - *G::RandomSeed() = -1; + G::RandomSeed() = -1; pLocal->m_nTickBase() = nOldTickBase; I::Prediction->m_bFirstTimePredicted = bOldIsFirstPrediction; diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.cpp b/Amalgam/src/Features/ImGui/Menu/Menu.cpp index da42266b..fb8e0765 100644 --- a/Amalgam/src/Features/ImGui/Menu/Menu.cpp +++ b/Amalgam/src/Features/ImGui/Menu/Menu.cpp @@ -1028,9 +1028,12 @@ void CMenu::MenuMisc(int iTab) { if (Section("##Debug")) { - FSlider(Vars::Misc::Movement::TimingOffset); - FSlider(Vars::Misc::Movement::ChokeCount); - FSlider(Vars::Misc::Movement::ApplyAbove); + FSlider(Vars::Misc::Movement::AutoRocketJumpChokeGrounded, FToggleEnum::Left); + FSlider(Vars::Misc::Movement::AutoRocketJumpChokeAir, FToggleEnum::Right); + FSlider(Vars::Misc::Movement::AutoRocketJumpSkipGround, FToggleEnum::Left); + FSlider(Vars::Misc::Movement::AutoRocketJumpSkipAir, FToggleEnum::Right); + FSlider(Vars::Misc::Movement::AutoRocketJumpTimingOffset, FToggleEnum::Left); + FSlider(Vars::Misc::Movement::AutoRocketJumpApplyAbove, FToggleEnum::Right); } EndSection(); } if (Section("Automation")) diff --git a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp index 248009cd..0fbac06a 100644 --- a/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp +++ b/Amalgam/src/Features/Simulation/ProjectileSimulation/ProjectileSimulation.cpp @@ -285,7 +285,7 @@ bool CProjectileSimulation::GetInfoMain(CTFPlayer* pPlayer, CTFWeaponBase* pWeap bool CProjectileSimulation::GetInfo(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, Vec3 vAngles, ProjectileInfo& tProjInfo, int iFlags, float flAutoCharge) { - bool InitCheck = iFlags & ProjSimEnum::InitCheck; + bool bInitCheck = iFlags & ProjSimEnum::InitCheck; bool bQuick = iFlags & ProjSimEnum::Quick; const float flOldCurrentTime = I::GlobalVars->curtime; @@ -294,7 +294,7 @@ bool CProjectileSimulation::GetInfo(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, I::GlobalVars->curtime = flOldCurrentTime; tProjInfo.m_iFlags = iFlags; - if (!bReturn || !InitCheck) + if (!bReturn || !bInitCheck) return bReturn; CGameTrace trace = {}; @@ -305,7 +305,9 @@ bool CProjectileSimulation::GetInfo(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, Vec3 vEnd = tProjInfo.m_vPos; SDK::TraceHull(vStart, vEnd, tProjInfo.m_vHull * -1.f, tProjInfo.m_vHull, MASK_SOLID, &filter, &trace); - return !trace.DidHit(); + tProjInfo.m_vPos = trace.endpos; + + return true; } void CProjectileSimulation::GetInfo(CBaseEntity* pProjectile, ProjectileInfo& tProjInfo) diff --git a/Amalgam/src/Features/Spectate/Spectate.cpp b/Amalgam/src/Features/Spectate/Spectate.cpp index 645a651f..f59085c5 100644 --- a/Amalgam/src/Features/Spectate/Spectate.cpp +++ b/Amalgam/src/Features/Spectate/Spectate.cpp @@ -7,13 +7,13 @@ void CSpectate::NetUpdateEnd(CTFPlayer* pLocal) m_iTarget = m_iIntendedTarget; CTFPlayer* pEntity = nullptr; - if (m_iTarget != -1) + if (HasTarget()) { pEntity = I::ClientEntityList->GetClientEntity(I::EngineClient->GetPlayerForUserID(m_iTarget))->As(); if (pEntity == pLocal) m_iTarget = m_iIntendedTarget = -1; } - if (m_iTarget == -1) + if (!HasTarget()) { if (pLocal->IsAlive() && pLocal->m_hObserverTarget()) { @@ -46,7 +46,7 @@ void CSpectate::NetUpdateEnd(CTFPlayer* pLocal) void CSpectate::NetUpdateStart(CTFPlayer* pLocal) { - if (!pLocal || m_iTarget == -1) + if (!pLocal || !HasTarget()) return; pLocal->m_hObserverTarget().Set(m_hOriginalTarget); @@ -61,15 +61,15 @@ void CSpectate::CreateMove(CUserCmd* pCmd) static bool bStaticView = false; const bool bLastView = bStaticView; - const bool bCurrView = bStaticView = m_iTarget != -1; - if (!bCurrView) - { - if (bLastView) - I::EngineClient->SetViewAngles(m_vOldView); + const bool bCurrView = bStaticView = HasTarget(); + if (!bCurrView && !bLastView) m_vOldView = pCmd->viewangles; - } else + { + if (!bCurrView) + I::EngineClient->SetViewAngles(m_vOldView); pCmd->viewangles = m_vOldView; + } } void CSpectate::SetTarget(int iTarget) diff --git a/Amalgam/src/Features/Spectate/Spectate.h b/Amalgam/src/Features/Spectate/Spectate.h index 6421d979..e36dcc68 100644 --- a/Amalgam/src/Features/Spectate/Spectate.h +++ b/Amalgam/src/Features/Spectate/Spectate.h @@ -9,6 +9,8 @@ public: void CreateMove(CUserCmd* pCmd); void SetTarget(int iTarget); + inline bool HasTarget() { return m_iTarget != -1; } + int m_iTarget = -1; int m_iIntendedTarget = -1; Vec3 m_vOldView = {}; // don't let spectating change viewangles diff --git a/Amalgam/src/Features/Visuals/ESP/ESP.cpp b/Amalgam/src/Features/Visuals/ESP/ESP.cpp index 33dcaff8..ce49f5be 100644 --- a/Amalgam/src/Features/Visuals/ESP/ESP.cpp +++ b/Amalgam/src/Features/Visuals/ESP/ESP.cpp @@ -16,7 +16,7 @@ static inline void StorePlayer(CTFPlayer* pPlayer, CTFPlayer* pLocal, Group_t* p int iObserverTarget = pLocal->m_hObserverTarget().GetEntryIndex(); int iObserverMode = pLocal->m_iObserverMode(); - if (F::Spectate.m_iTarget != -1) + if (F::Spectate.HasTarget()) { iObserverTarget = F::Spectate.m_hTargetTarget.GetEntryIndex(); iObserverMode = F::Spectate.m_iTargetMode; diff --git a/Amalgam/src/Features/Visuals/SpectatorList/SpectatorList.cpp b/Amalgam/src/Features/Visuals/SpectatorList/SpectatorList.cpp index 4b369591..1b1afdb0 100644 --- a/Amalgam/src/Features/Visuals/SpectatorList/SpectatorList.cpp +++ b/Amalgam/src/Features/Visuals/SpectatorList/SpectatorList.cpp @@ -36,12 +36,12 @@ bool CSpectatorList::GetSpectators(CTFPlayer* pTarget) int iObserverTarget = !pPlayer->IsDormant() ? pPlayer->m_hObserverTarget().GetEntryIndex() : iTarget; int iObserverMode = pPlayer->m_iObserverMode(); - if (bLocal && F::Spectate.m_iTarget != -1) + if (bLocal && F::Spectate.HasTarget()) { iObserverTarget = F::Spectate.m_hOriginalTarget.GetEntryIndex(); iObserverMode = F::Spectate.m_iOriginalMode; } - if (iObserverTarget != iTarget || bLocal && !I::EngineClient->IsPlayingDemo() && F::Spectate.m_iTarget == -1) + if (iObserverTarget != iTarget || bLocal && !I::EngineClient->IsPlayingDemo() && !F::Spectate.HasTarget()) { if (m_mRespawnCache.contains(n)) m_mRespawnCache.erase(n); diff --git a/Amalgam/src/Features/Visuals/Visuals.cpp b/Amalgam/src/Features/Visuals/Visuals.cpp index cc908812..1c578e93 100644 --- a/Amalgam/src/Features/Visuals/Visuals.cpp +++ b/Amalgam/src/Features/Visuals/Visuals.cpp @@ -51,7 +51,7 @@ void CVisuals::ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const Vec3 vAngles = bQuick ? I::EngineClient->GetViewAngles() : G::CurrentUserCmd->viewangles; int iFlags = bQuick ? ProjSimEnum::Trace | ProjSimEnum::InitCheck | ProjSimEnum::Quick : ProjSimEnum::Trace | ProjSimEnum::InitCheck; - if (bQuick && F::Spectate.m_iTarget != -1) + if (bQuick && F::Spectate.HasTarget()) { pPlayer = I::ClientEntityList->GetClientEntity(I::EngineClient->GetPlayerForUserID(F::Spectate.m_iTarget))->As(); if (!pPlayer || pPlayer->IsDormant()) @@ -111,20 +111,20 @@ void CVisuals::ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const case TF_WEAPON_ROCKETLAUNCHER_DIRECTHIT: case TF_WEAPON_PARTICLE_CANNON: if (Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::Rockets) - flRadius = 146.f; + flRadius = TF_ROCKET_RADIUS; break; case TF_WEAPON_PIPEBOMBLAUNCHER: if (Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::Stickies) - flRadius = 146.f; + flRadius = TF_ROCKET_RADIUS; break; case TF_WEAPON_GRENADELAUNCHER: if (Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::Pipes) - flRadius = 146.f; + flRadius = TF_ROCKET_RADIUS; break; case TF_WEAPON_FLAREGUN: case TF_WEAPON_FLAREGUN_REVENGE: if (Vars::Visuals::Simulation::SplashRadius.Value & Vars::Visuals::Simulation::SplashRadiusEnum::ScorchShot && pWeapon->As()->GetFlareGunType() == FLAREGUN_SCORCHSHOT) - flRadius = 110.f; + flRadius = TF_FLARE_DET_RADIUS; } if (flRadius) @@ -648,8 +648,8 @@ MAKE_HOOK(NDebugOverlay_BoxAngles, S::NDebugOverlay_BoxAngles(), void, if (s_bBoxesHeadOnly) { - const auto dwDesired = S::CBaseAnimating_DrawServerHitboxes_BoxAngles_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CBaseAnimating_DrawServerHitboxes_BoxAngles_Call(); if (dwRetAddr == dwDesired && (r != 255 || g != 127 || b != 127)) return; @@ -712,7 +712,7 @@ void CVisuals::FOV(CTFPlayer* pLocal, CViewSetup* pView) void CVisuals::ThirdPerson(CTFPlayer* pLocal, CViewSetup* pView) { - if (!pLocal->IsAlive() || F::Spectate.m_iTarget != -1) + if (!pLocal->IsAlive() || F::Spectate.HasTarget()) return I::Input->CAM_ToFirstPerson(); const bool bForce = pLocal->IsTaunting() || pLocal->IsAGhost() || pLocal->InCond(TF_COND_HALLOWEEN_KART) || pLocal->InCond(TF_COND_STUNNED) && pLocal->m_iStunFlags() & (TF_STUN_CONTROLS | TF_STUN_LOSER_STATE); diff --git a/Amalgam/src/Hooks/CAttributeManager_AttribHookValue.cpp b/Amalgam/src/Hooks/CAttributeManager_AttribHookValue.cpp index 2bb60f54..ead3622b 100644 --- a/Amalgam/src/Hooks/CAttributeManager_AttribHookValue.cpp +++ b/Amalgam/src/Hooks/CAttributeManager_AttribHookValue.cpp @@ -12,12 +12,12 @@ MAKE_HOOK(CAttributeManager_AttribHookInt, S::CAttributeManager_AttribHookInt(), int value, const char* name, void* econent, void* buffer, bool isGlobalConstString) { #ifdef DEBUG_HOOKS - if (!Vars::Hooks::CAttributeManager_AttribHookValue[DEFAULT_BIND]) + if (!Vars::Hooks::CAttributeManager_AttribHookInt[DEFAULT_BIND]) return CALL_ORIGINAL(value, name, econent, buffer, isGlobalConstString); #endif - const auto dwDesired = S::CTFPlayer_FireEvent_AttribHookValue_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CTFPlayer_FireEvent_AttribHookValue_Call(); if (dwRetAddr == dwDesired && Vars::Visuals::Effects::SpellFootsteps.Value && econent == H::Entities.GetLocal() && FNV1A::Hash32(name) == FNV1A::Hash32Const("halloween_footstep_type")) diff --git a/Amalgam/src/Hooks/CBaseEntity_SetAbsVelocity.cpp b/Amalgam/src/Hooks/CBaseEntity_SetAbsVelocity.cpp index 7602e144..49f89d7c 100644 --- a/Amalgam/src/Hooks/CBaseEntity_SetAbsVelocity.cpp +++ b/Amalgam/src/Hooks/CBaseEntity_SetAbsVelocity.cpp @@ -62,8 +62,8 @@ MAKE_HOOK(CBaseEntity_SetAbsVelocity, S::CBaseEntity_SetAbsVelocity(), void, return CALL_ORIGINAL(rcx, vecAbsVelocity); #endif - const auto dwDesired = S::CBasePlayer_PostDataUpdate_SetAbsVelocity_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CBasePlayer_PostDataUpdate_SetAbsVelocity_Call(); if (dwRetAddr != dwDesired) return CALL_ORIGINAL(rcx, vecAbsVelocity); diff --git a/Amalgam/src/Hooks/CBaseEntity_WorldSpaceCenter.cpp b/Amalgam/src/Hooks/CBaseEntity_WorldSpaceCenter.cpp index 3f34cd68..5fc4323e 100644 --- a/Amalgam/src/Hooks/CBaseEntity_WorldSpaceCenter.cpp +++ b/Amalgam/src/Hooks/CBaseEntity_WorldSpaceCenter.cpp @@ -12,8 +12,8 @@ MAKE_HOOK(CBaseEntity_WorldSpaceCenter, S::CBaseEntity_WorldSpaceCenter(), const return CALL_ORIGINAL(rcx); #endif - const auto dwDesired = S::CDamageAccountPanel_DisplayDamageFeedback_WorldSpaceCenter_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CDamageAccountPanel_DisplayDamageFeedback_WorldSpaceCenter_Call(); if (dwRetAddr == dwDesired && Vars::Visuals::Effects::DrawDamageNumbersThroughWalls.Value) return S::MainViewOrigin.Call(); diff --git a/Amalgam/src/Hooks/CBaseHudChatLine_InsertAndColorizeText.cpp b/Amalgam/src/Hooks/CBaseHudChatLine_InsertAndColorizeText.cpp index 968370fa..809e2b22 100644 --- a/Amalgam/src/Hooks/CBaseHudChatLine_InsertAndColorizeText.cpp +++ b/Amalgam/src/Hooks/CBaseHudChatLine_InsertAndColorizeText.cpp @@ -24,7 +24,7 @@ MAKE_HOOK(CBaseHudChatLine_InsertAndColorizeText, S::CBaseHudChatLine_InsertAndC if (const char* sReplace = F::PlayerUtils.GetPlayerName(clientIndex, nullptr, &iType)) { if (iFind != std::string::npos) - sMessage = sMessage.replace(std::max(iFind - 1, 0ui64), strlen(sName) + 1, std::format("\x3{}\x1", sReplace)); + sMessage = sMessage.replace(std::max(int(iFind) - 1, 0), strlen(sName) + 1, std::format("\x3{}\x1", sReplace)); sName = sReplace; } @@ -45,9 +45,9 @@ MAKE_HOOK(CBaseHudChatLine_InsertAndColorizeText, S::CBaseHudChatLine_InsertAndC if (!sTag.empty()) { - if (iFind != std::string::npos) - sMessage.insert(iFind + strlen(sName), "\x1"); - sMessage.insert(0, std::format("{}[{}] \x3", cColor, sTag)); + if (iFind != std::string::npos && iType == NameTypeEnum::None) + sMessage = sMessage.replace(std::max(int(iFind) - 1, 0), strlen(sName) + 1, std::format("\x3{}\x1", sName)); + sMessage.insert(0, std::format("{}[{}] ", cColor, sTag)); } } diff --git a/Amalgam/src/Hooks/CBasePlayer_CalcObserverView.cpp b/Amalgam/src/Hooks/CBasePlayer_CalcObserverView.cpp index 25d08134..ad056a50 100644 --- a/Amalgam/src/Hooks/CBasePlayer_CalcObserverView.cpp +++ b/Amalgam/src/Hooks/CBasePlayer_CalcObserverView.cpp @@ -12,7 +12,7 @@ MAKE_HOOK(CBasePlayer_CalcObserverView, S::CBasePlayer_CalcObserverView(), void, return CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles, fov); #endif - if (F::Spectate.m_iTarget == -1) + if (!F::Spectate.HasTarget()) return CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles, fov); auto pPlayer = reinterpret_cast(rcx); diff --git a/Amalgam/src/Hooks/CBasePlayer_CalcView.cpp b/Amalgam/src/Hooks/CBasePlayer_CalcView.cpp index b15cdb00..64681943 100644 --- a/Amalgam/src/Hooks/CBasePlayer_CalcView.cpp +++ b/Amalgam/src/Hooks/CBasePlayer_CalcView.cpp @@ -12,7 +12,7 @@ MAKE_HOOK(CBasePlayer_CalcView, S::CBasePlayer_CalcView(), void, return CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles, zNear, zFar, fov); #endif - if (!Vars::Visuals::Removals::ViewPunch.Value && F::Spectate.m_iTarget == -1) + if (!Vars::Visuals::Removals::ViewPunch.Value && !F::Spectate.HasTarget()) return CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles, zNear, zFar, fov); auto pPlayer = reinterpret_cast(rcx); diff --git a/Amalgam/src/Hooks/CBasePlayer_CalcViewModelView.cpp b/Amalgam/src/Hooks/CBasePlayer_CalcViewModelView.cpp index 53862ddb..675f8662 100644 --- a/Amalgam/src/Hooks/CBasePlayer_CalcViewModelView.cpp +++ b/Amalgam/src/Hooks/CBasePlayer_CalcViewModelView.cpp @@ -1,20 +1,20 @@ #include "../SDK/SDK.h" -MAKE_SIGNATURE(CBasePlayer_CalcViewModelView, "client.dll", "48 89 74 24 ? 55 41 56 41 57 48 8D AC 24", 0x0); +MAKE_SIGNATURE(CBaseViewModel_CalcViewModelView, "client.dll", "48 89 74 24 ? 55 41 56 41 57 48 8D AC 24", 0x0); +MAKE_SIGNATURE(CBasePlayer_CalcViewModelView, "client.dll", "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 49 8B F0 48 8B EA 48 8B F9 33 DB", 0x0); -MAKE_HOOK(CBasePlayer_CalcViewModelView, S::CBasePlayer_CalcViewModelView(), void, - void* rcx, CBaseEntity* pOwner, /*const*/ Vec3& vEyePosition, Vec3& vEyeAngles) +MAKE_HOOK(CBaseViewModel_CalcViewModelView, S::CBaseViewModel_CalcViewModelView(), void, + void* rcx, CBasePlayer* owner, /*const*/ Vector& eyePosition, /*const*/ QAngle& eyeAngles) { #ifdef DEBUG_HOOKS - if (!Vars::Hooks::CBasePlayer_CalcViewModelView[DEFAULT_BIND]) - return CALL_ORIGINAL(rcx, pOwner, vEyePosition, vEyeAngles); + if (!Vars::Hooks::CBaseViewModel_CalcViewModelView[DEFAULT_BIND]) + return CALL_ORIGINAL(rcx, owner, eyePosition, eyeAngles); #endif Vec3 vOffset = { Vars::Visuals::Viewmodel::OffsetX.Value, Vars::Visuals::Viewmodel::OffsetY.Value, Vars::Visuals::Viewmodel::OffsetZ.Value }; - bool bOffset = !vOffset.IsZero(); - - if (!Vars::Visuals::Viewmodel::ViewmodelAim.Value && !bOffset && !Vars::Visuals::Viewmodel::Roll.Value || SDK::CleanScreenshot()) - return CALL_ORIGINAL(rcx, pOwner, vEyePosition, vEyeAngles); + Vec3 vAngles = { Vars::Visuals::Viewmodel::Pitch.Value, Vars::Visuals::Viewmodel::Yaw.Value, Vars::Visuals::Viewmodel::Roll.Value }; + if (!Vars::Visuals::Viewmodel::ViewmodelAim.Value && vOffset.IsZero() && vAngles.IsZero() || SDK::CleanScreenshot()) + return CALL_ORIGINAL(rcx, owner, eyePosition, eyeAngles); bool bFlip = G::FlipViewmodels; @@ -23,26 +23,39 @@ MAKE_HOOK(CBasePlayer_CalcViewModelView, S::CBasePlayer_CalcViewModelView(), voi auto pLocal = H::Entities.GetLocal(); if (pLocal && pLocal->IsAlive() && G::AimPoint.m_iTickCount) { - Vec3 vDiff = I::EngineClient->GetViewAngles() - Math::CalcAngle(vEyePosition, G::AimPoint.m_vOrigin); + Vec3 vDiff = I::EngineClient->GetViewAngles() - Math::CalcAngle(eyePosition, G::AimPoint.m_vOrigin); if (bFlip) vDiff.y *= -1; - vEyeAngles = I::EngineClient->GetViewAngles() - vDiff; + eyeAngles = I::EngineClient->GetViewAngles() - vDiff; } } - if (bOffset) + if (!vOffset.IsZero()) { - Vec3 vForward, vRight, vUp; Math::AngleVectors(vEyeAngles, &vForward, &vRight, &vUp); - vEyePosition += vForward * vOffset.y; - vEyePosition += vRight * vOffset.x * (bFlip ? -1 : 1); - vEyePosition += vUp * vOffset.z; + Vec3 vForward, vRight, vUp; Math::AngleVectors(eyeAngles, &vForward, &vRight, &vUp); + eyePosition += vForward * vOffset.y; + eyePosition += vRight * vOffset.x * (bFlip ? -1 : 1); + eyePosition += vUp * vOffset.z; } - if (Vars::Visuals::Viewmodel::Pitch.Value) - vEyeAngles.x += Vars::Visuals::Viewmodel::Pitch.Value; - if (Vars::Visuals::Viewmodel::Yaw.Value) - vEyeAngles.y += Vars::Visuals::Viewmodel::Yaw.Value * (bFlip ? -1 : 1); - if (Vars::Visuals::Viewmodel::Roll.Value) - vEyeAngles.z += Vars::Visuals::Viewmodel::Roll.Value * (bFlip ? -1 : 1); + if (vAngles.x) + eyeAngles.x += vAngles.x; + if (vAngles.y) + eyeAngles.y += vAngles.y * (bFlip ? -1 : 1); + if (vAngles.z) + eyeAngles.z += vAngles.z * (bFlip ? -1 : 1); - CALL_ORIGINAL(rcx, pOwner, vEyePosition, vEyeAngles); + CALL_ORIGINAL(rcx, owner, eyePosition, eyeAngles); +} + +MAKE_HOOK(CBasePlayer_CalcViewModelView, S::CBasePlayer_CalcViewModelView(), void, + void* rcx, /*const*/ Vector& eyeOrigin, /*const*/ QAngle& eyeAngles) +{ +#ifdef DEBUG_HOOKS + if (!Vars::Hooks::CBasePlayer_CalcViewModelView[DEFAULT_BIND]) + return CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles); +#endif + + Vector vOldEyeOrigin = eyeOrigin, vOldEyeAngles = eyeAngles; + CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles); + eyeOrigin = vOldEyeOrigin, eyeAngles = vOldEyeAngles; } \ No newline at end of file diff --git a/Amalgam/src/Hooks/CClientState_ProcessFixAngle.cpp b/Amalgam/src/Hooks/CClientState_ProcessFixAngle.cpp index 9899babe..cbf74eea 100644 --- a/Amalgam/src/Hooks/CClientState_ProcessFixAngle.cpp +++ b/Amalgam/src/Hooks/CClientState_ProcessFixAngle.cpp @@ -15,7 +15,7 @@ MAKE_HOOK(CClientState_ProcessFixAngle, S::CClientState_ProcessFixAngle(), bool, if (Vars::Visuals::Removals::AngleForcing.Value) return false; - if (F::Spectate.m_iTarget != -1) + if (F::Spectate.HasTarget()) F::Spectate.m_vOldView = msg->m_Angle; return CALL_ORIGINAL(rcx, msg); diff --git a/Amalgam/src/Hooks/CHLTVCamera_CalcView.cpp b/Amalgam/src/Hooks/CHLTVCamera_CalcView.cpp new file mode 100644 index 00000000..717b7523 --- /dev/null +++ b/Amalgam/src/Hooks/CHLTVCamera_CalcView.cpp @@ -0,0 +1,67 @@ +#include "../SDK/SDK.h" + +#include "../Features/Spectate/Spectate.h" + +MAKE_SIGNATURE(CHLTVCamera_CalcView, "client.dll", "48 89 5C 24 ? 48 89 74 24 ? 57 41 56 41 57 48 83 EC ? 80 79 ? ? 4D 8B F9", 0x0); +MAKE_SIGNATURE(CHLTVCamera_GetPrimaryTarget, "client.dll", "40 53 48 83 EC ? 48 8B D9 8B 49 ? 85 C9 7E ? E8 ? ? ? ? 48 85 C0 74 ? 48 8B 10 48 8B C8 48 83 C4 ? 5B 48 FF A2 ? ? ? ? 8B 53", 0x0); +MAKE_SIGNATURE(CHLTVCamera_GetMode, "client.dll", "40 53 48 83 EC ? 48 8B D9 8B 49 ? 85 C9 7E ? E8 ? ? ? ? 48 85 C0 74 ? 48 8B 10 48 8B C8 48 83 C4 ? 5B 48 FF A2 ? ? ? ? 8B 43", 0x0); + +MAKE_HOOK(CHLTVCamera_CalcView, S::CHLTVCamera_CalcView(), void, + void* rcx, Vector& origin, QAngle& angles, float& fov) +{ +#ifdef DEBUG_HOOKS + if (!Vars::Hooks::CHLTVCamera_CalcView[DEFAULT_BIND]) + return CALL_ORIGINAL(rcx, origin, angles, fov); +#endif + + auto pHLTVCamera = reinterpret_cast(rcx); + + if (F::Spectate.HasTarget()) + pHLTVCamera->m_nCameraMode = Vars::Visuals::Thirdperson::Enabled.Value ? OBS_MODE_THIRDPERSON : OBS_MODE_FIRSTPERSON; + + auto pEntity = I::ClientEntityList->GetClientEntity(pHLTVCamera->m_iTraget1)->As(); + if (!pEntity) + return CALL_ORIGINAL(rcx, origin, angles, fov); + + auto pGameRules = I::TFGameRules(); + auto pViewVectors = pGameRules ? pGameRules->GetViewVectors() : nullptr; + if (!pViewVectors) + return CALL_ORIGINAL(rcx, origin, angles, fov); + + Vec3 vOriginalOffset = pViewVectors->m_vView; + pViewVectors->m_vView = pEntity->GetViewOffset(pHLTVCamera->m_iCameraMan <= 0); + CALL_ORIGINAL(rcx, origin, angles, fov); + pViewVectors->m_vView = vOriginalOffset; +} + +MAKE_HOOK(CHLTVCamera_GetPrimaryTarget, S::CHLTVCamera_GetPrimaryTarget(), CBaseEntity*, + void* rcx) +{ +#ifdef DEBUG_HOOKS + if (!Vars::Hooks::CHLTVCamera_GetPrimaryTarget[DEFAULT_BIND]) + return CALL_ORIGINAL(rcx); +#endif + + auto pHLTVCamera = reinterpret_cast(rcx); + + if (F::Spectate.HasTarget()) + pHLTVCamera->m_iTraget1 = I::EngineClient->GetPlayerForUserID(F::Spectate.m_iTarget), F::Spectate.m_iTarget = F::Spectate.m_iIntendedTarget = -1; + + return CALL_ORIGINAL(rcx); +} + +MAKE_HOOK(CHLTVCamera_GetMode, S::CHLTVCamera_GetMode(), int, + void* rcx) +{ +#ifdef DEBUG_HOOKS + if (!Vars::Hooks::CHLTVCamera_GetMode[DEFAULT_BIND]) + return CALL_ORIGINAL(rcx); +#endif + + auto pHLTVCamera = reinterpret_cast(rcx); + + if (F::Spectate.HasTarget()) + pHLTVCamera->m_nCameraMode = Vars::Visuals::Thirdperson::Enabled.Value ? OBS_MODE_THIRDPERSON : OBS_MODE_FIRSTPERSON; + + return CALL_ORIGINAL(rcx); +} \ No newline at end of file diff --git a/Amalgam/src/Hooks/CParticleProperty_Create.cpp b/Amalgam/src/Hooks/CParticleProperty_Create.cpp index cf315a6d..ae68bd92 100644 --- a/Amalgam/src/Hooks/CParticleProperty_Create.cpp +++ b/Amalgam/src/Hooks/CParticleProperty_Create.cpp @@ -17,10 +17,10 @@ MAKE_HOOK(CParticleProperty_Create_Name, S::CParticleProperty_Create_Name(), voi return CALL_ORIGINAL(rcx, pszParticleName, iAttachType, pszAttachmentName); #endif + const auto dwRetAddr = uintptr_t(_ReturnAddress()); const auto dwUpdateEffects1 = S::CWeaponMedigun_UpdateEffects_CreateName_Call1(); const auto dwUpdateEffects2 = S::CWeaponMedigun_UpdateEffects_CreateName_Call2(); const auto dwManageChargeEffect = S::CWeaponMedigun_ManageChargeEffect_CreateName_Call(); - const auto dwRetAddr = uintptr_t(_ReturnAddress()); bool bUpdateEffects = dwRetAddr == dwUpdateEffects1 || dwRetAddr == dwUpdateEffects2, bManageChargeEffect = dwRetAddr == dwManageChargeEffect; if (bUpdateEffects || bManageChargeEffect) diff --git a/Amalgam/src/Hooks/CSniperDot_GetRenderingPositions.cpp b/Amalgam/src/Hooks/CSniperDot_GetRenderingPositions.cpp index c9f365bc..aa37d329 100644 --- a/Amalgam/src/Hooks/CSniperDot_GetRenderingPositions.cpp +++ b/Amalgam/src/Hooks/CSniperDot_GetRenderingPositions.cpp @@ -36,8 +36,8 @@ MAKE_HOOK(CBasePlayer_EyePosition, S::CBasePlayer_EyePosition(), Vec3*, return CALL_ORIGINAL(rcx, rdx); #endif - const auto dwDesired = S::CSniperDot_GetRenderingPositions_EyePosition_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CSniperDot_GetRenderingPositions_EyePosition_Call(); if (dwRetAddr == dwDesired) return &s_vEyePosition; @@ -53,8 +53,8 @@ MAKE_HOOK(CTFPlayer_EyeAngles, S::CTFPlayer_EyeAngles(), Vec3*, return CALL_ORIGINAL(rcx); #endif - const auto dwDesired = S::CSniperDot_GetRenderingPositions_EyeAngles_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CSniperDot_GetRenderingPositions_EyeAngles_Call(); if (dwRetAddr == dwDesired) return &s_vEyeAngles; diff --git a/Amalgam/src/Hooks/CTFClientScoreBoardDialog_UpdatePlayerAvatar.cpp b/Amalgam/src/Hooks/CTFClientScoreBoardDialog_UpdatePlayerAvatar.cpp index 0f4a92d4..ac291c6c 100644 --- a/Amalgam/src/Hooks/CTFClientScoreBoardDialog_UpdatePlayerAvatar.cpp +++ b/Amalgam/src/Hooks/CTFClientScoreBoardDialog_UpdatePlayerAvatar.cpp @@ -124,8 +124,8 @@ MAKE_HOOK(SectionedListPanel_SetItemFgColor, S::SectionedListPanel_SetItemFgColo return CALL_ORIGINAL(rcx, itemID, color); #endif - const auto dwDesired = S::CTFClientScoreBoardDialog_UpdatePlayerList_SetItemFgColor_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CTFClientScoreBoardDialog_UpdatePlayerList_SetItemFgColor_Call(); if (dwDesired == dwRetAddr && Vars::Visuals::UI::ScoreboardColors.Value && !SDK::CleanScreenshot()) SetScoreboardColor(s_iPlayerIndex, color); diff --git a/Amalgam/src/Hooks/CTFPlayerInventory_VerifyChangedLoadoutsAreValid.cpp b/Amalgam/src/Hooks/CTFPlayerInventory_VerifyChangedLoadoutsAreValid.cpp index ce7e2d4e..65389004 100644 --- a/Amalgam/src/Hooks/CTFPlayerInventory_VerifyChangedLoadoutsAreValid.cpp +++ b/Amalgam/src/Hooks/CTFPlayerInventory_VerifyChangedLoadoutsAreValid.cpp @@ -39,8 +39,8 @@ MAKE_HOOK(CTFInventoryManager_GetItemInLoadoutForClass, S::CTFInventoryManager_G return CALL_ORIGINAL(rcx, iClass, iSlot, pID); #endif - const auto dwDesired = S::CEquipSlotItemSelectionPanel_UpdateModelPanelsForSelection_GetItemInLoadoutForClass_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CEquipSlotItemSelectionPanel_UpdateModelPanelsForSelection_GetItemInLoadoutForClass_Call(); if (dwRetAddr == dwDesired && Vars::Misc::Exploits::EquipRegionUnlock.Value) return nullptr; diff --git a/Amalgam/src/Hooks/CTFPlayerPanel_GetTeam.cpp b/Amalgam/src/Hooks/CTFPlayerPanel_GetTeam.cpp index f0b3debd..1b2d0ffa 100644 --- a/Amalgam/src/Hooks/CTFPlayerPanel_GetTeam.cpp +++ b/Amalgam/src/Hooks/CTFPlayerPanel_GetTeam.cpp @@ -38,8 +38,8 @@ MAKE_HOOK(CTFPlayerPanel_GetTeam, S::CTFPlayerPanel_GetTeam(), int, return CALL_ORIGINAL(rcx); #endif - const auto dwDesired = S::CTFTeamStatusPlayerPanel_Update_GetTeam_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CTFTeamStatusPlayerPanel_Update_GetTeam_Call(); int iReturn = CALL_ORIGINAL(rcx); @@ -68,8 +68,8 @@ MAKE_HOOK(vgui_Panel_SetBgColor, S::vgui_Panel_SetBgColor(), void, return CALL_ORIGINAL(rcx, color); #endif - const auto dwDesired = S::CTFTeamStatusPlayerPanel_Update_SetBgColor_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CTFTeamStatusPlayerPanel_Update_SetBgColor_Call(); if (dwRetAddr == dwDesired && Vars::Visuals::UI::ScoreboardColors.Value && !SDK::CleanScreenshot()) SetScoreboardColor(s_iPlayerIndex, color); diff --git a/Amalgam/src/Hooks/CTFPlayerShared_InCond.cpp b/Amalgam/src/Hooks/CTFPlayerShared_InCond.cpp index 257e5d2d..b98a990d 100644 --- a/Amalgam/src/Hooks/CTFPlayerShared_InCond.cpp +++ b/Amalgam/src/Hooks/CTFPlayerShared_InCond.cpp @@ -16,13 +16,13 @@ MAKE_HOOK(CTFPlayerShared_InCond, S::CTFPlayerShared_InCond(), bool, return CALL_ORIGINAL(rcx, nCond); #endif + const auto dwRetAddr = uintptr_t(_ReturnAddress()); const auto dwZoomPlayer = S::CTFPlayer_ShouldDraw_InCond_Call(); const auto dwZoomWearable = S::CTFWearable_ShouldDraw_InCond_Call(); const auto dwZoomHudScope = S::CHudScope_ShouldDraw_InCond_Call(); const auto dwTaunt = S::CTFPlayer_CreateMove_InCondTaunt_Call(); const auto dwKart1 = S::CTFPlayer_CreateMove_InCondKart_Call(); const auto dwKart2 = S::CTFInput_ApplyMouse_InCond_Call(); - const auto dwRetAddr = uintptr_t(_ReturnAddress()); auto GetOuter = [&rcx]() -> CBaseEntity* { diff --git a/Amalgam/src/Hooks/CTFPlayerShared_IsPlayerDominated.cpp b/Amalgam/src/Hooks/CTFPlayerShared_IsPlayerDominated.cpp index 517ef082..05ed74e8 100644 --- a/Amalgam/src/Hooks/CTFPlayerShared_IsPlayerDominated.cpp +++ b/Amalgam/src/Hooks/CTFPlayerShared_IsPlayerDominated.cpp @@ -15,9 +15,9 @@ MAKE_HOOK(CTFPlayerShared_IsPlayerDominated, S::CTFPlayerShared_IsPlayerDominate return CALL_ORIGINAL(rcx, index); #endif + const auto dwRetAddr = uintptr_t(_ReturnAddress()); const auto dwDesired = S::CTFClientScoreBoardDialog_UpdatePlayerList_IsPlayerDominated_Call(); const auto dwJump = S::CTFClientScoreBoardDialog_UpdatePlayerList_Jump(); - const auto dwRetAddr = uintptr_t(_ReturnAddress()); bool bReturn = CALL_ORIGINAL(rcx, index); @@ -35,9 +35,9 @@ MAKE_HOOK(KeyValues_SetInt, S::KeyValues_SetInt(), void, return CALL_ORIGINAL(rcx, keyName, value); #endif + const auto dwRetAddr = uintptr_t(_ReturnAddress()); const auto dwDesired = S::CTFClientScoreBoardDialog_UpdatePlayerList_SetInt_Call(); const auto dwJump = S::CTFClientScoreBoardDialog_UpdatePlayerList_Jump(); - const auto dwRetAddr = uintptr_t(_ReturnAddress()); CALL_ORIGINAL(rcx, keyName, value); diff --git a/Amalgam/src/Hooks/CTFPlayer_BRenderAsZombie.cpp b/Amalgam/src/Hooks/CTFPlayer_BRenderAsZombie.cpp index 30e5c466..bc4eb55c 100644 --- a/Amalgam/src/Hooks/CTFPlayer_BRenderAsZombie.cpp +++ b/Amalgam/src/Hooks/CTFPlayer_BRenderAsZombie.cpp @@ -11,8 +11,8 @@ MAKE_HOOK(CTFPlayer_BRenderAsZombie, S::CTFPlayer_BRenderAsZombie(), bool, return CALL_ORIGINAL(rcx, bWeaponsCheck); #endif - const auto dwDesired = S::CTFRagdoll_CreateTFRagdoll_BRenderAsZombie_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CTFRagdoll_CreateTFRagdoll_BRenderAsZombie_Call(); if (dwRetAddr == dwDesired && Vars::Visuals::Removals::Gibs.Value) return true; diff --git a/Amalgam/src/Hooks/CTFPlayer_IsPlayerClass.cpp b/Amalgam/src/Hooks/CTFPlayer_IsPlayerClass.cpp index 79d320c7..2b9955be 100644 --- a/Amalgam/src/Hooks/CTFPlayer_IsPlayerClass.cpp +++ b/Amalgam/src/Hooks/CTFPlayer_IsPlayerClass.cpp @@ -11,8 +11,8 @@ MAKE_HOOK(CTFPlayer_IsPlayerClass, S::CTFPlayer_IsPlayerClass(), bool, return CALL_ORIGINAL(rcx, iClass); #endif - static const auto dwDesired = S::CDamageAccountPanel_DisplayDamageFeedback_IsPlayerClass_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + static const auto dwDesired = S::CDamageAccountPanel_DisplayDamageFeedback_IsPlayerClass_Call(); if (dwRetAddr == dwDesired && Vars::Misc::Sound::HitsoundAlways.Value) return false; diff --git a/Amalgam/src/Hooks/CTFPlayer_ShouldDraw.cpp b/Amalgam/src/Hooks/CTFPlayer_ShouldDraw.cpp index d0866ad0..606b9f46 100644 --- a/Amalgam/src/Hooks/CTFPlayer_ShouldDraw.cpp +++ b/Amalgam/src/Hooks/CTFPlayer_ShouldDraw.cpp @@ -19,7 +19,7 @@ MAKE_HOOK(CTFPlayer_ShouldDraw, S::CTFPlayer_ShouldDraw(), bool, return CALL_ORIGINAL(rcx); #endif - if (F::Spectate.m_iTarget != -1) + if (F::Spectate.HasTarget() && !I::EngineClient->IsHLTV()) { auto pLocal = H::Entities.GetLocal(); auto pTarget = I::ClientEntityList->GetClientEntity(I::EngineClient->GetPlayerForUserID(F::Spectate.m_iTarget))->As(); @@ -40,14 +40,14 @@ MAKE_HOOK(CBasePlayer_ShouldDrawThisPlayer, S::CBasePlayer_ShouldDrawThisPlayer( return CALL_ORIGINAL(rcx); #endif + const auto dwRetAddr = uintptr_t(_ReturnAddress()); //const auto dwDesired = S::CTFWeaponBase_PostDataUpdate_ShouldDrawThisPlayer_Call(); const auto dwUndesired = S::CBasePlayer_BuildFirstPersonMeathookTransformations_ShouldDrawThisPlayer_Call(); - const auto dwRetAddr = uintptr_t(_ReturnAddress()); //if (dwRetAddr == dwDesired) // return false; // breaks thirdperson jigglebones? - if (F::Spectate.m_iTarget != -1) + if (F::Spectate.HasTarget() && !I::EngineClient->IsHLTV()) { if (dwRetAddr == dwUndesired) return false; @@ -71,13 +71,13 @@ MAKE_HOOK(CBasePlayer_ShouldDrawLocalPlayer, S::CBasePlayer_ShouldDrawLocalPlaye return CALL_ORIGINAL(/*rcx*/); #endif - //const auto dwDesired = S::CBaseCombatWeapon_CalcOverrideModelIndex_ShouldDrawLocalPlayer_Call(); //const auto dwRetAddr = uintptr_t(_ReturnAddress()); + //const auto dwDesired = S::CBaseCombatWeapon_CalcOverrideModelIndex_ShouldDrawLocalPlayer_Call(); //if (dwRetAddr == dwDesired) // return false; - if (F::Spectate.m_iTarget != -1) + if (F::Spectate.HasTarget() && !I::EngineClient->IsHLTV()) { auto pLocal = H::Entities.GetLocal(); if (pLocal && pLocal->IsAlive()) @@ -95,7 +95,7 @@ MAKE_HOOK(CBaseCombatWeapon_ShouldDraw, S::CBaseCombatWeapon_ShouldDraw(), bool, return CALL_ORIGINAL(rcx); #endif - if (F::Spectate.m_iTarget != -1) + if (F::Spectate.HasTarget() && !I::EngineClient->IsHLTV()) { auto pWeapon = H::Entities.GetWeapon(); if (pWeapon && rcx == pWeapon->GetClientRenderable()) @@ -113,5 +113,5 @@ MAKE_HOOK(CViewRender_DrawViewModels, S::CViewRender_DrawViewModels(), void, return CALL_ORIGINAL(rcx, viewRender, drawViewmodel); #endif - CALL_ORIGINAL(rcx, viewRender, F::Spectate.m_iTarget != -1 ? false : drawViewmodel); + CALL_ORIGINAL(rcx, viewRender, F::Spectate.HasTarget() && !I::EngineClient->IsHLTV() ? false : drawViewmodel); } \ No newline at end of file diff --git a/Amalgam/src/Hooks/ClientModeTFNormal_BIsFriendOrPartyMember.cpp b/Amalgam/src/Hooks/ClientModeTFNormal_BIsFriendOrPartyMember.cpp index 0131abba..c0bd3114 100644 --- a/Amalgam/src/Hooks/ClientModeTFNormal_BIsFriendOrPartyMember.cpp +++ b/Amalgam/src/Hooks/ClientModeTFNormal_BIsFriendOrPartyMember.cpp @@ -10,8 +10,8 @@ MAKE_HOOK(ClientModeTFNormal_BIsFriendOrPartyMember, S::ClientModeTFNormal_BIsFr return CALL_ORIGINAL(rcx, pEntity); #endif - const auto dwDesired = S::CHudInspectPanel_UserCmd_InspectTarget_BIsFriendOrPartyMember_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CHudInspectPanel_UserCmd_InspectTarget_BIsFriendOrPartyMember_Call(); if (dwRetAddr == dwDesired && Vars::Misc::MannVsMachine::AllowInspect.Value) return true; diff --git a/Amalgam/src/Hooks/FX_FireBullets.cpp b/Amalgam/src/Hooks/FX_FireBullets.cpp index 8c5a0b01..dd3e8122 100644 --- a/Amalgam/src/Hooks/FX_FireBullets.cpp +++ b/Amalgam/src/Hooks/FX_FireBullets.cpp @@ -15,8 +15,8 @@ MAKE_HOOK(FX_FireBullets, S::FX_FireBullets(), void, return CALL_ORIGINAL(pWpn, iPlayer, vecOrigin, vecAngles, iWeapon, iMode, iSeed, flSpread, flDamage, bCritical); #endif - const auto dwDesired = S::CTFWeaponBaseGun_FireBullet_FireBullets_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CTFWeaponBaseGun_FireBullet_FireBullets_Call(); if (iPlayer != I::EngineClient->GetLocalPlayer()) F::Backtrack.ReportShot(iPlayer); diff --git a/Amalgam/src/Hooks/GetClientInterpAmount.cpp b/Amalgam/src/Hooks/GetClientInterpAmount.cpp index 5d02c30b..0e51208e 100644 --- a/Amalgam/src/Hooks/GetClientInterpAmount.cpp +++ b/Amalgam/src/Hooks/GetClientInterpAmount.cpp @@ -15,9 +15,9 @@ MAKE_HOOK(GetClientInterpAmount, S::GetClientInterpAmount(), float, if (!Vars::Visuals::Removals::Lerp.Value && !Vars::Visuals::Removals::Interpolation.Value) return CALL_ORIGINAL(); + const auto dwRetAddr = uintptr_t(_ReturnAddress()); const auto dwUndesired1 = S::CNetGraphPanel_DrawTextFields_GetClientInterpAmount_Call1(); const auto dwUndesired2 = S::CNetGraphPanel_DrawTextFields_GetClientInterpAmount_Call2(); - const auto dwRetAddr = uintptr_t(_ReturnAddress()); if (dwRetAddr != dwUndesired1 && dwRetAddr != dwUndesired2) return 0.f; diff --git a/Amalgam/src/Hooks/IEngineTrace_SetTraceEntity.cpp b/Amalgam/src/Hooks/IEngineTrace_SetTraceEntity.cpp index 4d025bd6..95edefe9 100644 --- a/Amalgam/src/Hooks/IEngineTrace_SetTraceEntity.cpp +++ b/Amalgam/src/Hooks/IEngineTrace_SetTraceEntity.cpp @@ -46,8 +46,8 @@ MAKE_HOOK(IEngineTrace_SetTraceEntity, U::Memory.GetVirtual(I::EngineTrace, 20), return CALL_ORIGINAL(rcx, pCollideable, pTrace); #endif - const auto dwDesired = S::IEngineTrace_TraceRay_SetTraceEntity_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::IEngineTrace_TraceRay_SetTraceEntity_Call(); CALL_ORIGINAL(rcx, pCollideable, pTrace); diff --git a/Amalgam/src/Hooks/ISteamFriends_GetFriendPersonaName.cpp b/Amalgam/src/Hooks/ISteamFriends_GetFriendPersonaName.cpp index bcbe2151..13b85b25 100644 --- a/Amalgam/src/Hooks/ISteamFriends_GetFriendPersonaName.cpp +++ b/Amalgam/src/Hooks/ISteamFriends_GetFriendPersonaName.cpp @@ -12,8 +12,8 @@ MAKE_HOOK(ISteamFriends_GetFriendPersonaName, U::Memory.GetVirtual(I::SteamFrien return CALL_ORIGINAL(rcx, steamIDFriend); #endif - const auto dwDesired = S::GetPlayerNameForSteamID_GetFriendPersonaName_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::GetPlayerNameForSteamID_GetFriendPersonaName_Call(); if (dwRetAddr == dwDesired && Vars::Visuals::UI::StreamerMode.Value) { diff --git a/Amalgam/src/Hooks/IVModelRender_DrawModelExecute.cpp b/Amalgam/src/Hooks/IVModelRender_DrawModelExecute.cpp index 210b1373..d3dd4ced 100644 --- a/Amalgam/src/Hooks/IVModelRender_DrawModelExecute.cpp +++ b/Amalgam/src/Hooks/IVModelRender_DrawModelExecute.cpp @@ -51,8 +51,8 @@ MAKE_HOOK(CBaseAnimating_DrawModel, S::CBaseAnimating_DrawModel(), int, return CALL_ORIGINAL(rcx, flags); #endif - const auto dwDesired = S::CEconEntity_DrawOverriddenViewmodel_DrawModel_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CEconEntity_DrawOverriddenViewmodel_DrawModel_Call(); if (dwRetAddr != dwDesired || I::EngineVGui->IsGameUIVisible() || SDK::CleanScreenshot() || F::CameraWindow.m_bDrawing || !F::Materials.m_bLoaded || G::Unload) @@ -68,7 +68,7 @@ MAKE_HOOK(CBaseAnimating_InternalDrawModel, S::CBaseAnimating_InternalDrawModel( void* rcx, int flags) { #ifdef DEBUG_HOOKS - if (!Vars::Hooks::IVModelRender_DrawModelExecute[DEFAULT_BIND]) + if (!Vars::Hooks::CBaseAnimating_InternalDrawModel[DEFAULT_BIND]) return CALL_ORIGINAL(rcx, flags); #endif diff --git a/Amalgam/src/Hooks/TF_IsHolidayActive.cpp b/Amalgam/src/Hooks/TF_IsHolidayActive.cpp index e2af21de..8d22c244 100644 --- a/Amalgam/src/Hooks/TF_IsHolidayActive.cpp +++ b/Amalgam/src/Hooks/TF_IsHolidayActive.cpp @@ -28,8 +28,8 @@ MAKE_HOOK(TF_IsHolidayActive, S::TF_IsHolidayActive(), bool, return CALL_ORIGINAL(eHoliday); #endif - const auto dwDesired = S::CTFPlayer_FireEvent_IsHolidayActive_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CTFPlayer_FireEvent_IsHolidayActive_Call(); if (dwRetAddr == dwDesired) return true; diff --git a/Amalgam/src/Hooks/VGuiMenuBuilder_AddMenuItem.cpp b/Amalgam/src/Hooks/VGuiMenuBuilder_AddMenuItem.cpp index a1b2f882..8996eec5 100644 --- a/Amalgam/src/Hooks/VGuiMenuBuilder_AddMenuItem.cpp +++ b/Amalgam/src/Hooks/VGuiMenuBuilder_AddMenuItem.cpp @@ -4,114 +4,122 @@ #include "../Features/Spectate/Spectate.h" #include "../Features/Output/Output.h" -MAKE_SIGNATURE(CVoiceStatus_IsPlayerBlocked, "client.dll", "40 53 48 81 EC ? ? ? ? 48 8B D9 4C 8D 44 24", 0x0); +MAKE_SIGNATURE(CPlayerResource_IsFakePlayer, "client.dll", "48 89 5C 24 ? 57 48 81 EC ? ? ? ? 48 8B 01 48 8B F9 48 63 DA", 0x0); MAKE_SIGNATURE(VGuiMenuBuilder_AddMenuItem, "client.dll", "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 48 8B EA 49 8B F9 48 8B 51 ? 49 8B F0 48 8B D9 48 85 D2 74 ? 49 8B C9 E8 ? ? ? ? 85 C0 74 ? 48 8B 0B 48 8B 01 FF 90 ? ? ? ? 48 8B 0B 4C 8B C6 4C 8B 4B ? 48 8B D5 48 89 7B ? 48 C7 44 24 ? ? ? ? ? 48 8B 01 FF 90 ? ? ? ? 48 8B 13 3B 82 ? ? ? ? 73 ? 3B 82 ? ? ? ? 7F ? 48 8B 92 ? ? ? ? 8B C8 48 03 C9 39 44 CA ? 75 ? 39 44 CA ? 75 ? 48 8B 04 CA EB ? 33 C0 48 8B 5C 24 ? 48 8B 6C 24 ? 48 8B 74 24 ? 48 83 C4 ? 5F C3 CC CC CC CC 48 89 5C 24", 0x0); MAKE_SIGNATURE(CTFClientScoreBoardDialog_OnCommand, "client.dll", "48 89 5C 24 ? 57 48 83 EC ? 48 8B DA 48 8B F9 48 8B CB 48 8D 15 ? ? ? ? E8 ? ? ? ? 48 85 C0 74 ? 48 8B 0D", 0x0); -MAKE_SIGNATURE(CTFClientScoreBoardDialog_OnScoreBoardMouseRightRelease_IsPlayerBlocked_Call, "client.dll", "84 C0 48 8D 0D ? ? ? ? 48 8D 15 ? ? ? ? 48 0F 45 D1 4C 8D 0D", 0x0); -MAKE_SIGNATURE(CTFClientScoreBoardDialog_OnScoreBoardMouseRightRelease_AddMenuItem_Call, "client.dll", "48 8B 0D ? ? ? ? 4C 8D 85 ? ? ? ? 48 8D 95 ? ? ? ? 48 8B 01 FF 90 ? ? ? ? 44 8B 85", 0x0); +MAKE_SIGNATURE(CTFClientScoreBoardDialog_OnScoreBoardMouseRightRelease_IsFakePlayer_Call, "client.dll", "48 8B 0D ? ? ? ? 41 8B D6 48 81 C1 ? ? ? ? 44 0F B6 E8", 0x0); +MAKE_SIGNATURE(CTFClientScoreBoardDialog_OnScoreBoardMouseRightRelease_AddMenuItem_CallProfile, "client.dll", "48 8B 0D ? ? ? ? 4C 8D 85 ? ? ? ? 48 8D 95 ? ? ? ? 48 8B 01 FF 90 ? ? ? ? 44 8B 85", 0x0); +MAKE_SIGNATURE(CTFClientScoreBoardDialog_OnScoreBoardMouseRightRelease_AddMenuItem_CallSpectate, "client.dll", "45 84 ED 4C 8B AC 24 ? ? ? ? 0F 85", 0x0); static int s_iPlayerIndex; static uint32_t s_uAccountID; static const char* s_sPlayerName; -MAKE_HOOK(CVoiceStatus_IsPlayerBlocked, S::CVoiceStatus_IsPlayerBlocked(), bool, - void* rcx, int playerIndex) +MAKE_HOOK(CPlayerResource_IsFakePlayer, S::CPlayerResource_IsFakePlayer(), bool, + void* rcx, int index) { #ifdef DEBUG_HOOKS - if (!Vars::Hooks::CVoiceStatus_IsPlayerBlocked[DEFAULT_BIND]) - return CALL_ORIGINAL(rcx, playerIndex); + if (!Vars::Hooks::CPlayerResource_IsFakePlayer[DEFAULT_BIND]) + return CALL_ORIGINAL(rcx, index); #endif - const auto dwDesired = S::CTFClientScoreBoardDialog_OnScoreBoardMouseRightRelease_IsPlayerBlocked_Call(); - const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CTFClientScoreBoardDialog_OnScoreBoardMouseRightRelease_IsFakePlayer_Call(); - if (dwRetAddr == dwDesired && Vars::Visuals::UI::ScoreboardUtility.Value) - s_iPlayerIndex = playerIndex; + if (dwRetAddr == dwDesired && Vars::Visuals::UI::ScoreboardUtility.Value) + s_iPlayerIndex = index; - return CALL_ORIGINAL(rcx, playerIndex); + return CALL_ORIGINAL(rcx, index); } MAKE_HOOK(VGuiMenuBuilder_AddMenuItem, S::VGuiMenuBuilder_AddMenuItem(), void*, - void* rcx, const char* pszButtonText, const char* pszCommand, const char* pszCategoryName) + void* rcx, const char* pszButtonText, const char* pszCommand, const char* pszCategoryName) { #ifdef DEBUG_HOOKS - if (!Vars::Hooks::VGuiMenuBuilder_AddMenuItem[DEFAULT_BIND]) - return CALL_ORIGINAL(rcx, pszButtonText, pszCommand, pszCategoryName); + if (!Vars::Hooks::VGuiMenuBuilder_AddMenuItem[DEFAULT_BIND]) + return CALL_ORIGINAL(rcx, pszButtonText, pszCommand, pszCategoryName); #endif - const auto dwDesired = S::CTFClientScoreBoardDialog_OnScoreBoardMouseRightRelease_AddMenuItem_Call(); - const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired1 = S::CTFClientScoreBoardDialog_OnScoreBoardMouseRightRelease_AddMenuItem_CallProfile(); + const auto dwDesired2 = S::CTFClientScoreBoardDialog_OnScoreBoardMouseRightRelease_AddMenuItem_CallSpectate(); - if (dwRetAddr == dwDesired && Vars::Visuals::UI::ScoreboardUtility.Value && s_iPlayerIndex != -1) - { - auto pReturn = CALL_ORIGINAL(rcx, pszButtonText, pszCommand, pszCategoryName); + if (dwRetAddr == dwDesired1 && Vars::Visuals::UI::ScoreboardUtility.Value && s_iPlayerIndex != -1) + { + auto pReturn = CALL_ORIGINAL(rcx, pszButtonText, pszCommand, pszCategoryName); - if (auto pResource = H::Entities.GetResource()) - { - s_uAccountID = pResource->m_iAccountID(s_iPlayerIndex); - s_sPlayerName = pResource->GetName(s_iPlayerIndex); + if (auto pResource = H::Entities.GetResource()) + { + s_uAccountID = pResource->m_iAccountID(s_iPlayerIndex); + s_sPlayerName = pResource->GetName(s_iPlayerIndex); - CALL_ORIGINAL(rcx, "History", "history", "profile"); - CALL_ORIGINAL(rcx, I::EngineClient->GetPlayerForUserID(F::Spectate.m_iIntendedTarget) == s_iPlayerIndex ? "Unspectate" : "Spectate", "spectate", "profile"); + CALL_ORIGINAL(rcx, "History", "history", "profile"); + CALL_ORIGINAL(rcx, I::EngineClient->GetPlayerForUserID(F::Spectate.m_iIntendedTarget) == s_iPlayerIndex ? "Unspectate" : "Spectate", "specplayer", "profile"); - CALL_ORIGINAL(rcx, std::format("Tags for {}", s_sPlayerName).c_str(), "listtags", "tags"); - for (auto it = F::PlayerUtils.m_vTags.begin(); it != F::PlayerUtils.m_vTags.end(); it++) - { - int iID = std::distance(F::PlayerUtils.m_vTags.begin(), it); - auto& tTag = *it; - if (!tTag.m_bAssignable) - continue; + CALL_ORIGINAL(rcx, std::format("Tags for {}", s_sPlayerName).c_str(), "listtags", "tags"); + for (auto it = F::PlayerUtils.m_vTags.begin(); it != F::PlayerUtils.m_vTags.end(); it++) + { + int iID = std::distance(F::PlayerUtils.m_vTags.begin(), it); + auto& tTag = *it; + if (!tTag.m_bAssignable) + continue; - bool bHasTag = F::PlayerUtils.HasTag(s_uAccountID, iID); - CALL_ORIGINAL(rcx, std::format("{} {}", bHasTag ? "Remove" : "Add", tTag.m_sName).c_str(), std::format("modifytag{}", iID).c_str(), "tags"); - } - } - - return pReturn; - } + bool bHasTag = F::PlayerUtils.HasTag(s_uAccountID, iID); + CALL_ORIGINAL(rcx, std::format("{} {}", bHasTag ? "Remove" : "Add", tTag.m_sName).c_str(), std::format("modifytag{}", iID).c_str(), "tags"); + } + } + + return pReturn; + } - return CALL_ORIGINAL(rcx, pszButtonText, pszCommand, pszCategoryName); + if (dwRetAddr == dwDesired2 && Vars::Visuals::UI::ScoreboardUtility.Value && s_iPlayerIndex != -1) + return nullptr; + + return CALL_ORIGINAL(rcx, pszButtonText, pszCommand, pszCategoryName); } MAKE_HOOK(CTFClientScoreBoardDialog_OnCommand, S::CTFClientScoreBoardDialog_OnCommand(), void, - void* rcx, const char* command) + void* rcx, const char* command) { #ifdef DEBUG_HOOKS - if (!Vars::Hooks::CTFClientScoreBoardDialog_OnCommand[DEFAULT_BIND]) - return CALL_ORIGINAL(rcx, command); + if (!Vars::Hooks::CTFClientScoreBoardDialog_OnCommand[DEFAULT_BIND]) + return CALL_ORIGINAL(rcx, command); #endif - if (!Vars::Visuals::UI::ScoreboardUtility.Value && !command) - return CALL_ORIGINAL(rcx, command); + if (!Vars::Visuals::UI::ScoreboardUtility.Value && !command) + return CALL_ORIGINAL(rcx, command); - auto uHash = FNV1A::Hash32(command); - switch (uHash) - { - case FNV1A::Hash32Const("history"): - I::SteamFriends->ActivateGameOverlayToWebPage(std::format("https://steamhistory.net/id/{}", CSteamID(s_uAccountID, k_EUniversePublic, k_EAccountTypeIndividual).ConvertToUint64()).c_str()); - break; - case FNV1A::Hash32Const("spectate"): - if (auto pResource = H::Entities.GetResource()) - F::Spectate.SetTarget(pResource->m_iUserID(s_iPlayerIndex)); - break; - case FNV1A::Hash32Const("listtags"): - F::Output.TagsOnJoin(s_sPlayerName, s_uAccountID); - break; - default: - if (strstr(command, "modifytag")) - { - try - { - std::string sTag = command; - sTag = sTag.replace(0, strlen("modifytag"), ""); - int iID = std::stoi(sTag); - if (!F::PlayerUtils.HasTag(s_uAccountID, iID)) - F::PlayerUtils.AddTag(s_uAccountID, iID, true, s_sPlayerName); - else - F::PlayerUtils.RemoveTag(s_uAccountID, iID, true, s_sPlayerName); - } - catch (...) {} - } - CALL_ORIGINAL(rcx, command); - } + auto uHash = FNV1A::Hash32(command); + switch (uHash) + { + case FNV1A::Hash32Const("history"): + I::SteamFriends->ActivateGameOverlayToWebPage(std::format("https://steamhistory.net/id/{}", CSteamID(s_uAccountID, k_EUniversePublic, k_EAccountTypeIndividual).ConvertToUint64()).c_str()); + break; + case FNV1A::Hash32Const("listtags"): + F::Output.TagsOnJoin(s_sPlayerName, s_uAccountID); + break; + case FNV1A::Hash32Const("specplayer"): + if (auto pResource = H::Entities.GetResource(); pResource && Vars::Visuals::UI::ScoreboardUtility.Value) + { + F::Spectate.SetTarget(pResource->m_iUserID(s_iPlayerIndex)); + break; + } + [[fallthrough]]; + default: + if (strstr(command, "modifytag")) + { + try + { + std::string sTag = command; + sTag = sTag.replace(0, strlen("modifytag"), ""); + int iID = std::stoi(sTag); + if (!F::PlayerUtils.HasTag(s_uAccountID, iID)) + F::PlayerUtils.AddTag(s_uAccountID, iID, true, s_sPlayerName); + else + F::PlayerUtils.RemoveTag(s_uAccountID, iID, true, s_sPlayerName); + } + catch (...) {} + } + CALL_ORIGINAL(rcx, command); + } } \ No newline at end of file diff --git a/Amalgam/src/Hooks/bf_read_ReadString.cpp b/Amalgam/src/Hooks/bf_read_ReadString.cpp index c49d6f1e..e505bdd8 100644 --- a/Amalgam/src/Hooks/bf_read_ReadString.cpp +++ b/Amalgam/src/Hooks/bf_read_ReadString.cpp @@ -13,8 +13,8 @@ MAKE_HOOK(bf_read_ReadString, S::bf_read_ReadString(), bool, return CALL_ORIGINAL(rcx, pStr, maxLen, bLine, pOutNumChars); #endif - const auto dwDesired = S::CHudVote_MsgFunc_VoteStart_ReadString_Call(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); + const auto dwDesired = S::CHudVote_MsgFunc_VoteStart_ReadString_Call(); bool bReturn = CALL_ORIGINAL(rcx, pStr, maxLen, bLine, pOutNumChars); diff --git a/Amalgam/src/SDK/Definitions/Definitions.h b/Amalgam/src/SDK/Definitions/Definitions.h index aab13a08..4cd6b8ef 100644 --- a/Amalgam/src/SDK/Definitions/Definitions.h +++ b/Amalgam/src/SDK/Definitions/Definitions.h @@ -194,6 +194,11 @@ #define TF_WEAPON_ZOOM_FOV 20 #define TF_PARTICLE_MAX_CHARGE_TIME 2.f +#define TF_ROCKET_RADIUS_FOR_RJS (110.f * 1.1f) +#define TF_ROCKET_RADIUS (146.f) +#define TF_FLARE_DET_RADIUS (110.f) +#define TF_FLARE_RADIUS_FOR_FJS (100.f) + #define TF_PLAYER_VIEW_OFFSET Vector( 0, 0, 64.0 ) #define TF_BURNING_FREQUENCY 0.5f #define TF_BURNING_FLAME_LIFE 10.0 diff --git a/Amalgam/src/SDK/Definitions/Interfaces.h b/Amalgam/src/SDK/Definitions/Interfaces.h index 75694b74..e7f2a7e4 100644 --- a/Amalgam/src/SDK/Definitions/Interfaces.h +++ b/Amalgam/src/SDK/Definitions/Interfaces.h @@ -6,6 +6,7 @@ #include "Interfaces/CClientState.h" #include "Interfaces/CGlobalVarsBase.h" #include "Interfaces/CHLClient.h" +#include "Interfaces/CHLTVCamera.h" #include "Interfaces/CTFGameRules.h" #include "Interfaces/CTFGCClientSystem.h" #include "Interfaces/CTFPartyClient.h" diff --git a/Amalgam/src/SDK/Definitions/Interfaces/CHLTVCamera.h b/Amalgam/src/SDK/Definitions/Interfaces/CHLTVCamera.h new file mode 100644 index 00000000..548e8a93 --- /dev/null +++ b/Amalgam/src/SDK/Definitions/Interfaces/CHLTVCamera.h @@ -0,0 +1,27 @@ +#pragma once +#include "../Main/CUserCmd.h" +#include "../Misc/CGameEventListener.h" + +class CHLTVCamera : CGameEventListener +{ +public: + int m_nCameraMode; // current camera mode + int m_iCameraMan; // camera man entindex or 0 + Vector m_vCamOrigin; //current camera origin + QAngle m_aCamAngle; //current camera angle + int m_iTraget1; // first tracked target or 0 + int m_iTraget2; // second tracked target or 0 + float m_flFOV; // current FOV + float m_flOffset; // z-offset from target origin + float m_flDistance; // distance to traget origin+offset + float m_flLastDistance; // too smooth distance + float m_flTheta; // view angle horizontal + float m_flPhi; // view angle vertical + float m_flInertia; // camera inertia 0..100 + float m_flLastAngleUpdateTime; + bool m_bEntityPacketReceived; // true after a new packet was received + int m_nNumSpectators; + char m_szTitleText[64]; + CUserCmd m_LastCmd; + Vector m_vecVelocity; +}; \ No newline at end of file diff --git a/Amalgam/src/SDK/Definitions/Main/CTFPlayer.cpp b/Amalgam/src/SDK/Definitions/Main/CTFPlayer.cpp index e58733e7..fc8b7075 100644 --- a/Amalgam/src/SDK/Definitions/Main/CTFPlayer.cpp +++ b/Amalgam/src/SDK/Definitions/Main/CTFPlayer.cpp @@ -7,37 +7,30 @@ Vec3 CTFPlayer::GetEyeAngles() return { m_angEyeAnglesX(), m_angEyeAnglesY(), 0.f }; } -Vec3 CTFPlayer::GetViewOffset() +Vec3 CTFPlayer::GetViewOffset(bool bScale) { + Vec3 vOffset = GetOffset() / 2; + if (!IsPlayer()) - return GetOffset() / 2; + return vOffset; - auto getMainOffset = [this]() -> Vec3 + if (IsDucking()) + vOffset = { 0.f, 0.f, 45.f }; + else switch (m_iClass()) { - if (IsDucking()) - return { 0.f, 0.f, 45.f }; + case TF_CLASS_SCOUT: vOffset = { 0.f, 0.f, 65.f }; break; + case TF_CLASS_SOLDIER: vOffset = { 0.f, 0.f, 68.f }; break; + case TF_CLASS_PYRO: vOffset = { 0.f, 0.f, 68.f }; break; + case TF_CLASS_DEMOMAN: vOffset = { 0.f, 0.f, 68.f }; break; + case TF_CLASS_HEAVY: vOffset = { 0.f, 0.f, 75.f }; break; + case TF_CLASS_ENGINEER: vOffset = { 0.f, 0.f, 68.f }; break; + case TF_CLASS_MEDIC: vOffset = { 0.f, 0.f, 75.f }; break; + case TF_CLASS_SNIPER: vOffset = { 0.f, 0.f, 75.f }; break; + case TF_CLASS_SPY: vOffset = { 0.f, 0.f, 75.f }; break; + default: vOffset = m_vecViewOffset().z ? m_vecViewOffset() : Vec3(0.f, 0.f, 72.f); + } - switch (m_iClass()) - { - case TF_CLASS_SCOUT: return { 0.f, 0.f, 65.f }; - case TF_CLASS_SOLDIER: return { 0.f, 0.f, 68.f }; - case TF_CLASS_PYRO: return { 0.f, 0.f, 68.f }; - case TF_CLASS_DEMOMAN: return { 0.f, 0.f, 68.f }; - case TF_CLASS_HEAVY: return { 0.f, 0.f, 75.f }; - case TF_CLASS_ENGINEER: return { 0.f, 0.f, 68.f }; - case TF_CLASS_MEDIC: return { 0.f, 0.f, 75.f }; - case TF_CLASS_SNIPER: return { 0.f, 0.f, 75.f }; - case TF_CLASS_SPY: return { 0.f, 0.f, 75.f }; - } - - const Vec3 vOffset = m_vecViewOffset(); - if (vOffset.z) - return vOffset; - - return { 0.f, 0.f, 68.f }; - }; - - return getMainOffset() * m_flModelScale(); + return bScale ? vOffset * m_flModelScale() : vOffset; } bool CTFPlayer::InCond(ETFCond eCond) diff --git a/Amalgam/src/SDK/Definitions/Main/CTFPlayer.h b/Amalgam/src/SDK/Definitions/Main/CTFPlayer.h index d2002296..3f569425 100644 --- a/Amalgam/src/SDK/Definitions/Main/CTFPlayer.h +++ b/Amalgam/src/SDK/Definitions/Main/CTFPlayer.h @@ -203,7 +203,7 @@ public: SIGNATURE(UpdateWearables, void, CTFPlayer, this); Vec3 GetEyeAngles(); - Vec3 GetViewOffset(); // use on nonlocal players + Vec3 GetViewOffset(bool bScale = true); // use on nonlocal players bool InCond(ETFCond eCond); void AddCond(ETFCond eCond); // bits only void RemoveCond(ETFCond eCond); // bits only diff --git a/Amalgam/src/SDK/Globals.h b/Amalgam/src/SDK/Globals.h index f0149f7a..bd2faba7 100644 --- a/Amalgam/src/SDK/Globals.h +++ b/Amalgam/src/SDK/Globals.h @@ -108,9 +108,9 @@ namespace G inline std::vector SphereStorage = {}; inline std::vector SweptStorage = {}; - inline int* RandomSeed() + inline int& RandomSeed() { - static auto pRandomSeed = reinterpret_cast(U::Memory.RelToAbs(S::RandomSeed())); + static auto& pRandomSeed = *reinterpret_cast(U::Memory.RelToAbs(S::RandomSeed())); return pRandomSeed; } }; \ No newline at end of file diff --git a/Amalgam/src/SDK/Helpers/Draw/Draw.cpp b/Amalgam/src/SDK/Helpers/Draw/Draw.cpp index 62ddc3c4..b5ba9fb2 100644 --- a/Amalgam/src/SDK/Helpers/Draw/Draw.cpp +++ b/Amalgam/src/SDK/Helpers/Draw/Draw.cpp @@ -98,7 +98,7 @@ void CDraw::String(const Font_t& tFont, int x, int y, Color_t tColor, EAlign eAl I::MatSystemSurface->DrawSetTextPos(x, y); I::MatSystemSurface->DrawSetTextFont(dwFont); - I::MatSystemSurface->DrawSetTextColor(tColor.r, tColor.g, tColor.b, tColor.a); + I::MatSystemSurface->DrawSetTextColor(tColor); I::MatSystemSurface->DrawPrintText(s_wstr, int(wcslen(s_wstr))); } void CDraw::String(const Font_t& tFont, int x, int y, Color_t tColor, EAlign eAlign, const wchar_t* wstr) @@ -121,7 +121,7 @@ void CDraw::String(const Font_t& tFont, int x, int y, Color_t tColor, EAlign eAl I::MatSystemSurface->DrawSetTextPos(x, y); I::MatSystemSurface->DrawSetTextFont(dwFont); - I::MatSystemSurface->DrawSetTextColor(tColor.r, tColor.g, tColor.b, tColor.a); + I::MatSystemSurface->DrawSetTextColor(tColor); I::MatSystemSurface->DrawPrintText(wstr, int(wcslen(wstr))); } void CDraw::StringOutlined(const Font_t& tFont, int x, int y, Color_t tColor, Color_t tColorOut, EAlign eAlign, const char* str, bool bAlpha) @@ -156,14 +156,14 @@ void CDraw::StringOutlined(const Font_t& tFont, int x, int y, Color_t tColor, Co { I::MatSystemSurface->DrawSetTextPos(x + x2, y + y2); I::MatSystemSurface->DrawSetTextFont(dwFont); - I::MatSystemSurface->DrawSetTextColor(tColorOut.r, tColorOut.g, tColorOut.b, tColorOut.a); + I::MatSystemSurface->DrawSetTextColor(tColorOut); I::MatSystemSurface->DrawPrintText(s_wstr, int(wcslen(s_wstr))); } } I::MatSystemSurface->DrawSetTextPos(x, y); I::MatSystemSurface->DrawSetTextFont(dwFont); - I::MatSystemSurface->DrawSetTextColor(tColor.r, tColor.g, tColor.b, tColor.a); + I::MatSystemSurface->DrawSetTextColor(tColor); I::MatSystemSurface->DrawPrintText(s_wstr, int(wcslen(s_wstr))); } void CDraw::StringOutlined(const Font_t& tFont, int x, int y, Color_t tColor, Color_t tColorOut, EAlign eAlign, const wchar_t* wstr, bool bAlpha) @@ -197,20 +197,20 @@ void CDraw::StringOutlined(const Font_t& tFont, int x, int y, Color_t tColor, Co { I::MatSystemSurface->DrawSetTextPos(x + x2, y + y2); I::MatSystemSurface->DrawSetTextFont(dwFont); - I::MatSystemSurface->DrawSetTextColor(tColorOut.r, tColorOut.g, tColorOut.b, tColorOut.a); + I::MatSystemSurface->DrawSetTextColor(tColorOut); I::MatSystemSurface->DrawPrintText(wstr, int(wcslen(wstr))); } } I::MatSystemSurface->DrawSetTextPos(x, y); I::MatSystemSurface->DrawSetTextFont(dwFont); - I::MatSystemSurface->DrawSetTextColor(tColor.r, tColor.g, tColor.b, tColor.a); + I::MatSystemSurface->DrawSetTextColor(tColor); I::MatSystemSurface->DrawPrintText(wstr, int(wcslen(wstr))); } void CDraw::Line(int x1, int y1, int x2, int y2, Color_t tColor) { - I::MatSystemSurface->DrawSetColor(tColor.r, tColor.g, tColor.b, tColor.a); + I::MatSystemSurface->DrawSetColor(tColor); I::MatSystemSurface->DrawLine(x1, y1, x2, y2); } @@ -220,7 +220,7 @@ void CDraw::FillPolygon(std::vector vVertices, Color_t tColor) if (!I::MatSystemSurface->IsTextureIDValid(iId)) iId = I::MatSystemSurface->CreateNewTextureID(); - I::MatSystemSurface->DrawSetColor(tColor.r, tColor.g, tColor.b, tColor.a); + I::MatSystemSurface->DrawSetColor(tColor); I::MatSystemSurface->DrawSetTexture(iId); I::MatSystemSurface->DrawTexturedPolygon(int(vVertices.size()), vVertices.data()); } @@ -230,26 +230,26 @@ void CDraw::LinePolygon(std::vector vVertices, Color_t tColor) if (!I::MatSystemSurface->IsTextureIDValid(iId)) iId = I::MatSystemSurface->CreateNewTextureID(); - I::MatSystemSurface->DrawSetColor(tColor.r, tColor.g, tColor.b, tColor.a); + I::MatSystemSurface->DrawSetColor(tColor); I::MatSystemSurface->DrawSetTexture(iId); I::MatSystemSurface->DrawTexturedPolyLine(vVertices.data(), int(vVertices.size())); } void CDraw::FillRect(int x, int y, int w, int h, Color_t tColor) { - I::MatSystemSurface->DrawSetColor(tColor.r, tColor.g, tColor.b, tColor.a); + I::MatSystemSurface->DrawSetColor(tColor); I::MatSystemSurface->DrawFilledRect(x, y, x + w, y + h); } void CDraw::LineRect(int x, int y, int w, int h, Color_t tColor) { - I::MatSystemSurface->DrawSetColor(tColor.r, tColor.g, tColor.b, tColor.a); + I::MatSystemSurface->DrawSetColor(tColor); I::MatSystemSurface->DrawOutlinedRect(x, y, x + w, y + h); } void CDraw::GradientRect(int x, int y, int w, int h, Color_t tColorTop, Color_t tColorBottom, bool bHorizontal) { - I::MatSystemSurface->DrawSetColor(tColorTop.r, tColorTop.g, tColorTop.b, tColorTop.a); + I::MatSystemSurface->DrawSetColor(tColorTop); I::MatSystemSurface->DrawFilledRectFade(x, y, x + w, y + h, tColorTop.a, tColorBottom.a, bHorizontal); - I::MatSystemSurface->DrawSetColor(tColorBottom.r, tColorBottom.g, tColorBottom.b, tColorBottom.a); + I::MatSystemSurface->DrawSetColor(tColorBottom); I::MatSystemSurface->DrawFilledRectFade(x, y, x + w, y + h, tColorTop.a, tColorBottom.a, bHorizontal); } void CDraw::FillRectOutline(int x, int y, int w, int h, Color_t tColor, Color_t tColorOut) @@ -336,7 +336,7 @@ void CDraw::FillCircle(int x, int y, float iRadius, int iSegments, Color_t tColo } void CDraw::LineCircle(int x, int y, float iRadius, int iSegments, Color_t tColor) { - I::MatSystemSurface->DrawSetColor(tColor.r, tColor.g, tColor.b, tColor.a); + I::MatSystemSurface->DrawSetColor(tColor); I::MatSystemSurface->DrawOutlinedCircle(x, y, iRadius, iSegments); } @@ -375,7 +375,7 @@ int CDraw::CreateTextureFromArray(const unsigned char* rgba, int w, int h) I::MatSystemSurface->DrawSetTextureRGBAEx(nTextureIdOut, rgba, w, h, IMAGE_FORMAT_RGBA8888); return nTextureIdOut; } -void CDraw::DrawHudTexture(float x, float y, float s, const CHudTexture* pTexture, Color_t clr) +void CDraw::DrawHudTexture(float x, float y, float s, const CHudTexture* pTexture, Color_t tColor) { if (!pTexture) return; @@ -383,18 +383,18 @@ void CDraw::DrawHudTexture(float x, float y, float s, const CHudTexture* pTextur if (pTexture->bRenderUsingFont) { I::MatSystemSurface->DrawSetTextFont(pTexture->hFont); - I::MatSystemSurface->DrawSetTextColor(clr.r, clr.g, clr.b, clr.a); + I::MatSystemSurface->DrawSetTextColor(tColor); I::MatSystemSurface->DrawSetTextPos(x, y); I::MatSystemSurface->DrawUnicodeChar(pTexture->cCharacterInFont); } else if (pTexture->textureId != -1) { I::MatSystemSurface->DrawSetTexture(pTexture->textureId); - I::MatSystemSurface->DrawSetColor(clr.r, clr.g, clr.b, clr.a); + I::MatSystemSurface->DrawSetColor(tColor); I::MatSystemSurface->DrawTexturedSubRect(x, y, x + pTexture->Width() * s, y + pTexture->Height() * s, pTexture->texCoords[0], pTexture->texCoords[1], pTexture->texCoords[2], pTexture->texCoords[3]); } } -void CDraw::DrawHudTextureByName(float x, float y, float s, const char* sTexture, Color_t clr) +void CDraw::DrawHudTextureByName(float x, float y, float s, const char* sTexture, Color_t tColor) { const CHudTexture* pIcon = GetIcon(sTexture, 0); @@ -404,14 +404,14 @@ void CDraw::DrawHudTextureByName(float x, float y, float s, const char* sTexture if (pIcon->bRenderUsingFont) { I::MatSystemSurface->DrawSetTextFont(pIcon->hFont); - I::MatSystemSurface->DrawSetTextColor(clr.r, clr.g, clr.b, clr.a); + I::MatSystemSurface->DrawSetTextColor(tColor); I::MatSystemSurface->DrawSetTextPos(x, y); I::MatSystemSurface->DrawUnicodeChar(pIcon->cCharacterInFont); } else if (pIcon->textureId != -1) { I::MatSystemSurface->DrawSetTexture(pIcon->textureId); - I::MatSystemSurface->DrawSetColor(clr.r, clr.g, clr.b, clr.a); + I::MatSystemSurface->DrawSetColor(tColor); I::MatSystemSurface->DrawTexturedSubRect(x, y, x + pIcon->Width() * s, y + pIcon->Height() * s, pIcon->texCoords[0], pIcon->texCoords[1], pIcon->texCoords[2], pIcon->texCoords[3]); } } diff --git a/Amalgam/src/SDK/Vars.h b/Amalgam/src/SDK/Vars.h index dc18a18d..95a7409c 100644 --- a/Amalgam/src/SDK/Vars.h +++ b/Amalgam/src/SDK/Vars.h @@ -361,10 +361,10 @@ namespace Vars CVar(HuntsmanClamp, "Huntsman clamp", 5.f, NOSAVE | DEBUGVAR | SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 10.f, 0.5f); CVar(HuntsmanPullPoint, "Huntsman pull point", false, NOSAVE | DEBUGVAR); - CVar(SplashPointsDirect, "Splash points direct", 100, NOSAVE | DEBUGVAR | SLIDER_MIN, 0, 400, 5); - CVar(SplashPointsArc, "Splash points arc", 100, NOSAVE | DEBUGVAR | SLIDER_MIN, 0, 400, 5); - CVar(SplashCountDirect, "Splash count direct", 100, NOSAVE | DEBUGVAR | SLIDER_MIN, 1, 100); - CVar(SplashCountArc, "Splash count arc", 5, NOSAVE | DEBUGVAR | SLIDER_MIN, 1, 100); + CVar(SplashPointsDirect, "Splash points direct", 100, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0, 400, 5); + CVar(SplashPointsArc, "Splash points arc", 100, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 0, 400, 5); + CVar(SplashCountDirect, "Splash count direct", 100, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 1, 400, 5); + CVar(SplashCountArc, "Splash count arc", 5, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, 1, 400, 5); CVar(SplashRotateX, "Splash Rx", -1.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, -1.f, 360.f); CVar(SplashRotateY, "Splash Ry", -1.f, NOSAVE | DEBUGVAR | SLIDER_MIN | SLIDER_PRECISION, -1.f, 360.f); CVar(SplashTraceInterval, "Splash trace interval", 10, NOSAVE | DEBUGVAR, 1, 10); @@ -715,9 +715,12 @@ namespace Vars CVar(BreakJump, "Break jump", false); CVar(ShieldTurnRate, "Shield turn rate", false); - CVar(TimingOffset, "Timing offset", 0, NOSAVE | DEBUGVAR, 0, 3); - CVar(ChokeCount, "Choke count", 1, NOSAVE | DEBUGVAR, 0, 3); - CVar(ApplyAbove, "Apply timing offset above", 0, NOSAVE | DEBUGVAR, 0, 8); + CVar(AutoRocketJumpChokeGrounded, "Choke grounded", 1, NOSAVE | DEBUGVAR, 0, 3); + CVar(AutoRocketJumpChokeAir, "Choke air", 1, NOSAVE | DEBUGVAR, 0, 3); + CVar(AutoRocketJumpSkipGround, "Skip grounded", 0, NOSAVE | DEBUGVAR, 0, 3); + CVar(AutoRocketJumpSkipAir, "Skip air", 1, NOSAVE | DEBUGVAR, 0, 3); + CVar(AutoRocketJumpTimingOffset, "Timing offset", 0, NOSAVE | DEBUGVAR, 0, 3); + CVar(AutoRocketJumpApplyAbove, "Apply offset above", 0, NOSAVE | DEBUGVAR, 0, 10); SUBNAMESPACE_END(Movement); SUBNAMESPACE_BEGIN(Automation) @@ -904,6 +907,7 @@ namespace Vars CVar(CBasePlayer_ItemPostFrame, "CBasePlayer_ItemPostFrame", true, NOSAVE | DEBUGVAR); CVar(CBasePlayer_ShouldDrawLocalPlayer, "CBasePlayer_ShouldDrawLocalPlayer", true, NOSAVE | DEBUGVAR); CVar(CBasePlayer_ShouldDrawThisPlayer, "CBasePlayer_ShouldDrawThisPlayer", true, NOSAVE | DEBUGVAR); + CVar(CBaseViewModel_CalcViewModelView, "CBaseViewModel_CalcViewModelView", true, NOSAVE | DEBUGVAR); CVar(CBaseViewModel_ShouldFlipViewModel, "CBaseViewModel_ShouldFlipViewModel", true, NOSAVE | DEBUGVAR); CVar(Cbuf_ExecuteCommand, "Cbuf_ExecuteCommand", true, NOSAVE | DEBUGVAR); CVar(CClientModeShared_DoPostScreenSpaceEffects, "CClientModeShared_DoPostScreenSpaceEffects", true, NOSAVE | DEBUGVAR); @@ -916,6 +920,9 @@ namespace Vars CVar(CHLClient_DispatchUserMessage, "CHLClient_DispatchUserMessage", true, NOSAVE | DEBUGVAR); CVar(CHLClient_FrameStageNotify, "CHLClient_FrameStageNotify", true, NOSAVE | DEBUGVAR); CVar(CHLClient_LevelShutdown, "CHLClient_LevelShutdown", true, NOSAVE | DEBUGVAR); + CVar(CHLTVCamera_CalcView, "CHLTVCamera_CalcView", true, NOSAVE | DEBUGVAR); + CVar(CHLTVCamera_GetMode, "CHLTVCamera_GetMode", true, NOSAVE | DEBUGVAR); + CVar(CHLTVCamera_GetPrimaryTarget, "CHLTVCamera_GetPrimaryTarget", true, NOSAVE | DEBUGVAR); CVar(CHudCrosshair_GetDrawPosition, "CHudCrosshair_GetDrawPosition", true, NOSAVE | DEBUGVAR); CVar(CInput_GetUserCmd, "CInput_GetUserCmd", true, NOSAVE | DEBUGVAR); CVar(CInput_ValidateUserCmd, "CInput_ValidateUserCmd", true, NOSAVE | DEBUGVAR); @@ -941,6 +948,7 @@ namespace Vars CVar(CParticleProperty_Create_Point, "CParticleProperty_Create_Point", true, NOSAVE | DEBUGVAR); CVar(CParticleProperty_AddControlPoint_Pointer, "CParticleProperty_AddControlPoint_Pointer", true, NOSAVE | DEBUGVAR); CVar(CPlayerResource_GetPlayerName, "CPlayerResource_GetPlayerName", true, NOSAVE | DEBUGVAR); + CVar(CPlayerResource_IsFakePlayer, "CPlayerResource_IsFakePlayer", true, NOSAVE | DEBUGVAR); CVar(CPrediction_RunSimulation, "CPrediction_RunSimulation", true, NOSAVE | DEBUGVAR); CVar(CRendering3dView_EnableWorldFog, "CRendering3dView_EnableWorldFog", true, NOSAVE | DEBUGVAR); CVar(CSkyboxView_Enable3dSkyboxFog, "CSkyboxView_Enable3dSkyboxFog", true, NOSAVE | DEBUGVAR); @@ -994,7 +1002,6 @@ namespace Vars CVar(CViewRender_LevelInit, "CViewRender_LevelInit", true, NOSAVE | DEBUGVAR); CVar(CViewRender_PerformScreenOverlay, "CViewRender_PerformScreenOverlay", true, NOSAVE | DEBUGVAR); CVar(CViewRender_RenderView, "CViewRender_RenderView", true, NOSAVE | DEBUGVAR); - CVar(CVoiceStatus_IsPlayerBlocked, "CVoiceStatus_IsPlayerBlocked", true, NOSAVE | DEBUGVAR); CVar(CWeaponMedigun_PrimaryAttack, "CWeaponMedigun_PrimaryAttack", true, NOSAVE | DEBUGVAR); CVar(DoEnginePostProcessing, "DoEnginePostProcessing", true, NOSAVE | DEBUGVAR); CVar(DSP_Process, "DSP_Process", true, NOSAVE | DEBUGVAR); diff --git a/Amalgam/src/Utils/ExceptionHandler/ExceptionHandler.cpp b/Amalgam/src/Utils/ExceptionHandler/ExceptionHandler.cpp index f751527b..9ac72bba 100644 --- a/Amalgam/src/Utils/ExceptionHandler/ExceptionHandler.cpp +++ b/Amalgam/src/Utils/ExceptionHandler/ExceptionHandler.cpp @@ -117,12 +117,12 @@ static LONG APIENTRY ExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo) std::stringstream ssErrorStream; ssErrorStream << std::format("Error: {} (0x{:X}) ({})\n", sError, ExceptionInfo->ExceptionRecord->ExceptionCode, ++s_iExceptions); - if (U::Memory.GetOffsetFromBase(s_lpParam)) - ssErrorStream << std::format("This: {}\n", U::Memory.GetModuleOffset(s_lpParam)); ssErrorStream << "Built @ " __DATE__ ", " __TIME__ ", " __CONFIGURATION__ "\n"; ssErrorStream << std::format("Time @ {}, {}\n", SDK::GetDate(), SDK::GetTime()); ssErrorStream << "\n"; + if (U::Memory.GetOffsetFromBase(s_lpParam)) + ssErrorStream << std::format("This: {}\n", U::Memory.GetModuleOffset(s_lpParam)); ssErrorStream << std::format("RIP: {:#x}\n", ExceptionInfo->ContextRecord->Rip); ssErrorStream << std::format("RAX: {:#x}\n", ExceptionInfo->ContextRecord->Rax); ssErrorStream << std::format("RCX: {:#x}\n", ExceptionInfo->ContextRecord->Rcx);