diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /engine/precache.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'engine/precache.h')
| -rw-r--r-- | engine/precache.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/engine/precache.h b/engine/precache.h new file mode 100644 index 0000000..77c2a27 --- /dev/null +++ b/engine/precache.h @@ -0,0 +1,97 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef PRECACHE_H +#define PRECACHE_H +#ifdef _WIN32 +#pragma once +#endif + +#include "networkstringtabledefs.h" + +#define PRECACHE_USER_DATA_NUMBITS 2 // Only network two bits from flags field... + +#pragma pack(1) +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +struct CPrecacheUserData +{ + unsigned char flags : PRECACHE_USER_DATA_NUMBITS; +}; + +#pragma pack() + + + +class CSfxTable; +struct model_t; + +//#define DEBUG_PRECACHE 1 + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +class CPrecacheItem +{ +public: + CPrecacheItem( void ); + + // accessorts + model_t *GetModel( void ); + char const *GetGeneric( void ); + CSfxTable *GetSound( void ); + char const *GetName( void ); + char const *GetDecal( void ); + + void SetModel( model_t const *pmodel ); + void SetGeneric( char const *pname ); + void SetSound( CSfxTable const *psound ); + void SetName( char const *pname ); + void SetDecal( char const *decalname ); + + float GetFirstReference( void ); + float GetMostRecentReference( void ); + unsigned int GetReferenceCount( void ); + +private: + enum + { + TYPE_UNK = 0, + TYPE_MODEL, + TYPE_SOUND, + TYPE_GENERIC, + TYPE_DECAL + }; + + void Init( int type, void const *ptr ); + void ResetStats( void ); + void Reference( void ); + + unsigned int m_nType : 3; + unsigned int m_uiRefcount : 29; + union precacheptr + { + model_t *model; + char const *generic; + CSfxTable *sound; + char const *name; + } u; +#if DEBUG_PRECACHE + float m_flFirst; + float m_flMostRecent; +#endif +}; + +#define MODEL_PRECACHE_TABLENAME "modelprecache" +#define GENERIC_PRECACHE_TABLENAME "genericprecache" +#define SOUND_PRECACHE_TABLENAME "soundprecache" +#define DECAL_PRECACHE_TABLENAME "decalprecache" + +char const *GetFlagString( int flags ); + +#endif // PRECACHE_H |