mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-19 20:16:10 +08:00
Add SpawnGroups & WorldRenderer related interfaces (#175)
Adds ISpawnGroup, ILoadingSpawnGroup, IGameSpawnGroupMgr, IWorld, IWorldReference & IWorldRendererMgr interfaces.
This commit is contained in:
365
game/shared/gamesystems/spawngroup_manager.h
Normal file
365
game/shared/gamesystems/spawngroup_manager.h
Normal file
@ -0,0 +1,365 @@
|
||||
#ifndef SPAWNGROUP_MANAGER_H
|
||||
#define SPAWNGROUP_MANAGER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "eiface.h"
|
||||
#include "iserver.h"
|
||||
#include "igamesystem.h"
|
||||
#include "entity2/entitysystem.h"
|
||||
#include "entity2/entityidentity.h"
|
||||
#include "mathlib/mathlib.h"
|
||||
#include "resourcefile/resourcetype.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier1/utlscratchmemory.h"
|
||||
#include "tier1/utlvector.h"
|
||||
|
||||
#define MAX_SPAWN_GROUP_WORLD_NAME_LENGTH 4096
|
||||
|
||||
class matrix3x4a_t;
|
||||
class CKeyValues3Context;
|
||||
class CEntityKeyValues;
|
||||
class ILoadingSpawnGroup;
|
||||
class CGameResourceManifest;
|
||||
class ISpawnGroupPrerequisiteRegistry;
|
||||
class IWorld;
|
||||
class IWorldReference;
|
||||
|
||||
abstract_class IGameResourceManifestLoadCompletionCallback
|
||||
{
|
||||
public:
|
||||
virtual void OnGameResourceManifestLoaded( HGameResourceManifest hManifest, int nResourceCount, ResourceHandle_t * pResourceHandles ) = 0;
|
||||
};
|
||||
|
||||
abstract_class IComputeWorldOriginCallback
|
||||
{
|
||||
public:
|
||||
virtual matrix3x4_t ComputeWorldOrigin( const char *pWorldName, SpawnGroupHandle_t hSpawnGroup, IWorld * pWorld ) = 0;
|
||||
};
|
||||
|
||||
typedef int *SaveRestoreDataHandle_t;
|
||||
|
||||
enum SpawnGroupState_t
|
||||
{
|
||||
SPAWN_GROUP_ALLOCATED = 0,
|
||||
SPAWN_GROUP_WORLD_LOADED = 1,
|
||||
SPAWN_GROUP_ENTITIES_ALLOCATED = 2,
|
||||
SPAWN_GROUP_GAMESYSTEMS_PRECACHE_START = 3,
|
||||
SPAWN_GROUP_GAMESYSTEMS_PRECACHE_END = 4,
|
||||
SPAWN_GROUP_ENTITY_PRECACHE_START = 5,
|
||||
SPAWN_GROUP_ENTITY_PRECACHE_END = 6,
|
||||
SPAWN_GROUP_READY_TO_SPAWN_ENTITIES = 7,
|
||||
SPAWN_GROUP_ENTITIES_SPAWNED = 8
|
||||
};
|
||||
|
||||
struct SpawnGroupDesc_t
|
||||
{
|
||||
public:
|
||||
SpawnGroupDesc_t()
|
||||
: m_pWorldOffsetCallback(NULL),
|
||||
m_hOwner(0),
|
||||
m_iPriorityLoader(-2),
|
||||
m_manifestLoadPriority(RESOURCE_MANIFEST_LOAD_PRIORITY_DEFAULT),
|
||||
m_flTimeoutInterval(0.0f),
|
||||
m_bCreateClientEntitiesOnLaterConnectingClients(false),
|
||||
m_bDontSpawnEntities(false),
|
||||
m_bBlockUntilLoaded(false),
|
||||
m_bLoadStreamingData(true),
|
||||
m_bCreateNewSceneWorld(false),
|
||||
m_bManualCompletion(false),
|
||||
m_bSetActivePostLoad(false),
|
||||
m_bUnk(true),
|
||||
m_bLevelTransition(false),
|
||||
m_bUnk2(false)
|
||||
{
|
||||
SetIdentityMatrix(m_vecWorldOffset);
|
||||
}
|
||||
|
||||
matrix3x4a_t m_vecWorldOffset;
|
||||
CUtlString m_sWorldName;
|
||||
CUtlString m_sWorldMountName;
|
||||
CUtlString m_sEntityLumpName;
|
||||
CUtlString m_sEntityFilterName;
|
||||
CUtlString m_sDescriptiveName;
|
||||
CUtlString m_sParentNameFixup;
|
||||
CUtlString m_sLocalNameFixup;
|
||||
IComputeWorldOriginCallback *m_pWorldOffsetCallback;
|
||||
CUtlString m_sWorldGroupname;
|
||||
SpawnGroupHandle_t m_hOwner;
|
||||
int m_iPriorityLoader;
|
||||
ResourceManifestLoadPriority_t m_manifestLoadPriority;
|
||||
float m_flTimeoutInterval;
|
||||
CUtlString m_sSaveFileName;
|
||||
|
||||
bool m_bCreateClientEntitiesOnLaterConnectingClients;
|
||||
bool m_bDontSpawnEntities;
|
||||
bool m_bBlockUntilLoaded;
|
||||
bool m_bLoadStreamingData;
|
||||
bool m_bCreateNewSceneWorld;
|
||||
bool m_bManualCompletion;
|
||||
bool m_bSetActivePostLoad;
|
||||
bool m_bUnk;
|
||||
bool m_bLevelTransition;
|
||||
bool m_bUnk2;
|
||||
};
|
||||
|
||||
struct SpawnGroupDescReceive_t
|
||||
{
|
||||
public:
|
||||
bool m_bIsInitialSpawnGroup;
|
||||
bool m_bCreateClientOnlyEntities;
|
||||
bool m_bIsSynchronousSpawn;
|
||||
|
||||
public:
|
||||
CCompressedResourceManifest *m_pCompressedResource;
|
||||
|
||||
public:
|
||||
int32 m_nTickCount;
|
||||
bool m_bManifestInComplete;
|
||||
|
||||
public:
|
||||
SpawnGroupHandle_t m_hSpawnGroupParentHandle;
|
||||
WorldGroupId_t m_hWorldGroupId;
|
||||
};
|
||||
|
||||
enum SpawnGroupFlags_t
|
||||
{
|
||||
SPAWN_GROUP_LOAD_ENTITIES_FROM_SAVE = 0x1,
|
||||
SPAWN_GROUP_DONT_SPAWN_ENTITIES = 0x2,
|
||||
SPAWN_GROUP_SYNCHRONOUS_SPAWN = 0x4,
|
||||
SPAWN_GROUP_IS_INITIAL_SPAWN_GROUP = 0x8,
|
||||
SPAWN_GROUP_CREATE_CLIENT_ONLY_ENTITIES = 0x10,
|
||||
SPAWN_GROUP_SAVE_ENTITIES = 0x20,
|
||||
SPAWN_GROUP_BLOCK_UNTIL_LOADED = 0x40,
|
||||
SPAWN_GROUP_LOAD_STREAMING_DATA = 0x80,
|
||||
SPAWN_GROUP_CREATE_NEW_SCENE_WORLD = 0x100,
|
||||
};
|
||||
|
||||
enum CreateSpawnGroupType_t
|
||||
{
|
||||
CREATE_SPAWN_GROUP_IMMEDIATELY = 0,
|
||||
CREATE_SPAWN_GROUP_ASYNCHRONOUSLY,
|
||||
CREATE_SPAWN_GROUP_ASYNCHRONOUSLY_CONFIRM_RESOURCES_LOADED,
|
||||
};
|
||||
|
||||
enum ESpawnGroupUnloadOption
|
||||
{
|
||||
kSGUO_None = 0,
|
||||
kSGUO_SaveEntities,
|
||||
kSGUO_MergedIntoOwner,
|
||||
};
|
||||
|
||||
abstract_class ISpawnGroup
|
||||
{
|
||||
public:
|
||||
virtual const char *GetWorldName() const = 0;
|
||||
virtual const char *GetEntityLumpName() const = 0;
|
||||
virtual const char *GetEntityFilterName() const = 0;
|
||||
virtual SpawnGroupHandle_t GetHandle() const = 0;
|
||||
virtual const matrix3x4a_t &GetWorldOffset() const = 0;
|
||||
virtual bool ShouldLoadEntitiesFromSave() const = 0;
|
||||
virtual const char *GetParentNameFixup() const = 0;
|
||||
virtual const char *GetLocalNameFixup() const = 0;
|
||||
virtual SpawnGroupHandle_t GetOwnerSpawnGroup() const = 0;
|
||||
virtual ILoadingSpawnGroup *GetLoadingSpawnGroup() const = 0;
|
||||
virtual void SetLoadingSpawnGroup(ILoadingSpawnGroup *pLoading) = 0;
|
||||
virtual IWorldReference *GetWorldReference() const = 0;
|
||||
virtual CUtlString Describe() const = 0;
|
||||
|
||||
public:
|
||||
virtual uint32 GetCreationTick() const = 0;
|
||||
virtual void RequestDeferredUnload(bool bAsync = true) = 0;
|
||||
virtual uint32 GetDestructionTick() const = 0;
|
||||
|
||||
public:
|
||||
virtual bool DontSpawnEntities() const = 0;
|
||||
virtual uint8 GetUnk2AndLastFlagBits() const = 0;
|
||||
virtual SpawnGroupHandle_t GetParentSpawnGroup() const = 0;
|
||||
virtual uint32 GetChildSpawnGroupCount() const = 0;
|
||||
virtual void GetSpawnGroupDesc(SpawnGroupDesc_t *pDesc) const = 0;
|
||||
|
||||
public:
|
||||
virtual void FlagManualCreation() = 0;
|
||||
virtual bool HasManualCreation() = 0;
|
||||
virtual void LoadAllGameResourceManifests(void *) = 0;
|
||||
virtual void AddSpawnGroupChild(SpawnGroupHandle_t hSpawnGroup) = 0;
|
||||
virtual bool HasSetActivePostLoad() const = 0;
|
||||
virtual bool HasUnk2() const = 0;
|
||||
virtual bool HasUnk() const = 0;
|
||||
virtual void UnkSetter(uint32 n) = 0;
|
||||
virtual bool HasLevelTransition() const = 0;
|
||||
virtual WorldGroupId_t GetWorldGroupId() const = 0;
|
||||
|
||||
virtual matrix3x4_t ComputeWorldOrigin(const char *pWorldName, SpawnGroupHandle_t hSpawnGroup, IWorld *pWorld) = 0;
|
||||
virtual void Release() = 0;
|
||||
virtual void OnGameResourceManifestLoaded(HGameResourceManifest hManifest, int nResourceCount, ResourceHandle_t *pResourceHandles) = 0;
|
||||
virtual void Init(IResourceManifestRegistry *pResourceManifest, IEntityPrecacheConfiguration *pConfig, ISpawnGroupPrerequisiteRegistry *pRegistry) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
virtual bool GetLoadStatus() = 0;
|
||||
virtual void ForceBlockingLoad() = 0;
|
||||
virtual bool ShouldBlockUntilLoaded() const = 0;
|
||||
virtual void ServiceBlockingLoads() = 0;
|
||||
virtual bool GetEntityPrerequisites(HGameResourceManifest hManifest) = 0;
|
||||
virtual bool EntityPrerequisitesSatisfied() = 0;
|
||||
|
||||
public:
|
||||
virtual bool LoadEntities() = 0;
|
||||
virtual void SaveRestoreMap(ILoadingSpawnGroup *pLoading, SpawnGroupHandle_t hSpawnGroup, const matrix3x4a_t &vecSpawnOffset) = 0;
|
||||
virtual void SaveRestoreMap2(ILoadingSpawnGroup *pLoading, SpawnGroupHandle_t hSpawnGroup, const matrix3x4a_t &vecSpawnOffset) = 0;
|
||||
virtual void SetParentSpawnGroupForChild(SpawnGroupHandle_t hSpawnGroup) = 0;
|
||||
|
||||
public:
|
||||
virtual void TransferOwnershipOfManifestsTo(ISpawnGroup *pTarget) = 0;
|
||||
|
||||
public:
|
||||
virtual IGameSpawnGroupMgr *GetSpawnGroupMgr() const = 0;
|
||||
};
|
||||
|
||||
class CMapSpawnGroup
|
||||
{
|
||||
public:
|
||||
const char *GetWorldName() const
|
||||
{
|
||||
return m_pSpawnGroup->GetWorldName();
|
||||
}
|
||||
|
||||
const char *GetEntityLumpName() const
|
||||
{
|
||||
return m_pSpawnGroup->GetEntityLumpName();
|
||||
}
|
||||
|
||||
const char *GetEntityFilterName() const
|
||||
{
|
||||
return m_pSpawnGroup->GetEntityFilterName();
|
||||
}
|
||||
|
||||
SpawnGroupHandle_t GetSpawnGroupHandle() const
|
||||
{
|
||||
return m_pSpawnGroup->GetHandle();
|
||||
}
|
||||
|
||||
const matrix3x4a_t &GetWorldOffset() const
|
||||
{
|
||||
return m_pSpawnGroup->GetWorldOffset();
|
||||
}
|
||||
|
||||
const char *GetParentNameFixup() const
|
||||
{
|
||||
return m_pSpawnGroup->GetParentNameFixup();
|
||||
}
|
||||
|
||||
const char *GetLocalNameFixup() const
|
||||
{
|
||||
return m_pSpawnGroup->GetLocalNameFixup();
|
||||
}
|
||||
|
||||
SpawnGroupHandle_t GetOwnerSpawnGroup() const
|
||||
{
|
||||
return m_pSpawnGroup->GetOwnerSpawnGroup();
|
||||
}
|
||||
|
||||
ILoadingSpawnGroup *GetLoadingSpawnGroup() const
|
||||
{
|
||||
return m_pSpawnGroup->GetLoadingSpawnGroup();
|
||||
}
|
||||
|
||||
void SetLoadingSpawnGroup(ILoadingSpawnGroup *pLoading)
|
||||
{
|
||||
m_pSpawnGroup->SetLoadingSpawnGroup(pLoading);
|
||||
}
|
||||
|
||||
int GetCreationTick() const
|
||||
{
|
||||
return m_pSpawnGroup->GetCreationTick();
|
||||
}
|
||||
|
||||
bool DontSpawnEntities() const
|
||||
{
|
||||
return m_pSpawnGroup->DontSpawnEntities();
|
||||
}
|
||||
|
||||
void GetSpawnGroupDesc(SpawnGroupDesc_t *pDesc) const
|
||||
{
|
||||
m_pSpawnGroup->GetSpawnGroupDesc(pDesc);
|
||||
}
|
||||
|
||||
public:
|
||||
ISpawnGroup *GetSpawnGroup() const
|
||||
{
|
||||
return m_pSpawnGroup;
|
||||
}
|
||||
|
||||
private:
|
||||
ISpawnGroup *m_pSpawnGroup;
|
||||
bool m_bSpawnGroupPrecacheDispatched;
|
||||
bool m_bSpawnGroupLoadDispatched;
|
||||
IPVS *m_pPVS;
|
||||
// CUtlVector<SpawnGroupConnectionInfo_t> m_Connections;
|
||||
};
|
||||
|
||||
abstract_class ILoadingSpawnGroup
|
||||
{
|
||||
public:
|
||||
virtual int EntityCount() const = 0;
|
||||
virtual const EntitySpawnInfo_t *GetEntities() const = 0;
|
||||
virtual bool ShouldLoadEntitiesFromSave() const = 0;
|
||||
virtual const CUtlBuffer *GetSaveRestoreFileData() const = 0;
|
||||
virtual void SetLevelTransitionPreviousMap(const char *pLevelTransitionMap, const char *pLandmarkName) = 0;
|
||||
virtual bool IsLevelTransition() const = 0;
|
||||
virtual const char *GetLevelTransitionPreviousMap() const = 0;
|
||||
virtual const char *GetLevelTransitionLandmarkName() const = 0;
|
||||
virtual CKeyValues3Context *GetEntityKeyValuesAllocator() = 0;
|
||||
virtual CEntityInstance *CreateEntityToSpawn(SpawnGroupHandle_t hSpawnGroup, const matrix3x4a_t &vecSpawnOffset, CreateSpawnGroupType_t createType, const CEntityKeyValues *pEntityKeyValues) = 0;
|
||||
virtual void SpawnEntities() = 0;
|
||||
virtual void Release() = 0;
|
||||
};
|
||||
|
||||
abstract_class IGameSpawnGroupMgr
|
||||
{
|
||||
public:
|
||||
virtual void AllocateSpawnGroup(SpawnGroupHandle_t h, ISpawnGroup *pSpawnGroup) = 0;
|
||||
virtual void ReleaseSpawnGroup(SpawnGroupHandle_t h) = 0;
|
||||
virtual void SpawnGroupInit(SpawnGroupHandle_t handle, IEntityResourceManifest *pManifest, IEntityPrecacheConfiguration *pConfig, ISpawnGroupPrerequisiteRegistry *pRegistry) = 0;
|
||||
virtual ILoadingSpawnGroup *CreateLoadingSpawnGroup(SpawnGroupHandle_t handle, bool bSynchronouslySpawnEntities, bool bConfirmResourcesLoaded, const CUtlVector<const CEntityKeyValues *> *pKeyValues) = 0;
|
||||
virtual ILoadingSpawnGroup *CreateLoadingSpawnGroupForSaveFile(SpawnGroupHandle_t handle, const void *pSaveData, size_t nSaveDataSize) = 0;
|
||||
virtual void SpawnGroupSpawnEntities(SpawnGroupHandle_t handle) = 0;
|
||||
virtual void SpawnGroupShutdown(SpawnGroupHandle_t handle) = 0;
|
||||
virtual void SetActiveSpawnGroup(SpawnGroupHandle_t handle) = 0;
|
||||
virtual void UnloadSpawnGroup(SpawnGroupHandle_t hSpawnGroup, bool bSaveEntities) = 0;
|
||||
virtual SpawnGroupHandle_t GetParentSpawnGroup(SpawnGroupHandle_t hSpawnGroup) = 0;
|
||||
virtual int GetChildSpawnGroupCount(SpawnGroupHandle_t handle) = 0;
|
||||
virtual SaveRestoreDataHandle_t SaveGame_Start(const char *pSaveName, const char *pOldLevel, const char *pszLandmarkName) = 0;
|
||||
virtual bool SaveGame_Finalize(SaveRestoreDataHandle_t hSaveRestore) = 0;
|
||||
virtual bool FrameUpdatePostEntityThink(const EventServerPostEntityThink_t &msg) = 0;
|
||||
virtual const char *SaveGame_GetLastSaveFile(SaveRestoreDataHandle_t hSaveRestore) = 0;
|
||||
virtual bool IsGameReadyToSave() = 0;
|
||||
virtual unsigned long UnkGetGlobal1() = 0;
|
||||
virtual void * const UnkGetGameEntitySystemSync1() = 0;
|
||||
virtual void UnkRelease1() = 0;
|
||||
virtual void UnkRelease2() = 0;
|
||||
|
||||
// AMNOTE: Game System related methods
|
||||
virtual void YouForgot_DECLARE_GAME_SYSTEM_InYourClassDefinition() = 0;
|
||||
virtual void UnkSpawnGroupManagerGameSystemMember1() = 0;
|
||||
virtual void GameInit(const EventGameInit_t &msg) = 0;
|
||||
virtual void GameShutdown(const EventGameInit_t &msg) = 0;
|
||||
virtual void FrameBoundary(const EventGameInit_t &msg) = 0;
|
||||
virtual void PreSpawnGroupLoad(const EventPreSpawnGroupLoad_t &msg) = 0;
|
||||
virtual ~IGameSpawnGroupMgr() {}
|
||||
};
|
||||
|
||||
// AMNOTE: Short stubs representing game class hierarchy
|
||||
class CBaseSpawnGroup : public ISpawnGroup, public IComputeWorldOriginCallback, public IGameResourceManifestLoadCompletionCallback
|
||||
{
|
||||
};
|
||||
|
||||
class CLoadingSpawnGroup : public ILoadingSpawnGroup
|
||||
{
|
||||
};
|
||||
|
||||
class CSpawnGroupMgrGameSystem : public IGameSpawnGroupMgr, public IGameSystem
|
||||
{
|
||||
};
|
||||
|
||||
#endif // SPAWNGROUP_MANAGER_H
|
@ -90,6 +90,11 @@ public:
|
||||
return m_EHandle.GetEntryIndex();
|
||||
}
|
||||
|
||||
inline SpawnGroupHandle_t GetSpawnGroup() const
|
||||
{
|
||||
return m_hSpawnGroup;
|
||||
}
|
||||
|
||||
bool NameMatches( const char* pszNameOrWildcard ) const;
|
||||
bool ClassMatches( const char* pszClassOrWildcard ) const;
|
||||
|
||||
|
@ -17,11 +17,13 @@
|
||||
#include "networksystem/inetworkserializer.h"
|
||||
#include "vscript/ivscript.h"
|
||||
#include "eiface.h"
|
||||
#include "resourcefile/resourcetype.h"
|
||||
#include "baseentity.h"
|
||||
#include "entityhandle.h"
|
||||
#include "concreteentitylist.h"
|
||||
#include "entitydatainstantiator.h"
|
||||
|
||||
class CKeyValues3Context;
|
||||
class CEntityClass;
|
||||
class CEntityComponentHelper;
|
||||
class CEntityKeyValues;
|
||||
@ -160,36 +162,6 @@ struct CEntityPrecacheContext
|
||||
IEntityResourceManifest* m_pManifest;
|
||||
};
|
||||
|
||||
// Resource data //
|
||||
|
||||
struct ResourceNameInfo_t
|
||||
{
|
||||
CUtlSymbolLarge m_ResourceNameSymbol;
|
||||
};
|
||||
|
||||
typedef const ResourceNameInfo_t *ResourceNameHandle_t;
|
||||
|
||||
typedef uint16 LoadingResourceIndex_t;
|
||||
|
||||
typedef char ResourceTypeIndex_t;
|
||||
|
||||
typedef uint32 ExtRefIndex_t;
|
||||
|
||||
struct ResourceBindingBase_t
|
||||
{
|
||||
void* m_pData;
|
||||
ResourceNameHandle_t m_Name;
|
||||
uint16 m_nFlags;
|
||||
uint16 m_nReloadCounter;
|
||||
ResourceTypeIndex_t m_nTypeIndex;
|
||||
uint8 m_nPadding;
|
||||
LoadingResourceIndex_t m_nLoadingResource;
|
||||
CInterlockedInt m_nRefCount;
|
||||
ExtRefIndex_t m_nExtRefHandle;
|
||||
};
|
||||
|
||||
typedef const ResourceBindingBase_t* ResourceHandle_t;
|
||||
|
||||
struct SecondaryPrecacheMemberCallback_t
|
||||
{
|
||||
void (CEntityInstance::*pfnPrecache)(ResourceHandle_t hResource, const CEntityPrecacheContext* pContext);
|
||||
@ -222,10 +194,10 @@ abstract_class IEntityResourceManifestBuilder
|
||||
public:
|
||||
virtual void BuildResourceManifest(SpawnGroupHandle_t hSpawnGroup, int nCount, const EntitySpawnInfo_t *pEntities, const matrix3x4a_t *vWorldOffset, IEntityPrecacheConfiguration* pConfig, IEntityResourceManifest* pResourceManifest) = 0;
|
||||
virtual void BuildResourceManifest(SpawnGroupHandle_t hSpawnGroup, int iCount, const CEntityKeyValues *pKeyValues, IEntityPrecacheConfiguration* pConfig, IEntityResourceManifest* pResourceManifest) = 0;
|
||||
virtual void BuildResourceManifest(SpawnGroupHandle_t hSpawnGroup, const CUtlVector<const CEntityKeyValues*>* pEntityKeyValues, const char* pFilterName, IEntityPrecacheConfiguration* pConfig, IEntityResourceManifest* pResourceManifest) = 0;
|
||||
virtual void BuildResourceManifest(SpawnGroupHandle_t hSpawnGroup, const CUtlVector<const CEntityKeyValues*>* pEntityKeyValues, const char* pFilterName /* Usually, "mapload" and "cs_respawn"/"respawn". See CSpawnGroupEntityFilterRegistrar ctors */, IEntityPrecacheConfiguration* pConfig, IEntityResourceManifest* pResourceManifest) = 0;
|
||||
virtual void BuildResourceManifest(const char* pManifestNameOrGroupName, IEntityPrecacheConfiguration* pConfig, IEntityResourceManifest* pResourceManifest) = 0;
|
||||
virtual void BuildResourceManifest(EntityResourceManifestCreationCallback_t callback, void* pContext, IEntityPrecacheConfiguration* pConfig, IEntityResourceManifest* pResourceManifest) = 0;
|
||||
virtual void BuildResourceManifestForEntity(const char* pEntityDesignerName, IEntityPrecacheConfiguration* pConfig, IEntityResourceManifest* pResourceManifest, CUtlScratchMemoryPool* pKeyValuesMemoryPool) = 0;
|
||||
virtual void BuildResourceManifestForEntity(const char* pEntityDesignerName, IEntityPrecacheConfiguration* pConfig, IEntityResourceManifest* pResourceManifest, CKeyValues3Context* pEntityAllocator) = 0;
|
||||
virtual void InvokePrecacheCallback(ResourceHandle_t hResource, const EntitySpawnInfo_t* info, IEntityPrecacheConfiguration* pConfig, IEntityResourceManifest* pResourceManifest, SecondaryPrecacheMemberCallback_t callback) = 0;
|
||||
virtual void AddRefKeyValues(const CEntityKeyValues* pKeyValues) = 0;
|
||||
virtual void ReleaseKeyValues(const CEntityKeyValues* pKeyValues) = 0;
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include <inetmsghandler.h>
|
||||
#include <edict.h>
|
||||
#include <resourcefile/resourcetype.h>
|
||||
#include <tier1/checksum_crc.h>
|
||||
#include <engine/IEngineService.h>
|
||||
|
||||
@ -28,19 +29,12 @@ class ISource2WorldSession;
|
||||
class INetworkGameClient;
|
||||
class GameSessionConfiguration_t;
|
||||
|
||||
typedef int HGameResourceManifest;
|
||||
|
||||
enum ESpawnGroupUnloadOption
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
abstract_class INetworkGameServer : public IConnectionlessPacketHandler
|
||||
{
|
||||
public:
|
||||
virtual void Init( const GameSessionConfiguration_t &, const char * ) = 0;
|
||||
virtual void SetGameSpawnGroupMgr( IGameSpawnGroupMgr * ) = 0;
|
||||
virtual void SetGameSessionManifest( HGameResourceManifest * ) = 0;
|
||||
virtual void SetGameSessionManifest( HGameResourceManifest ) = 0;
|
||||
virtual void RegisterLoadingSpawnGroups( CUtlVector<unsigned int> & ) = 0;
|
||||
virtual void Shutdown( void ) = 0;
|
||||
virtual void AddRef( void ) = 0;
|
||||
@ -58,7 +52,7 @@ public:
|
||||
virtual void ServerSimulate( const EventServerSimulate_t & ) = 0;
|
||||
virtual void ServerPostSimulate( const EventServerPostSimulate_t & ) = 0;
|
||||
virtual void LoadSpawnGroup( const SpawnGroupDesc_t & ) = 0;
|
||||
virtual void AsyncUnloadSpawnGroup( unsigned int, ESpawnGroupUnloadOption ) = 0;
|
||||
virtual void AsyncUnloadSpawnGroup( unsigned int, /*ESpawnGroupUnloadOption*/ int ) = 0;
|
||||
virtual void PrintSpawnGroupStatus( void ) const = 0;
|
||||
virtual float GetTimescale( void ) const = 0; // returns the game time scale (multiplied in conjunction with host_timescale)
|
||||
virtual bool IsSaveRestoreAllowed( void ) const = 0;
|
||||
@ -67,7 +61,6 @@ public:
|
||||
virtual const char *GetAddonName( void ) const = 0;
|
||||
virtual bool IsBackgroundMap( void ) const = 0;
|
||||
virtual float GetTime( void ) const = 0; // returns game world time
|
||||
virtual int GetMapVersion( void ) const = 0;
|
||||
virtual void ActivateServer( void ) = 0;
|
||||
virtual void PrepareForAssetLoad( void ) = 0;
|
||||
virtual int GetServerNetworkAddress( void ) = 0;
|
||||
@ -76,7 +69,7 @@ public:
|
||||
virtual void SynchronouslySpawnGroup( SpawnGroupHandle_t ) = 0;
|
||||
virtual void SetServerState( server_state_t ) = 0;
|
||||
virtual void SpawnServer( const char * ) = 0;
|
||||
virtual void GetSpawnGroupLoadingStatus( SpawnGroupHandle_t ) = 0;
|
||||
virtual int GetSpawnGroupLoadingStatus( SpawnGroupHandle_t ) = 0;
|
||||
virtual void SetSpawnGroupDescription( SpawnGroupHandle_t, const char * ) = 0;
|
||||
virtual CUtlVector<INetworkGameClient *> *StartChangeLevel( const char *, const char *pszLandmark, void * ) = 0;
|
||||
virtual void FinishChangeLevel( CServerChangelevelState * ) = 0;
|
||||
|
77
public/resourcefile/resourcetype.h
Normal file
77
public/resourcefile/resourcetype.h
Normal file
@ -0,0 +1,77 @@
|
||||
#ifndef RESOURCETYPE_H
|
||||
#define RESOURCETYPE_H
|
||||
|
||||
#ifdef COMPILER_MSVC
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <tier0/platform.h>
|
||||
#include <tier0/threadtools.h>
|
||||
#include <tier1/utlsymbollarge.h>
|
||||
|
||||
enum ResourceStatus_t
|
||||
{
|
||||
RESOURCE_STATUS_UNKNOWN = 0,
|
||||
RESOURCE_STATUS_KNOWN_BUT_NOT_RESIDENT,
|
||||
RESOURCE_STATUS_PARTIALLY_RESIDENT,
|
||||
RESOURCE_STATUS_RESIDENT,
|
||||
};
|
||||
|
||||
enum ResourceManifestLoadBehavior_t
|
||||
{
|
||||
RESOURCE_MANIFEST_LOAD_DEFAULT = -1,
|
||||
RESOURCE_MANIFEST_LOAD_STREAMING_DATA = 0,
|
||||
RESOURCE_MANIFEST_INITIALLY_USE_FALLBACKS,
|
||||
};
|
||||
|
||||
enum ResourceManifestLoadPriority_t
|
||||
{
|
||||
RESOURCE_MANIFEST_LOAD_PRIORITY_DEFAULT = -1,
|
||||
RESOURCE_MANIFEST_LOAD_PRIORITY_LOW = 0,
|
||||
RESOURCE_MANIFEST_LOAD_PRIORITY_MEDIUM,
|
||||
RESOURCE_MANIFEST_LOAD_PRIORITY_HIGH,
|
||||
RESOURCE_MANIFEST_LOAD_PRIORITY_IMMEDIATE,
|
||||
|
||||
RESOURCE_MANIFEST_LOAD_PRIORITY_COUNT,
|
||||
};
|
||||
|
||||
enum ResourceBindingFlags_t
|
||||
{
|
||||
RESOURCE_BINDING_LOADED = 0x1,
|
||||
RESOURCE_BINDING_ERROR = 0x2,
|
||||
RESOURCE_BINDING_UNLOADABLE = 0x4,
|
||||
RESOURCE_BINDING_PROCEDURAL = 0x8,
|
||||
RESOURCE_BINDING_TRACKLEAKS = 0x20,
|
||||
RESOURCE_BINDING_IS_ERROR_BINDING_FOR_TYPE = 0x40,
|
||||
RESOURCE_BINDING_HAS_EVER_BEEN_LOADED = 0x80,
|
||||
RESOURCE_BINDING_ANONYMOUS = 0x100,
|
||||
|
||||
RESOURCE_BINDING_FIRST_UNUSED_FLAG = 0x200
|
||||
};
|
||||
|
||||
struct ResourceNameInfo_t
|
||||
{
|
||||
CUtlSymbolLarge m_ResourceNameSymbol;
|
||||
};
|
||||
|
||||
typedef const ResourceNameInfo_t *ResourceNameHandle_t;
|
||||
typedef uint16 LoadingResourceIndex_t;
|
||||
typedef char ResourceTypeIndex_t;
|
||||
typedef uint32 ExtRefIndex_t;
|
||||
|
||||
struct ResourceBindingBase_t
|
||||
{
|
||||
void* m_pData;
|
||||
ResourceNameHandle_t m_Name;
|
||||
uint16 m_nFlags;
|
||||
uint16 m_nReloadCounter;
|
||||
ResourceTypeIndex_t m_nTypeIndex;
|
||||
LoadingResourceIndex_t m_nLoadingResource;
|
||||
CInterlockedInt m_nRefCount;
|
||||
ExtRefIndex_t m_nExtRefHandle;
|
||||
};
|
||||
|
||||
typedef const ResourceBindingBase_t* ResourceHandle_t;
|
||||
typedef void* HGameResourceManifest;
|
||||
|
||||
#endif // RESOURCETYPE_H
|
@ -15,13 +15,10 @@
|
||||
#include "entityhandle.h"
|
||||
#include "tier1/bufferstring.h"
|
||||
#include "tier1/utlscratchmemory.h"
|
||||
#include "resourcefile/resourcetype.h"
|
||||
|
||||
FORWARD_DECLARE_HANDLE( HSCRIPT );
|
||||
|
||||
// Non-implemented classes/structs
|
||||
struct ResourceBindingBase_t;
|
||||
typedef const ResourceBindingBase_t *ResourceHandle_t;
|
||||
|
||||
// ========
|
||||
|
||||
class CVariantDefaultAllocator
|
||||
|
58
public/worldrenderer/iworld.h
Normal file
58
public/worldrenderer/iworld.h
Normal file
@ -0,0 +1,58 @@
|
||||
#ifndef IWORLD_H
|
||||
#define IWORLD_H
|
||||
|
||||
#ifdef COMPILER_MSVC
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "worldschema.h"
|
||||
|
||||
#include <tier0/platform.h>
|
||||
#include <tier1/utlvector.h>
|
||||
#include <mathlib/camera.h>
|
||||
|
||||
class ISceneWorld;
|
||||
class Vector;
|
||||
class CEntityKeyValues;
|
||||
|
||||
abstract_class IWorld
|
||||
{
|
||||
public:
|
||||
// Loading
|
||||
virtual void Init( ISceneWorld *pScene, bool b, int n ) = 0;
|
||||
virtual void CreateAndDispatchLoadRequests( const Vector &vEye, int n ) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
// Reflection
|
||||
virtual int GetNumNodes() const = 0;
|
||||
virtual const WorldBuilderParams_t *GetBuilderParams() const = 0;
|
||||
virtual bool IsAncestor( int nNodeInQuestion, int nPotentialAncestor ) const = 0;
|
||||
virtual const NodeData_t *GetNodeData( int n ) = 0;
|
||||
virtual AABB_t GetNodeBounds( int n ) const = 0;
|
||||
virtual float GetNodeMinDistance( int n ) const = 0;
|
||||
|
||||
// Transform
|
||||
virtual void SetWorldTransform( const matrix3x4_t &mat ) = 0;
|
||||
virtual const matrix3x4_t &GetWorldTransform() const = 0;
|
||||
|
||||
// Sun
|
||||
virtual void SetLoadSun( bool bEnable ) = 0;
|
||||
virtual bool GetLoadSun() const = 0;
|
||||
|
||||
// Players
|
||||
virtual bool IsFullyLoadedForPlayer( WorldGroupId_t hWorldGroupId, CSplitScreenSlot nSlot ) const = 0;
|
||||
virtual void ClearOutstandingLoadRequests() = 0;
|
||||
|
||||
// Precache
|
||||
virtual void PrecacheAllWorldNodes( WorldNodeFlags_t flags, int iCacheNodes = 1, bool bDoNotDeleteManifest = false ) = 0;
|
||||
|
||||
// Entities and lighting
|
||||
virtual const CUtlVector< const CEntityKeyValues * > *GetEntityList( const char *pSearchLump = NULL ) const = 0; // Can be return NULL value.
|
||||
virtual void FindEntitiesByTargetname( const char *pTargetname, const char *pSearchLump, CUtlVector< const CEntityKeyValues * > &res ) const = 0;
|
||||
virtual bool HasLightmaps() const = 0;
|
||||
virtual bool HasBakedLighting() const = 0;
|
||||
virtual const BakedLightingInfo_t *GetBakedLightingInfo() const = 0;
|
||||
virtual void FindEntitiesByClassname( const char *pClassname, const char *pSearchLump, CUtlVector< const CEntityKeyValues * > &res ) const = 0;
|
||||
};
|
||||
|
||||
#endif // IWORLD_H
|
35
public/worldrenderer/iworldreference.h
Normal file
35
public/worldrenderer/iworldreference.h
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef IWORLDREFERENCE_H
|
||||
#define IWORLDREFERENCE_H
|
||||
|
||||
#ifdef COMPILER_MSVC
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "worldschema.h"
|
||||
|
||||
#include <tier0/platform.h>
|
||||
|
||||
class ISceneWorld;
|
||||
class Vector;
|
||||
|
||||
abstract_class IWorldReference
|
||||
{
|
||||
public:
|
||||
virtual uint32 AddRef() = 0;
|
||||
virtual uint32 Release() = 0;
|
||||
virtual bool IsWorldLoaded() const = 0;
|
||||
virtual bool IsErrorWorld() const = 0;
|
||||
virtual bool IsMarkedForDeletion() const = 0;
|
||||
virtual SpawnGroupHandle_t GetSpawnGroupHandle() const = 0;
|
||||
virtual bool GetWorldBounds( Vector &vecMins, Vector &vecMaxs ) const = 0;
|
||||
virtual void ClearComputeWorldOriginCallback() = 0;
|
||||
virtual bool HasWorldGeometry() const = 0;
|
||||
virtual void ForceBlockingLoad() = 0;
|
||||
virtual ISceneWorld *GetSceneWorld() const = 0;
|
||||
virtual WorldGroupId_t GetWorldGroupId() const = 0;
|
||||
virtual bool SetLayerVisiblity( const char *pLayerName, bool bVisible ) = 0;
|
||||
virtual void PrecacheAllWorldNodes( WorldNodeFlags_t flags, bool bDoNotDeleteManifest = false ) = 0;
|
||||
virtual bool GetCompileData( uint64 &nTimestamp, uint64 &nFingerprint ) const = 0;
|
||||
};
|
||||
|
||||
#endif // IWORLDREFERENCE_H
|
72
public/worldrenderer/iworldrenderermgr.h
Normal file
72
public/worldrenderer/iworldrenderermgr.h
Normal file
@ -0,0 +1,72 @@
|
||||
#ifndef IWORLDRENDERERMGR_H
|
||||
#define IWORLDRENDERERMGR_H
|
||||
|
||||
#ifdef COMPILER_MSVC
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "worldschema.h"
|
||||
|
||||
#include <appframework/IAppSystem.h>
|
||||
#include <tier0/platform.h>
|
||||
|
||||
struct CreateWorldInfo_t;
|
||||
class CThreadRWLock;
|
||||
class IWorldReference;
|
||||
class CWorldVisibility;
|
||||
class IWorldVPKOverrideManager;
|
||||
|
||||
abstract_class IWorldLoadUnloadCallback
|
||||
{
|
||||
public:
|
||||
virtual void OnWorldCreate( const char *pWorldName, IWorldReference *pWorldRef ) = 0;
|
||||
virtual void OnWorldDestroy( const char *pWorldName, IWorldReference *pWorldRef ) = 0;
|
||||
};
|
||||
|
||||
abstract_class IWorldRendererMgr : public IAppSystem
|
||||
{
|
||||
public:
|
||||
virtual IWorldReference *CreateWorld( CreateWorldInfo_t &info ) = 0;
|
||||
virtual IWorldReference *GetWorldReference( int iIndex ) const = 0;
|
||||
virtual IWorldReference *FindWorldReferenceAndAddRef( SpawnGroupHandle_t hSpawnGroup ) = 0;
|
||||
virtual uint32 GetWorldCount( CThreadRWLock *lock = NULL ) = 0;
|
||||
virtual uint32 GetPendingWorldCount() = 0;
|
||||
virtual const char *GetWorldName( int iIndex ) const = 0;
|
||||
virtual IWorld *GetGeometryWorld( int iIndex ) = 0;
|
||||
virtual IWorld *GetGeomentryFromReference( IWorldReference *pWorldRef ) const = 0;
|
||||
virtual CWorldVisibility *GetWorldVisibility( int iIndex ) const = 0;
|
||||
|
||||
// World group id
|
||||
virtual int FindLoadedWorldIndex( WorldGroupId_t hWorldGroupId, const char *pWorldName, CThreadRWLock *lock = NULL ) const = 0;
|
||||
virtual void UpdateObjectsForRendering( WorldGroupId_t hWorldGroupId, int nSkipFlags, const Vector &vCameraPos, float flLODScale, float flFarPlane, float flElapsedTime = 0.0f, const Vector *pCameraPos2 = NULL ) = 0;
|
||||
virtual bool IsFullyLoadedForPlayer( WorldGroupId_t hWorldGroupId, CSplitScreenSlot nSlot ) const = 0;
|
||||
virtual bool GetBoundsForWorld( WorldGroupId_t hWorldGroupId, Vector &vecMins, Vector &vecMaxs ) const = 0;
|
||||
virtual void UnkPutUtlContainer( WorldGroupId_t hWorldGroupId, void * ) = 0;
|
||||
virtual void FindEntitiesByTargetname( WorldGroupId_t hWorldGroupId, const char *pTargetname, const char *pSearchLump, CUtlVector< const CEntityKeyValues * > &res ) const = 0;
|
||||
|
||||
// World reference
|
||||
virtual const CUtlVector< const CEntityKeyValues * > *GetEntityList( IWorldReference *pWorldRef, const char *pSearchLump = NULL ) const = 0;
|
||||
virtual bool LoadEntityLump( IWorldReference *pWorldRef, const char *pLumpName ) = 0;
|
||||
virtual bool IsEntityLumpLoaded( IWorldReference *pWorldRef, const char *pLumpName ) const = 0;
|
||||
virtual void UnloadEntityLump( IWorldReference *pWorldRef, const char *pLumpName ) = 0;
|
||||
|
||||
virtual void UnkMarkGeometryWorld( int nCompareFlags, SpawnGroupHandle_t h ) = 0;
|
||||
virtual void ServiceWorldRequests() = 0;
|
||||
virtual IWorld *FindWorld( WorldGroupId_t hWorldGroupId, const char *pWorldName ) = 0;
|
||||
|
||||
// Load/Unload callback
|
||||
virtual void AddWorldLoadHandler( IWorldLoadUnloadCallback *pCallback ) = 0;
|
||||
virtual void RemoveWorldLoadHandler( IWorldLoadUnloadCallback *pCallback ) = 0;
|
||||
|
||||
virtual int GetDeletedWorldCount() = 0;
|
||||
|
||||
// VPK manager
|
||||
virtual void InstallWorldVPKOverrideManager( IWorldVPKOverrideManager *pVPKMgr ) = 0;
|
||||
virtual void RemoveWorldVPKOverrideManager( IWorldVPKOverrideManager *pVPKMgr ) = 0;
|
||||
|
||||
virtual int UnkGetCount() = 0;
|
||||
virtual const char *UnkGetStringElm( int i ) const = 0;
|
||||
virtual const char *UnkGetString2Elm( int i ) const = 0;
|
||||
};
|
||||
|
||||
#endif // IWORLDRENDERERMGR_H
|
70
public/worldrenderer/worldschema.h
Normal file
70
public/worldrenderer/worldschema.h
Normal file
@ -0,0 +1,70 @@
|
||||
#ifndef WORLD_SCHEMA_H
|
||||
#define WORLD_SCHEMA_H
|
||||
|
||||
#ifdef COMPILER_MSVC
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <tier0/platform.h>
|
||||
#include <tier1/utlstring.h>
|
||||
#include <tier1/utlvector.h>
|
||||
#include <mathlib/vector.h>
|
||||
#include <mathlib/vector2d.h>
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Enum related
|
||||
//--------------------------------------------------------------------------------------
|
||||
enum WorldNodeFlags_t
|
||||
{
|
||||
WORLD_NODE_SIMPLIFIED = 0x0001, // The geometry is simplified
|
||||
WORLD_NODE_UNIQUE_UV = 0x0002, // The geometry is uniquely mapped (likely, we're a higher LOD)
|
||||
WORLD_NODE_ATLASED = 0x0004, // This node was atlased but not uniquely mapped
|
||||
WORLD_NODE_KDTREE = 0x0008, // Node contains a kd-tree for raycasts
|
||||
WORLD_NODE_NODRAW = 0x0010, // Node has no actual draw calls... it's just a container for stuff and other nodes
|
||||
WORLD_NODE_START_TRAVERSAL = 0x0020, // Start a traversal at this node (add a check to ensure that the KDTREE flag also exists with this one)
|
||||
WORLD_NODE_CAN_SEE_SKY = 0x0040, // Can this node see the sky?
|
||||
WORLD_NODE_MOST_DETAILED = 0x0080, // Node is the most detailed node containing the original geometry and textures
|
||||
};
|
||||
|
||||
struct WorldBuilderParams_t
|
||||
{
|
||||
public:
|
||||
float m_flMinDrawVolumeSize;
|
||||
bool m_bBuildBakedLighting;
|
||||
Vector2D m_vLightmapUvScale;
|
||||
private:
|
||||
uint8 m_unk001[3];
|
||||
public:
|
||||
uint64 m_nCompileTimestamp;
|
||||
uint64 m_nCompileFingerprint;
|
||||
};
|
||||
|
||||
struct NodeData_t
|
||||
{
|
||||
public:
|
||||
int32 m_nParent;
|
||||
Vector m_vOrigin;
|
||||
Vector m_vMinBounds;
|
||||
Vector m_vMaxBounds;
|
||||
float m_flMinimumDistance;
|
||||
CUtlVector< int32 > m_ChildNodeIndices;
|
||||
private:
|
||||
uint8 m_unk001[4];
|
||||
public:
|
||||
CUtlString m_worldNodePrefix;
|
||||
};
|
||||
|
||||
struct BakedLightingInfo_t
|
||||
{
|
||||
public:
|
||||
uint32 m_nLightmapVersionNumber;
|
||||
uint32 m_nLightmapGameVersionNumber;
|
||||
Vector2D m_vLightmapUvScale;
|
||||
bool m_bHasLightmaps;
|
||||
private:
|
||||
uint8 m_unk001[7];
|
||||
public:
|
||||
CUtlVector< void * /* CStrongHandle< InfoForResourceTypeCTextureBase > */ > m_lightMaps;
|
||||
};
|
||||
|
||||
#endif // WORLD_SCHEMA_H
|
Reference in New Issue
Block a user