Skip to content

Commit

Permalink
Sync with 'alliedmodders/cs2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Wend4r committed Jan 16, 2025
2 parents 54e78db + d18bab8 commit fcf4f07
Show file tree
Hide file tree
Showing 33 changed files with 1,473 additions and 933 deletions.
2 changes: 1 addition & 1 deletion public/cdll_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ typedef void (*pfnDemoCustomDataCallback)( uint8 *pData, size_t iSize );

//-----------------------------------------------------------------------------
// Just an interface version name for the random number interface
// See vstdlib/random.h for the interface definition
// See tier1/random.h for the interface definition
// NOTE: If you change this, also change VENGINE_SERVER_RANDOM_INTERFACE_VERSION in eiface.h
//-----------------------------------------------------------------------------
#define VENGINE_CLIENT_RANDOM_INTERFACE_VERSION "VEngineRandom001"
Expand Down
4 changes: 2 additions & 2 deletions public/eiface.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ abstract_class IVEngineServer2 : public ISource2Engine
virtual bool IsClientLowViolence( CPlayerSlot nSlot ) = 0;

// Kicks the slot with the specified NetworkDisconnectionReason
virtual void DisconnectClient( CPlayerSlot nSlot, ENetworkDisconnectionReason reason ) = 0;
virtual void DisconnectClient( CPlayerSlot nSlot, ENetworkDisconnectionReason reason, const char *szInternalReason = nullptr ) = 0;

#if 0 // Don't really match the binary
virtual void GetAllSpawnGroupsWithPVS( CUtlVector<SpawnGroupHandle_t> *spawnGroups, CUtlVector<IPVS *> *pOut ) = 0;
Expand Down Expand Up @@ -465,7 +465,7 @@ abstract_class ISource2Server : public IAppSystem

//-----------------------------------------------------------------------------
// Just an interface version name for the random number interface
// See vstdlib/random.h for the interface definition
// See tier1/random.h for the interface definition
// NOTE: If you change this, also change VENGINE_CLIENT_RANDOM_INTERFACE_VERSION in cdll_int.h
//-----------------------------------------------------------------------------
#define VENGINE_SERVER_RANDOM_INTERFACE_VERSION "VEngineRandom001"
Expand Down
1 change: 1 addition & 0 deletions public/inetchannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ abstract_class INetChannel : public INetChannelInfo
virtual int GetCurrentNetMessageInSequenceNr( void ) const = 0;

virtual void unk211() = 0;
virtual void unk212() = 0;
};


Expand Down
1 change: 1 addition & 0 deletions public/inetchannelinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class INetChannelInfo

virtual void unk201() = 0;
virtual void unk202() = 0;
virtual void unk203() = 0;
};

#endif // INETCHANNELINFO_H
Expand Down
2 changes: 1 addition & 1 deletion public/mathlib/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "mathlib/vector2d.h"
#include "mathlib/math_pfns.h"
#include "tier0/memalloc.h"
#include "vstdlib/random.h"
#include "tier1/random.h"

// Uncomment this to add extra Asserts to check for NANs, uninitialized vecs, etc.
//#define VECTOR_PARANOIA 1
Expand Down
2 changes: 1 addition & 1 deletion public/mathlib/vector2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "tier0/basetypes.h"

// For RandomFloat()
#include "vstdlib/random.h"
#include "tier1/random.h"

#include "tier0/dbg.h"
#include "mathlib/math_pfns.h"
Expand Down
2 changes: 1 addition & 1 deletion public/mathlib/vector4d.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "tier0/dbg.h"
#include "mathlib/math_pfns.h"
#include "mathlib/vector.h"
#include "vstdlib/random.h"
#include "tier1/random.h"
// forward declarations
class Vector;
class Vector2D;
Expand Down
2 changes: 1 addition & 1 deletion public/particles/particles.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class IMatRenderContext;

