2004-05-29 22:56:24 +02:00
|
|
|
#ifndef _MAPREADER_H
|
|
|
|
#define _MAPREADER_H
|
|
|
|
|
|
|
|
#include "MapIO.h"
|
2004-12-07 03:04:38 +01:00
|
|
|
#include "res/handle.h"
|
2004-05-29 22:56:24 +02:00
|
|
|
#include "CStr.h"
|
|
|
|
#include "LightEnv.h"
|
|
|
|
#include "FileUnpacker.h"
|
|
|
|
|
|
|
|
class CObjectEntry;
|
2004-07-31 17:57:18 +02:00
|
|
|
class CTerrain;
|
|
|
|
class CUnitManager;
|
|
|
|
class CLightEnv;
|
2004-05-29 22:56:24 +02:00
|
|
|
|
|
|
|
class CMapReader : public CMapIO
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructor
|
|
|
|
CMapReader();
|
|
|
|
// LoadMap: try to load the map from given file; reinitialise the scene to new data if successful
|
2004-07-31 17:57:18 +02:00
|
|
|
void LoadMap(const char* filename, CTerrain *pTerrain, CUnitManager *pUnitMan, CLightEnv *pLightEnv);
|
2004-05-29 22:56:24 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
// UnpackMap: unpack the given data from the raw data stream into local variables
|
2005-03-22 22:00:56 +01:00
|
|
|
void UnpackMap();
|
2004-05-29 22:56:24 +02:00
|
|
|
// UnpackTerrain: unpack the terrain from the input stream
|
2005-03-22 22:00:56 +01:00
|
|
|
void UnpackTerrain();
|
2004-05-29 22:56:24 +02:00
|
|
|
// UnpackObjects: unpack world objects from the input stream
|
2005-03-22 22:00:56 +01:00
|
|
|
void UnpackObjects();
|
2004-05-29 22:56:24 +02:00
|
|
|
// UnpackObjects: unpack lighting parameters from the input stream
|
2005-03-22 22:00:56 +01:00
|
|
|
void UnpackLightEnv();
|
2004-05-29 22:56:24 +02:00
|
|
|
|
|
|
|
// ApplyData: take all the input data, and rebuild the scene from it
|
2005-03-22 22:00:56 +01:00
|
|
|
void ApplyData();
|
2004-05-29 22:56:24 +02:00
|
|
|
|
2005-01-12 15:31:47 +01:00
|
|
|
// ReadXML: read some other data (entities, etc) in XML format
|
2005-03-22 22:00:56 +01:00
|
|
|
void ReadXML();
|
|
|
|
|
|
|
|
// clean up everything used during delayed load
|
|
|
|
void DelayLoadFinished();
|
2005-01-12 15:31:47 +01:00
|
|
|
|
2004-05-29 22:56:24 +02:00
|
|
|
// size of map
|
|
|
|
u32 m_MapSize;
|
|
|
|
// heightmap for map
|
|
|
|
std::vector<u16> m_Heightmap;
|
|
|
|
// list of terrain textures used by map
|
|
|
|
std::vector<Handle> m_TerrainTextures;
|
|
|
|
// tile descriptions for each tile
|
|
|
|
std::vector<STileDesc> m_Tiles;
|
|
|
|
// list of object types used by map
|
2005-03-19 12:55:27 +01:00
|
|
|
std::vector<CStr> m_ObjectTypes;
|
2004-05-29 22:56:24 +02:00
|
|
|
// descriptions for each objects
|
|
|
|
std::vector<SObjectDesc> m_Objects;
|
|
|
|
// lightenv stored in file
|
|
|
|
CLightEnv m_LightEnv;
|
2005-03-22 22:00:56 +01:00
|
|
|
|
|
|
|
// state latched by LoadMap and held until DelayedLoadFinished
|
|
|
|
CFileUnpacker unpacker;
|
|
|
|
CTerrain *pTerrain;
|
|
|
|
CUnitManager *pUnitMan;
|
|
|
|
CLightEnv *pLightEnv;
|
|
|
|
CStr filename_xml;
|
2004-05-29 22:56:24 +02:00
|
|
|
};
|
|
|
|
|
2004-06-02 17:03:17 +02:00
|
|
|
#endif
|