ScummVM API documentation
config.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef ULTIMA4_CORE_CONFIG_H
23#define ULTIMA4_CORE_CONFIG_H
24
25#include "ultima/shared/conf/xml_tree.h"
26#include "ultima/shared/conf/xml_node.h"
27
28namespace Ultima {
29namespace Ultima4 {
30
31/* info for loading city data from *.ult and *.tlk */
32#define CITY_HEIGHT 32
33#define CITY_WIDTH 32
34#define CITY_MAX_PERSONS 32
35
36/* info for loading area data from *.con */
37#define CON_HEIGHT 11
38#define CON_WIDTH 11
39
40/* info for loading dungeon map data from *.dng */
41#define DNG_HEIGHT 8
42#define DNG_WIDTH 8
43
44/* info for loading image data from shapes.ega */
45#define N_TILES 256
46#define TILE_WIDTH (2 * CHAR_WIDTH)
47#define TILE_HEIGHT (2 * CHAR_HEIGHT)
48
49/* info for loading image data from charset.ega */
50#define CHAR_WIDTH 8
51#define CHAR_HEIGHT 8
52
53/* some character defines */
54#define CHARSET_ANKH '\0'
55#define CHARSET_REDDOT '\01'
56#define CHARSET_SDOOR '\02'
57#define CHARSET_WALL '\03'
58#define CHARSET_LADDER_UPDOWN '\04'
59#define CHARSET_LADDER_DOWN '\05'
60#define CHARSET_LADDER_UP '\06'
61#define CHARSET_BULLET '\010'
62#define CHARSET_COPYRIGHT '\011'
63#define CHARSET_REGISTERED '\012'
64#define CHARSET_MALE '\013'
65#define CHARSET_FEMALE '\014'
66#define CHARSET_HORIZBAR '\015'
67#define CHARSET_ROOM '\016'
68#define CHARSET_ORB '\017'
69#define CHARSET_PROMPT '\020'
70#define CHARSET_FLOOR '\022'
71
72/* map viewport size (in tiles) */
73#define VIEWPORT_W 11
74#define VIEWPORT_H 11
75
76/* screen border size (in pixels) */
77#define BORDER_WIDTH 8
78#define BORDER_HEIGHT 8
79
80/* text area (in character units) */
81#define TEXT_AREA_X 24
82#define TEXT_AREA_Y 12
83#define TEXT_AREA_W 16
84#define TEXT_AREA_H 12
85
86/* moons/moongates */
87#define MOON_PHASES 24
88#define MOON_SECONDS_PER_PHASE 4
89#define MOON_CHAR 20
90
91/* wind */
92#define WIND_AREA_X 7
93#define WIND_AREA_Y 23
94#define WIND_AREA_W 10
95#define WIND_AREA_H 1
96#define WIND_SECONDS_PER_PHASE 1
97
98
99class ConfigElement;
100
104class Config {
105private:
106 static Config *_instance;
107 Shared::XMLTree _doc;
108public:
109 static const Config *getInstance() {
110 return _instance;
111 }
112public:
113 Config();
114 ~Config();
115
116 ConfigElement getElement(const Common::String &name) const;
117
118 static Common::Array<Common::String> getGames();
119 static void setGame(const Common::String &name);
120};
121
127private:
128 const Shared::XMLNode *_node;
129 Common::String _name;
130public:
131 ConfigElement(const Shared::XMLNode *xmlNode);
135
136 ConfigElement &operator=(const ConfigElement &e);
137
138 const Common::String getName() const {
139 return _name;
140 }
141
142 bool exists(const Common::String &name) const;
143 Common::String getString(const Common::String &name) const;
144 int getInt(const Common::String &name, int defaultValue = 0) const;
145 bool getBool(const Common::String &name) const;
146 int getEnum(const Common::String &name, const char *const enumValues[]) const;
147
148 Common::Array<ConfigElement> getChildren() const;
149
150 const Shared::XMLNode *getNode() const {
151 return _node;
152 }
153};
154
155} // End of namespace Ultima4
156} // End of namespace Ultima
157
158#endif
Definition: str.h:59
Definition: xml_node.h:36
Definition: xml_tree.h:36
Definition: config.h:126
Definition: config.h:104