#include "dmxloader/dmxelement.h"
#include "tier1/utlintrusivelist.h"
#include "vstdlib/random.h"
#include "tier1/random.h"
#include "tier1/utlobjectreference.h"
#include "tier1/utlstringmap.h"
#include "tier1/utlmap.h"
Expand Down
6 changes: 3 additions & 3 deletions public/schemasystem/schemasystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ abstract_class ISchemaSystemTypeScope
virtual SchemaMetaInfoHandle_t<CSchemaType_Ptr> Type_Ptr( CSchemaType* pObjectType ) = 0;
virtual SchemaMetaInfoHandle_t<CSchemaType_Atomic> Type_Atomic( const char* pszAtomicName, uint16 nSize, uint8 nAlignment ) = 0;
virtual SchemaMetaInfoHandle_t<CSchemaType_Atomic_T> Type_Atomic_T( const char* pszAtomicName, uint16 nSize, uint8 nAlignment, CSchemaType* pTemplateType ) = 0;
virtual SchemaMetaInfoHandle_t<CSchemaType_Atomic_CollectionOfT> Type_Atomic_CollectionOfT( const char* pszAtomicName, uint16 nSize, uint8 nAlignment, uint16 nElementSize, CSchemaType* pTemplateType, SchemaCollectionManipulatorFn_t manipulator ) = 0;
virtual SchemaMetaInfoHandle_t<CSchemaType_Atomic_CollectionOfT> Type_Atomic_CollectionOfT( const char* pszAtomicName, uint16 nSize, uint8 nAlignment, uint16 nElementSize, CSchemaType* pTemplateType, uint64 nFixedBufferCount, SchemaCollectionManipulatorFn_t manipulator ) = 0;
virtual SchemaMetaInfoHandle_t<CSchemaType_Atomic_TT> Type_Atomic_TT( const char* pszAtomicName, uint16 nSize, uint8 nAlignment, CSchemaType* pTemplateType, CSchemaType* pTemplateType2 ) = 0;
virtual SchemaMetaInfoHandle_t<CSchemaType_Atomic_I> Type_Atomic_I( const char* pszAtomicName, uint16 nSize, uint8 nAlignment, int nInterger ) = 0;
virtual SchemaMetaInfoHandle_t<CSchemaType_Atomic_I> Type_Atomic_I( const char* pszAtomicName, uint16 nSize, uint8 nAlignment, int nInteger ) = 0;
virtual SchemaMetaInfoHandle_t<CSchemaType_DeclaredClass> Type_DeclaredClass( const char* pszClassName ) = 0;
virtual SchemaMetaInfoHandle_t<CSchemaType_DeclaredEnum> Type_DeclaredEnum( const char* pszEnumName ) = 0;
virtual SchemaMetaInfoHandle_t<CSchemaType_FixedArray> Type_FixedArray( CSchemaType* pElementType, int nElementCount, uint16 nElementSize, uint8 nElementAlignment ) = 0;
Expand Down Expand Up @@ -89,7 +89,7 @@ class CSchemaSystemTypeScope : public ISchemaSystemTypeScope
CSchemaPtrMap<SchemaMetaInfoHandle_t<CSchemaType>, CSchemaType_Ptr*> m_Pointers;
CSchemaPtrMap<int, CSchemaType_Atomic*> m_Atomics;
CSchemaPtrMap<AtomicTypeInfo_T_t, CSchemaType_Atomic_T*> m_AtomicsT;
CSchemaPtrMap<AtomicTypeInfo_T_t, CSchemaType_Atomic_CollectionOfT*> m_AtomicsCollectionOfT;
CSchemaPtrMap<AtomicTypeInfo_CollectionOfT_t, CSchemaType_Atomic_CollectionOfT*> m_AtomicsCollectionOfT;
CSchemaPtrMap<AtomicTypeInfo_TT_t, CSchemaType_Atomic_TT*> m_AtomicsTT;
CSchemaPtrMap<AtomicTypeInfo_I_t, CSchemaType_Atomic_I*> m_AtomicsI;
CSchemaPtrMap<uint, CSchemaType_DeclaredClass*> m_DeclaredClasses;
Expand Down
114 changes: 97 additions & 17 deletions public/schemasystem/schematypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ class CBufferString;
struct SchemaAtomicTypeInfo_t;
struct datamap_t;

