summaryrefslogtreecommitdiff
path: root/ZAPD/GameConfig.h
blob: d650c6d7049ef370d6802fd02f5cb806391a0262 (plain)
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
#pragma once

#include <cstdint>
#include <map>
#include <string>
#include <vector>

#include "Utils/Directory.h"
#include "tinyxml2.h"

struct TexturePoolEntry
{
	fs::path path = "";  // Path to Shared Texture
};

class ExternalFile
{
public:
	fs::path xmlPath, outPath;

	ExternalFile(fs::path nXmlPath, fs::path nOutPath);
};

class ZFile;

class GameConfig
{
public:
	std::string configFilePath;
	std::map<int32_t, std::vector<ZFile*>> segmentRefFiles;
	std::map<uint32_t, std::string> symbolMap;
	std::vector<std::string> actorList;
	std::vector<std::string> objectList;
	std::vector<std::string> entranceList;
	std::vector<std::string> specialEntranceList;
	std::map<uint32_t, TexturePoolEntry> texturePool;  // Key = CRC

	// ZBackground
	uint32_t bgScreenWidth = 320, bgScreenHeight = 240;
	bool useScreenWidthHeightConstants = true;  // If true, ZBackground's will be declared with
	                                            // SCREEN_WIDTH * SCREEN_HEIGHT in the C file

	// ExternalFile
	fs::path externalXmlFolder;
	std::vector<ExternalFile> externalFiles;

	GameConfig() = default;
	~GameConfig();

	void ReadTexturePool(const fs::path& texturePoolXmlPath);
	void GenSymbolMap(const fs::path& symbolMapPath);

	void ConfigFunc_SymbolMap(const tinyxml2::XMLElement& element);
	void ConfigFunc_ActorList(const tinyxml2::XMLElement& element);
	void ConfigFunc_ObjectList(const tinyxml2::XMLElement& element);
	void ConfigFunc_EntranceList(const tinyxml2::XMLElement& element);
	void ConfigFunc_specialEntranceList(const tinyxml2::XMLElement& element);
	void ConfigFunc_TexturePool(const tinyxml2::XMLElement& element);
	void ConfigFunc_BGConfig(const tinyxml2::XMLElement& element);
	void ConfigFunc_ExternalXMLFolder(const tinyxml2::XMLElement& element);
	void ConfigFunc_ExternalFile(const tinyxml2::XMLElement& element);

	void ReadConfigFile(const fs::path& configFilePath);
};