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.

108 lines
3.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #ifndef VCDBLOCKDOC_H
  9. #define VCDBLOCKDOC_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "dme_controls/inotifyui.h"
  14. #include "datamodel/dmehandle.h"
  15. #include "datamodel/dmelement.h"
  16. //-----------------------------------------------------------------------------
  17. // Forward declarations
  18. //-----------------------------------------------------------------------------
  19. class IVcdBlockDocCallback;
  20. class CVcdBlockDoc;
  21. class CDmeVMFEntity;
  22. //-----------------------------------------------------------------------------
  23. // Contains all editable state
  24. //-----------------------------------------------------------------------------
  25. class CVcdBlockDoc : public IDmNotify
  26. {
  27. public:
  28. CVcdBlockDoc( IVcdBlockDocCallback *pCallback );
  29. ~CVcdBlockDoc();
  30. // Inherited from INotifyUI
  31. virtual void NotifyDataChanged( const char *pReason, int nNotifySource, int nNotifyFlags );
  32. // Sets/Gets the file name
  33. const char *GetBSPFileName();
  34. const char *GetVMFFileName();
  35. const char *GetEditFileName();
  36. void SetVMFFileName( const char *pFileName );
  37. void SetEditFileName( const char *pFileName );
  38. // Dirty bits (has it changed since the last time it was saved?)
  39. void SetDirty( bool bDirty );
  40. bool IsDirty() const;
  41. // Saves/loads from file
  42. bool LoadFromFile( const char *pFileName );
  43. void SaveToFile( );
  44. // Returns the root object
  45. CDmElement *GetRootObject();
  46. // Called when data changes (see INotifyUI for flags)
  47. void OnDataChanged( const char *pReason, int nNotifySource, int nNotifyFlags );
  48. // Create a text block the engine can parse containing the entity data to spawn
  49. void ServerLevelInitPostEntity( void );
  50. // Returns the entity list
  51. CDmAttribute *GetEntityList();
  52. // Adds a new info_target
  53. void AddNewInfoTarget( void );
  54. void AddNewInfoTarget( const Vector &vecOrigin, const QAngle &angAngles );
  55. // Deletes a commentary node
  56. void DeleteInfoTarget( CDmeVMFEntity *pNode );
  57. // Returns the commentary node at the specified location
  58. CDmeVMFEntity *GetInfoTargetForLocation( Vector &vecOrigin, QAngle &angAbsAngles );
  59. // Returns the info target that's closest to this line
  60. CDmeVMFEntity *GetInfoTargetForLocation( Vector &vecStart, Vector &vecEnd );
  61. // For element choice lists. Return false if it's an unknown choice list type
  62. virtual bool GetStringChoiceList( const char *pChoiceListType, CDmElement *pElement,
  63. const char *pAttributeName, bool bArrayElement, StringChoiceList_t &list );
  64. virtual bool GetElementChoiceList( const char *pChoiceListType, CDmElement *pElement,
  65. const char *pAttributeName, bool bArrayElement, ElementChoiceList_t &list );
  66. void VerifyAllEdits( const CDmrElementArray<> &entityList );
  67. void InitializeFromServer( CDmrElementArray<> &entityList );
  68. bool CopyEditsToVMF( void );
  69. bool RememberPlayerPosition( void );
  70. private:
  71. IVcdBlockDocCallback *m_pCallback;
  72. CDmeHandle< CDmElement > m_hVMFRoot; // VMF file
  73. CDmeHandle< CDmElement > m_hEditRoot; // VMF Edits file
  74. char m_pBSPFileName[512];
  75. char m_pVMFFileName[512];
  76. char m_pEditFileName[512];
  77. bool m_bDirty;
  78. };
  79. #endif // VCDBLOCKDOC_H