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 #include "ultima/shared/std/containers.h"
28 
29 namespace Ultima {
30 namespace Ultima4 {
31 
32 /* info for loading city data from *.ult and *.tlk */
33 #define CITY_HEIGHT 32
34 #define CITY_WIDTH 32
35 #define CITY_MAX_PERSONS 32
36 
37 /* info for loading area data from *.con */
38 #define CON_HEIGHT 11
39 #define CON_WIDTH 11
40 
41 /* info for loading dungeon map data from *.dng */
42 #define DNG_HEIGHT 8
43 #define DNG_WIDTH 8
44 
45 /* info for loading image data from shapes.ega */
46 #define N_TILES 256
47 #define TILE_WIDTH (2 * CHAR_WIDTH)
48 #define TILE_HEIGHT (2 * CHAR_HEIGHT)
49 
50 /* info for loading image data from charset.ega */
51 #define CHAR_WIDTH 8
52 #define CHAR_HEIGHT 8
53 
54 /* some character defines */
55 #define CHARSET_ANKH '\0'
56 #define CHARSET_REDDOT '\01'
57 #define CHARSET_SDOOR '\02'
58 #define CHARSET_WALL '\03'
59 #define CHARSET_LADDER_UPDOWN '\04'
60 #define CHARSET_LADDER_DOWN '\05'
61 #define CHARSET_LADDER_UP '\06'
62 #define CHARSET_BULLET '\010'
63 #define CHARSET_COPYRIGHT '\011'
64 #define CHARSET_REGISTERED '\012'
65 #define CHARSET_MALE '\013'
66 #define CHARSET_FEMALE '\014'
67 #define CHARSET_HORIZBAR '\015'
68 #define CHARSET_ROOM '\016'
69 #define CHARSET_ORB '\017'
70 #define CHARSET_PROMPT '\020'
71 #define CHARSET_FLOOR '\022'
72 
73 /* map viewport size (in tiles) */
74 #define VIEWPORT_W 11
75 #define VIEWPORT_H 11
76 
77 /* screen border size (in pixels) */
78 #define BORDER_WIDTH 8
79 #define BORDER_HEIGHT 8
80 
81 /* text area (in character units) */
82 #define TEXT_AREA_X 24
83 #define TEXT_AREA_Y 12
84 #define TEXT_AREA_W 16
85 #define TEXT_AREA_H 12
86 
87 /* moons/moongates */
88 #define MOON_PHASES 24
89 #define MOON_SECONDS_PER_PHASE 4
90 #define MOON_CHAR 20
91 
92 /* wind */
93 #define WIND_AREA_X 7
94 #define WIND_AREA_Y 23
95 #define WIND_AREA_W 10
96 #define WIND_AREA_H 1
97 #define WIND_SECONDS_PER_PHASE 1
98 
99 
100 class ConfigElement;
101 
105 class Config {
106 private:
107  static Config *_instance;
108  Shared::XMLTree _doc;
109 public:
110  static const Config *getInstance() {
111  return _instance;
112  }
113 public:
114  Config();
115  ~Config();
116 
117  ConfigElement getElement(const Common::String &name) const;
118 
119  static Std::vector<Common::String> getGames();
120  static void setGame(const Common::String &name);
121 };
122 
128 private:
129  const Shared::XMLNode *_node;
130  Common::String _name;
131 public:
132  ConfigElement(const Shared::XMLNode *xmlNode);
133  ConfigElement(const ConfigElement &e);
134  ConfigElement();
135  ~ConfigElement();
136 
137  ConfigElement &operator=(const ConfigElement &e);
138 
139  const Common::String getName() const {
140  return _name;
141  }
142 
143  bool exists(const Common::String &name) const;
144  Common::String getString(const Common::String &name) const;
145  int getInt(const Common::String &name, int defaultValue = 0) const;
146  bool getBool(const Common::String &name) const;
147  int getEnum(const Common::String &name, const char *enumValues[]) const;
148 
149  Std::vector<ConfigElement> getChildren() const;
150 
151  const Shared::XMLNode *getNode() const {
152  return _node;
153  }
154 };
155 
156 } // End of namespace Ultima4
157 } // End of namespace Ultima
158 
159 #endif
Definition: str.h:59
Definition: xml_tree.h:36
Definition: config.h:127
Definition: xml_node.h:36
Definition: detection.h:27
Definition: config.h:105