ScummVM API documentation
tileset.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_MAP_TILESET_H
23#define ULTIMA4_MAP_TILESET_H
24
25#include "ultima/ultima4/core/types.h"
26#include "common/hash-str.h"
27
28namespace Ultima {
29namespace Ultima4 {
30
31class ConfigElement;
32class Tile;
33class TileSets;
34
36
40class TileRule {
41public:
45 bool initFromConf(const ConfigElement &tileRuleConf);
46
47 Common::String _name;
48 unsigned short _mask;
49 unsigned short _movementMask;
50 TileSpeed _speed;
51 TileEffect _effect;
52 int _walkOnDirs;
53 int _walkOffDirs;
54};
55
59class Tileset {
60 friend class TileSets;
61public:
64public:
65 Tileset() : _totalFrames(0), _extends(nullptr) {}
66
70 void load(const ConfigElement &tilesetConf);
71
75 void unload();
76 void unloadImages();
77
81 Tile *get(TileId id);
82
87
92
96 uint numTiles() const;
97
101 uint numFrames() const;
102
103private:
104 Common::String _name;
105 TileIdMap _tiles;
106 uint _totalFrames;
107 Common::String _imageName;
108 Tileset *_extends;
109
110 TileStrMap _nameMap;
111};
112
113
117class TileRules : public TileRuleMap {
118public:
123
128
132 void load();
133
138};
139
143class TileSets : public Common::HashMap<Common::String, Tileset *> {
144public:
149
154
159 void loadAll();
160
164 void unloadAll();
165
170
175
180 Tile *findTileById(TileId id);
181};
182
183extern TileRules *g_tileRules;
184extern TileSets *g_tileSets;
185
186} // End of namespace Ultima4
187} // End of namespace Ultima
188
189#endif
Definition: hashmap.h:85
Definition: str.h:59
Definition: config.h:126
Definition: tile.h:64
Definition: tileset.h:40
bool initFromConf(const ConfigElement &tileRuleConf)
Definition: tileset.h:117
TileRule * findByName(const Common::String &name)
Definition: tileset.h:143
Tile * findTileByName(const Common::String &name)
Tileset * get(const Common::String &name)
Definition: tileset.h:59
Tile * get(TileId id)
void load(const ConfigElement &tilesetConf)
Tile * getByName(const Common::String &name)
Common::String getImageName() const