Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef MAPENTITIES_H
  8. #define MAPENTITIES_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "mapentities_shared.h"
  13. // This class provides hooks into the map-entity loading process that allows CS to do some tricks
  14. // when restarting the round. The main trick it tries to do is recreate all
  15. abstract_class IMapEntityFilter
  16. {
  17. public:
  18. virtual bool ShouldCreateEntity( const char *pClassname ) = 0;
  19. virtual CBaseEntity* CreateNextEntity( const char *pClassname ) = 0;
  20. };
  21. // Use the filter so you can prevent certain entities from being created out of the map.
  22. // CSPort does this when restarting rounds. It wants to reload most entities from the map, but certain
  23. // entities like the world entity need to be left intact.
  24. void MapEntity_ParseAllEntities( const char *pMapData, IMapEntityFilter *pFilter=NULL, bool bActivateEntities=false );
  25. const char *MapEntity_ParseEntity( CBaseEntity *&pEntity, const char *pEntData, IMapEntityFilter *pFilter );
  26. void MapEntity_PrecacheEntity( const char *pEntData, int &nStringSize );
  27. //-----------------------------------------------------------------------------
  28. // Hierarchical spawn
  29. //-----------------------------------------------------------------------------
  30. struct HierarchicalSpawn_t
  31. {
  32. CHandle<CBaseEntity> m_hEntity;
  33. int m_nDepth;
  34. CBaseEntity *m_pDeferredParent; // attachment parents can't be set until the parents are spawned
  35. const char *m_pDeferredParentAttachment; // so defer setting them up until the second pass
  36. };
  37. void SpawnHierarchicalList( int nEntities, HierarchicalSpawn_t *pSpawnList, bool bActivateEntities );
  38. #endif // MAPENTITIES_H