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