template <typename T>
struct SchemaTypeMap {};

#define SCHEMATYPE_ENTRY( type, type_cat, atomic_cat ) template <> struct SchemaTypeMap<type> \
{ \
static const SchemaTypeCategory_t type_category = type_cat; \
static const SchemaAtomicCategory_t atomic_category = atomic_cat; \
static inline bool Match( CSchemaType *ptr ) { return ptr->m_eTypeCategory == type_category && ptr->m_eAtomicCategory == atomic_category; } \
};

enum SchemaClassFlags1_t
{
SCHEMA_CF1_HAS_VIRTUAL_MEMBERS = (1 << 0),
Expand Down Expand Up @@ -103,30 +113,50 @@ enum SchemaBuiltinType_t
SCHEMA_BUILTIN_TYPE_COUNT,
};

// Works in combination with SchemaClassManipulatorFn_t
enum SchemaClassManipulatorAction_t
{
// Registers pObject in a schemasystem
SCHEMA_CLASS_MANIPULATOR_ACTION_REGISTER = 0,
SCHEMA_CLASS_MANIPULATOR_ACTION_REGISTER_PRE,

// Allocates object on the heap and constructs it in place, pObject is unused
SCHEMA_CLASS_MANIPULATOR_ACTION_ALLOCATE,
// Deallocates pObject
SCHEMA_CLASS_MANIPULATOR_ACTION_DEALLOCATE,

// Constructs pObject in place
SCHEMA_CLASS_MANIPULATOR_ACTION_CONSTRUCT_IN_PLACE,
// Destructs pObject in place
SCHEMA_CLASS_MANIPULATOR_ACTION_DESCTRUCT_IN_PLACE,

// Returns schema binding of pObject
SCHEMA_CLASS_MANIPULATOR_ACTION_GET_SCHEMA_BINDING,
};

// Works in combination with SchemaCollectionManipulatorFn_t
enum SchemaCollectionManipulatorAction_t
{
// Returns count of the collection, index1 & index2 is unused
SCHEMA_COLLECTION_MANIPULATOR_ACTION_GET_COUNT = 0,

// Returns element from the collection at index1, index2 is unused
SCHEMA_COLLECTION_MANIPULATOR_ACTION_GET_ELEMENT_CONST,
SCHEMA_COLLECTION_MANIPULATOR_ACTION_GET_ELEMENT,

// Swaps elements in a collection, index1 & index2 is first and second elements to swap
SCHEMA_COLLECTION_MANIPULATOR_ACTION_SWAP_ELEMENTS,
// Inserts elements to a collection at index1 where index2 is how much elements to insert
SCHEMA_COLLECTION_MANIPULATOR_ACTION_INSERT_BEFORE,
// Removes elements from a collection at index1 where index2 is how much elements to remove
SCHEMA_COLLECTION_MANIPULATOR_ACTION_REMOVE_MULTIPLE,

// Sets the count of a collection of size index1, index2 is unused
SCHEMA_COLLECTION_MANIPULATOR_ACTION_SET_COUNT,
};

typedef void* (*SchemaClassManipulatorFn_t)(SchemaClassManipulatorAction_t, void*, void*);
typedef void* (*SchemaCollectionManipulatorFn_t)(SchemaCollectionManipulatorAction_t, void*, void*, void*);
typedef void *(*SchemaClassManipulatorFn_t)(SchemaClassManipulatorAction_t eAction, void *pObject);
typedef void *(*SchemaCollectionManipulatorFn_t)(SchemaCollectionManipulatorAction_t eAction, void *pCollection, int index1, int index2);

