Counter Strike : Global Offensive Source Code
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.

81 lines
2.5 KiB

  1. //========= Copyright � 1996-2005, 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. void PrecachePointTemplates();
  19. //-----------------------------------------------------------------------------
  20. void ScriptInstallPreSpawnHook();
  21. bool ScriptPreInstanceSpawn( CScriptScope *pScriptScope, CBaseEntity *pChild, string_t iszKeyValueData );
  22. void ScriptPostSpawn( CScriptScope *pScriptScope, CBaseEntity **ppEntities, int nEntities );
  23. //-----------------------------------------------------------------------------
  24. // Purpose:
  25. //-----------------------------------------------------------------------------
  26. class CPointTemplate : public CLogicalEntity
  27. {
  28. DECLARE_CLASS( CPointTemplate, CLogicalEntity );
  29. public:
  30. DECLARE_DATADESC();
  31. virtual void Spawn( void );
  32. virtual void Precache();
  33. // Template initialization
  34. void StartBuildingTemplates( void );
  35. void FinishBuildingTemplates( void );
  36. // Template Entity accessors
  37. int GetNumTemplateEntities( void );
  38. CBaseEntity *GetTemplateEntity( int iTemplateNumber );
  39. void AddTemplate( CBaseEntity *pEntity, const char *pszMapData, int nLen );
  40. bool ShouldRemoveTemplateEntities( void );
  41. bool AllowNameFixup();
  42. // Templates accessors
  43. int GetNumTemplates( void );
  44. int GetTemplateIndexForTemplate( int iTemplate );
  45. // Template instancing
  46. bool CreateInstance( const Vector &vecOrigin, const QAngle &vecAngles, CUtlVector<CBaseEntity*> *pEntities, CBaseEntity *pEntityMaker = NULL, bool bCreateTime = false );
  47. void CreationComplete( const CUtlVector<CBaseEntity*> &entities );
  48. // Inputs
  49. void InputForceSpawn( inputdata_t &inputdata );
  50. virtual void PerformPrecache();
  51. private:
  52. string_t m_iszTemplateEntityNames[MAX_NUM_TEMPLATES];
  53. // List of map entities this template targets. Built inside our Spawn().
  54. // It's only valid between Spawn() & Activate(), because the map entity parsing
  55. // code removes all the entities in it once it finishes turning them into templates.
  56. CUtlVector< CBaseEntity * > m_hTemplateEntities;
  57. // List of templates, generated from our template entities.
  58. CUtlVector< template_t > m_hTemplates;
  59. COutputEvent m_pOutputOnSpawned;
  60. };
  61. #endif // POINT_TEMPLATE_H