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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=====================================================================================//
#ifndef MANIFEST_H
#define MANIFEST_H
#pragma once
#include "KeyValues.h"
#include "utlvector.h"
#include "MapDoc.h"
class BoundBox;
class CSelection;
class CMapWorld;
class CManifestInstance;
typedef struct SManifestLoadPrefs TManifestLoadPrefs;
class CManifestMap
{
public:
CManifestMap( void );
bool IsEditable( void );
CMapDoc *m_Map;
CString m_RelativeMapFileName, m_AbsoluteMapFileName;
CString m_FriendlyName;
bool m_bTopLevelMap;
bool m_bReadOnly;
bool m_bIsVersionControlled;
bool m_bCheckedOut;
bool m_bDefaultCheckin;
int m_InternalID;
CManifestInstance *m_Entity;
// user prefs ( which don't impact the bsp process )
bool m_bVisible;
bool m_bPrimaryMap;
bool m_bProtected;
};
class CManifestInstance : public CMapEntity
{
public:
DECLARE_MAPCLASS( CManifestInstance, CMapEntity )
CManifestInstance( void );
CManifestInstance( CManifestMap *pManifestMap );
virtual bool IsEditable( void );
CManifestMap *GetManifestMap( void ) { return m_pManifestMap; }
private:
CManifestMap *m_pManifestMap;
};
class CManifest : public CMapDoc
{
friend class CManifestCheckin;
protected:
DECLARE_DYNCREATE(CManifest)
public:
CManifest( void );
~CManifest( void );
static ChunkFileResult_t LoadKeyInfoCallback( const char *szKey, const char *szValue, CManifest *pDoc );
static ChunkFileResult_t LoadManifestInfoCallback( CChunkFile *pFile, CManifest *pDoc );
static ChunkFileResult_t LoadKeyCallback( const char *szKey, const char *szValue, CManifestMap *pManifestMap );
static ChunkFileResult_t LoadManifestVMFCallback( CChunkFile *pFile, CManifest *pDoc );
static ChunkFileResult_t LoadManifestMapsCallback( CChunkFile *pFile, CManifest *pDoc );
static ChunkFileResult_t LoadKeyPrefsCallback( const char *szKey, const char *szValue, TManifestLoadPrefs *pManifestLoadPrefs );
static ChunkFileResult_t LoadManifestVMFPrefsCallback( CChunkFile *pFile, CManifest *pDoc );
static ChunkFileResult_t LoadManifestMapsPrefsCallback( CChunkFile *pFile, CManifest *pDoc );
static ChunkFileResult_t LoadManifestCordoningPrefsCallback( CChunkFile *pFile, CManifest *pDoc );
bool Load( const char *pszFileName );
bool Save( const char *pszFileName, bool bForce );
bool IsValid( void ) { return m_bIsValid; }
virtual void Initialize( void );
virtual void Update( void );
virtual void SetModifiedFlag( BOOL bModified = TRUE );
virtual bool IsManifest( void ) { return true; }
void GetFullMapPath( const char *pManifestMapFileName, char *pOutputPath );
void SetManifestPrefsModifiedFlag( bool bModified = true );
int GetNumMaps( void ) { return m_Maps.Count(); }
CManifestMap *GetMap( int index ) { return m_Maps[ index ]; }
CManifestMap *FindMap( CMapDoc *pMap );
CManifestMap *FindMapByID( int InternalID );
void SetPrimaryMap( CManifestMap *pManifestMap );
CManifestMap *GetPrimaryMap( void ) { return m_pPrimaryMap; }
void SetVisibility( CManifestMap *pManifestMap, bool bIsVisible );
void MoveSelectionToSubmap( CManifestMap *pManifestMap, bool CenterContents );
CManifestMap *MoveSelectionToNewSubmap( CString &FriendlyName, CString &FileName, bool CenterContents );
CManifestMap *CreateNewMap( const char *AbsoluteFileName, const char *RelativeFileName, bool bSetID );
CManifestMap *AddNewSubmap( CString &FriendlyName, CString &FileName );
bool AddExistingMap( const char *pszFileName, bool bFromInstance );
bool AddExistingMap( void );
bool RemoveSubMap( CManifestMap *pManifestMap );
bool CheckOut( );
bool AddToVersionControl( );
void CheckFileStatus( );
CSelection *GetSelection( void ) { return m_pSelection; }
void ClearSelection( void );
virtual void UpdateInstanceMap( CMapDoc *pInstanceMapDoc );
virtual void AddObjectToWorld(CMapClass *pObject, CMapClass *pParent = NULL);
CMapWorld *GetManifestWorld( void ) { return m_ManifestWorld; }
bool m_bReadOnly;
bool m_bIsVersionControlled;
bool m_bCheckedOut;
bool m_bDefaultCheckin;
protected:
virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
virtual void DeleteContents( void );
private:
void AddManifestObjectToWorld( CMapClass *pObject, CMapClass *pParent = NULL );
void RemoveManifestObjectFromWorld( CMapClass *pObject, bool bRemoveChildren );
bool LoadVMFManifest( const char *pszFileName );
bool LoadVMFManifestUserPrefs( const char *pszFileName );
bool SaveVMFManifest( const char *pszFileName );
bool SaveVMFManifestMaps( const char *pszFileName );
bool SaveVMFManifestUserPrefs( const char *pszFileName );
int m_NextInternalID;
bool m_bIsValid;
bool m_bRelocateSave;
CUtlVector< CManifestMap * > m_Maps;
CManifestMap *m_pPrimaryMap;
char m_ManifestDir[ MAX_PATH ];
CMenu m_ManifestMenu;
CMapWorld *m_ManifestWorld;
bool m_bManifestChanged, m_bManifestUserPrefsChanged;
CHistory *m_pSaveUndo;
CHistory *m_pSaveRedo;
protected:
//{{AFX_MSG(CMapDoc)
afx_msg void OnFileSaveAs();
//}}AFX_MSG
public:
DECLARE_MESSAGE_MAP()
};
#endif // #define MANIFEST_H
|