inline uint32 CSchemaType_Hash( const char *pString, int len )
{
Expand Down Expand Up @@ -156,26 +186,41 @@ class CSchemaType
{
public:
virtual bool IsValid() const { return false; }
virtual const char* ToString( CBufferString& buff, bool bDontClearBuff ) const { return ""; }
virtual void SpewDescription( LoggingChannelID_t channelID, const char* pszName ) {}
virtual bool GetSizeAndAlignment( int& nSize, uint8& nAlignment ) const { return false; }
virtual bool CanReinterpretAs( const CSchemaType* pType ) const { return false; }
virtual SchemaMetaInfoHandle_t<CSchemaType> GetInnerType() const { return SchemaMetaInfoHandle_t<CSchemaType>(); }
virtual SchemaMetaInfoHandle_t<CSchemaType> GetInnermostType() const { return SchemaMetaInfoHandle_t<CSchemaType>(); }
virtual bool IsA( const CSchemaType* pType ) const { return false; }
virtual bool InternalMatchInnerAs( SchemaTypeCategory_t eTypeCategory, SchemaAtomicCategory_t eAtomicCategory ) const { return false; }

virtual void unk001() {}
virtual void unk002() {}
virtual void unk003() {}
virtual void unk004() {}
virtual void unk005() {}
virtual void unk006() {}
virtual const char *ToString( CBufferString &buff, bool bDontClearBuff ) const { return ""; }
virtual void SpewDescription( LoggingChannelID_t channelID, const char *pszName ) const {}
virtual bool GetSizeAndAlignment( int &nSize, uint8 &nAlignment ) const { return false; }
virtual bool CanReinterpretAs( const CSchemaType *pType ) const { return false; }
virtual SchemaMetaInfoHandle_t<CSchemaType> GetInnerType() const { return nullptr; }
virtual SchemaMetaInfoHandle_t<CSchemaType> GetInnermostType() const { return nullptr; }

// Returns true if pType is this object
virtual bool IsA( const CSchemaType *pType ) const { return false; }
virtual CSchemaType *InternalMatchInnerAs( SchemaTypeCategory_t eTypeCategory, SchemaAtomicCategory_t eAtomicCategory ) const { return nullptr; }

// Returns true if this type matches pType type traits
virtual bool IsTypeByType( const CSchemaType *pType ) const { return false; }
// Returns true if this type name matches szName
virtual bool IsTypeByName( const char *szName ) const { return false; }

// Returns true if this type is builtin and matches eType
virtual bool IsBuiltinType( SchemaBuiltinType_t eType ) const { return false; }
// Returns true if this type is atomic and matches nAtomicID
virtual bool IsAtomicType( int nAtomicID ) const { return false; }
// Returns true if this type is declared class and matches szClassName
virtual bool IsDeclaredClass( const char *szClassName ) const { return false; }
// Returns true if this type is declared enum and matches szEnumName
virtual bool IsDeclaredEnum( const char *szEnumName ) const { return false; };

virtual bool DependsOnlyOnUnresolvedOrGlobalTypes( ISchemaSystemTypeScope* pTypeScope ) const { return false; }

virtual ~CSchemaType() = 0;

template <typename T>
bool IsA() { return SchemaTypeMap<T>::Match( this ); }

template <typename T>
T *ReinterpretAs() { return (IsA<T>()) ? (T *)this : nullptr; }

public:
CUtlString m_sTypeName;
CSchemaSystemTypeScope* m_pTypeScope;
Expand Down Expand Up @@ -216,6 +261,7 @@ class CSchemaType_Atomic_CollectionOfT : public CSchemaType_Atomic_T
public:
SchemaCollectionManipulatorFn_t m_pfnManipulator;
uint16 m_nElementSize;
uint64 m_nFixedBufferCount;
};

class CSchemaType_Atomic_TT : public CSchemaType_Atomic_T
Expand Down Expand Up @@ -259,6 +305,18 @@ class CSchemaType_Bitfield : public CSchemaType
int m_nBitfieldCount;
};

