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.

104 lines
3.0 KiB

  1. //========= Copyright 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 DeterminePath( const char *pszBaseFileName, const char *pszInstanceFileName, char *pszOutFileName );
  28. //
  29. // Construction/destruction:
  30. //
  31. CMapInstance( void );
  32. CMapInstance( const char *pszBaseFileName, const char *pszInstanceFileName );
  33. ~CMapInstance(void);
  34. GDIV_TYPE GetFieldType( const char *pszValue );
  35. virtual void FindTargetNames( CUtlVector< const char * > &Names );
  36. virtual void ReplaceTargetname( const char *szOldName, const char *szNewName );
  37. virtual bool OnApply( void );
  38. virtual void CalcBounds(BOOL bFullUpdate = FALSE);
  39. virtual void UpdateChild(CMapClass *pChild);
  40. virtual CMapEntity *FindChildByKeyValue( const char* key, const char* value, bool *bIsInInstance = NULL, VMatrix *InstanceMatrix = NULL );
  41. virtual void InstanceMoved( void );
  42. virtual CMapClass *Copy(bool bUpdateDependencies);
  43. virtual CMapClass *CopyFrom(CMapClass *pFrom, bool bUpdateDependencies);
  44. void Initialize(void);
  45. void SetManifest( CManifestMap *pManifestMap );
  46. void Render2D(CRender2D *pRender);
  47. void Render3D(CRender3D *pRender);
  48. void SwitchTo( void );
  49. // Called by entity code to render sprites
  50. void RenderLogicalAt(CRender2D *pRender, const Vector2D &vecMins, const Vector2D &vecMaxs );
  51. void GetAngles(QAngle &Angles);
  52. int SerializeRMF(std::fstream &File, BOOL bRMF);
  53. int SerializeMAP(std::fstream &File, BOOL bRMF);
  54. bool ShouldRenderLast(void);
  55. bool IsVisualElement(void) { return(true); }
  56. virtual bool IsEditable( void );
  57. bool IsInstanceVisible( void );
  58. const char *GetDescription( void ) { return( "Instance" ); }
  59. CMapDoc *GetInstancedMap( void ) { return m_pInstancedMap; }
  60. CManifestMap *GetManifestMap( void ) { return m_pManifestMap; }
  61. bool IsInstance( void ) { return ( m_pManifestMap == NULL ); }
  62. void UpdateInstanceMap( void );
  63. void OnParentKeyChanged(const char* szKey, const char* szValue);
  64. protected:
  65. //
  66. // Implements CMapAtom transformation functions.
  67. //
  68. void DoTransform(const VMatrix &matrix);
  69. QAngle m_Angles;
  70. char m_FileName[ MAX_PATH ];
  71. CMapDoc *m_pInstancedMap;
  72. CManifestMap *m_pManifestMap;
  73. static char m_InstancePath[ MAX_PATH ];
  74. };
  75. #endif // MAPINSTANCE_H