misc changes

This commit is contained in:
rei-2
2025-11-04 18:06:10 -05:00
parent b69077ed19
commit 4668497939
21 changed files with 141 additions and 64 deletions
+2 -1
View File
@@ -963,6 +963,7 @@
<ClCompile Include="src\Hooks\CBaseAnimating_UpdateClientSideAnimation.cpp" />
<ClCompile Include="src\Hooks\CBaseEntity_BaseInterpolatePart1.cpp" />
<ClCompile Include="src\Hooks\CBaseEntity_EstimateAbsVelocity.cpp" />
<ClCompile Include="src\Hooks\CBasePlayer_CalcObserverView.cpp" />
<ClCompile Include="src\Hooks\CInput_ValidateUserCmd.cpp" />
<ClCompile Include="src\Hooks\CTFRocketLauncher_CheckReloadMisfire.cpp" />
<ClCompile Include="src\Hooks\CTFPlayer_FireBullet.cpp" />
@@ -970,7 +971,7 @@
<ClCompile Include="src\Hooks\CBaseEntity_SetAbsVelocity.cpp" />
<ClCompile Include="src\Hooks\CBaseEntity_WorldSpaceCenter.cpp" />
<ClCompile Include="src\Hooks\CBaseHudChatLine_InsertAndColorizeText.cpp" />
<ClCompile Include="src\Hooks\CBasePlayer_CalcPlayerView.cpp" />
<ClCompile Include="src\Hooks\CBasePlayer_CalcView.cpp" />
<ClCompile Include="src\Hooks\CBasePlayer_CalcViewModelView.cpp" />
<ClCompile Include="src\Hooks\CBasePlayer_ItemPostFrame.cpp" />
<ClCompile Include="src\Hooks\CBaseViewModel_ShouldFlipViewModel.cpp" />
+2 -1
View File
@@ -104,7 +104,7 @@
<ClCompile Include="src\Hooks\CBaseEntity_SetAbsVelocity.cpp" />
<ClCompile Include="src\Hooks\CBaseEntity_WorldSpaceCenter.cpp" />
<ClCompile Include="src\Hooks\CBaseHudChatLine_InsertAndColorizeText.cpp" />
<ClCompile Include="src\Hooks\CBasePlayer_CalcPlayerView.cpp" />
<ClCompile Include="src\Hooks\CBasePlayer_CalcView.cpp" />
<ClCompile Include="src\Hooks\CBasePlayer_CalcViewModelView.cpp" />
<ClCompile Include="src\Hooks\CBasePlayer_ItemPostFrame.cpp" />
<ClCompile Include="src\Hooks\CBaseViewModel_ShouldFlipViewModel.cpp" />
@@ -199,6 +199,7 @@
<ClCompile Include="src\Hooks\CTFPlayer_GetMinFOV.cpp" />
<ClCompile Include="src\Hooks\CWeaponMedigun_PrimaryAttack.cpp" />
<ClCompile Include="src\Hooks\IMaterialSystem_FindTexture.cpp" />
<ClCompile Include="src\Hooks\CBasePlayer_CalcObserverView.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Utils\UtlVector\UtlVector.h" />
+10
View File
@@ -62,6 +62,16 @@ namespace MAKE_INTERFACE_SCOPE \
static int nOffset = U::NetVars.GetNetVar(table, name) + offset; \
return *reinterpret_cast<type*>(uintptr_t(this) + nOffset); \
}
#define NETVAR_EMBED(_name, type, table, name) inline type _name() \
{ \
static int nOffset = U::NetVars.GetNetVar(table, name); \
return reinterpret_cast<type>(uintptr_t(this) + nOffset); \
}
#define NETVAR_EMBED_OFF(_name, type, table, name, offset) inline type _name() \
{ \
static int nOffset = U::NetVars.GetNetVar(table, name) + offset; \
return reinterpret_cast<type>(uintptr_t(this) + nOffset); \
}
#define NETVAR_ARRAY(_name, type, table, size, name) inline type& _name(int iIndex) \
{ \
static int nOffset = U::NetVars.GetNetVar(table, name); \
+7 -2
View File
@@ -73,12 +73,17 @@ void CCore::Load()
}
float flTime = 0.f;
while (!U::Memory.FindSignature("client.dll", "48 8B 0D ? ? ? ? 48 8B 10 48 8B 19 48 8B C8 FF 92") || !SDK::GetTeamFortressWindow())
while (true)
{
auto uSignature = U::Memory.FindSignature("client.dll", "48 8B 0D ? ? ? ? 48 8B 10 48 8B 19 48 8B C8 FF 92");
auto hWindow = SDK::GetTeamFortressWindow();
if (uSignature && hWindow)
break;
Sleep(500), flTime += 0.5f;
if (m_bUnload = m_bFailed = flTime >= 60.f)
{
AppendFailText("Failed to load");
AppendFailText(std::format("Failed to load in time ({:#x}, {:#x})", uSignature, uintptr_t(hWindow)).c_str());
return;
}
if (m_bUnload = m_bFailed = U::KeyHandler.Down(VK_F11, true))
@@ -320,7 +320,7 @@ bool CAimbotGlobal::ValidBomb(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CBaseEn
|| !FriendlyFire() && pEntity->m_iTeamNum() == pLocal->m_iTeamNum())
continue;
Vec3 vPos; reinterpret_cast<CCollisionProperty*>(pEntity->GetCollideable())->CalcNearestPoint(vOrigin, &vPos);
Vec3 vPos; pEntity->m_Collision()->CalcNearestPoint(vOrigin, &vPos);
if (vOrigin.DistTo(vPos) > 300.f)
continue;
@@ -394,11 +394,11 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase*
for (auto& [pBox, nHitbox, _] : vHitboxes)
{
Vec3 vAngle; Math::MatrixAngles(aBones[pBox->bone], vAngle);
Vec3 vMins = pBox->bbmin;
Vec3 vMaxs = pBox->bbmax;
Vec3 vCheckMins = (vMins + flBoneSubtract / flModelScale) * flBoneScale;
Vec3 vCheckMaxs = (vMaxs - flBoneSubtract / flModelScale) * flBoneScale;
Vec3 vAngle; Math::MatrixAngles(aBones[pBox->bone], vAngle);
Vec3 vOffset;
{
@@ -489,11 +489,10 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase*
Vec3 vCheckMins = (vMins + flBoneSubtract) * flBoneScale;
Vec3 vCheckMaxs = (vMaxs - flBoneSubtract) * flBoneScale;
auto pCollideable = tTarget.m_pEntity->GetCollideable();
const matrix3x4& mTransform = pCollideable ? pCollideable->CollisionToWorldTransform() : tTarget.m_pEntity->RenderableToWorldTransform();
const matrix3x4& mTransform = tTarget.m_pEntity->m_Collision()->CollisionToWorldTransform();
std::vector<Vec3> vPoints = { Vec3() };
//if (Vars::Aimbot::Hitscan::PointScale.Value > 0.f)
//if (Vars::Aimbot::Hitscan::MultipointScale.Value > 0.f)
{
bool bTriggerbot = (Vars::Aimbot::General::AimType.Value == Vars::Aimbot::General::AimTypeEnum::Smooth
|| Vars::Aimbot::General::AimType.Value == Vars::Aimbot::General::AimTypeEnum::Assistive)
@@ -501,7 +500,7 @@ int CAimbotHitscan::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase*
if (!bTriggerbot)
{
float flScale = 0.5f; //Vars::Aimbot::Hitscan::PointScale.Value / 100;
float flScale = 0.5f; //Vars::Aimbot::Hitscan::MultipointScale.Value / 100;
Vec3 vMinsS = (vMins - vMaxs) / 2 * flScale;
Vec3 vMaxsS = (vMaxs - vMins) / 2 * flScale;
@@ -701,7 +701,7 @@ std::vector<Point_t> CAimbotProjectile::GetSplashPoints(Target_t& tTarget, std::
bool bValid = vPoint.m_tSolution.m_iCalculated != CalculatedEnum::Pending;
if (bValid)
{
Vec3 vPos; reinterpret_cast<CCollisionProperty*>(tTarget.m_pEntity->GetCollideable())->CalcNearestPoint(vPoint.m_vPoint, &vPos);
Vec3 vPos; tTarget.m_pEntity->m_Collision()->CalcNearestPoint(vPoint.m_vPoint, &vPos);
bValid = vPoint.m_vPoint.DistTo(vPos) < m_tInfo.m_flRadius;
}
@@ -849,7 +849,7 @@ std::vector<Point_t> CAimbotProjectile::GetSplashPointsSimple(Target_t& tTarget,
bool bValid = vPoint.m_tSolution.m_iCalculated != CalculatedEnum::Pending;
if (bValid)
{
Vec3 vPos = {}; reinterpret_cast<CCollisionProperty*>(tTarget.m_pEntity->GetCollideable())->CalcNearestPoint(vPoint.m_vPoint, &vPos);
Vec3 vPos = {}; tTarget.m_pEntity->m_Collision()->CalcNearestPoint(vPoint.m_vPoint, &vPos);
bValid = vPoint.m_vPoint.DistTo(vPos) < m_tInfo.m_flRadius;
}
@@ -77,7 +77,7 @@ static inline bool CheckEntities(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUse
continue;
// CEntitySphereQuery actually does a box test so we need to make sure the distance is less than the radius first
Vec3 vPos; reinterpret_cast<CCollisionProperty*>(pEntity->GetCollideable())->CalcNearestPoint(vOrigin, &vPos);
Vec3 vPos; pEntity->m_Collision()->CalcNearestPoint(vOrigin, &vPos);
if (vOrigin.DistTo(vPos) > flRadius)
continue;
@@ -137,7 +137,7 @@ static inline bool CheckLocal(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CBaseEn
{
flRadius += 1;
Vec3 vPos; reinterpret_cast<CCollisionProperty*>(pLocal->GetCollideable())->CalcNearestPoint(vOrigin, &vPos);
Vec3 vPos; pLocal->m_Collision()->CalcNearestPoint(vOrigin, &vPos);
if (vOrigin.DistTo(vPos) > flRadius)
return false;
@@ -171,7 +171,7 @@ void CAutoRocketJump::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* p
{
const Vec3 vOriginal = pLocal->GetAbsOrigin();
pLocal->SetAbsOrigin(vOrigin);
Vec3 vPos; reinterpret_cast<CCollisionProperty*>(pLocal->GetCollideable())->CalcNearestPoint(vPoint, &vPos);
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);
@@ -17,7 +17,6 @@ void CSpectate::NetUpdateEnd(CTFPlayer* pLocal)
{
if (pLocal->IsAlive() && pLocal->m_hObserverTarget())
{
pLocal->m_vecViewOffset() = pLocal->GetViewOffset();
pLocal->m_iObserverMode() = OBS_MODE_NONE;
pLocal->m_hObserverTarget().Set(nullptr);
}
@@ -39,7 +38,6 @@ void CSpectate::NetUpdateEnd(CTFPlayer* pLocal)
pLocal->m_hObserverTarget().Set(pEntity);
}
pLocal->m_iObserverMode() = Vars::Visuals::Thirdperson::Enabled.Value ? OBS_MODE_THIRDPERSON : OBS_MODE_FIRSTPERSON;
pLocal->m_vecViewOffset() = pEntity->GetViewOffset();
Vars::Visuals::Thirdperson::Enabled.Value ? I::Input->CAM_ToThirdPerson() : I::Input->CAM_ToFirstPerson();
m_hTargetTarget = pLocal->m_hObserverTarget();
@@ -0,0 +1,27 @@
#include "../SDK/SDK.h"
#include "../Features/Spectate/Spectate.h"
MAKE_SIGNATURE(CBasePlayer_CalcObserverView, "client.dll", "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 48 8B 01 49 8B F9 49 8B F0", 0x0);
MAKE_HOOK(CBasePlayer_CalcObserverView, S::CBasePlayer_CalcObserverView(), void,
void* rcx, Vector& eyeOrigin, QAngle& eyeAngles, float& fov)
{
#ifdef DEBUG_HOOKS
if (!Vars::Hooks::CBasePlayer_CalcPlayerView[DEFAULT_BIND])
return CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles, fov);
#endif
if (F::Spectate.m_iTarget == -1)
return CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles, fov);
auto pPlayer = reinterpret_cast<CBasePlayer*>(rcx);
auto pTarget = pPlayer->m_hObserverTarget()->As<CTFPlayer>();
if (!pTarget || !pTarget->IsPlayer())
return CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles, fov);
Vec3 vOldOffset = pPlayer->m_vecViewOffset();
pPlayer->m_vecViewOffset() = pTarget->GetViewOffset();
CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles, fov);
pPlayer->m_vecViewOffset() = vOldOffset;
}
@@ -1,25 +0,0 @@
#include "../SDK/SDK.h"
MAKE_SIGNATURE(CBasePlayer_CalcPlayerView, "client.dll", "48 89 5C 24 ? 56 57 41 54 48 83 EC ? 48 8B D9", 0x0);
MAKE_HOOK(CBasePlayer_CalcPlayerView, S::CBasePlayer_CalcPlayerView(), void,
void* rcx, Vector& eyeOrigin, QAngle& eyeAngles, float& fov)
{
#ifdef DEBUG_HOOKS
if (!Vars::Hooks::CBasePlayer_CalcPlayerView[DEFAULT_BIND])
return CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles, fov);
#endif
if (Vars::Visuals::Removals::ViewPunch.Value)
{
auto pPlayer = reinterpret_cast<CBasePlayer*>(rcx);
Vec3 vOldPunch = pPlayer->m_vecPunchAngle();
pPlayer->m_vecPunchAngle() = {};
CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles, fov);
pPlayer->m_vecPunchAngle() = vOldPunch;
return;
}
CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles, fov);
}
@@ -0,0 +1,24 @@
#include "../SDK/SDK.h"
#include "../Features/Spectate/Spectate.h"
MAKE_SIGNATURE(CBasePlayer_CalcView, "client.dll", "40 57 48 83 EC ? 44 8B 91", 0x0);
MAKE_HOOK(CBasePlayer_CalcView, S::CBasePlayer_CalcView(), void,
void* rcx, Vector& eyeOrigin, QAngle& eyeAngles, float& zNear, float& zFar, float& fov)
{
#ifdef DEBUG_HOOKS
if (!Vars::Hooks::CBasePlayer_CalcPlayerView[DEFAULT_BIND])
return CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles, fov);
#endif
if (!Vars::Visuals::Removals::ViewPunch.Value && F::Spectate.m_iTarget == -1)
return CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles, zNear, zFar, fov);
auto pPlayer = reinterpret_cast<CBasePlayer*>(rcx);
Vec3 vOldPunch = pPlayer->m_vecPunchAngle();
pPlayer->m_vecPunchAngle() = {};
CALL_ORIGINAL(rcx, eyeOrigin, eyeAngles, zNear, zFar, fov);
pPlayer->m_vecPunchAngle() = vOldPunch;
}
@@ -36,7 +36,7 @@ MAKE_HOOK(CParticleProperty_Create_Name, S::CParticleProperty_Create_Name(), voi
*/
auto pModel = pLocal->GetRenderedWeaponModel();
if (!pModel || rcx != &pModel->m_Particles())
if (!pModel || rcx != pModel->m_Particles())
return CALL_ORIGINAL(rcx, pszParticleName, iAttachType, pszAttachmentName);
bool bBlue = pLocal->m_iTeamNum() == TF_TEAM_BLUE;
@@ -146,7 +146,7 @@ MAKE_HOOK(CParticleProperty_Create_Point, S::CParticleProperty_Create_Point(), v
for (auto pEntity : H::Entities.GetGroup(EntityEnum::WorldProjectile))
{
auto pOwner = F::ProjSim.GetEntities(pEntity).second;
if (bValid = pLocal == pOwner && rcx == &pEntity->m_Particles())
if (bValid = pLocal == pOwner && rcx == pEntity->m_Particles())
break;
}
if (!bValid)
@@ -67,7 +67,7 @@ public:
NETVAR(m_hEffectEntity, EHANDLE, "CBaseEntity", "m_hEffectEntity");
NETVAR(moveparent, int, "CBaseEntity", "moveparent");
NETVAR(m_iParentAttachment, int, "CBaseEntity", "m_iParentAttachment");
NETVAR(m_Collision, CCollisionProperty*, "CBaseEntity", "m_Collision");
NETVAR_EMBED(m_Collision, CCollisionProperty*, "CBaseEntity", "m_Collision");
NETVAR(m_vecMinsPreScaled, Vec3, "CBaseEntity", "m_vecMinsPreScaled");
NETVAR(m_vecMaxsPreScaled, Vec3, "CBaseEntity", "m_vecMaxsPreScaled");
NETVAR(m_vecMins, Vec3, "CBaseEntity", "m_vecMins");
@@ -95,7 +95,7 @@ public:
NETVAR_OFF(m_MoveType, byte, "CTFPlayer", "m_nWaterLevel", -4);
NETVAR_OFF(m_MoveCollide, byte, "CTFPlayer", "m_nWaterLevel", -3);
NETVAR_OFF(m_nWaterType, byte, "CTFPlayer", "m_nWaterLevel", 1);
NETVAR_OFF(m_Particles, CParticleProperty*, "CBaseEntity", "m_flElasticity", -56);
NETVAR_EMBED_OFF(m_Particles, CParticleProperty*, "CBaseEntity", "m_flElasticity", -56);
NETVAR_OFF(m_iv_vecVelocity, CInterpolatedVar<Vec3>, "CBaseEntity", "m_iTeamNum", 156);
NETVAR_OFF(m_iv_vecOrigin, CInterpolatedVar<Vec3>, "CBaseEntity", "m_flShadowCastDistance", 84);
NETVAR_OFF(m_iv_angRotation, CInterpolatedVar<Vec3>, "CBaseEntity", "m_vecOrigin", -128);
@@ -8,7 +8,7 @@ MAKE_SIGNATURE(CBasePlayer_GetAmmoCount, "client.dll", "48 89 5C 24 ? 57 48 83 E
class CBasePlayer : public CBaseCombatCharacter
{
public:
NETVAR(m_Local, void*, "CBasePlayer", "m_Local");
NETVAR_EMBED(m_Local, void*, "CBasePlayer", "m_Local");
NETVAR(m_chAreaBits, void*, "CBasePlayer", "m_chAreaBits");
NETVAR(m_chAreaPortalBits, void*, "CBasePlayer", "m_chAreaPortalBits");
NETVAR(m_iHideHUD, int, "CBasePlayer", "m_iHideHUD");
@@ -45,8 +45,8 @@ public:
NETVAR(m_flDeathTime, float, "CBasePlayer", "m_flDeathTime");
NETVAR(m_nWaterLevel, byte, "CBasePlayer", "m_nWaterLevel");
NETVAR(m_flLaggedMovementValue, float, "CBasePlayer", "m_flLaggedMovementValue");
NETVAR(m_AttributeList, void*, "CBasePlayer", "m_AttributeList");
NETVAR(pl, void*, "CBasePlayer", "pl");
NETVAR_EMBED(m_AttributeList, void*, "CBasePlayer", "m_AttributeList");
NETVAR_EMBED(pl, void*, "CBasePlayer", "pl");
NETVAR(deadflag, int, "CBasePlayer", "deadflag");
NETVAR(m_iFOV, int, "CBasePlayer", "m_iFOV");
NETVAR(m_iFOVStart, int, "CBasePlayer", "m_iFOVStart");
@@ -35,6 +35,26 @@ public:
class CCollisionProperty : public ICollideable
{
public:
CBaseEntity* m_pOuter;
Vec3 m_vecMinsPreScaled;
Vec3 m_vecMaxsPreScaled;
Vec3 m_vecMins;
Vec3 m_vecMaxs;
float m_flRadius;
unsigned short m_usSolidFlags;
SpatialPartitionHandle_t m_Partition;
unsigned char m_nSurroundType;
unsigned char m_nSolidType;
unsigned char m_triggerBloat;
bool m_bUniformTriggerBloat;
Vec3 m_vecSpecifiedSurroundingMinsPreScaled;
Vec3 m_vecSpecifiedSurroundingMaxsPreScaled;
Vec3 m_vecSpecifiedSurroundingMins;
Vec3 m_vecSpecifiedSurroundingMaxs;
Vec3 m_vecSurroundingMins;
Vec3 m_vecSurroundingMaxs;
public:
SIGNATURE_ARGS(SetCollisionBounds, void, CCollisionProperty, (const Vec3& mins, const Vec3& maxs), this, std::ref(mins), std::ref(maxs));
SIGNATURE_ARGS(CalcNearestPoint, void, CCollisionProperty, (const Vec3& vecWorldPt, Vec3* pVecNearestWorldPt), this, std::ref(vecWorldPt), pVecNearestWorldPt);
+2 -7
View File
@@ -28,7 +28,7 @@ public:
NETVAR(m_bCustomModelVisibleToSelf, bool, "CTFPlayer", "m_bCustomModelVisibleToSelf");
NETVAR(m_bUseClassAnimations, bool, "CTFPlayer", "m_bUseClassAnimations");
NETVAR(m_iClassModelParity, int, "CTFPlayer", "m_iClassModelParity");
//NETVAR(m_Shared, void*, "CTFPlayer", "m_Shared");
NETVAR_EMBED(m_Shared, void*, "CTFPlayer", "m_Shared");
NETVAR(m_nPlayerCond, int, "CTFPlayer", "m_nPlayerCond");
NETVAR(m_bJumping, bool, "CTFPlayer", "m_bJumping");
NETVAR(m_nNumHealers, int, "CTFPlayer", "m_nNumHealers");
@@ -156,7 +156,7 @@ public:
NETVAR(m_bInPowerPlay, bool, "CTFPlayer", "m_bInPowerPlay");
NETVAR(m_iSpawnCounter, int, "CTFPlayer", "m_iSpawnCounter");
NETVAR(m_bArenaSpectator, bool, "CTFPlayer", "m_bArenaSpectator");
NETVAR(m_AttributeManager, void*, "CTFPlayer", "m_AttributeManager");
NETVAR_EMBED(m_AttributeManager, void*, "CTFPlayer", "m_AttributeManager");
NETVAR(m_hOuter, EHANDLE, "CTFPlayer", "m_hOuter");
NETVAR(m_ProviderType, int, "CTFPlayer", "m_ProviderType");
NETVAR(m_iReapplyProvisionParity, int, "CTFPlayer", "m_iReapplyProvisionParity");
@@ -180,11 +180,6 @@ public:
NETVAR(m_iCampaignMedals, int, "CTFPlayer", "m_iCampaignMedals");
NETVAR(m_iPlayerSkinOverride, int, "CTFPlayer", "m_iPlayerSkinOverride");
NETVAR(m_bViewingCYOAPDA, bool, "CTFPlayer", "m_bViewingCYOAPDA");
inline void* m_Shared()
{
static int nOffset = U::NetVars.GetNetVar("CTFPlayer", "m_Shared");
return reinterpret_cast<void*>(uintptr_t(this) + nOffset);
};
NETVAR_OFF(m_flInvisibility, float, "CTFPlayer", "m_flInvisChangeCompleteTime", -8);
NETVAR_OFF(m_flPrevInvisibility, float, "CTFPlayer", "m_flInvisChangeCompleteTime", -4);
+17 -7
View File
@@ -68,6 +68,11 @@ public:
return x != v.x || y != v.y;
}
explicit operator bool() const
{
return x || y;
}
inline Vec2& operator+=(const Vec2& v)
{
x += v.x; y += v.y; return *this;
@@ -270,10 +275,10 @@ public:
return x * v.x + y * v.y;
}
inline bool IsZero(void) const
inline bool IsZero(float flEpsilon = 0.001f) const
{
return fabsf(x) < 0.001f &&
fabsf(y) < 0.001f;
return fabsf(x) < flEpsilon &&
fabsf(y) < flEpsilon;
}
};
using Vector2D = Vec2;
@@ -339,6 +344,11 @@ public:
return x != v.x || y != v.y || z != v.z;
}
explicit operator bool() const
{
return x || y || z;
}
inline Vec3& operator+=(const Vec3& v)
{
x += v.x; y += v.y; z += v.z; return *this;
@@ -612,11 +622,11 @@ public:
return Vec3(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x);
}
inline bool IsZero(void) const
inline bool IsZero(float flEpsilon = 0.001f) const
{
return fabsf(x) < 0.001f &&
fabsf(y) < 0.001f &&
fabsf(z) < 0.001f;
return fabsf(x) < flEpsilon &&
fabsf(y) < flEpsilon &&
fabsf(z) < flEpsilon;
}
inline Vec3 ToAngle() const noexcept
@@ -320,7 +320,7 @@ void CEntities::Clear(bool bShutdown)
void CEntities::ManualNetwork(const StartSoundParams_t& params)
{
if (params.soundsource <= 0 || params.soundsource == I::EngineClient->GetLocalPlayer())
if (params.soundsource <= 0 || !params.origin || params.soundsource == I::EngineClient->GetLocalPlayer())
return;
auto pEntity = I::ClientEntityList->GetClientEntity(params.soundsource)->As<CBaseEntity>();
+12
View File
@@ -26,6 +26,18 @@ ADD_FEATURE_CUSTOM(CNetVars, NetVars, U);
return *reinterpret_cast<type*>(uintptr_t(this) + nOffset); \
}
#define NETVAR_EMBED(_name, type, table, name) inline type _name() \
{ \
static int nOffset = U::NetVars.GetNetVar(table, name); \
return reinterpret_cast<type>(uintptr_t(this) + nOffset); \
}
#define NETVAR_EMBED_OFF(_name, type, table, name, offset) inline type _name() \
{ \
static int nOffset = U::NetVars.GetNetVar(table, name) + offset; \
return reinterpret_cast<type>(uintptr_t(this) + nOffset); \
}
#define NETVAR_ARRAY(_name, type, table, name) inline type& _name(int iIndex) \
{ \
static int nOffset = U::NetVars.GetNetVar(table, name); \