Add files via upload

This commit is contained in:
0TheSpy
2022-11-27 04:19:30 +03:00
committed by GitHub
parent 5e94bdea49
commit 5e32f49dae
13 changed files with 1055 additions and 23 deletions

View File

@ -3,7 +3,7 @@
#pragma once
#include "icliententity.h"
//#include "icliententity.h"
#include "NetVarManager.hpp"
#include "PatternScan.hpp"
#include "netvars.hpp"
@ -63,9 +63,12 @@ public:
NETVAR(GetModelScale, "CBaseAnimating", "m_flModelScale", float);
NETVAR(GetScaleType, "CBaseAnimating", "m_ScaleType", float);
NETVAR(GetFrozen, "CBaseAnimating", "m_flFrozen", float);
NETVAR(GetPoseParameter, "CBaseAnimating", "m_flPoseParameter", float);
NETVAR(GetMins, "CBaseEntity", "m_vecMins", Vector);
NETVAR(GetMaxs, "CBaseEntity", "m_vecMaxs", Vector);
NETVAR(GetSimulationTime, "CBaseEntity", "m_flSimulationTime", float);
NETVAR2(IsScoped, "DT_CSPlayer", "m_bIsScoped", bool);
NETVAR2(GetViewOffset, "DT_CSPlayer", "m_vecViewOffset[0]", Vector);
@ -97,6 +100,25 @@ public:
return getvfunc<OriginalFn>(this, 246)(this, sequence);
}
bool IsVisible(C_BaseEntity* pEntity, const Vector& vecEnd)
{
const Vector vecStart = this->GetViewPos();
Ray_t ray; ray.Init(vecStart, vecEnd);
CTraceFilter filter(this);
//Trace_t trace = { };
CGameTrace trace = {};
iff.g_pEnginetrace->TraceRay(ray, MASK_SHOT, &filter, &trace);
// trace check
if ((trace.IsVisible() || trace.m_pEnt == pEntity))
return true;
return false;
}
};
class C_BaseCombatCharacter : public C_BaseEntity
@ -104,6 +126,7 @@ public:
public:
NETVAR(GetWeapons, "CBaseCombatCharacter", "m_hMyWeapons", std::array<CBaseHandle, MAX_WEAPONS>);
PNETVAR(GetWearables, "CBaseCombatCharacter", "m_hMyWearables", CBaseHandle);
NETVAR(GetActiveWeapon, "CBaseCombatCharacter", "m_hActiveWeapon", CBaseHandle);
};
class C_BasePlayer : public C_BaseCombatCharacter
@ -129,6 +152,13 @@ public:
NETVAR2(GetObserverTarget, "DT_BasePlayer", "m_hObserverTarget", short);
NETVAR2(GetAccount, "DT_CSPlayer", "m_iAccount", int);
NETVAR2(GetAimPunchAngle, "DT_CSPlayer", "m_aimPunchAngle", Vector);
NETVAR2(GetViewPunchAngle, "DT_CSPlayer", "m_viewPunchAngle", Vector);
NETVAR2(GetFlashMaxAlpha, "DT_CSPlayer", "m_flFlashMaxAlpha", float);
NETVAR2(GetLowerBodyYawTarget, "DT_CSPlayer", "m_flLowerBodyYawTarget", float);
NETVAR2(HasImmunity, "DT_CSPlayer", "m_bGunGameImmunity", bool);
/*
bool isDormant()
{
@ -138,6 +168,16 @@ public:
}
*/
bool IsPlayer()
{
// @xref: "effects/nightvision"
typedef bool(__thiscall* OriginalFn)(void*);
return getvfunc<OriginalFn>(this, 157)(this);
}
inline bool IsPlayerValid();
};
class C_BaseCombatWeapon : public C_BaseEntity
@ -207,8 +247,9 @@ public:
NETVAR(GetTotalCashSpent, "CCSPlayerResource", "m_iTotalCashSpent", int[MAX_PLAYERS]);
NETVAR(GetCashSpentThisRound, "CCSPlayerResource", "m_iCashSpentThisRound", int[MAX_PLAYERS]);
NETVAR(GetMatchStats_CashEarned_Total, "CCSPlayerResource", "m_iMatchStats_CashEarned_Total", int[MAX_PLAYERS]);
NETVAR(IsAlive, "CCSPlayerResource", "m_bAlive", bool[MAX_PLAYERS]);
NETVAR(IsConnected, "CCSPlayerResource", "m_bConnected", bool[MAX_PLAYERS]);
NETVAR2(IsAlive, "DT_CSPlayerResource", "m_bAlive", bool[MAX_PLAYERS]);
NETVAR2(IsConnected, "DT_CSPlayerResource", "m_bConnected", bool[MAX_PLAYERS]);
static C_CS_PlayerResource** GetPlayerResource()
{
@ -234,7 +275,7 @@ public:
class C_Precipitation : public C_BaseEntity
{
public:
NETVAR2(GetPrecipitationType, "DT_Precipitation", "m_nPrecipType", PrecipitationType_t);
NETVAR2(GetPrecipitationType, "DT_Precipitation", "m_nPrecipType", PrecipitationType_t);
};
class CPlantedC4 : public C_BaseEntity
@ -251,4 +292,26 @@ public:
NETVAR2(GetBombSite, "DT_PlantedC4", "m_nBombSite", unsigned);
};
/*
class CColliderable
{
public:
Vector& OBBMins()
{
using OriginalFn = Vector& (__thiscall* )(void*);
return getvfunc<OriginalFn>(this, 1)(this);
}
Vector& OBBMaxs()
{
typedef Vector&(__thiscall* OriginalFn)(void*);
return getvfunc<OriginalFn>(this, 2)(this);
}
};
*/
#endif

View File