SCHEMATYPE_ENTRY( CSchemaType_Builtin, SCHEMA_TYPE_BUILTIN, SCHEMA_ATOMIC_INVALID );
SCHEMATYPE_ENTRY( CSchemaType_Ptr, SCHEMA_TYPE_POINTER, SCHEMA_ATOMIC_INVALID );
SCHEMATYPE_ENTRY( CSchemaType_Atomic, SCHEMA_TYPE_ATOMIC, SCHEMA_ATOMIC_PLAIN );
SCHEMATYPE_ENTRY( CSchemaType_Atomic_T, SCHEMA_TYPE_ATOMIC, SCHEMA_ATOMIC_T );
SCHEMATYPE_ENTRY( CSchemaType_Atomic_CollectionOfT, SCHEMA_TYPE_ATOMIC, SCHEMA_ATOMIC_COLLECTION_OF_T );
SCHEMATYPE_ENTRY( CSchemaType_Atomic_TT, SCHEMA_TYPE_ATOMIC, SCHEMA_ATOMIC_TT );
SCHEMATYPE_ENTRY( CSchemaType_Atomic_I, SCHEMA_TYPE_ATOMIC, SCHEMA_ATOMIC_I );
SCHEMATYPE_ENTRY( CSchemaType_DeclaredClass, SCHEMA_TYPE_DECLARED_CLASS, SCHEMA_ATOMIC_INVALID );
SCHEMATYPE_ENTRY( CSchemaType_DeclaredEnum, SCHEMA_TYPE_DECLARED_ENUM, SCHEMA_ATOMIC_INVALID );
SCHEMATYPE_ENTRY( CSchemaType_FixedArray, SCHEMA_TYPE_FIXED_ARRAY, SCHEMA_ATOMIC_INVALID );
SCHEMATYPE_ENTRY( CSchemaType_Bitfield, SCHEMA_TYPE_BITFIELD, SCHEMA_ATOMIC_INVALID );

struct SchemaMetadataEntryData_t
{
const char* m_pszName;
Expand Down Expand Up @@ -407,6 +465,28 @@ struct AtomicTypeInfo_T_t
SchemaCollectionManipulatorFn_t m_pfnManipulator;
};

struct AtomicTypeInfo_CollectionOfT_t
{
bool operator<( const AtomicTypeInfo_CollectionOfT_t &rhs ) const
{
if(m_nAtomicID != rhs.m_nAtomicID)
return m_nAtomicID < rhs.m_nAtomicID;

if(m_pTemplateType != rhs.m_pTemplateType)
return m_pTemplateType < rhs.m_pTemplateType;

if(m_nFixedBufferCount != rhs.m_nFixedBufferCount)
return m_nFixedBufferCount < rhs.m_nFixedBufferCount;

return (void *)m_pfnManipulator < (void *)rhs.m_pfnManipulator;
}

int m_nAtomicID;
CSchemaType *m_pTemplateType;
uint64 m_nFixedBufferCount;
SchemaCollectionManipulatorFn_t m_pfnManipulator;
};

struct AtomicTypeInfo_TT_t
{
bool operator<( const AtomicTypeInfo_TT_t& rhs ) const
Expand Down
2 changes: 1 addition & 1 deletion public/soundcombiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "snd_wave_source.h"
#include "AudioWaveOutput.h"
#include "ifaceposersound.h"
#include "vstdlib/random.h"
#include "tier1/random.h"
#include "checksum_crc.h"

#define WAVEOUTPUT_BITSPERCHANNEL 16
Expand Down
Loading

0 comments on commit fcf4f07

Please sign in to comment.