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.

105 lines
3.1 KiB

  1. //========= Copyright � 1996-2009, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef MAPINSTANCE_H
  8. #define MAPINSTANCE_H
  9. #pragma once
  10. #include "MapHelper.h"
  11. #include "MapDoc.h"
  12. class CRender3D;
  13. class CManifestMap;
  14. //-----------------------------------------------------------------------------
  15. // Purpose:
  16. //-----------------------------------------------------------------------------
  17. class CMapInstance : public CMapHelper
  18. {
  19. public:
  20. DECLARE_MAPCLASS(CMapInstance, CMapHelper)
  21. //
  22. // Factory for building from a list of string parameters.
  23. //
  24. static CMapClass *Create( CHelperInfo *pInfo, CMapEntity *pParent );
  25. static void SetInstancePath( const char *pszInstancePath );
  26. static const char *GetInstancePath( void ) { return m_InstancePath; }
  27. static bool IsMapInVersionControl( const char *pszFileName );
  28. static bool DeterminePath( const char *pszBaseFileName, const char *pszInstanceFileName, char *pszOutFileName );
  29. //
  30. // Construction/destruction:
  31. //
  32. CMapInstance( void );
  33. CMapInstance( const char *pszBaseFileName, const char *pszInstanceFileName );
  34. ~CMapInstance(void);
  35. GDIV_TYPE GetFieldType( const char *pszValue );
  36. virtual void FindTargetNames( CUtlVector< const char * > &Names );
  37. virtual void ReplaceTargetname( const char *szOldName, const char *szNewName );
  38. virtual bool OnApply( void );
  39. virtual void CalcBounds(BOOL bFullUpdate = FALSE);
  40. virtual void UpdateChild(CMapClass *pChild);
  41. virtual CMapEntity *FindChildByKeyValue( const char* key, const char* value, bool *bIsInInstance = NULL, VMatrix *InstanceMatrix = NULL );
  42. virtual void InstanceMoved( void );
  43. virtual CMapClass *Copy(bool bUpdateDependencies);
  44. virtual CMapClass *CopyFrom(CMapClass *pFrom, bool bUpdateDependencies);
  45. void Initialize(void);
  46. void SetManifest( CManifestMap *pManifestMap );
  47. void Render2D(CRender2D *pRender);
  48. void Render3D(CRender3D *pRender);
  49. void SwitchTo( void );
  50. // Called by entity code to render sprites
  51. void RenderLogicalAt(CRender2D *pRender, const Vector2D &vecMins, const Vector2D &vecMaxs );
  52. void GetAngles(QAngle &Angles);
  53. int SerializeRMF(std::fstream &File, BOOL bRMF);
  54. int SerializeMAP(std::fstream &File, BOOL bRMF);
  55. bool ShouldRenderLast(void);
  56. bool IsVisualElement(void) { return(true); }
  57. virtual bool IsEditable( void );
  58. bool IsInstanceVisible( void );
  59. const char *GetDescription( void ) { return( "Instance" ); }
  60. CMapDoc *GetInstancedMap( void ) { return m_pInstancedMap; }
  61. CManifestMap *GetManifestMap( void ) { return m_pManifestMap; }
  62. bool IsInstance( void ) { return ( m_pManifestMap == NULL ); }
  63. void UpdateInstanceMap( void );
  64. void OnParentKeyChanged(const char* szKey, const char* szValue);
  65. protected:
  66. //
  67. // Implements CMapAtom transformation functions.
  68. //
  69. void DoTransform(const VMatrix &matrix);
  70. QAngle m_Angles;
  71. char m_FileName[ MAX_PATH ];
  72. CMapDoc *m_pInstancedMap;
  73. CManifestMap *m_pManifestMap;
  74. static char m_InstancePath[ MAX_PATH ];
  75. };
  76. #endif // MAPINSTANCE_H