diff --git a/entity2/entitysystem.cpp b/entity2/entitysystem.cpp index 32b56744..7b2019ef 100644 --- a/entity2/entitysystem.cpp +++ b/entity2/entitysystem.cpp @@ -17,7 +17,7 @@ CBaseEntity* CEntitySystem::GetBaseEntity(CEntityIndex entnum) if (pIdentity->m_EHandle.GetEntryIndex() != entnum.Get()) return nullptr; - return dynamic_cast(pIdentity->m_pInstance); + return static_cast(pIdentity->m_pInstance); } CBaseEntity* CEntitySystem::GetBaseEntity(const CEntityHandle& hEnt) @@ -36,7 +36,7 @@ CBaseEntity* CEntitySystem::GetBaseEntity(const CEntityHandle& hEnt) if (pIdentity->m_EHandle != hEnt) return nullptr; - return dynamic_cast(pIdentity->m_pInstance); + return static_cast(pIdentity->m_pInstance); } void CGameEntitySystem::AddListenerEntity(IEntityListener* pListener) diff --git a/game/server/baseentity.h b/game/server/baseentity.h index 25f3fe57..3b823c31 100644 --- a/game/server/baseentity.h +++ b/game/server/baseentity.h @@ -11,7 +11,7 @@ #pragma once #endif -#include "entityidentity.h" +#include "entityinstance.h" class CBaseEntity : public CEntityInstance { }; diff --git a/game/shared/ehandle.h b/game/shared/ehandle.h index 6bece5c2..24a49129 100644 --- a/game/shared/ehandle.h +++ b/game/shared/ehandle.h @@ -11,14 +11,14 @@ #pragma once #endif -#include "entityhandle.h" #include "entity2/entitysystem.h" +#include "entityhandle.h" // -------------------------------------------------------------------------------------------------- // // Game-code CBaseHandle implementation. // -------------------------------------------------------------------------------------------------- // -inline IHandleEntity* CEntityHandle::Get() const +inline CEntityInstance* CEntityHandle::Get() const { extern CEntitySystem *g_pEntitySystem; return g_pEntitySystem->GetBaseEntity( *this ); @@ -137,7 +137,7 @@ inline bool CHandle::operator!=( T *val ) const template void CHandle::Set( const T* pVal ) { - CBaseHandle::Set( reinterpret_cast(pVal) ); + CBaseHandle::Set(pVal); } template diff --git a/public/edict.h b/public/edict.h index 0c0028f4..29a31761 100644 --- a/public/edict.h +++ b/public/edict.h @@ -156,280 +156,4 @@ private: unsigned short m_iChangeInfoSerialNumber; }; -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -// NOTE: YOU CAN'T CHANGE THE LAYOUT OR SIZE OF CBASEEDICT AND REMAIN COMPATIBLE WITH HL2_VC6!!!!! -class CBaseEdict -{ -public: - - // Returns an IServerEntity if FL_FULLEDICT is set or NULL if this - // is a lightweight networking entity. - IServerEntity* GetIServerEntity(); - const IServerEntity* GetIServerEntity() const; - - IServerNetworkable* GetNetworkable(); - IServerUnknown* GetUnknown(); - - // Set when initting an entity. If it's only a networkable, this is false. - void SetEdict( IServerUnknown *pUnk, bool bFullEdict ); - - int AreaNum() const; - const char * GetClassName() const; - - bool IsFree() const; - void SetFree(); - void ClearFree(); - - bool HasStateChanged() const; - void ClearStateChanged(); - void StateChanged(); - void StateChanged( unsigned short offset ); - - void ClearTransmitState(); - - void SetChangeInfo( unsigned short info ); - void SetChangeInfoSerialNumber( unsigned short sn ); - unsigned short GetChangeInfo() const; - unsigned short GetChangeInfoSerialNumber() const; - -public: - - // NOTE: this is in the edict instead of being accessed by a virtual because the engine needs fast access to it. - // NOTE: YOU CAN'T CHANGE THE LAYOUT OR SIZE OF CBASEEDICT AND REMAIN COMPATIBLE WITH HL2_VC6!!!!! -#ifdef _XBOX - unsigned short m_fStateFlags; -#else - int m_fStateFlags; -#endif - - // NOTE: this is in the edict instead of being accessed by a virtual because the engine needs fast access to it. - int m_NetworkSerialNumber; // Game DLL sets this when it gets a serial number for its EHANDLE. - - // NOTE: this is in the edict instead of being accessed by a virtual because the engine needs fast access to it. - IServerNetworkable *m_pNetworkable; - - // New as of "6.84" update. - int unknown1; - int unknown2; - -protected: - IServerUnknown *m_pUnk; - - -public: - - IChangeInfoAccessor *GetChangeAccessor(); // The engine implements this and the game .dll implements as - const IChangeInfoAccessor *GetChangeAccessor() const; // The engine implements this and the game .dll implements as - // as callback through to the engine!!! - - // NOTE: YOU CAN'T CHANGE THE LAYOUT OR SIZE OF CBASEEDICT AND REMAIN COMPATIBLE WITH HL2_VC6!!!!! - // This breaks HL2_VC6!!!!! - // References a CEdictChangeInfo with a list of modified network props. - //unsigned short m_iChangeInfo; - //unsigned short m_iChangeInfoSerialNumber; - - friend void InitializeEntityDLLFields( edict_t *pEdict ); -}; - - -//----------------------------------------------------------------------------- -// CBaseEdict inlines. -//----------------------------------------------------------------------------- -inline IServerEntity* CBaseEdict::GetIServerEntity() -{ - if ( m_fStateFlags & FL_EDICT_FULL ) - return (IServerEntity*)m_pUnk; - else - return 0; -} - -inline bool CBaseEdict::IsFree() const -{ - return (m_fStateFlags & FL_EDICT_FREE) != 0; -} - - - -inline bool CBaseEdict::HasStateChanged() const -{ - return (m_fStateFlags & FL_EDICT_CHANGED) != 0; -} - -inline void CBaseEdict::ClearStateChanged() -{ - m_fStateFlags &= ~(FL_EDICT_CHANGED | FL_FULL_EDICT_CHANGED); - SetChangeInfoSerialNumber( 0 ); -} - -inline void CBaseEdict::StateChanged() -{ - // Note: this should only happen for properties in data tables that used some kind of pointer - // dereference. If the data is directly offsetable, then changes will automatically be detected - m_fStateFlags |= (FL_EDICT_CHANGED | FL_FULL_EDICT_CHANGED); - SetChangeInfoSerialNumber( 0 ); -} - -inline void CBaseEdict::StateChanged( unsigned short offset ) -{ -#ifdef NETWORK_VARS_ENABLED - if ( m_fStateFlags & FL_FULL_EDICT_CHANGED ) - return; - - m_fStateFlags |= FL_EDICT_CHANGED; - - IChangeInfoAccessor *accessor = GetChangeAccessor(); - - if ( accessor->GetChangeInfoSerialNumber() == g_pSharedChangeInfo->m_iSerialNumber ) - { - // Ok, I still own this one. - CEdictChangeInfo *p = &g_pSharedChangeInfo->m_ChangeInfos[accessor->GetChangeInfo()]; - - // Now add this offset to our list of changed variables. - for ( unsigned short i=0; i < p->m_nChangeOffsets; i++ ) - if ( p->m_ChangeOffsets[i] == offset ) - return; - - if ( p->m_nChangeOffsets == MAX_CHANGE_OFFSETS ) - { - // Invalidate our change info. - accessor->SetChangeInfoSerialNumber( 0 ); - m_fStateFlags |= FL_FULL_EDICT_CHANGED; // So we don't get in here again. - } - else - { - p->m_ChangeOffsets[p->m_nChangeOffsets++] = offset; - } - } - else - { - if ( g_pSharedChangeInfo->m_nChangeInfos == MAX_EDICT_CHANGE_INFOS ) - { - // Shucks.. have to mark the edict as fully changed because we don't have room to remember this change. - accessor->SetChangeInfoSerialNumber( 0 ); - m_fStateFlags |= FL_FULL_EDICT_CHANGED; - } - else - { - // Get a new CEdictChangeInfo and fill it out. - accessor->SetChangeInfo( g_pSharedChangeInfo->m_nChangeInfos ); - g_pSharedChangeInfo->m_nChangeInfos++; - - accessor->SetChangeInfoSerialNumber( g_pSharedChangeInfo->m_iSerialNumber ); - - CEdictChangeInfo *p = &g_pSharedChangeInfo->m_ChangeInfos[accessor->GetChangeInfo()]; - p->m_ChangeOffsets[0] = offset; - p->m_nChangeOffsets = 1; - } - } -#else - StateChanged(); -#endif -} - - - -inline void CBaseEdict::SetFree() -{ - m_fStateFlags |= FL_EDICT_FREE; -} - -inline void CBaseEdict::ClearFree() -{ - m_fStateFlags &= ~FL_EDICT_FREE; -} - -inline void CBaseEdict::ClearTransmitState() -{ - m_fStateFlags &= ~(FL_EDICT_ALWAYS|FL_EDICT_PVSCHECK|FL_EDICT_DONTSEND); -} - -inline const IServerEntity* CBaseEdict::GetIServerEntity() const -{ - if ( m_fStateFlags & FL_EDICT_FULL ) - return (IServerEntity*)m_pUnk; - else - return 0; -} - -inline IServerUnknown* CBaseEdict::GetUnknown() -{ - return m_pUnk; -} - -inline IServerNetworkable* CBaseEdict::GetNetworkable() -{ - return m_pNetworkable; -} - -inline void CBaseEdict::SetEdict( IServerUnknown *pUnk, bool bFullEdict ) -{ - m_pUnk = pUnk; - if ( (pUnk != NULL) && bFullEdict ) - { - m_fStateFlags = FL_EDICT_FULL; - } - else - { - m_fStateFlags = 0; - } -} - -inline int CBaseEdict::AreaNum() const -{ - if ( !m_pUnk ) - return 0; - - return m_pNetworkable->AreaNum(); -} - -inline const char * CBaseEdict::GetClassName() const -{ - if ( !m_pUnk ) - return ""; - return m_pNetworkable->GetClassName(); -} - -inline void CBaseEdict::SetChangeInfo( unsigned short info ) -{ - GetChangeAccessor()->SetChangeInfo( info ); -} - -inline void CBaseEdict::SetChangeInfoSerialNumber( unsigned short sn ) -{ - GetChangeAccessor()->SetChangeInfoSerialNumber( sn ); -} - -inline unsigned short CBaseEdict::GetChangeInfo() const -{ - return GetChangeAccessor()->GetChangeInfo(); -} - -inline unsigned short CBaseEdict::GetChangeInfoSerialNumber() const -{ - return GetChangeAccessor()->GetChangeInfoSerialNumber(); -} - -//----------------------------------------------------------------------------- -// Purpose: The engine's internal representation of an entity, including some -// basic collision and position info and a pointer to the class wrapped on top -// of the structure -//----------------------------------------------------------------------------- -struct edict_t : public CBaseEdict -{ -public: - ICollideable *GetCollideable(); -}; - -inline ICollideable *edict_t::GetCollideable() -{ - IServerEntity *pEnt = GetIServerEntity(); - if ( pEnt ) - return pEnt->GetCollideable(); - else - return NULL; -} - - #endif // EDICT_H diff --git a/public/eiface.h b/public/eiface.h index 28bcde6c..0e22f34d 100644 --- a/public/eiface.h +++ b/public/eiface.h @@ -90,8 +90,6 @@ namespace google } } -typedef uint32 SpawnGroupHandle_t; - //----------------------------------------------------------------------------- // defines //----------------------------------------------------------------------------- diff --git a/public/engine/ICollideable.h b/public/engine/ICollideable.h index 77e9746b..0b0bff61 100644 --- a/public/engine/ICollideable.h +++ b/public/engine/ICollideable.h @@ -13,7 +13,7 @@ enum SolidType_t : unsigned char; -class IHandleEntity; +class CEntityInstance; struct Ray_t; struct model_t; class Vector; @@ -27,7 +27,7 @@ abstract_class ICollideable { public: // Gets at the entity handle associated with the collideable - virtual IHandleEntity *GetEntityHandle() = 0; + virtual CEntityInstance *GetEntityHandle() = 0; // These methods return the bounds of an OBB measured in "collision" space // which can be retreived through the CollisionToWorldTransform or diff --git a/public/engine/IEngineTrace.h b/public/engine/IEngineTrace.h index 1ad3dbf7..fc7ae7e5 100644 --- a/public/engine/IEngineTrace.h +++ b/public/engine/IEngineTrace.h @@ -18,7 +18,7 @@ #include "bspflags.h" class Vector; -class IHandleEntity; +class CEntityInstance; struct Ray_t; class CGameTrace; typedef CGameTrace trace_t; @@ -43,7 +43,7 @@ enum TraceType_t abstract_class ITraceFilter { public: - virtual bool ShouldHitEntity( IHandleEntity *pEntity, int contentsMask ) = 0; + virtual bool ShouldHitEntity( CEntityInstance *pEntity, int contentsMask ) = 0; virtual TraceType_t GetTraceType() const = 0; }; @@ -78,7 +78,7 @@ public: class CTraceFilterWorldOnly : public ITraceFilter { public: - bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask ) + bool ShouldHitEntity( CEntityInstance *pServerEntity, int contentsMask ) { return false; } @@ -91,7 +91,7 @@ public: class CTraceFilterWorldAndPropsOnly : public ITraceFilter { public: - bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask ) + bool ShouldHitEntity( CEntityInstance *pServerEntity, int contentsMask ) { return false; } @@ -104,7 +104,7 @@ public: class CTraceFilterHitAll : public CTraceFilter { public: - virtual bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask ) + virtual bool ShouldHitEntity( CEntityInstance *pServerEntity, int contentsMask ) { return true; } @@ -124,7 +124,7 @@ abstract_class IEntityEnumerator { public: // This gets called with each handle - virtual bool EnumEntity( IHandleEntity *pHandleEntity ) = 0; + virtual bool EnumEntity( CEntityInstance *pHandleEntity ) = 0; }; @@ -144,7 +144,7 @@ abstract_class IEngineTrace { public: // Returns the contents mask + entity at a particular world-space position - virtual int GetPointContents( const Vector &vecAbsPosition, int contentsMask = MASK_ALL, IHandleEntity** ppEntity = NULL ) = 0; + virtual int GetPointContents( const Vector &vecAbsPosition, int contentsMask = MASK_ALL, CEntityInstance** ppEntity = NULL ) = 0; // Returns the contents mask of the world only @ the world-space position (static props are ignored) virtual int GetPointContents_WorldOnly( const Vector &vecAbsPosition, int contentsMask = MASK_ALL ) = 0; @@ -157,7 +157,7 @@ public: virtual int GetPointContents_Collideable( ICollideable *pCollide, const Vector &vecAbsPosition ) = 0; // Traces a ray against a particular entity - virtual void ClipRayToEntity( const Ray_t &ray, unsigned int fMask, IHandleEntity *pEnt, trace_t *pTrace ) = 0; + virtual void ClipRayToEntity( const Ray_t &ray, unsigned int fMask, CEntityInstance *pEnt, trace_t *pTrace ) = 0; // Traces a ray against a particular entity virtual void ClipRayToCollideable( const Ray_t &ray, unsigned int fMask, ICollideable *pCollide, trace_t *pTrace ) = 0; @@ -184,7 +184,7 @@ public: virtual void EnumerateEntities( const Vector &vecAbsMins, const Vector &vecAbsMaxs, IEntityEnumerator *pEnumerator ) = 0; // Convert a handle entity to a collideable. Useful inside enumer - virtual ICollideable *GetCollideable( IHandleEntity *pEntity ) = 0; + virtual ICollideable *GetCollideable( CEntityInstance *pEntity ) = 0; // HACKHACK: Temp for performance measurments virtual int GetStatByIndex( int index, bool bClear ) = 0; diff --git a/public/engine/IStaticPropMgr.h b/public/engine/IStaticPropMgr.h index 654e0d09..90b07296 100644 --- a/public/engine/IStaticPropMgr.h +++ b/public/engine/IStaticPropMgr.h @@ -51,7 +51,7 @@ public: virtual void TraceRayAgainstStaticProp( const Ray_t& ray, int staticPropIndex, trace_t& tr ) = 0; // Is a base handle a static prop? - virtual bool IsStaticProp( IHandleEntity *pHandleEntity ) const = 0; + virtual bool IsStaticProp( CEntityInstance *pHandleEntity ) const = 0; virtual bool IsStaticProp( CBaseHandle handle ) const = 0; // returns a collideable interface to static props diff --git a/public/entity2/entityidentity.h b/public/entity2/entityidentity.h index 38c53abd..4dd943f8 100644 --- a/public/entity2/entityidentity.h +++ b/public/entity2/entityidentity.h @@ -13,36 +13,47 @@ #include "entitycomponent.h" #include "entityhandle.h" -class CEntityIdentity; +class CEntityInstance; struct ChangeAccessorFieldPathIndex_t { int16 m_Value; }; +typedef uint32 SpawnGroupHandle_t; typedef CUtlStringToken WorldGroupId_t; -class CEntityInstance : public IHandleEntity +enum EntityFlags_t : uint32 { -public: - // MNetworkDisable - CUtlSymbolLarge m_iszPrivateVScripts; // 0x8 - // MNetworkEnable - // MNetworkPriority "56" - CEntityIdentity* m_pEntity; // 0x10 -private: - void* m_hPrivateScope; // 0x18 - CEntityPrivateScriptScope - uint8 unknown[0x8]; // 0x20 -public: - // MNetworkEnable - // MNetworkDisable - CScriptComponent* m_CScriptComponent; // 0x28 + EF_IS_INVALID_EHANDLE = 0x1, + EF_SPAWN_IN_PROGRESS = 0x2, + EF_IN_STAGING_LIST = 0x4, + EF_IN_POST_DATA_UPDATE = 0x8, + EF_DELETE_IN_PROGRESS = 0x10, + EF_IN_STASIS = 0x20, + EF_IS_ISOLATED_ALLOCATION_NETWORKABLE = 0x40, + EF_IS_DORMANT = 0x80, + EF_IS_PRE_SPAWN = 0x100, + EF_MARKED_FOR_DELETE = 0x200, + EF_IS_CONSTRUCTION_IN_PROGRESS = 0x400, + EF_IS_ISOLATED_ALLOCATION = 0x800, + EF_HAS_BEEN_UNSERIALIZED = 0x1000, + EF_IS_SUSPENDED = 0x2000, + EF_IS_ANONYMOUS_ALLOCATION = 0x4000, }; - // Size: 0x78 class CEntityIdentity { +public: + inline CEntityHandle GetRefEHandle() const + { + CEntityHandle handle = m_EHandle; + handle.m_Parts.m_Serial -= (m_flags & EF_IS_INVALID_EHANDLE); + + return handle; + } + public: CEntityInstance* m_pInstance; // 0x0 private: @@ -55,7 +66,7 @@ public: private: uint64 m_hPublicScope; // 0x28 - CEntityPublicScriptScope public: - uint32 m_flags; // 0x30 + EntityFlags_t m_flags; // 0x30 private: SpawnGroupHandle_t m_hSpawnGroup; // 0x34 public: diff --git a/public/entity2/entityinstance.h b/public/entity2/entityinstance.h new file mode 100644 index 00000000..7580a65b --- /dev/null +++ b/public/entity2/entityinstance.h @@ -0,0 +1,56 @@ +#ifndef ENTITYINSTANCE_H +#define ENTITYINSTANCE_H +#ifdef _WIN32 +#pragma once +#endif + +#include "tier1/utlsymbollarge.h" +#include "entitycomponent.h" +#include "entity2/entityidentity.h" + +class CEntityInstance +{ + virtual void Schema_DynamicBinding(void**) = 0; + +public: + virtual ~CEntityInstance() = 0; + + inline CEntityHandle GetRefEHandle() const + { + return m_pEntity->GetRefEHandle(); + } + + CUtlSymbolLarge m_iszPrivateVScripts; // 0x8 + CEntityIdentity* m_pEntity; // 0x10 +private: + void* m_hPrivateScope; // 0x18 - CEntityPrivateScriptScope + uint8 __pad001[0x8]; // 0x20 +public: + CScriptComponent* m_CScriptComponent; // 0x28 +}; + +// -------------------------------------------------------------------------------------------------- // +// CEntityInstance dependant functions +// -------------------------------------------------------------------------------------------------- // + +inline bool CEntityHandle::operator <( const CEntityInstance *pEntity ) const +{ + unsigned long otherIndex = (pEntity) ? pEntity->GetRefEHandle().m_Index : INVALID_EHANDLE_INDEX; + return m_Index < otherIndex; +} + +inline const CEntityHandle &CEntityHandle::Set( const CEntityInstance *pEntity ) +{ + if(pEntity) + { + *this = pEntity->GetRefEHandle(); + } + else + { + m_Index = INVALID_EHANDLE_INDEX; + } + + return *this; +} + +#endif // ENTITYINSTANCE_H diff --git a/public/entity2/entitysystem.h b/public/entity2/entitysystem.h index fec918b8..ab0b8478 100644 --- a/public/entity2/entitysystem.h +++ b/public/entity2/entitysystem.h @@ -5,9 +5,9 @@ #include "tier1/utlmemory.h" #include "tier1/utlvector.h" #include "tier1/utldict.h" -#include "entityhandle.h" -#include "baseentity.h" #include "eiface.h" +#include "baseentity.h" +#include "entityhandle.h" #include "concreteentitylist.h" #include "entitydatainstantiator.h" @@ -154,7 +154,7 @@ public: private: uint8 pad2696[0xa88]; -#ifdef PLATFORM_LINUX +#ifdef PLATFORM_POSIX uint8 pad5392[0x30]; #endif }; diff --git a/public/entityhandle.h b/public/entityhandle.h index 776237bd..7eaa0399 100644 --- a/public/entityhandle.h +++ b/public/entityhandle.h @@ -11,12 +11,14 @@ #endif #include "const.h" -#include "ihandleentity.h" +class CEntityInstance; class CEntityHandle { public: + friend class CEntityIdentity; + CEntityHandle(); CEntityHandle(const CEntityHandle& other); CEntityHandle(uint32 value); @@ -32,18 +34,18 @@ public: bool operator !=(const CEntityHandle& other) const; bool operator ==(const CEntityHandle& other) const; - bool operator ==(const IHandleEntity* pEnt) const; - bool operator !=(const IHandleEntity* pEnt) const; + bool operator ==(const CEntityInstance* pEnt) const; + bool operator !=(const CEntityInstance* pEnt) const; bool operator <(const CEntityHandle& other) const; - bool operator <(const IHandleEntity* pEnt) const; + bool operator <(const CEntityInstance* pEnt) const; // Assign a value to the handle. - const CEntityHandle& operator=(const IHandleEntity* pEntity); - const CEntityHandle& Set(const IHandleEntity* pEntity); + const CEntityHandle& operator=(const CEntityInstance* pEntity); + const CEntityHandle& Set(const CEntityInstance* pEntity); // Use this to dereference the handle. // Note: this is implemented in game code (ehandle.h) - IHandleEntity* Get() const; + CEntityInstance* Get() const; protected: union @@ -57,7 +59,6 @@ protected: }; }; - inline CEntityHandle::CEntityHandle() { m_Index = INVALID_EHANDLE_INDEX; @@ -119,12 +120,12 @@ inline bool CEntityHandle::operator ==(const CEntityHandle& other) const return m_Index == other.m_Index; } -inline bool CEntityHandle::operator ==(const IHandleEntity* pEnt) const +inline bool CEntityHandle::operator ==(const CEntityInstance* pEnt) const { return Get() == pEnt; } -inline bool CEntityHandle::operator !=(const IHandleEntity* pEnt) const +inline bool CEntityHandle::operator !=(const CEntityInstance* pEnt) const { return Get() != pEnt; } @@ -134,31 +135,11 @@ inline bool CEntityHandle::operator <(const CEntityHandle& other) const return m_Index < other.m_Index; } -inline bool CEntityHandle::operator <(const IHandleEntity* pEntity) const +inline const CEntityHandle &CEntityHandle::operator=( const CEntityInstance *pEntity ) { - unsigned long otherIndex = (pEntity) ? pEntity->GetRefEHandle().m_Index : INVALID_EHANDLE_INDEX; - return m_Index < otherIndex; + return Set( pEntity ); } -inline const CEntityHandle& CEntityHandle::operator=(const IHandleEntity* pEntity) -{ - return Set(pEntity); -} - -inline const CEntityHandle& CEntityHandle::Set(const IHandleEntity* pEntity) -{ - if (pEntity) - { - *this = pEntity->GetRefEHandle(); - } - else - { - m_Index = INVALID_EHANDLE_INDEX; - } - - return *this; -} +typedef CEntityHandle CBaseHandle; #endif // ENTITYHANDLE_H - -typedef CEntityHandle CBaseHandle; \ No newline at end of file diff --git a/public/gametrace.h b/public/gametrace.h index 3a27ecf7..2a6f6406 100644 --- a/public/gametrace.h +++ b/public/gametrace.h @@ -13,7 +13,6 @@ #include "cmodel.h" #include "tier1/utlvector.h" -#include "ihandleentity.h" #include "ispatialpartition.h" #if defined( CLIENT_DLL ) diff --git a/public/iclientunknown.h b/public/iclientunknown.h index f6926fdc..b66af9de 100644 --- a/public/iclientunknown.h +++ b/public/iclientunknown.h @@ -13,7 +13,7 @@ #include "tier0/platform.h" -#include "ihandleentity.h" +#include "entity2/entityinstance.h" class IClientNetworkable; class C_BaseEntity; @@ -28,7 +28,7 @@ class IClientAlphaProperty; // This is the client's version of IUnknown. We may want to use a QueryInterface-like // mechanism if this gets big. -abstract_class IClientUnknown : public IHandleEntity +abstract_class IClientUnknown : public CEntityInstance { public: virtual ICollideable* GetCollideable() = 0; diff --git a/public/igameevents.h b/public/igameevents.h index d8b9f741..cc1e48a8 100644 --- a/public/igameevents.h +++ b/public/igameevents.h @@ -20,7 +20,7 @@ #include "tier1/bitbuf.h" #include "tier1/generichash.h" #include "tier1/utlstring.h" -#include "ihandleentity.h" +#include "entity2/entityinstance.h" class CMsgSource1LegacyGameEvent; class CPlayerSlot; @@ -124,13 +124,13 @@ public: virtual CEntityHandle GetEHandle( const GameEventKeySymbol_t &keySymbol, CEntityHandle defaultValue = CEntityHandle() ) = 0; // Returns the entity instance, mostly used for _pawn keys, might return 0 if used on any other key (even on a controller). - virtual IHandleEntity *GetEntity( const GameEventKeySymbol_t &keySymbol, IHandleEntity *fallbackInstance = NULL ) = 0; + virtual CEntityInstance *GetEntity( const GameEventKeySymbol_t &keySymbol, CEntityInstance *fallbackInstance = NULL ) = 0; virtual CEntityIndex GetEntityIndex( const GameEventKeySymbol_t &keySymbol, CEntityIndex defaultValue = CEntityIndex( -1 ) ) = 0; virtual CPlayerSlot GetPlayerSlot( const GameEventKeySymbol_t &keySymbol ) = 0; - virtual IHandleEntity *GetPlayerController( const GameEventKeySymbol_t &keySymbol ) = 0; - virtual IHandleEntity *GetPlayerPawn( const GameEventKeySymbol_t &keySymbol ) = 0; + virtual CEntityInstance *GetPlayerController( const GameEventKeySymbol_t &keySymbol ) = 0; + virtual CEntityInstance *GetPlayerPawn( const GameEventKeySymbol_t &keySymbol ) = 0; // Returns the EHandle for the _pawn entity. virtual CEntityHandle GetPawnEHandle( const GameEventKeySymbol_t &keySymbol ) = 0; @@ -145,16 +145,16 @@ public: virtual void SetPtr( const GameEventKeySymbol_t &keySymbol, void *value ) = 0; virtual void SetEntity( const GameEventKeySymbol_t &keySymbol, CEntityIndex value ) = 0; - virtual void SetEntity( const GameEventKeySymbol_t &keySymbol, IHandleEntity *value ) = 0; + virtual void SetEntity( const GameEventKeySymbol_t &keySymbol, CEntityInstance *value ) = 0; // Also sets the _pawn key virtual void SetPlayer( const GameEventKeySymbol_t &keySymbol, CPlayerSlot value ) = 0; // Also sets the _pawn key (Expects pawn entity to be passed) - virtual void SetPlayer( const GameEventKeySymbol_t &keySymbol, IHandleEntity *pawn ) = 0; + virtual void SetPlayer( const GameEventKeySymbol_t &keySymbol, CEntityInstance *pawn ) = 0; // Expects pawn entity to be passed, will set the controller entity as a controllerKeyName // and pawn entity as a pawnKeyName. - virtual void SetPlayerRaw( const GameEventKeySymbol_t &controllerKeySymbol, const GameEventKeySymbol_t &pawnKeySymbol, IHandleEntity *pawn ) = 0; + virtual void SetPlayerRaw( const GameEventKeySymbol_t &controllerKeySymbol, const GameEventKeySymbol_t &pawnKeySymbol, CEntityInstance *pawn ) = 0; virtual bool HasKey( const GameEventKeySymbol_t &keySymbol ) = 0; diff --git a/public/ihandleentity.h b/public/ihandleentity.h deleted file mode 100644 index 38ad2425..00000000 --- a/public/ihandleentity.h +++ /dev/null @@ -1,25 +0,0 @@ -//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// -// -// Purpose: -// -//=============================================================================// - -#ifndef IHANDLEENTITY_H -#define IHANDLEENTITY_H -#ifdef _WIN32 -#pragma once -#endif - -class CEntityHandle; - -// An IHandleEntity-derived class can go into an entity list and use ehandles. -class IHandleEntity -{ - virtual void Schema_DynamicBinding(void**) = 0; -public: - virtual ~IHandleEntity() = 0; - virtual const CEntityHandle GetRefEHandle() const = 0; -}; - - -#endif // IHANDLEENTITY_H \ No newline at end of file diff --git a/public/iservernetworkable.h b/public/iservernetworkable.h index 2152da8d..8e83a54e 100644 --- a/public/iservernetworkable.h +++ b/public/iservernetworkable.h @@ -12,7 +12,7 @@ #endif -#include "ihandleentity.h" +#include "entity2/entityinstance.h" #include "basetypes.h" #include "bitvec.h" #include "const.h" @@ -88,7 +88,7 @@ class IServerNetworkable // These functions are handled automatically by the server_class macros and CBaseNetworkable. public: // Gets at the entity handle associated with the collideable - virtual IHandleEntity *GetEntityHandle() = 0; + virtual CEntityInstance *GetEntityHandle() = 0; // Tell the engine which class this object is. virtual ServerClass* GetServerClass() = 0; diff --git a/public/iserverunknown.h b/public/iserverunknown.h index 9d5c0757..ce4fd3ff 100644 --- a/public/iserverunknown.h +++ b/public/iserverunknown.h @@ -13,7 +13,7 @@ #endif -#include "ihandleentity.h" +#include "entity2/entityinstance.h" class ICollideable; class IServerNetworkable; @@ -22,7 +22,7 @@ class CBaseEntity; // This is the server's version of IUnknown. We may want to use a QueryInterface-like // mechanism if this gets big. -class IServerUnknown : public IHandleEntity +class IServerUnknown : public CEntityInstance { public: // Gets the interface to the collideable + networkable representation of the entity diff --git a/public/ispatialpartition.h b/public/ispatialpartition.h index c4adb042..f03594db 100644 --- a/public/ispatialpartition.h +++ b/public/ispatialpartition.h @@ -17,7 +17,7 @@ class Vector; struct Ray_t; -class IHandleEntity; +class CEntityInstance; #define INTERFACEVERSION_SPATIALPARTITION "SpatialPartition001" @@ -85,7 +85,7 @@ typedef int SpatialTempHandle_t; class IPartitionEnumerator { public: - virtual IterationRetval_t EnumElement( IHandleEntity *pHandleEntity ) = 0; + virtual IterationRetval_t EnumElement( CEntityInstance *pHandleEntity ) = 0; }; @@ -114,10 +114,10 @@ abstract_class ISpatialPartition public: // Create/destroy a handle for this dude in our system. Destroy // will also remove it from all lists it happens to be in - virtual SpatialPartitionHandle_t CreateHandle( IHandleEntity *pHandleEntity ) = 0; + virtual SpatialPartitionHandle_t CreateHandle( CEntityInstance *pHandleEntity ) = 0; // A fast method of creating a handle + inserting into the tree in the right place - virtual SpatialPartitionHandle_t CreateHandle( IHandleEntity *pHandleEntity, + virtual SpatialPartitionHandle_t CreateHandle( CEntityInstance *pHandleEntity, SpatialPartitionListMask_t listMask, const Vector& mins, const Vector& maxs ) = 0; virtual void DestroyHandle( SpatialPartitionHandle_t handle ) = 0; diff --git a/public/particles/particles.h b/public/particles/particles.h index b2b29641..ad406f77 100644 --- a/public/particles/particles.h +++ b/public/particles/particles.h @@ -315,7 +315,7 @@ public: virtual void GetLightingAtPoint( const Vector& vecOrigin, Color &tint ) = 0; virtual void TraceLine( const Vector& vecAbsStart, const Vector& vecAbsEnd, unsigned int mask, - const class IHandleEntity *ignore, + const class CEntityInstance *ignore, int collisionGroup, CBaseTrace *ptr ) = 0; diff --git a/public/toolframework/ienginetool.h b/public/toolframework/ienginetool.h index 9cdd2254..00c6c354 100644 --- a/public/toolframework/ienginetool.h +++ b/public/toolframework/ienginetool.h @@ -224,7 +224,7 @@ public: virtual void GetWorldToScreenMatrixForView( const CViewSetup &view, VMatrix *pVMatrix ) = 0; // Collision support - virtual SpatialPartitionHandle_t CreatePartitionHandle( IHandleEntity *pEntity, + virtual SpatialPartitionHandle_t CreatePartitionHandle( CEntityInstance *pEntity, SpatialPartitionListMask_t listMask, const Vector& mins, const Vector& maxs ) = 0; virtual void DestroyPartitionHandle( SpatialPartitionHandle_t hPartition ) = 0; virtual void InstallPartitionQueryCallback( IPartitionQueryCallback *pQuery ) = 0;