Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "Definitions.h"
- #include "IClientUnknown.h"
- #include "IClientEntityList.h"
- #include "CInput.h"
- #include "..\Utils\Utils.h"
- #include "..\Utils\NetvarManager.h"
- #define NETVAR(type, name, table, netvar) \
- type& name##() const { \
- static int _##name = g_pNetvars->GetOffset(table, netvar); \
- return *(type*)((uintptr_t)this + _##name); \
- }
- #define PNETVAR(type, name, table, netvar) \
- type* name##() const { \
- static int _##name = g_pNetvars->GetOffset(table, netvar); \
- return (type*)((uintptr_t)this + _##name); \
- }
- #define ANETVAR(type, funcname, num, table, netvar) std::array<type, num>& funcname() \
- { \
- static int _##name = g_pNetvars->GetOffset(table, netvar); \
- return *reinterpret_cast<std::array<type, num>*>( uintptr_t( this ) + _##name ); \
- }
- // class predefinition
- class C_BaseCombatWeapon;
- class C_AnimState
- {
- public:
- char pad[3];
- char bUnknown; //0x4
- char pad2[91];
- void* pBaseEntity; //0x60
- void* pActiveWeapon; //0x64
- void* pLastActiveWeapon; //0x68
- float m_flLastClientSideAnimationUpdateTime; //0x6C
- int m_iLastClientSideAnimationUpdateFramecount; //0x70
- float m_flEyePitch; //0x74
- float m_flEyeYaw; //0x78
- float m_flPitch; //0x7C
- float m_flGoalFeetYaw; //0x80
- float m_flCurrentFeetYaw; //0x84
- float m_flCurrentTorsoYaw; //0x88
- float m_flUnknownVelocityLean; //0x8C //changes when moving/jumping/hitting ground
- float m_flLeanAmount; //0x90
- char pad4[4]; //NaN
- float m_flFeetCycle; //0x98 0 to 1
- float m_flFeetYawRate; //0x9C 0 to 1
- float m_fUnknown2;
- float m_fDuckAmount; //0xA4
- float m_fLandingDuckAdditiveSomething; //0xA8
- float m_fUnknown3; //0xAC
- Vector m_vOrigin; //0xB0, 0xB4, 0xB8
- Vector m_vLastOrigin; //0xBC, 0xC0, 0xC4
- float m_vVelocityX; //0xC8
- float m_vVelocityY; //0xCC
- char pad5[4];
- float m_flUnknownFloat1; //0xD4 Affected by movement and direction
- char pad6[8];
- float m_flUnknownFloat2; //0xE0 //from -1 to 1 when moving and affected by direction
- float m_flUnknownFloat3; //0xE4 //from -1 to 1 when moving and affected by direction
- float m_unknown; //0xE8
- float speed_2d; //0xEC
- float flUpVelocity; //0xF0
- float m_flSpeedNormalized; //0xF4 //from 0 to 1
- float m_flFeetSpeedForwardsOrSideWays; //0xF8 //from 0 to 2. something is 1 when walking, 2.something when running, 0.653 when crouch walking
- float m_flFeetSpeedUnknownForwardOrSideways; //0xFC //from 0 to 3. something
- float m_flTimeSinceStartedMoving; //0x100
- float m_flTimeSinceStoppedMoving; //0x104
- unsigned char m_bOnGround; //0x108
- unsigned char m_bInHitGroundAnimation; //0x109
- char pad7[10];
- float m_flLastOriginZ; //0x114
- float m_flHeadHeightOrOffsetFromHittingGroundAnimation; //0x118 from 0 to 1, is 1 when standing
- float m_flStopToFullRunningFraction; //0x11C from 0 to 1, doesnt change when walking or crouching, only running
- char pad8[4]; //NaN
- float m_flUnknownFraction; //0x124 affected while jumping and running, or when just jumping, 0 to 1
- char pad9[4]; //NaN
- float m_flUnknown3;
- char pad10[528];
- };
- class AnimationLayer {
- public:
- char pad_0000[20];
- // These should also be present in the padding, don't see the use for it though
- //float m_flLayerAnimtime;
- //float m_flLayerFadeOuttime;
- unsigned int m_nOrder; //0x0014
- unsigned int m_nSequence; //0x0018
- float m_flPrevCycle; //0x001C
- float m_flWeight; //0x0020
- float m_flWeightDeltaRate; //0x0024
- float m_flPlaybackRate; //0x0028
- float m_flCycle; //0x002C
- void *m_pOwner; //0x0030 // player's thisptr
- char pad_0038[4]; //0x0034
- }; //Size: 0x0038
- class CollisionProperty
- {
- public:
- NETVAR(Vector, GetMin, "DT_BaseEntity", "m_vecMins"); // m_vecMins : 0x29BC
- NETVAR(Vector, GetMax, "DT_BaseEntity", "m_vecMaxs"); // m_vecMaxs : 0x29C8
- };
- class viewmodel_t;
- class C_BaseEntity : public IClientUnknown, public IClientRenderable, public IClientNetworkable
- {
- private:
- template<class T>
- T GetPointer(const int offset)
- {
- return reinterpret_cast<T*>(reinterpret_cast<std::uintptr_t>(this) + offset);
- }
- // To get value from the pointer itself
- template<class T>
- T GetValue(const int offset)
- {
- return *reinterpret_cast<T*>(reinterpret_cast<std::uintptr_t>(this) + offset);
- }
- template <typename T>
- T& SetValue(uintptr_t offset)
- {
- return *reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(this) + offset);
- }
- public:
- NETVAR(int, m_iObserverMode, "DT_BasePlayer", "m_iObserverMode");
- NETVAR(CHandle<C_BaseEntity>, m_hObserverTarget, "DT_BasePlayer", "m_hObserverTarget");
- NETVAR(int, GetGrenadeSmokeTickBegin, "DT_SmokeGrenadeProjectile", "m_nSmokeEffectTickBegin");
- NETVAR(Vector, GetOBBMins, "DT_BaseEntity", "m_vecMins");
- NETVAR(Vector, GetOBBMaxs,"DT_BaseEntity", "m_vecMaxs");
- Vector GetBonePosition(int iBone);
- Vector GetHitboxPositionxd(int Hitbox);
- VMatrix & GetCollisionBoundTrans()
- {
- return *reinterpret_cast<VMatrix*>((DWORD)this + 0x0440);
- }
- matrix3x4_t& get_rgflcoordinateframe()
- {
- static auto _m_rgflCoordinateFrame = g_pNetvars->GetOffset("DT_CSPlayer", "m_CollisionGroup") - 0x30;
- return *reinterpret_cast<matrix3x4_t*>(reinterpret_cast<uintptr_t>(this) + _m_rgflCoordinateFrame);
- }
- CollisionProperty* GetCollision()
- {
- return reinterpret_cast<CollisionProperty*>((DWORD)this + 0x31C);
- }
- int GetHitboxSet();
- NETVAR(CHandle<viewmodel_t>, m_hViewModel, "DT_BasePlayer", "m_hViewModel[0]");
- NETVAR(float, m_flFlashDuration, "DT_CSPlayer", "m_flFlashDuration");
- C_AnimState *AnimState()
- {
- return *reinterpret_cast<C_AnimState**>(uintptr_t(this) + 0x3900);
- }
- AnimationLayer *AnimOverlays()
- {
- return *reinterpret_cast<AnimationLayer**>(uintptr_t(this) + 0x2980);
- }
- CBaseHandle* m_hMyWeapons()
- {
- return (CBaseHandle*)((uintptr_t)this + 0x2DF8);
- }
- int NumOverlays()
- {
- return 15;
- }
- void UpdateClientAnimation()
- {
- Utils::GetVFunc<void(__thiscall*)(void*)>(this, 221)(this);
- }
- void ClientAnimations(bool value)
- {
- static int m_bClientSideAnimation = g_pNetvars->GetOffset("DT_BaseAnimating", "m_bClientSideAnimation");
- *reinterpret_cast<bool*>(uintptr_t(this) + m_bClientSideAnimation) = value;
- }
- int GetSequence()
- {
- static int m_nSequence = g_pNetvars->GetOffset("DT_BaseAnimating", "m_nSequence");
- return GetValue<int>(m_nSequence);
- }
- void SetSequence(int Sequence)
- {
- static int m_nSequence = g_pNetvars->GetOffset("DT_BaseAnimating", "m_nSequence");
- *reinterpret_cast<int*>(uintptr_t(this) + m_nSequence) = Sequence;
- }
- void SimulatedEveryTick(bool value)
- {
- static int m_bSimulatedEveryTick = g_pNetvars->GetOffset("DT_BaseEntity", "m_bSimulatedEveryTick");
- *reinterpret_cast<bool*>(uintptr_t(this) + m_bSimulatedEveryTick) = value;
- }
- void SetAbsAngles(Vector angles);
- void SetAbsOrigin(Vector origin);
- NETVAR(CHandle<C_BaseCombatWeapon>, m_hActiveWeapon, "DT_BaseCombatCharacter", "m_hActiveWeapon");
- NETVAR(int32_t, m_iShotsFired, "DT_CSPlayer", "m_iShotsFired");
- NETVAR(int, m_nModelIndex, "DT_BaseEntity", "m_nModelIndex");
- Vector GetAbsOrigin()
- {
- return Utils::GetVFunc<Vector&(__thiscall*)(void*)>(this, 10)(this);
- }
- void SetAbsVelocity(Vector velocity);
- C_BaseCombatWeapon* GetActiveWeapon()
- {
- static int m_hActiveWeapon = g_pNetvars->GetOffset("DT_BaseCombatCharacter", "m_hActiveWeapon");
- const auto weaponData = GetValue<CBaseHandle>(m_hActiveWeapon);
- return reinterpret_cast<C_BaseCombatWeapon*>(g_pEntityList->GetClientEntityFromHandle(weaponData));
- }
- int GetActiveWeaponIndex()
- {
- static int m_hActiveWeapon = g_pNetvars->GetOffset("DT_BaseCombatCharacter", "m_hActiveWeapon");
- return *reinterpret_cast<int*>(uintptr_t(this) + m_hActiveWeapon) & 0xFFF; //m_hActiveWeapon
- }
- int GetTeam()
- {
- static int m_iTeamNum = g_pNetvars->GetOffset("DT_BaseEntity", "m_iTeamNum");
- return GetValue<int>(m_iTeamNum);
- }
- void SetModelIndex(int index)
- {
- typedef void(__thiscall* OriginalFn)(PVOID, int);
- return Utils::GetVFunc<OriginalFn>(this, 75)(this, index);
- }
- int WeaponID()
- {
- return GetItemDefinitionIndex();
- }
- short GetItemDefinitionIndex(void)
- {
- if (!this) return 0;
- return *(short*)((uintptr_t)this + 0x2FAA);
- }
- int Clip1()
- {
- return *reinterpret_cast<int*>((uintptr_t)this + 0x3244);
- }
- float GetPostponeFireReadyTime()
- {
- return *reinterpret_cast<float*>((uintptr_t)this + 0x331c);
- }
- EntityFlags GetFlags()
- {
- static int m_fFlags = g_pNetvars->GetOffset("DT_BasePlayer", "m_fFlags");
- return GetValue<EntityFlags>(m_fFlags);
- }
- void SetFlags(int offset)
- {
- static int m_fFlags = g_pNetvars->GetOffset("DT_BasePlayer", "m_fFlags");
- *reinterpret_cast<int*>(uintptr_t(this) + m_fFlags) = offset;
- }
- MoveType_t GetMoveType()
- {
- static int m_Movetype = g_pNetvars->GetOffset("DT_BaseEntity", "m_nRenderMode") + 1;
- return GetValue<MoveType_t>(m_Movetype);
- }
- float GetSimulationTime()
- {
- static int m_flSimulationTime = g_pNetvars->GetOffset("DT_BaseEntity", "m_flSimulationTime");
- return GetValue<float>(m_flSimulationTime);
- }
- float GetOldSimulationTime()
- {
- static int m_flOldSimulationTime = g_pNetvars->GetOffset("DT_BaseEntity", "m_flSimulationTime") + 4;
- return GetValue<float>(m_flOldSimulationTime);
- }
- float GetLowerBodyYaw()
- {
- static int m_flLowerBodyYawTarget = g_pNetvars->GetOffset("DT_CSPlayer", "m_flLowerBodyYawTarget");
- return GetValue<float>(m_flLowerBodyYawTarget);
- }
- void SetLowerBodyYaw(float value)
- {
- static int m_flLowerBodyYawTarget = g_pNetvars->GetOffset("DT_CSPlayer", "m_flLowerBodyYawTarget");
- *reinterpret_cast<float*>(uintptr_t(this) + m_flLowerBodyYawTarget) = value;
- }
- bool GetHeavyArmor()
- {
- static int m_bHasHeavyArmor = g_pNetvars->GetOffset("DT_CSPlayer", "m_bHasHeavyArmor");
- return GetValue<bool>(m_bHasHeavyArmor);
- }
- int ArmorValue()
- {
- static int m_ArmorValue = g_pNetvars->GetOffset("DT_CSPlayer", "m_ArmorValue");
- return GetValue<int>(m_ArmorValue);
- }
- bool HasHelmet()
- {
- static int m_bHasHelmet = g_pNetvars->GetOffset("DT_CSPlayer", "m_bHasHelmet");
- return GetValue<bool>(m_bHasHelmet);
- }
- bool GetLifeState()
- {
- static int m_lifeState = g_pNetvars->GetOffset("DT_BasePlayer", "m_lifeState");
- return GetValue<bool>(m_lifeState);
- }
- NETVAR(int, m_zoomLevel, "DT_WeaponCSBaseGun", "m_zoomLevel");
- bool IsScoped()
- {
- static int m_bIsScoped = g_pNetvars->GetOffset("DT_CSPlayer", "m_bIsScoped");
- return GetValue<bool>(m_bIsScoped);
- }
- int GetHealth()
- {
- static int m_iHealth = g_pNetvars->GetOffset("DT_BasePlayer", "m_iHealth");
- return GetValue<int>(m_iHealth);
- }
- bool IsKnifeorNade();
- bool IsKnife();
- bool IsAlive() { return this->GetHealth() > 0 && this->GetLifeState() == 0; }
- bool IsEnemy();
- bool IsImmune()
- {
- static int m_bGunGameImmunity = g_pNetvars->GetOffset("DT_CSPlayer", "m_bGunGameImmunity");
- return GetValue<bool>(m_bGunGameImmunity);
- }
- DWORD deadflag()
- {
- return GetValue<DWORD>(g_pNetvars->GetOffset("DT_CSPlayer", "deadflag"));
- }
- int GetTickBase()
- {
- static int m_nTickBase = g_pNetvars->GetOffset("DT_BasePlayer", "localdata", "m_nTickBase");
- return GetValue<int>(m_nTickBase);
- }
- int GetShotsFired()
- {
- static int m_iShotsFired = g_pNetvars->GetOffset("DT_CSPlayer", "cslocaldata", "m_iShotsFired");
- return GetValue<int>(m_iShotsFired);
- }
- void SetTickBase(int TickBase)
- {
- static int m_nTickBase = g_pNetvars->GetOffset("DT_BasePlayer", "localdata", "m_nTickBase");
- *reinterpret_cast<int*>(uintptr_t(this) + m_nTickBase) = TickBase;
- }
- Vector GetEyeAngles()
- {
- static int m_angEyeAngles = g_pNetvars->GetOffset("DT_CSPlayer", "m_angEyeAngles");
- return GetValue<Vector>(m_angEyeAngles);
- }
- void SetEyeAngles(Vector Angle)
- {
- static int m_angEyeAngles = g_pNetvars->GetOffset("DT_CSPlayer", "m_angEyeAngles");
- *reinterpret_cast<Vector*>(uintptr_t(this) + m_angEyeAngles) = Angle;
- }
- Vector GetOrigin()
- {
- static int m_vecOrigin = g_pNetvars->GetOffset("DT_BaseEntity", "m_vecOrigin");
- return GetValue<Vector>(m_vecOrigin);
- }
- Vector GetViewOffset()
- {
- return *reinterpret_cast<Vector*>(uintptr_t(this) + 0x108);
- }
- int SetObserverMode(int mode)
- {
- return *reinterpret_cast<int*>(uintptr_t(this) + 0x3374) = mode;
- }
- NETVAR(int, SetObserverModexd, "DT_CSPlayer", "m_iObserverMode");
- Vector GetOldOrigin()
- {
- static int m_vecOldOrigin = g_pNetvars->GetOffset("DT_BasePlayer", "localdata", "m_flFriction") + 12;
- return GetValue<Vector>(m_vecOldOrigin);
- }
- Vector GetNetworkOrigin()
- {
- static int m_vecNetworkOrigin = g_pNetvars->GetOffset("DT_BasePlayer", "localdata", "m_flFriction") + 40;
- return GetValue<Vector>(m_vecNetworkOrigin);
- }
- void SetOrigin(Vector Origin)
- {
- static int m_vecOrigin = g_pNetvars->GetOffset("DT_BaseEntity", "m_vecOrigin");
- *reinterpret_cast<Vector*>(uintptr_t(this) + m_vecOrigin) = Origin;
- }
- Vector GetVelocity()
- {
- static int m_vecVelocity = g_pNetvars->GetOffset("DT_BasePlayer", "localdata", "m_vecVelocity[0]");
- return GetValue<Vector>(m_vecVelocity);
- }
- void SetVelocity(Vector velocity)
- {
- static int m_vecVelocity = g_pNetvars->GetOffset("DT_BasePlayer", "localdata", "m_vecVelocity[0]");
- *reinterpret_cast<Vector*>(uintptr_t(this) + m_vecVelocity) = velocity;
- }
- Vector GetAimPunchAngle()
- {
- return *reinterpret_cast<Vector*>(uintptr_t(this) + uintptr_t(0x302C));
- }
- Vector GetViewPunchAngle()
- {
- return *reinterpret_cast<Vector*>(uintptr_t(this) + uintptr_t(0x3020));
- }
- Vector GetEyePosition()
- {
- Vector ret;
- typedef void(__thiscall *OrigFn)(void *, Vector&);
- Utils::GetVFunc<OrigFn>(this, 279)(this, ret);
- return ret;
- }
- ICollideable* GetCollideable()
- {
- return (ICollideable*)((DWORD)this + 0x31C);
- }
- void SetCurrentCommand(CUserCmd *cmd)
- {
- static int m_hConstraintEntity = g_pNetvars->GetOffset("DT_BasePlayer", "localdata", "m_hConstraintEntity");
- *reinterpret_cast<CUserCmd**>(uintptr_t(this) + m_hConstraintEntity - 0xC) = cmd;
- }
- float FireRate();
- void FixSetupBones(matrix3x4_t *Matrix);
- bool IsVisible(int bone);
- bool IsPlayer();
- Vector GetHitboxPosition(int Hitbox, matrix3x4_t *Matrix, float *Radius);
- Vector GetHitboxPosition(int Hitbox, matrix3x4_t *Matrix);
- std::vector<C_BaseCombatWeapon*> GetWeapons();
- };
- class ragdoll_t : public C_BaseEntity {
- public:
- NETVAR(Vector, m_vecForce, "DT_CSRagdoll", "m_vecForce");
- NETVAR(Vector, m_vecRagdollVelocity, "DT_CSRagdoll", "m_vecRagdollVelocity");
- };
- class C_BaseCombatWeapon : public C_BaseEntity
- {
- private:
- template<class T>
- T GetPointer(const int offset)
- {
- return reinterpret_cast<T*>(reinterpret_cast<std::uintptr_t>(this) + offset);
- }
- // To get value from the pointer itself
- template<class T>
- T GetValue(const int offset)
- {
- return *reinterpret_cast<T*>(reinterpret_cast<std::uintptr_t>(this) + offset);
- }
- public:
- HANDLE m_hWeaponWorldModel_h()
- {
- return *(HANDLE*)((uintptr_t)this + 0x3234); //m_hWeaponWorldModel
- }
- CBaseHandle m_hWeaponWorldModel_c()
- {
- return *(CBaseHandle*)((uintptr_t)this + 0x3234); //m_hWeaponWorldModel
- }
- bool is_grenade() {
- int WeaponIDz = *fixskins();
- if (WeaponIDz == 44 || WeaponIDz == 48 ||
- WeaponIDz == 46 || WeaponIDz == 43 ||
- WeaponIDz == 47 || WeaponIDz == 45)
- return true;
- else
- false;
- }
- bool IsKnife()
- {
- int iWeaponID = (int)this->GetItemDefinitionIndex();
- return (iWeaponID == (int)ItemDefinitionIndex::WEAPON_KNIFE || iWeaponID == (int)ItemDefinitionIndex::WEAPON_KNIFE_T
- || iWeaponID == 59 || iWeaponID == 41
- || iWeaponID == 500 || iWeaponID == 505 || iWeaponID == 506
- || iWeaponID == 507 || iWeaponID == 508 || iWeaponID == 509
- || iWeaponID == 515);
- }
- NETVAR(float, m_fThrowTime, "DT_BaseCSGrenade", "m_fThrowTime");
- int* OwnerXuidHigh()
- {
- return (int*)((uintptr_t)this + 0x31B4);
- }
- int* ModelIndex()
- {
- return (int*)((uintptr_t)this + 0x258);
- }
- int* ViewModelIndex()
- {
- return (int*)((uintptr_t)this + 0x3220);
- }
- short* fixskins()
- {
- return (short*)((uintptr_t)this + 0x2FAA);
- }
- inline int* FallbackPaintKit() {
- return (int*)((DWORD)this + 0x31B8);
- }
- int* GetEntityQuality()
- {
- return (int*)((uintptr_t)this + 0x2FAC);
- }
- int* OwnerXuidLow()
- {
- return (int*)((uintptr_t)this + 0x31B0);
- }
- float* FallbackWear()
- {
- return (float*)((uintptr_t)this + 0x31C0);
- }
- int* ItemIDHigh()
- {
- return (int*)((uintptr_t)this + 0x2FC0);
- }
- ItemDefinitionIndex GetItemDefinitionIndex()
- {
- static int m_iItemDefinitionIndex = g_pNetvars->GetOffset("DT_BaseAttributableItem", "m_AttributeManager", "m_Item", "m_iItemDefinitionIndex");
- return GetValue<ItemDefinitionIndex>(m_iItemDefinitionIndex);
- }
- float GetInaccuracy()
- {
- typedef float(__thiscall* oInaccuracy)(PVOID);
- return Utils::GetVFunc< oInaccuracy >(this, 476)(this);
- }
- CBaseHandle m_hWeaponWorldModel()
- {
- return *(CBaseHandle*)((uintptr_t)this + g_pNetvars->GetOffset("DT_BaseCombatWeapon", "m_hWeaponWorldModel")); //m_hWeaponWorldModel
- }
- HANDLE m_hWeaponWorldModel1()
- {
- return *(HANDLE*)((uintptr_t)this + g_pNetvars->GetOffset("DT_BaseCombatWeapon", "m_hWeaponWorldModel")); //m_hWeaponWorldModel
- }
- float GetSpread()
- {
- typedef float(__thiscall* oWeaponSpread)(PVOID);
- return Utils::GetVFunc< oWeaponSpread >(this, 446)(this);
- }
- float GetAccuracyPenalty()
- {
- static int m_fAccuracyPenalty = g_pNetvars->GetOffset("DT_WeaponCSBase", "m_fAccuracyPenalty");
- return GetValue<float>(m_fAccuracyPenalty);
- }
- float GetLastShotTime()
- {
- static int m_fLastShotTime = g_pNetvars->GetOffset("DT_WeaponCSBase", "m_fLastShotTime");
- return GetValue<float>(m_fLastShotTime);
- }
- void AccuracyPenalty()
- {
- typedef void(__thiscall *OrigFn)(void *);
- return Utils::GetVFunc<OrigFn>(this, 477)(this);
- }
- float GetNextPrimaryAttack()
- {
- static int m_flNextPrimaryAttack = g_pNetvars->GetOffset("DT_BaseCombatWeapon", "LocalActiveWeaponData", "m_flNextPrimaryAttack");
- return GetValue<float>(m_flNextPrimaryAttack);
- }
- bool realWeapon()
- {
- short idx = (short)GetItemDefinitionIndex();
- return (idx == (short)ItemDefinitionIndex::WEAPON_C4 || idx == (short)ItemDefinitionIndex::WEAPON_KNIFE || idx == (short)ItemDefinitionIndex::WEAPON_KNIFE_BAYONET || idx == (short)ItemDefinitionIndex::WEAPON_KNIFE_BUTTERFLY || idx == (short)ItemDefinitionIndex::WEAPON_KNIFE_FALCHION
- || idx == (short)ItemDefinitionIndex::WEAPON_KNIFE_FLIP || idx == (short)ItemDefinitionIndex::WEAPON_KNIFE_GUT || idx == (short)ItemDefinitionIndex::WEAPON_KNIFE_KARAMBIT || idx == (short)ItemDefinitionIndex::WEAPON_KNIFE_M9_BAYONET || idx == (short)ItemDefinitionIndex::WEAPON_KNIFE_PUSH
- || idx == (short)ItemDefinitionIndex::WEAPON_KNIFE_SURVIVAL_BOWIE || idx == (short)ItemDefinitionIndex::WEAPON_KNIFE_T || idx == (short)ItemDefinitionIndex::WEAPON_KNIFE_TACTICAL || idx == (short)ItemDefinitionIndex::WEAPON_FLASHBANG || idx == (short)ItemDefinitionIndex::WEAPON_HEGRENADE
- || idx == (short)ItemDefinitionIndex::WEAPON_SMOKEGRENADE || idx == (short)ItemDefinitionIndex::WEAPON_MOLOTOV || idx == (short)ItemDefinitionIndex::WEAPON_DECOY || idx == (short)ItemDefinitionIndex::WEAPON_INCGRENADE);
- }
- int GetAmmo()
- {
- static int m_iClip1 = g_pNetvars->GetOffset("DT_BaseCombatWeapon", "m_iClip1");
- return GetValue<int>(m_iClip1);
- }
- WeaponInfo_t* GetCSWpnData()
- {
- return Utils::CallVFunc<454, WeaponInfo_t*>(this);
- }
- std::string GetName()
- {
- ///TODO: Test if szWeaponName returns proper value for m4a4 / m4a1-s or it doesnt recognize them.
- return std::string(this->GetCSWpnData()->weapon_name);
- }
- char * getNameLowerCase()
- {
- switch (GetItemDefinitionIndex())
- {
- case ItemDefinitionIndex::WEAPON_KNIFE_BAYONET:
- return "bayonet";
- case ItemDefinitionIndex::WEAPON_KNIFE_SURVIVAL_BOWIE:
- return "bowie";
- case ItemDefinitionIndex::WEAPON_KNIFE_BUTTERFLY:
- return "butterfly";
- case ItemDefinitionIndex::WEAPON_KNIFE:
- return "knife";
- case ItemDefinitionIndex::WEAPON_KNIFE_FALCHION:
- return "falchion";
- case ItemDefinitionIndex::WEAPON_KNIFE_FLIP:
- return "flip";
- case ItemDefinitionIndex::WEAPON_KNIFE_GUT:
- return "gut";
- case ItemDefinitionIndex::WEAPON_KNIFE_KARAMBIT:
- return "karambit";
- case ItemDefinitionIndex::WEAPON_KNIFE_M9_BAYONET:
- return "m9 bayonet";
- case ItemDefinitionIndex::WEAPON_KNIFE_T:
- return "knife";
- case ItemDefinitionIndex::WEAPON_KNIFE_TACTICAL:
- return "huntsman";
- case ItemDefinitionIndex::WEAPON_KNIFE_PUSH:
- return "daggers";
- case ItemDefinitionIndex::WEAPON_DEAGLE:
- return "desert eagle";
- case ItemDefinitionIndex::WEAPON_ELITE:
- return "berretas";
- case ItemDefinitionIndex::WEAPON_FIVESEVEN:
- return "fiveseven";
- case ItemDefinitionIndex::WEAPON_GLOCK:
- return "glock";
- case ItemDefinitionIndex::WEAPON_HKP2000:
- return "p2000";
- case ItemDefinitionIndex::WEAPON_P250:
- return "p250";
- case ItemDefinitionIndex::WEAPON_USP_SILENCER:
- return "usp-s";
- case ItemDefinitionIndex::WEAPON_TEC9:
- return "tec9";
- case ItemDefinitionIndex::WEAPON_REVOLVER:
- return "revolver";
- case ItemDefinitionIndex::WEAPON_MAC10:
- return "mac10";
- case ItemDefinitionIndex::WEAPON_UMP45:
- return "ump45";
- case ItemDefinitionIndex::WEAPON_BIZON:
- return "bizon";
- case ItemDefinitionIndex::WEAPON_MP7:
- return "mp7";
- case ItemDefinitionIndex::WEAPON_MP5:
- return "mp5";
- case ItemDefinitionIndex::WEAPON_MP9:
- return "mp9";
- case ItemDefinitionIndex::WEAPON_P90:
- return "p90";
- case ItemDefinitionIndex::WEAPON_GALILAR:
- return "galil";
- case ItemDefinitionIndex::WEAPON_FAMAS:
- return "famas";
- case ItemDefinitionIndex::WEAPON_M4A1_SILENCER:
- return "m4a1-s";
- case ItemDefinitionIndex::WEAPON_M4A1:
- return "m4a4";
- case ItemDefinitionIndex::WEAPON_AUG:
- return "aug";
- case ItemDefinitionIndex::WEAPON_SG556:
- return "sg556";
- case ItemDefinitionIndex::WEAPON_AK47:
- return "ak47";
- case ItemDefinitionIndex::WEAPON_G3SG1:
- return "g3sg1";
- case ItemDefinitionIndex::WEAPON_SCAR20:
- return "scar20";
- case ItemDefinitionIndex::WEAPON_AWP:
- return "awp";
- case ItemDefinitionIndex::WEAPON_SSG08:
- return "scout";
- case ItemDefinitionIndex::WEAPON_XM1014:
- return "xm1014";
- case ItemDefinitionIndex::WEAPON_SAWEDOFF:
- return "sawedoff";
- case ItemDefinitionIndex::WEAPON_MAG7:
- return "mag7";
- case ItemDefinitionIndex::WEAPON_NOVA:
- return "nova";
- case ItemDefinitionIndex::WEAPON_NEGEV:
- return "negev";
- case ItemDefinitionIndex::WEAPON_M249:
- return "m249";
- case ItemDefinitionIndex::WEAPON_TASER:
- return "zeus";
- case ItemDefinitionIndex::WEAPON_FLASHBANG:
- return "flashbang";
- case ItemDefinitionIndex::WEAPON_HEGRENADE:
- return "grenade";
- case ItemDefinitionIndex::WEAPON_SMOKEGRENADE:
- return "smoke";
- case ItemDefinitionIndex::WEAPON_MOLOTOV:
- return "molotov";
- case ItemDefinitionIndex::WEAPON_DECOY:
- return "decoy";
- case ItemDefinitionIndex::WEAPON_INCGRENADE:
- return "incendiary";
- case ItemDefinitionIndex::WEAPON_C4:
- return "bomb";
- case ItemDefinitionIndex::WEAPON_CZ75A:
- return "cz75a";
- default:
- return "error";
- }
- }
- };
- class viewmodel_t : public C_BaseEntity {
- public:
- NETVAR(int, m_nModelIndex, "DT_BaseViewModel", "m_nModelIndex");
- NETVAR(int, m_nViewModelIndex, "DT_BaseViewModel", "m_nViewModelIndex");
- NETVAR(CHandle<C_BaseCombatWeapon>, m_hWeapon, "DT_BaseViewModel", "m_hWeapon");
- NETVAR(CHandle<C_BaseEntity>, m_hOwner, "DT_BaseViewModel", "m_hOwner");
- };
- class C_BaseViewModel
- {
- public:
- inline DWORD GetOwner() {
- return *(PDWORD)((DWORD)this + 0x29CC);
- }
- inline int GetModelIndex() {
- return *(int*)((DWORD)this + 0x258);
- }
- };
- #include "shit1.h"
- class CGlowObjectManager {
- public:
- int RegisterGlowObject(C_BaseEntity *pEntity, const Vector &vGlowColor, float flGlowAlpha, bool bRenderWhenOccluded, bool bRenderWhenUnoccluded, int nSplitScreenSlot) {
- int nIndex;
- if (m_nFirstFreeSlot == GlowObjectDefinition_t::END_OF_FREE_LIST) {
- nIndex = m_GlowObjectDefinitions.AddToTail();
- }
- else {
- nIndex = m_nFirstFreeSlot;
- m_nFirstFreeSlot = m_GlowObjectDefinitions[nIndex].m_nNextFreeSlot;
- }
- m_GlowObjectDefinitions[nIndex].m_hEntity = pEntity;
- m_GlowObjectDefinitions[nIndex].m_vGlowColor = vGlowColor;
- m_GlowObjectDefinitions[nIndex].m_flGlowAlpha = flGlowAlpha;
- m_GlowObjectDefinitions[nIndex].flUnk = 0.0f;
- m_GlowObjectDefinitions[nIndex].m_flBloomAmount = 1.0f;
- m_GlowObjectDefinitions[nIndex].localplayeriszeropoint3 = 0.0f;
- m_GlowObjectDefinitions[nIndex].m_bRenderWhenOccluded = bRenderWhenOccluded;
- m_GlowObjectDefinitions[nIndex].m_bRenderWhenUnoccluded = bRenderWhenUnoccluded;
- m_GlowObjectDefinitions[nIndex].m_bFullBloomRender = false;
- m_GlowObjectDefinitions[nIndex].m_nFullBloomStencilTestValue = 0;
- m_GlowObjectDefinitions[nIndex].m_nSplitScreenSlot = nSplitScreenSlot;
- m_GlowObjectDefinitions[nIndex].m_nNextFreeSlot = GlowObjectDefinition_t::ENTRY_IN_USE;
- return nIndex;
- }
- void UnregisterGlowObject(int nGlowObjectHandle) {
- Assert(!m_GlowObjectDefinitions[nGlowObjectHandle].IsUnused());
- m_GlowObjectDefinitions[nGlowObjectHandle].m_nNextFreeSlot = m_nFirstFreeSlot;
- m_GlowObjectDefinitions[nGlowObjectHandle].m_hEntity = NULL;
- m_nFirstFreeSlot = nGlowObjectHandle;
- }
- int HasGlowEffect(C_BaseEntity *pEntity) const {
- for (int i = 0; i < m_GlowObjectDefinitions.Count(); ++i) {
- if (!m_GlowObjectDefinitions[i].IsUnused() && m_GlowObjectDefinitions[i].m_hEntity == pEntity) {
- return i;
- }
- }
- return NULL;
- }
- class GlowObjectDefinition_t {
- public:
- void Set(float r, float g, float b, float a, float bloom, int style) {
- m_vGlowColor = Vector(r, g, b);
- m_flGlowAlpha = a;
- m_bRenderWhenOccluded = true;
- m_bRenderWhenUnoccluded = false;
- m_flBloomAmount = bloom;
- m_nGlowStyle = style;
- }
- C_BaseEntity* GetEnt() {
- return m_hEntity;
- }
- bool IsUnused() const { return m_nNextFreeSlot != GlowObjectDefinition_t::ENTRY_IN_USE; }
- public:
- C_BaseEntity * m_hEntity;
- Vector m_vGlowColor;
- float m_flGlowAlpha;
- char unknown[4]; //pad
- float flUnk; //confirmed to be treated as a float while reversing glow functions
- float m_flBloomAmount;
- float localplayeriszeropoint3;
- bool m_bRenderWhenOccluded;
- bool m_bRenderWhenUnoccluded;
- bool m_bFullBloomRender;
- char unknown1[1]; //pad
- int m_nFullBloomStencilTestValue; // 0x28
- int m_nGlowStyle;
- int m_nSplitScreenSlot; //Should be -1
- // Linked list of free slots
- int m_nNextFreeSlot;
- // Special values for GlowObjectDefinition_t::m_nNextFreeSlot
- static const int END_OF_FREE_LIST = -1;
- static const int ENTRY_IN_USE = -2;
- };
- CUtlVector< GlowObjectDefinition_t > m_GlowObjectDefinitions;
- int m_nFirstFreeSlot;
- };
- extern CGlowObjectManager* g_pGlow;
- extern std::string cleanstd;
- class OverlayText_t;
- class IVDebugOverlay
- {
- public:
- virtual void __unkn() = 0;
- virtual void AddEntityTextOverlay(int ent_index, int line_offset, float duration, int r, int g, int b, int a, const char *format, ...) = 0;
- virtual void AddBoxOverlay(const Vector& origin, const Vector& mins, const Vector& max, QAngle const& orientation, int r, int g, int b, int a, float duration) = 0;
- virtual void AddSphereOverlay(const Vector& vOrigin, float flRadius, int nTheta, int nPhi, int r, int g, int b, int a, float flDuration) = 0;
- virtual void AddTriangleOverlay(const Vector& p1, const Vector& p2, const Vector& p3, int r, int g, int b, int a, bool noDepthTest, float duration) = 0;
- virtual void AddLineOverlay(const Vector& origin, const Vector& dest, int r, int g, int b, bool noDepthTest, float duration) = 0;
- virtual void AddTextOverlay(const Vector& origin, float duration, const char *format, ...) = 0;
- virtual void AddTextOverlay(const Vector& origin, int line_offset, float duration, const char *format, ...) = 0;
- virtual void AddScreenTextOverlay(float flXPos, float flYPos, float flDuration, int r, int g, int b, int a, const char *text) = 0;
- virtual void AddSweptBoxOverlay(const Vector& start, const Vector& end, const Vector& mins, const Vector& max, const QAngle & angles, int r, int g, int b, int a, float flDuration) = 0;
- virtual void AddGridOverlay(const Vector& origin) = 0;
- virtual void AddCoordFrameOverlay(const matrix3x4_t& frame, float flScale, int vColorTable[3][3] = NULL) = 0;
- virtual int ScreenPosition(const Vector& point, Vector& screen) = 0;
- virtual int ScreenPosition(float flXPos, float flYPos, Vector& screen) = 0;
- virtual OverlayText_t* GetFirst(void) = 0;
- virtual OverlayText_t* GetNext(OverlayText_t *current) = 0;
- virtual void ClearDeadOverlays(void) = 0;
- virtual void ClearAllOverlays() = 0;
- virtual void AddTextOverlayRGB(const Vector& origin, int line_offset, float duration, float r, float g, float b, float alpha, const char *format, ...) = 0;
- virtual void AddTextOverlayRGB(const Vector& origin, int line_offset, float duration, int r, int g, int b, int a, const char *format, ...) = 0;
- virtual void AddLineOverlayAlpha(const Vector& origin, const Vector& dest, int r, int g, int b, int a, bool noDepthTest, float duration) = 0;
- virtual void AddBoxOverlay2(const Vector& origin, const Vector& mins, const Vector& max, QAngle const& orientation, const uint8_t* faceColor, const uint8_t* edgeColor, float duration) = 0;
- virtual void PurgeTextOverlays() = 0;
- virtual void DrawPill(const Vector& mins, const Vector& max, float& diameter, int r, int g, int b, int a, float duration) = 0;
- public:
- void AddCapsuleOverlay(Vector& mins, Vector& maxs, float pillradius, int r, int g, int b, int a, float duration)
- {
- Utils::GetVFunc<void(__thiscall*)(void*, Vector&, Vector&, float&, int, int, int, int, float)>(this, 24)(this, mins, maxs, pillradius, r, g, b, a, duration);
- };
- };
- extern IVDebugOverlay* g_pIVDebugOverlay;
- class IEffects
- {
- public:
- virtual ~IEffects() {};
- virtual void Beam(const Vector &Start, const Vector &End, int nModelIndex,
- int nHaloIndex, unsigned char frameStart, unsigned char frameRate,
- float flLife, unsigned char width, unsigned char endWidth, unsigned char fadeLength,
- unsigned char noise, unsigned char red, unsigned char green,
- unsigned char blue, unsigned char brightness, unsigned char speed) = 0;
- //-----------------------------------------------------------------------------
- // Purpose: Emits smoke sprites.
- // Input : origin - Where to emit the sprites.
- // scale - Sprite scale * 10.
- // framerate - Framerate at which to animate the smoke sprites.
- //-----------------------------------------------------------------------------
- virtual void Smoke(const Vector &origin, int modelIndex, float scale, float framerate) = 0;
- virtual void Sparks(const Vector &position, int nMagnitude = 1, int nTrailLength = 1, const Vector *pvecDir = NULL) = 0;
- virtual void Dust(const Vector &pos, const Vector &dir, float size, float speed) = 0;
- virtual void MuzzleFlash(const Vector &vecOrigin, const QAngle &vecAngles, float flScale, int iType) = 0;
- // like ricochet, but no sound
- virtual void MetalSparks(const Vector &position, const Vector &direction) = 0;
- virtual void EnergySplash(const Vector &position, const Vector &direction, bool bExplosive = false) = 0;
- virtual void Ricochet(const Vector &position, const Vector &direction) = 0;
- // FIXME: Should these methods remain in this interface? Or go in some
- // other client-server neutral interface?
- virtual float Time() = 0;
- virtual bool IsServer() = 0;
- // Used by the playback system to suppress sounds
- virtual void SuppressEffectsSounds(bool bSuppress) = 0;
- };
- extern IEffects* g_pIEffects;
- struct ColorRGBExp32
- {
- byte r, g, b;
- signed char exponent;
- };
- struct dlight_t
- {
- int flags;
- Vector origin;
- float radius;
- ColorRGBExp32 color;
- float die;
- float decay;
- float minlight;
- int key;
- int style;
- Vector m_Direction;
- float m_InnerAngle;
- float m_OuterAngle;
- float GetRadius() const
- {
- return radius;
- }
- float GetRadiusSquared() const
- {
- return radius * radius;
- }
- float IsRadiusGreaterThanZero() const
- {
- return radius > 0.0f;
- }
- };
- class IVEffects
- {
- public:
- dlight_t * CL_AllocDlight(int key)
- {
- typedef dlight_t*(__thiscall* OriginalFn)(PVOID, int);
- return Utils::GetVFunc<OriginalFn>(this, 4)(this, key);
- }
- dlight_t* CL_AllocElight(int key)
- {
- typedef dlight_t*(__thiscall* OriginalFn)(PVOID, int);
- return Utils::GetVFunc<OriginalFn>(this, 5)(this, key);
- }
- dlight_t* GetElightByKey(int key)
- {
- typedef dlight_t*(__thiscall* OriginalFn)(PVOID, int);
- return Utils::GetVFunc<OriginalFn>(this, 8)(this, key);
- }
- };
- extern IVEffects* g_Dlight;
Add Comment
Please, Sign In to add comment