Pyrogenesis  trunk
MapWriter.h
Go to the documentation of this file.
1 /* Copyright (C) 2021 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INCLUDED_MAPWRITER
19 #define INCLUDED_MAPWRITER
20 
21 #include "MapIO.h"
22 #include "ps/CStr.h"
23 #include "ps/FileIo.h"
24 
25 #include <vector>
26 
27 
28 class CLightEnv;
29 class CTerrain;
30 class CCamera;
31 class CCinemaManager;
32 class CPostprocManager;
33 class WaterManager;
34 class SkyManager;
35 class CSimulation2;
36 struct MapTrigger;
37 
38 class CMapWriter : public CMapIO
39 {
40 public:
41  // constructor
42  CMapWriter();
43  // SaveMap: try to save the current map to the given file
44  void SaveMap(const VfsPath& pathname, CTerrain* pTerr,
45  WaterManager* pWaterMan, SkyManager* pSkyMan,
46  CLightEnv* pLightEnv, CCamera* pCamera,
47  CCinemaManager* pCinema, CPostprocManager* pPostproc,
48  CSimulation2* pSimulation2);
49 
50 private:
51  // PackMap: pack the current world into a raw data stream
52  void PackMap(CFilePacker& packer, CTerrain* pTerrain);
53  // PackTerrain: pack the terrain onto the end of the data stream
54  void PackTerrain(CFilePacker& packer, CTerrain* pTerrain);
55 
56  // EnumTerrainTextures: build lists of textures used by map, and indices into this list
57  // for each tile on the terrain
58  void EnumTerrainTextures(CTerrain* pTerrain, std::vector<CStr>& textures,
59  std::vector<STileDesc>& tileIndices);
60 
61  // WriteXML: output some other data (entities, etc) in XML format
62  void WriteXML(const VfsPath& pathname, WaterManager* pWaterMan,
63  SkyManager* pSkyMan, CLightEnv* pLightEnv, CCamera* pCamera,
64  CPostprocManager* pPostproc,
65  CSimulation2* pSimulation2);
66 };
67 
68 #endif
void SaveMap(const VfsPath &pathname, CTerrain *pTerr, WaterManager *pWaterMan, SkyManager *pSkyMan, CLightEnv *pLightEnv, CCamera *pCamera, CCinemaManager *pCinema, CPostprocManager *pPostproc, CSimulation2 *pSimulation2)
Definition: MapWriter.cpp:59
Definition: Terrain.h:51
Definition: MapWriter.h:38
helper class for writing binary files.
Definition: FileIo.h:52
Public API for simulation system.
Definition: Simulation2.h:46
void PackTerrain(CFilePacker &packer, CTerrain *pTerrain)
Definition: MapWriter.cpp:161
void WriteXML(const VfsPath &pathname, WaterManager *pWaterMan, SkyManager *pSkyMan, CLightEnv *pLightEnv, CCamera *pCamera, CPostprocManager *pPostproc, CSimulation2 *pSimulation2)
Definition: MapWriter.cpp:188
void EnumTerrainTextures(CTerrain *pTerrain, std::vector< CStr > &textures, std::vector< STileDesc > &tileIndices)
Definition: MapWriter.cpp:103
Definition: path.h:79
Definition: Camera.h:41
Class for in game playing of cinematics.
Definition: CinemaManager.h:28
Definition: PostprocManager.h:31
Definition: MapIO.h:29
Class CLightEnv: description of a lighting environment - contains all the necessary parameters for re...
Definition: LightEnv.h:36
void PackMap(CFilePacker &packer, CTerrain *pTerrain)
Definition: MapWriter.cpp:152
CMapWriter()
Definition: MapWriter.cpp:53
Class WaterManager: Maintain rendering-related water settings and textures Anything that affects game...
Definition: WaterManager.h:47
Class SkyManager: Maintain sky settings and textures, and render the sky.
Definition: SkyManager.h:37