ScummVM API documentation
map_dungeon.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 ULTIMA_ULTIMA1_MAP_MAP_DUNGEON_H
23 #define ULTIMA_ULTIMA1_MAP_MAP_DUNGEON_H
24 
25 #include "ultima/ultima1/maps/map_base.h"
26 #include "ultima/shared/core/rect.h"
27 #include "common/random.h"
28 
29 namespace Ultima {
30 namespace Ultima1 {
31 namespace Widgets {
32  class DungeonMonster;
33 }
34 
35 namespace Maps {
36 
37 #define DUNGEON_WIDTH 11
38 #define DUNGEON_HEIGHT 11
39 
40 enum DungeonTile {
41  DTILE_HALLWAY = 0, DTILE_WALL = 1, DTILE_SECRET_DOOR = 2, DTILE_DOOR = 3, DTILE_LADDER_DOWN = 6,
42  DTILE_LADDER_UP = 7, DTILE_BEAMS = 8
43 };
44 
48 class MapDungeon : public MapBase {
49 private:
50  Common::RandomSource _random;
51  uint _dungeonLevel; // Dungeon level number
52 private:
56  void setRandomSeed();
57 
62  uint getDeterministicRandomNumber(uint min, uint max) { return min + _random.getRandomNumber(max - min); }
63 
67  void leavingDungeon();
68 public:
69  uint _dungeonExitHitPoints;
70 public:
71  MapDungeon(Ultima1Game *game, Ultima1Map *map) : MapBase(game, map), _random("UltimaDungeons"),
72  _dungeonLevel(0), _dungeonExitHitPoints(0) {}
73  ~MapDungeon() override {}
74 
78  void synchronize(Common::Serializer &s) override;
79 
83  void load(Shared::Maps::MapId mapId) override;
84 
88  void getTileAt(const Point &pt, Shared::Maps::MapTile *tile, bool includePlayer = true) override;
89 
95  bool changeLevel(int delta) override;
96 
100  uint getLevel() const override { return _dungeonLevel; }
101 
105  void update() override;
106 
110  void spawnMonster();
111 
115  void spawnMonsterAt(const Point &pt);
116 
120  Widgets::DungeonMonster *findCreatureInCurrentDirection(uint maxDistance = 5);
121 
127  void attack(int direction, int effectId) override;
128 
138  void attack(int direction, int effectId, uint maxDistance, uint amount, uint agility, const Common::String &hitWidget) override;
139 
143  void inform() override;
144 
148  void climb() override;
149 
153  void open() override;
154 
158  void unlock() override { open(); }
159 
163  void castSpell(uint spell) override;
164 };
165 
166 } // End of namespace Maps
167 } // End of namespace Ultima1
168 } // End of namespace Ultima
169 
170 #endif
void unlock() override
Definition: map_dungeon.h:158
Definition: map_tile.h:36
Definition: str.h:59
Definition: random.h:44
Definition: map_dungeon.h:48
uint getRandomNumber(uint max)
Definition: serializer.h:79
Definition: map_base.h:39
Definition: detection.h:27
Definition: dungeon_monster.h:41
uint getLevel() const override
Definition: map_dungeon.h:100
Definition: rect.h:45
Definition: game.h:42