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.

72 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Point entity used to create templates out of other entities or groups of entities
  4. //
  5. //=============================================================================//
  6. #ifndef POINT_TEMPLATE_H
  7. #define POINT_TEMPLATE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #define MAX_NUM_TEMPLATES 16
  12. struct template_t
  13. {
  14. int iTemplateIndex;
  15. VMatrix matEntityToTemplate;
  16. DECLARE_SIMPLE_DATADESC();
  17. };
  18. //-----------------------------------------------------------------------------
  19. // Purpose:
  20. //-----------------------------------------------------------------------------
  21. class CPointTemplate : public CLogicalEntity
  22. {
  23. DECLARE_CLASS( CPointTemplate, CLogicalEntity );
  24. public:
  25. DECLARE_DATADESC();
  26. virtual void Spawn( void );
  27. virtual void Precache();
  28. // Template initialization
  29. void StartBuildingTemplates( void );
  30. void FinishBuildingTemplates( void );
  31. // Template Entity accessors
  32. int GetNumTemplateEntities( void );
  33. CBaseEntity *GetTemplateEntity( int iTemplateNumber );
  34. void AddTemplate( CBaseEntity *pEntity, const char *pszMapData, int nLen );
  35. bool ShouldRemoveTemplateEntities( void );
  36. bool AllowNameFixup();
  37. // Templates accessors
  38. int GetNumTemplates( void );
  39. int GetTemplateIndexForTemplate( int iTemplate );
  40. // Template instancing
  41. bool CreateInstance( const Vector &vecOrigin, const QAngle &vecAngles, CUtlVector<CBaseEntity*> *pEntities );
  42. // Inputs
  43. void InputForceSpawn( inputdata_t &inputdata );
  44. virtual void PerformPrecache();
  45. private:
  46. string_t m_iszTemplateEntityNames[MAX_NUM_TEMPLATES];
  47. // List of map entities this template targets. Built inside our Spawn().
  48. // It's only valid between Spawn() & Activate(), because the map entity parsing
  49. // code removes all the entities in it once it finishes turning them into templates.
  50. CUtlVector< CBaseEntity * > m_hTemplateEntities;
  51. // List of templates, generated from our template entities.
  52. CUtlVector< template_t > m_hTemplates;
  53. COutputEvent m_pOutputOnSpawned;
  54. };
  55. #endif // POINT_TEMPLATE_H