@ -35,6 +35,8 @@ struct csurface_t
struct Ray_t
{
VectorAligned m_Start;
VectorAligned m_Delta;
VectorAligned m_StartOffset;

View File

@ -0,0 +1,524 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef CS_WEAPON_PARSE_H
#define CS_WEAPON_PARSE_H
#ifdef _WIN32
#pragma once
#endif
#ifdef CLIENT_DLL
#define CWeaponCSBase C_WeaponCSBase
#endif
#include "weapon_parse.h"
#include "econ_item_constants.h"
class CWeaponCSBase;
//--------------------------------------------------------------------------------------------------------
enum CSWeaponType
{
WEAPONTYPE_KNIFE = 0,
WEAPONTYPE_PISTOL,
WEAPONTYPE_SUBMACHINEGUN,
WEAPONTYPE_RIFLE,
WEAPONTYPE_SHOTGUN,
WEAPONTYPE_SNIPER_RIFLE,
WEAPONTYPE_MACHINEGUN,
WEAPONTYPE_C4,
WEAPONTYPE_GRENADE,
WEAPONTYPE_EQUIPMENT,
WEAPONTYPE_STACKABLEITEM,
WEAPONTYPE_UNKNOWN
};
/*
NOTE!!!! Please try not to change the order. If you need to add something, please add it to the end.
Anytime the order of the weaponID's change, we need to updated a bunch of tables in a couple DB's. Also,
changing the order can invalidate saved queries and in general makes using the OGS stats difficult.
*/
//--------------------------------------------------------------------------------------------------------
enum ItemDefinitionIndex
{
ITEM_NONE = 0,
WEAPON_DEAGLE = 1,
WEAPON_ELITE = 2,
WEAPON_FIVESEVEN = 3,
WEAPON_GLOCK = 4,
WEAPON_AK47 = 7,
WEAPON_AUG = 8,
WEAPON_AWP = 9,
WEAPON_FAMAS = 10,
WEAPON_G3SG1 = 11,
WEAPON_GALILAR = 13,
WEAPON_M249 = 14,
WEAPON_M4A1 = 16,
WEAPON_MAC10 = 17,
WEAPON_P90 = 19,
WEAPON_UMP45 = 24,
WEAPON_XM1014 = 25,
WEAPON_BIZON = 26,
WEAPON_MAG7 = 27,
WEAPON_NEGEV = 28,
WEAPON_SAWEDOFF = 29,
WEAPON_TEC9 = 30,
WEAPON_TASER = 31,
WEAPON_HKP2000 = 32,
WEAPON_MP7 = 33,
WEAPON_MP9 = 34,
WEAPON_NOVA = 35,
WEAPON_P250 = 36,
WEAPON_SCAR20 = 38,
WEAPON_SG553 = 39,
WEAPON_SSG08 = 40,
WEAPON_KNIFE_GOLD = 41,
WEAPON_KNIFE = 42,
WEAPON_FLASHBANG = 43,
WEAPON_HEGRENADE = 44,
WEAPON_SMOKEGRENADE = 45,
WEAPON_MOLOTOV = 46,
WEAPON_DECOY = 47,
WEAPON_INCGRENADE = 48,
WEAPON_C4 = 49,
WEAPON_KNIFE_T = 59,
WEAPON_M4A1_SILENCER = 60,
WEAPON_USP_SILENCER = 61,
WEAPON_CZ75A = 63,
WEAPON_REVOLVER = 64,
WEAPON_KNIFE_BAYONET = 500,
WEAPON_KNIFE_FLIP = 505,
WEAPON_KNIFE_GUT = 506,
WEAPON_KNIFE_KARAMBIT = 507,
WEAPON_KNIFE_M9_BAYONET = 508,
WEAPON_KNIFE_TACTICAL = 509,
WEAPON_KNIFE_FALCHION = 512,
WEAPON_KNIFE_SURVIVAL_BOWIE = 514,
WEAPON_KNIFE_BUTTERFLY = 515,
WEAPON_KNIFE_PUSH = 516,
GLOVE_STUDDED_BLOODHOUND = 5027,
GLOVE_T_SIDE = 5028,
GLOVE_CT_SIDE = 5029,
GLOVE_SPORTY = 5030,
GLOVE_SLICK = 5031,
GLOVE_LEATHER_WRAP = 5032,
GLOVE_MOTORCYCLE = 5033,
GLOVE_SPECIALIST = 5034,
MAX_ITEMDEFINITIONINDEX
};
using CSWeaponID = ItemDefinitionIndex;
/*
enum CSWeaponID
{
WEAPON_NONE = 0,
WEAPON_FIRST,
WEAPON_DEAGLE = WEAPON_FIRST,
WEAPON_ELITE,
WEAPON_FIVESEVEN,
WEAPON_GLOCK,
WEAPON_P228,
WEAPON_USP,
WEAPON_AK47,
WEAPON_AUG,
WEAPON_AWP,
WEAPON_FAMAS,
WEAPON_G3SG1,
WEAPON_GALIL,
WEAPON_GALILAR,
WEAPON_M249,
WEAPON_M3,
WEAPON_M4A1,
WEAPON_MAC10,
WEAPON_MP5NAVY,
WEAPON_P90,
WEAPON_SCOUT,
WEAPON_SG550,
WEAPON_SG552,
WEAPON_TMP,
WEAPON_UMP45,
WEAPON_XM1014,
WEAPON_BIZON,
WEAPON_MAG7,
WEAPON_NEGEV,
WEAPON_SAWEDOFF,
WEAPON_TEC9,
WEAPON_TASER,
WEAPON_HKP2000,
WEAPON_MP7,
WEAPON_MP9,
WEAPON_NOVA,
WEAPON_P250,
WEAPON_SCAR17,
WEAPON_SCAR20,
WEAPON_SG556,
WEAPON_SSG08,
WEAPON_LAST = WEAPON_SSG08,
ITEM_FIRST,
WEAPON_KNIFE_GG = ITEM_FIRST,
WEAPON_KNIFE,
WEAPON_FLASHBANG,
WEAPON_HEGRENADE,
WEAPON_SMOKEGRENADE,
WEAPON_MOLOTOV,
WEAPON_DECOY,
WEAPON_INCGRENADE,
WEAPON_TAGRENADE,
WEAPON_C4,
ITEM_MAX = WEAPON_C4,
EQUIPMENT_FIRST,
ITEM_KEVLAR = EQUIPMENT_FIRST,
ITEM_ASSAULTSUIT,
ITEM_HEAVYASSAULTSUIT,
ITEM_NVG,
ITEM_DEFUSER,
ITEM_CUTTERS,
EQUIPMENT_MAX,
WEAPON_HEALTHSHOT,
WEAPON_MAX = EQUIPMENT_MAX, // number of weapons weapon index
};
*/
#define MAX_EQUIPMENT (EQUIPMENT_MAX - EQUIPMENT_FIRST)
enum
{
ITEM_PRICE_KEVLAR = 650,
ITEM_PRICE_HELMET = 350,
ITEM_PRICE_ASSAULTSUIT = ITEM_PRICE_KEVLAR + ITEM_PRICE_HELMET,
ITEM_PRICE_HEAVYASSAULTSUIT = 1250,
ITEM_PRICE_DEFUSEKIT = 400,
ITEM_PRICE_NVG = 1250,
};
struct WeaponPaintableMaterial_t;
void PrepareEquipmentInfo(void);
class WeaponRecoilData
{
public:
WeaponRecoilData();
~WeaponRecoilData();
void GetRecoilOffsets(CWeaponCSBase* pWeapon, int iMode, int iIndex, float& fAngle, float& fMagnitude);
void GenerateRecoilPatternForItemDefinition(item_definition_index_t idx);
private:
struct RecoilOffset
{
float fAngle;
float fMagnitude;
};
struct RecoilData
{
item_definition_index_t iItemDefIndex;
RecoilOffset recoilTable[2][64];
};
CUtlMap< item_definition_index_t, RecoilData* > m_mapRecoilTables;
void GenerateRecoilTable(RecoilData* data);
};
//--------------------------------------------------------------------------------------------------------
class CCSWeaponInfo : public FileWeaponInfo_t
{
public:
DECLARE_CLASS_GAMEROOT(CCSWeaponInfo, FileWeaponInfo_t);
CCSWeaponInfo();
virtual void Parse(::KeyValues* pKeyValuesData, const char* szWeaponName);
// recoiltable in csweaponinfo is obsolete. remove this once confirmed that the new implementation generates the same result.
virtual void RefreshDynamicParameters() { GenerateRecoilTable(); }
const char* GetZoomInSound(void) const { return m_szZoomINSound; }
const char* GetZoomOutSound(void) const { return m_szZoomOUTSound; }
const Vector& GetSmokeColor() const { return m_vSmokeColor; }
// recoiltable in csweaponinfo is obsolete. remove this once confirmed that the new implementation generates the same result.
void GetRecoilOffsets(int iMode, int iIndex, float& fAngle, float& fMagnitude) const;
//protected:
CSWeaponType m_WeaponType;
int m_iTeam; // Which team can have this weapon. TEAM_UNASSIGNED if both can have it.
public:
CSWeaponID m_weaponId;
int GetWeaponPrice(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
bool IsFullAuto(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
bool HasSilencer(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetBullets(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetCycleTime(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetHeatPerShot(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetRecoveryTimeCrouch(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetRecoveryTimeStand(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetRecoveryTimeCrouchFinal(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetRecoveryTimeStandFinal(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetRecoveryTransitionStartBullet(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetRecoveryTransitionEndBullet(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetRecoilSeed(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetFlinchVelocityModifierLarge(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetFlinchVelocityModifierSmall(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetTimeToIdleAfterFire(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetIdleInterval(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetRange(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetRangeModifier(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetDamage(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetPenetration(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetCrosshairDeltaDistance(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetCrosshairMinDistance(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetInaccuracyAltSwitch(void) const { return m_fInaccuracyAltSwitch; };
float GetInaccuracyPitchShift(void) const { return m_fInaccuracyPitchShift; }
float GetInaccuracyAltSoundThreshhold(void) const { return m_fInaccuracyAltSoundThreshold; }
float GetMaxSpeed(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetSpread(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 0.001f) const;
float GetInaccuracyCrouch(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 0.001f) const;
float GetInaccuracyStand(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 0.001f) const;
float GetInaccuracyJumpInitial(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 0.001f) const;
float GetInaccuracyJump(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 0.001f) const;
float GetInaccuracyLand(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 0.001f) const;
float GetInaccuracyLadder(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 0.001f) const;
float GetInaccuracyFire(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 0.001f) const;
float GetInaccuracyMove(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 0.001f) const;
float GetInaccuracyReload(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 0.001f) const;
float GetRecoilAngle(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetRecoilAngleVariance(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetRecoilMagnitude(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetRecoilMagnitudeVariance(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetTracerFrequency(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetPrimaryClipSize(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetSecondaryClipSize(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetDefaultPrimaryClipSize(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetDefaultSecondaryClipSize(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetKillAward(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
bool HasBurstMode(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
bool IsRevolver(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
bool HasAlternateFastSlowReload(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetArmorRatio(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
bool HasTraditionalScope(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
bool CannotShootUnderwater(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
bool DoesUnzoomAfterShot(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
bool DoesHideViewModelWhenZoomed(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetBucketSlot(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetZoomLevels(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetZoomFOV1(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetZoomFOV2(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetZoomTime0(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetZoomTime1(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
float GetZoomTime2(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetPrimaryReserveAmmoMax(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
int GetSecondaryReserveAmmoMax(const CEconItemView* pWepView = NULL, int nAlt = 0, float flScale = 1.0f) const;
CSWeaponType GetWeaponType(const CEconItemView* pWepView = NULL) const;
const char* GetAddonLocation(const CEconItemView* pWepView = NULL) const;
const char* GetEjectBrassEffectName(const CEconItemView* pWepView = NULL) const;
const char* GetTracerEffectName(const CEconItemView* pWepView = NULL) const;
const char* GetMuzzleFlashEffectName_1stPerson(const CEconItemView* pWepView = NULL) const;
const char* GetMuzzleFlashEffectName_1stPersonAlt(const CEconItemView* pWepView = NULL) const;
const char* GetMuzzleFlashEffectName_3rdPerson(const CEconItemView* pWepView = NULL) const;
const char* GetMuzzleFlashEffectName_3rdPersonAlt(const CEconItemView* pWepView = NULL) const;
const char* GetHeatEffectName(const CEconItemView* pWepView = NULL) const;
const char* GetPlayerAnimationExtension(const CEconItemView* pWepView = NULL) const;
void SetUsedByTeam(int nTeam) { m_iTeam = nTeam; }
int GetUsedByTeam(const CEconItemView* pWepView = NULL) const;
bool CanBeUsedWithShield() const { return m_bCanUseWithShield; }
float GetBotAudibleRange() const { return m_flBotAudibleRange; }
const char* GetWrongTeamMsg() const { return m_WrongTeamMsg; }
const char* GetAnimExtension() const { return m_szAnimExtension; }
const char* GetShieldViewModel() const { return m_szShieldViewModel; }
const char* GetSilencerModel() const { return m_szSilencerModel; }
float GetAddonScale() const { return m_flAddonScale; }
float GetThrowVelocity() const { return m_fThrowVelocity; }
const char* GetAddonModel(const CEconItemView* pWepView = NULL) const;
const CUtlVector< WeaponPaintableMaterial_t >* GetPaintData(const CEconItemView* pWepView = NULL) const;
// recoiltable in csweaponinfo is obsolete. remove this once confirmed that the new implementation generates the same result.
void GenerateRecoilTable();
void SetWeaponPrice(int price) { m_iWeaponPrice = price; };
void SetWeaponType(CSWeaponType type) { m_WeaponType = type; };
//private:
static bool m_bCSWeaponInfoLookupInitialized;
bool m_bFullAuto; // is this a fully automatic weapon?
float m_flHeatPerShot;
int m_iWeaponPrice;
float m_flArmorRatio;
float m_flMaxSpeed[2]; // How fast the player can run while this is his primary weapon.
int m_iCrosshairMinDistance;
int m_iCrosshairDeltaDistance;
// Parameters for FX_FireBullets:
float m_flPenetration;
int m_iDamage;
float m_flRange;
float m_flRangeModifier;
int m_iBullets;
float m_flCycleTime;
float m_flCycleTimeAlt;
char m_szHeatEffectName[MAX_WEAPON_STRING];
Vector m_vSmokeColor;
char m_szMuzzleFlashEffectName_1stPerson[MAX_WEAPON_STRING];
char m_szMuzzleFlashEffectName_3rdPerson[MAX_WEAPON_STRING];
char m_szEjectBrassEffectName[MAX_WEAPON_STRING];
char m_szTracerEffectName[MAX_WEAPON_STRING];
int m_iTracerFequency;
// variables for new accuracy model
float m_fSpread[2];
float m_fInaccuracyCrouch[2];
float m_fInaccuracyStand[2];
float m_fInaccuracyJump[2];
float m_fInaccuracyLand[2];
float m_fInaccuracyLadder[2];
float m_fInaccuracyImpulseFire[2];
float m_fInaccuracyMove[2];
float m_fRecoveryTimeStand;
float m_fRecoveryTimeCrouch;
float m_fRecoveryTimeStandFinal;
float m_fRecoveryTimeCrouchFinal;
float m_fInaccuracyReload;
float m_fInaccuracyAltSwitch;
float m_fInaccuracyPitchShift;
float m_fInaccuracyAltSoundThreshold;
float m_fRecoilAngle[2];
float m_fRecoilAngleVariance[2];
float m_fRecoilMagnitude[2];
float m_fRecoilMagnitudeVariance[2];
int m_iRecoilSeed;
float m_fFlinchVelocityModifierLarge; // velocity modifier for anyone hit by this weapon
float m_fFlinchVelocityModifierSmall; // velocity modifier for anyone hit by this weapon
// Delay until the next idle animation after shooting.
float m_flTimeToIdleAfterFire;
float m_flIdleInterval;
// recoiltable in csweaponinfo is obsolete. remove this once confirmed that the new implementation generates the same result.
struct RecoilOffset
{
float fAngle;
float fMagnitude;
};
RecoilOffset m_recoilTable[2][64];
int m_iZoomLevels;
int m_iZoomFov[3];
float m_fZoomTime[3];
bool m_bHideViewModelZoomed;
char m_szZoomINSound[MAX_WEAPON_STRING];
char m_szZoomOUTSound[MAX_WEAPON_STRING];
float m_flBotAudibleRange; // How far away a bot can hear this weapon.
bool m_bCanUseWithShield;
char m_WrongTeamMsg[32]; // Reference to a string describing the error if someone tries to buy
// this weapon but they're on the wrong team to have it.
// Zero-length if no specific message for this weapon.
char m_szAnimExtension[16];
char m_szShieldViewModel[64];
char m_szAddonModel[MAX_WEAPON_STRING]; // If this is set, it is used as the addon model. Otherwise, szWorldModel is used.
char m_szAddonLocation[MAX_WEAPON_STRING]; //If this is set, the weapon will look for an attachment location with this name. Otherwize the default is used based on weapon type.
char m_szSilencerModel[MAX_WEAPON_STRING]; // Alternate model with silencer attached
float m_flAddonScale;
// grenade throw parameters
float m_fThrowVelocity;
int m_iKillAward;
};
//--------------------------------------------------------------------------------------------------------
// Utility conversion functions
//--------------------------------------------------------------------------------------------------------
const char* WeaponClassAsString(CSWeaponType weaponType);
CSWeaponType WeaponClassFromString(const char* weaponType);
CSWeaponType WeaponClassFromWeaponID(CSWeaponID weaponID);
const char* WeaponIdAsString(CSWeaponID weaponID);
CSWeaponID WeaponIdFromString(const char* szWeaponName);
const char* WeaponIDToAlias(int id);
CSWeaponID AliasToWeaponID(const char* szAlias);
const CCSWeaponInfo* GetWeaponInfo(CSWeaponID weaponID);
bool IsGunWeapon(CSWeaponType weaponType);
//
class IWeaponSystem
{
virtual void unused0() = 0;
virtual void unused1() = 0;
public:
virtual CCSWeaponInfo* GetWpnData(ItemDefinitionIndex) = 0;
};
//
#endif // CS_WEAPON_PARSE_H

View File

@ -29,7 +29,10 @@ public:
bool DidHit() const;
bool isVisible() const;
inline bool IsVisible() const
{
return (fraction > 0.97f);
}
#if defined( ENGINE_DLL )
void SetEdict(edict_t* pEdict);
@ -43,13 +46,8 @@ public:
csurface_t surface;
int hitgroup;
short physicsbone;
#if defined( CLIENT_DLL )
C_BaseEntity* m_pEnt;
#else
IClientEntity* m_pEnt;
#endif
std::uint16_t uWorldSurfaceIndex; // index of the msurface2_t, if applicable
C_BaseEntity* m_pEnt;
int hitbox;
CGameTrace() {}

View File

@ -0,0 +1,345 @@
//============ Copyright (c) Valve Corporation, All rights reserved. ============
//
// Functionality to render a glowing outline around client renderable objects.
//
//===============================================================================
#ifndef GLOW_OUTLINE_EFFECT_H
#define GLOW_OUTLINE_EFFECT_H
#if defined( COMPILER_MSVC )
#pragma once
#endif
#include "utlvector.h"
#include "vector.h"
#include "interfaces.hpp"
class C_BaseEntity;
class CViewSetup;
class CMatRenderContextPtr;
static const int GLOW_FOR_ALL_SPLIT_SCREEN_SLOTS = -1;
enum GlowRenderStyle_t
{
GLOWRENDERSTYLE_DEFAULT = 0,
GLOWRENDERSTYLE_RIMGLOW3D,
GLOWRENDERSTYLE_EDGE_HIGHLIGHT,
GLOWRENDERSTYLE_EDGE_HIGHLIGHT_PULSE,
GLOWRENDERSTYLE_COUNT,
};
class CGlowObjectManager
{
public:
CGlowObjectManager() :
m_nFirstFreeSlot( GlowObjectDefinition_t::END_OF_FREE_LIST )
{
}
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_flGlowPulseOverdrive = 0.0f;
m_GlowObjectDefinitions[nIndex].m_bGlowAlphaCappedByRenderAlpha = false;
m_GlowObjectDefinitions[nIndex].m_flGlowAlphaFunctionOfMaxVelocity = 0.0f;
m_GlowObjectDefinitions[nIndex].m_flGlowAlphaMax = 1.0f;
m_GlowObjectDefinitions[nIndex].m_pEntity = pEntity;
m_GlowObjectDefinitions[nIndex].m_vGlowColor = vGlowColor;
m_GlowObjectDefinitions[nIndex].m_flGlowAlpha = flGlowAlpha;
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;
m_GlowObjectDefinitions[nIndex].m_nRenderStyle = GLOWRENDERSTYLE_DEFAULT;
return nIndex;
}
int AddGlowBox( Vector vecOrigin, QAngle angOrientation, Vector mins, Vector maxs, Color colColor, float flLifetime )
{
return 0; /*
int nIndex = m_GlowBoxDefinitions.AddToTail();
m_GlowBoxDefinitions[nIndex].m_vPosition = vecOrigin;
m_GlowBoxDefinitions[nIndex].m_angOrientation = angOrientation;
m_GlowBoxDefinitions[nIndex].m_vMins = mins;
m_GlowBoxDefinitions[nIndex].m_vMaxs = maxs;
m_GlowBoxDefinitions[nIndex].m_colColor = colColor;
m_GlowBoxDefinitions[nIndex].m_flBirthTimeIndex = iff.g_pGlobals->curtime;
m_GlowBoxDefinitions[nIndex].m_flTerminationTimeIndex = iff.g_pGlobals->curtime + flLifetime;
return nIndex;
*/
}
void UnregisterGlowObject( int nGlowObjectHandle )
{
Assert( !m_GlowObjectDefinitions[nGlowObjectHandle].IsUnused() );
m_GlowObjectDefinitions[nGlowObjectHandle].m_nNextFreeSlot = m_nFirstFreeSlot;
m_GlowObjectDefinitions[nGlowObjectHandle].m_pEntity = NULL;
m_nFirstFreeSlot = nGlowObjectHandle;
}
void UnregisterGlowObject( C_BaseEntity *pEntity )
{
for ( int i=0; i<m_GlowObjectDefinitions.Count(); i++ )
{
if ( m_GlowObjectDefinitions[i].m_pEntity == pEntity )
{
UnregisterGlowObject(i);
return;
}
}
}
void SetGlowAlphaPulseOverdrive( int nGlowObjectHandle, float flAdditionalAlpha )
{
Assert( !m_GlowObjectDefinitions[nGlowObjectHandle].IsUnused() );
m_GlowObjectDefinitions[nGlowObjectHandle].m_flGlowPulseOverdrive = flAdditionalAlpha;
}
void UnregisterAllGlowBoxes()
{
m_GlowBoxDefinitions.RemoveAll();
}
void SetGlowAlphaCappedByRenderAlpha( int nGlowObjectHandle, bool bGlowAlphaCappedByRenderAlpha )
{
Assert( !m_GlowObjectDefinitions[nGlowObjectHandle].IsUnused() );
m_GlowObjectDefinitions[nGlowObjectHandle].m_bGlowAlphaCappedByRenderAlpha = bGlowAlphaCappedByRenderAlpha;
}
void SetGlowAlphaFunctionOfMaxVelocity( int nGlowObjectHandle, float flMaxVelocity )
{
Assert( !m_GlowObjectDefinitions[nGlowObjectHandle].IsUnused() );
m_GlowObjectDefinitions[nGlowObjectHandle].m_flGlowAlphaFunctionOfMaxVelocity = flMaxVelocity;
}
void SetGlowAlphaMax( int nGlowObjectHandle, float flGlowAlphaMax )
{
Assert( !m_GlowObjectDefinitions[nGlowObjectHandle].IsUnused() );
m_GlowObjectDefinitions[nGlowObjectHandle].m_flGlowAlphaMax = flGlowAlphaMax;
}
void SetEntity( int nGlowObjectHandle, C_BaseEntity *pEntity )
{
Assert( !m_GlowObjectDefinitions[nGlowObjectHandle].IsUnused() );
m_GlowObjectDefinitions[nGlowObjectHandle].m_pEntity = pEntity;
}
void SetColor( int nGlowObjectHandle, const Vector &vGlowColor )
{
Assert( !m_GlowObjectDefinitions[nGlowObjectHandle].IsUnused() );
m_GlowObjectDefinitions[nGlowObjectHandle].m_vGlowColor = vGlowColor;
}
void SetAlpha( int nGlowObjectHandle, float flAlpha )
{
Assert( !m_GlowObjectDefinitions[nGlowObjectHandle].IsUnused() );
m_GlowObjectDefinitions[nGlowObjectHandle].m_flGlowAlpha = flAlpha;
}
void SetRenderFlags( int nGlowObjectHandle, bool bRenderWhenOccluded, bool bRenderWhenUnoccluded )
{
Assert( !m_GlowObjectDefinitions[nGlowObjectHandle].IsUnused() );
m_GlowObjectDefinitions[nGlowObjectHandle].m_bRenderWhenOccluded = bRenderWhenOccluded;
m_GlowObjectDefinitions[nGlowObjectHandle].m_bRenderWhenUnoccluded = bRenderWhenUnoccluded;
}
void SetRenderStyle( int nGlowObjectHandle, GlowRenderStyle_t nNewRenderStyle )
{
Assert( !m_GlowObjectDefinitions[nGlowObjectHandle].IsUnused() );
Assert( nNewRenderStyle >= GLOWRENDERSTYLE_DEFAULT && nNewRenderStyle < GLOWRENDERSTYLE_COUNT );
m_GlowObjectDefinitions[nGlowObjectHandle].m_nRenderStyle = nNewRenderStyle;
}
void SetFullBloomRender( int nGlowObjectHandle, bool bFullBloomRender, int nStencilTestValue )
{
Assert( !m_GlowObjectDefinitions[nGlowObjectHandle].IsUnused() );
m_GlowObjectDefinitions[nGlowObjectHandle].m_bFullBloomRender = bFullBloomRender;
m_GlowObjectDefinitions[nGlowObjectHandle].m_nFullBloomStencilTestValue = nStencilTestValue;
}
bool IsRenderingWhenOccluded( int nGlowObjectHandle ) const
{
Assert( !m_GlowObjectDefinitions[nGlowObjectHandle].IsUnused() );
return m_GlowObjectDefinitions[nGlowObjectHandle].m_bRenderWhenOccluded;
}
bool IsRenderingWhenUnoccluded( int nGlowObjectHandle ) const
{
Assert( !m_GlowObjectDefinitions[nGlowObjectHandle].IsUnused() );
return m_GlowObjectDefinitions[nGlowObjectHandle].m_bRenderWhenUnoccluded;
}
void RenderGlowEffects( const CViewSetup *pSetup, int nSplitScreenSlot );
//private:
void ApplyEntityGlowEffects( const CViewSetup *pSetup, int nSplitScreenSlot, CMatRenderContextPtr &pRenderContext, float flBloomScale, int x, int y, int w, int h );
void RenderGlowBoxes( int iPass, CMatRenderContextPtr &pRenderContext );
struct GlowObjectDefinition_t
{
bool ShouldDraw( int nSlot ) const {
return 0;// m_pEntity && (m_nSplitScreenSlot == GLOW_FOR_ALL_SPLIT_SCREEN_SLOTS || m_nSplitScreenSlot == nSlot) && (m_bRenderWhenOccluded || m_bRenderWhenUnoccluded) && m_pEntity->ShouldDraw();
}
bool IsUnused() const {
return m_nNextFreeSlot != GlowObjectDefinition_t::ENTRY_IN_USE;
}
void DrawModel();
// Linked list of free slots
int m_nNextFreeSlot;
C_BaseEntity* m_pEntity;
Vector m_vGlowColor;
float m_flGlowAlpha;
bool m_bGlowAlphaCappedByRenderAlpha;
float m_flGlowAlphaFunctionOfMaxVelocity;
float m_flGlowAlphaMax;
float m_flGlowPulseOverdrive;
bool m_bRenderWhenOccluded;
bool m_bRenderWhenUnoccluded;
bool m_bFullBloomRender;
int m_nFullBloomStencilTestValue; // only render full bloom objects if stencil is equal to this value (value of -1 implies no stencil test)
int m_nRenderStyle;
int m_nSplitScreenSlot;
// Special values for GlowObjectDefinition_t::m_nNextFreeSlot
static const int END_OF_FREE_LIST = -1;
static const int ENTRY_IN_USE = -2;
};
void RenderGlowModels( const CViewSetup *pSetup, int nSplitScreenSlot, CMatRenderContextPtr &pRenderContext, CUtlVector<GlowObjectDefinition_t> &vecGlowObjects );
void DownSampleAndBlurRT( const CViewSetup *pSetup, CMatRenderContextPtr &pRenderContext, float flBloomScale, ITexture *pRtFullFrame, ITexture *pRtQuarterSize0, ITexture *pRtQuarterSize1 );
CUtlVector< GlowObjectDefinition_t > m_GlowObjectDefinitions;
int m_nFirstFreeSlot;
struct GlowBoxDefinition_t
{
Vector m_vPosition;
QAngle m_angOrientation;
Vector m_vMins;
Vector m_vMaxs;
float m_flBirthTimeIndex;
float m_flTerminationTimeIndex; //when to die
Color m_colColor;
};
CUtlVector< GlowBoxDefinition_t > m_GlowBoxDefinitions;
};
CGlowObjectManager &GlowObjectManager();
class CGlowObject
{
public:
CGlowObject( C_BaseEntity *pEntity, const Vector &vGlowColor = Vector( 1.0f, 1.0f, 1.0f ), float flGlowAlpha = 1.0f, bool bRenderWhenOccluded = false, bool bRenderWhenUnoccluded = false, int nSplitScreenSlot = GLOW_FOR_ALL_SPLIT_SCREEN_SLOTS )
{
m_nGlowObjectHandle = GlowObjectManager().RegisterGlowObject( pEntity, vGlowColor, flGlowAlpha, bRenderWhenOccluded, bRenderWhenUnoccluded, nSplitScreenSlot );
}
~CGlowObject()
{
GlowObjectManager().UnregisterGlowObject( m_nGlowObjectHandle );
}
void SetGlowAlphaPulseOverdrive( float flAdditionalAlpha )
{
//this value is added to existing glow alpha, and fades away in a few frames
GlowObjectManager().SetGlowAlphaPulseOverdrive( m_nGlowObjectHandle, flAdditionalAlpha );
}
void SetGlowAlphaCappedByRenderAlpha( bool bGlowAlphaCappedByRenderAlpha )
{
GlowObjectManager().SetGlowAlphaCappedByRenderAlpha( m_nGlowObjectHandle, bGlowAlphaCappedByRenderAlpha );
}
void SetGlowAlphaFunctionOfMaxVelocity( float flMaxVelocity )
{
GlowObjectManager().SetGlowAlphaFunctionOfMaxVelocity( m_nGlowObjectHandle, flMaxVelocity );
}
void SetGlowAlphaMax( float flGlowAlphaMax )
{
GlowObjectManager().SetGlowAlphaMax( m_nGlowObjectHandle, flGlowAlphaMax );
}
void SetEntity( C_BaseEntity *pEntity )
{
GlowObjectManager().SetEntity( m_nGlowObjectHandle, pEntity );
}
void SetColor( const Vector &vGlowColor )
{
GlowObjectManager().SetColor( m_nGlowObjectHandle, vGlowColor );
}
void SetAlpha( float flAlpha )
{
GlowObjectManager().SetAlpha( m_nGlowObjectHandle, flAlpha );
}
void SetRenderFlags( bool bRenderWhenOccluded, bool bRenderWhenUnoccluded )
{
GlowObjectManager().SetRenderFlags( m_nGlowObjectHandle, bRenderWhenOccluded, bRenderWhenUnoccluded );
}
void SetRenderStyle( GlowRenderStyle_t nNewRenderStyle )
{
GlowObjectManager().SetRenderStyle( m_nGlowObjectHandle, nNewRenderStyle );
}
void SetFullBloomRender( bool bFullBloomRender, int nStencilTestValue = -1 )
{
return GlowObjectManager().SetFullBloomRender( m_nGlowObjectHandle, bFullBloomRender, nStencilTestValue );
}
bool IsRenderingWhenOccluded() const
{
return GlowObjectManager().IsRenderingWhenOccluded( m_nGlowObjectHandle );
}
bool IsRenderingWhenUnoccluded() const
{
return GlowObjectManager().IsRenderingWhenUnoccluded( m_nGlowObjectHandle );
}
bool IsRendering() const
{
return IsRenderingWhenOccluded() || IsRenderingWhenUnoccluded();
}
// Add more accessors/mutators here as needed
private:
int m_nGlowObjectHandle;
// Assignment & copy-construction disallowed
CGlowObject( const CGlowObject &other );
CGlowObject& operator=( const CGlowObject &other );
};
#endif // GLOW_OUTLINE_EFFECT_H

View File

@ -28,7 +28,7 @@ public:
virtual void Release(void) = 0;
virtual void Unknown000(void) = 0;
const Vector& GetAbsOrigin()
Vector& GetAbsOrigin()
{
typedef Vector& (__thiscall* GetAbsOriginFn)(void*);
return getvfunc<GetAbsOriginFn>(this, 10)(this);

View File

@ -36,10 +36,18 @@ public:
virtual TraceType_t GetTraceType() const = 0;
};
#include <functional>
class CTraceFilter : public ITraceFilter
{
using FilterCallbackFn = std::function<bool(IHandleEntity*, int)>;
public:
CTraceFilter(const IHandleEntity* pSkipEntity, TraceType_t iTraceType = TRACE_EVERYTHING)
: pSkip((void*)pSkipEntity), iTraceType(iTraceType) { }
CTraceFilter(FilterCallbackFn&& checkCallback, TraceType_t iTraceType = TRACE_EVERYTHING)
: checkCallback(std::move(checkCallback)), iTraceType(iTraceType) { }
bool ShouldHitEntity(IHandleEntity* pEntityHandle, int )
{
return !(pEntityHandle == pSkip);
@ -49,6 +57,8 @@ public:
return TRACE_EVERYTHING;
}
void* pSkip;
FilterCallbackFn checkCallback = nullptr;
TraceType_t iTraceType = TRACE_EVERYTHING;
};
class CTraceFilterEntitiesOnly : public ITraceFilter

View File

@ -79,6 +79,20 @@ public:
virtual int GetMaxRoutablePayloadSize() = 0;
virtual int GetProtocolVersion() = 0;
std::byte pad0[0x14]; //0x0000
bool bProcessingMessages; //0x0014
bool bShouldDelete; //0x0015
bool bStopProcessing; //0x0016
std::byte pad1[0x1]; //0x0017
int iOutSequenceNr; //0x0018 last send outgoing sequence number
int iInSequenceNr; //0x001C last received incoming sequence number
int iOutSequenceNrAck; //0x0020 last received acknowledge outgoing sequence number
int iOutReliableState; //0x0024 state of outgoing reliable data (0/1) flip flop used for loss detection
int iInReliableState; //0x0028 state of incoming reliable data
int iChokedPackets; //0x002C number of choked packets
std::byte pad2[0x414]; //0x0030
};

View File

@ -69,6 +69,8 @@ public:
virtual void GetRemoteFramerate(float* pflFrameTime, float* pflFrameTimeStdDeviation) const = 0;
virtual float GetTimeoutSeconds() const = 0;
};
#endif

View File

@ -90,7 +90,7 @@ enum VertexTextureSampler_t
#include "bittools.h"
#define TICK_INTERVAL (gpGlobals->interval_per_tick)
#define TICK_INTERVAL (iff.g_pGlobals->interval_per_tick)
#define TIME_TO_TICKS( dt ) ( (int)( 0.5f + (float)(dt) / TICK_INTERVAL ) )

View File

@ -8,6 +8,8 @@
#include "mathlib.h"
#define DISPSURF_FLAG_SURFACE (1<<0)
#define DISPSURF_FLAG_WALKABLE (1<<1)
#define DISPSURF_FLAG_BUILDABLE (1<<2)
@ -26,9 +28,10 @@ public:
public:
Vector startpos;
Vector endpos;
BYTE plane[20];
Vector vecStart; // start position
Vector vecEnd; // final position
cplane_t plane;
float fraction;

View File

@ -22,7 +22,7 @@
#include "math_pfns.h"
#include "minmax.h"
#include <algorithm>
#include <cmath>
//#include <numbers>.
#define pi_v 3.14159265358979323846
@ -48,6 +48,7 @@ template <typename T> constexpr auto rad2deg(T radians) noexcept { return radian
#define VecToString(v) (static_cast<const char *>(CFmtStr("(%f, %f, %f)", (v).x, (v).y, (v).z)))
class VectorByValue;
class QAngle;
class Vector
{
@ -56,6 +57,8 @@ public:
Vector(void);
Vector(vec_t X, vec_t Y, vec_t Z);
inline Vector(QAngle v);
explicit Vector(vec_t XYZ);
void Init(vec_t ix = 0.0f, vec_t iy = 0.0f, vec_t iz = 0.0f);
@ -127,7 +130,7 @@ public:
void MulAdd(const Vector& a, const Vector& b, float scalar);
vec_t Dot(const Vector& vOther) const;
vec_t Dot(const Vector& vOther) const;
Vector& operator=(const Vector& vOther);
@ -177,6 +180,31 @@ private:
return std::sqrt(x * x + y * y);
}
void Clamp(void)
{
if (this->x < -89.f)
this->x = -89.f;
if (this->x > 89.f)
this->x = 89.f;
while (this->y < -180.f)
this->y += 360.f;
while (this->y > 180.f)
this->y -= 360.f;
this->z = 0.f;
}
void Normalize()
{
this->x = std::isfinite(this->x) ? std::remainderf(this->x, 360.f) : 0.f;
this->y = std::isfinite(this->y) ? std::remainderf(this->y, 360.f) : 0.f;
this->z = std::clamp(this->z, -50.f, 50.f);
}
};
FORCEINLINE void NetworkVarConstruct(Vector& v) { v.Zero(); }
@ -982,7 +1010,7 @@ inline Vector& AllocTempVector()
FORCEINLINE vec_t DotProduct(const Vector& a, const Vector& b)
FORCEINLINE vec_t DotProduct(const Vector& a, const Vector& b)
{
CHECK_VALID(a);
CHECK_VALID(b);
@ -1444,6 +1472,12 @@ public:
QAngle(void);
QAngle(vec_t X, vec_t Y, vec_t Z);
QAngle(Vector v)
{
this->x = v.x;
this->y = v.y;
this->z = v.z;
}
operator QAngleByValue& () { return *((QAngleByValue*)(this)); }
operator const QAngleByValue& () const { return *((const QAngleByValue*)(this)); }
@ -1488,8 +1522,8 @@ private:
void Clamp(void)
{
if (this->z < -89.f)
this->x = 89.f;
if (this->x < -89.f)
this->x = -89.f;
if (this->x > 89.f)
this->x = 89.f;
@ -1503,8 +1537,32 @@ private:
this->z = 0.f;
}
void Normalize()
{
this->x = std::isfinite(this->x) ? std::remainderf(this->x, 360.f) : 0.f;
this->y = std::isfinite(this->y) ? std::remainderf(this->y, 360.f) : 0.f;
this->z = std::clamp(this->z, -50.f, 50.f);
}
float DistTo(const QAngle& other) {
QAngle delta;
delta.x = x - other.x;
delta.y = y - other.y;
delta.z = z - other.z;
return delta.Length();
}
};
inline Vector::Vector(QAngle v)
{
this->x = v.x;
this->y = v.y;
this->z = v.z;
}
FORCEINLINE void NetworkVarConstruct(QAngle& q) { q.x = q.y = q.z = 0.0f; }
class QAngleByValue : public QAngle

View File

@ -718,6 +718,18 @@ struct surfacesoundhandles_t
short strainSound;
};
struct surfacegameprops_t
{
float flMaxSpeedFactor;
float flJumpFactor;
float flPenetrationModifier;
float flDamageModifier;
MaterialHandle_t hMaterial;
std::byte dClimbable;
std::byte pad0[0x4];
}; // Size: 0x17
/*
struct surfacegameprops_t
{
float maxSpeedFactor;
@ -726,6 +738,7 @@ struct surfacegameprops_t
unsigned char climbable;
unsigned char pad;
};
*/
struct surfacedata_t
{