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.

52 lines
1.8 KiB

  1. //====== Copyright c 1996-2007, Valve Corporation, All rights reserved. =======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #ifndef VMFENTITYSUPPORT_H
  9. #define VMFENTITYSUPPORT_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. class IMapEntity_Type_t;
  14. class IMapEntity_SaveInfo_t;
  15. class CChunkFile;
  16. class CChunkHandlerMap;
  17. enum ChunkFileResult_t;
  18. //
  19. // Custom load/save handlers
  20. //
  21. class IMapEntitySaveLoadHandler
  22. {
  23. public:
  24. virtual char const *GetCustomSectionName() = 0;
  25. public:
  26. virtual void SetCurrentEntity( IMapEntity_Type_t *pEntity ); // Default implementation does nothing
  27. public:
  28. virtual ChunkFileResult_t SaveVMF( CChunkFile *pFile, IMapEntity_SaveInfo_t *pSaveInfo ); // Default implementation does nothing
  29. virtual ChunkFileResult_t LoadVMF( CChunkFile *pFile ); // Default implementation falls through to key values calls
  30. public:
  31. virtual ChunkFileResult_t LoadKeyValueBegin( CChunkFile *pFile ); // Default implementation does nothing
  32. virtual ChunkFileResult_t LoadKeyValue( const char *szKey, const char *szValue ); // Default implementation does nothing
  33. virtual ChunkFileResult_t LoadKeyValueEnd( CChunkFile *pFile, ChunkFileResult_t eLoadResult ); // Default implementation returns the given load result
  34. };
  35. typedef CUtlVector< IMapEntitySaveLoadHandler * > VmfSaveLoadHandlers;
  36. VmfSaveLoadHandlers & VmfGetSaveLoadHandlers();
  37. void VmfInstallMapEntitySaveLoadHandler( IMapEntitySaveLoadHandler *pHandler );
  38. void VmfUninstallMapEntitySaveLoadHandler( IMapEntitySaveLoadHandler *pHandler );
  39. void VmfAddMapEntityHandlers( CChunkHandlerMap *pHandlerMap, IMapEntity_Type_t *pEntity );
  40. ChunkFileResult_t VmfSaveVmfEntityHandlers( CChunkFile *pFile, IMapEntity_Type_t *pEntity, IMapEntity_SaveInfo_t *pSaveInfo );
  41. #endif // #ifndef VMFENTITYSUPPORT_H