ScummVM API documentation
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 ULTIMA4_MAP_DUNGEON_H
23 #define ULTIMA4_MAP_DUNGEON_H
24 
25 #include "ultima/ultima4/controllers/combat_controller.h"
26 #include "ultima/ultima4/core/types.h"
27 #include "ultima/ultima4/map/map.h"
28 
29 namespace Ultima {
30 namespace Ultima4 {
31 
32 #define DNGROOM_NTRIGGERS 4
33 
34 enum StatsBonusType {
35  STATSBONUS_INT = 0x1,
36  STATSBONUS_DEX = 0x2,
37  STATSBONUS_STR = 0x4
38 };
39 
40 struct Trigger {
41  byte _tile;
42  byte x, y;
43  byte _changeX1, _changeY1, changeX2, changeY2;
44 };
45 
46 struct PartyEntry {
47 private:
48  Common::Point *_array[5];
49 public:
50  Common::Point _northStart;
51  Common::Point _eastStart;
52  Common::Point _southStart;
53  Common::Point _westStart;
54 
55  PartyEntry() {
56  _array[DIR_NONE] = nullptr;
57  _array[DIR_NORTH] = &_northStart;
58  _array[DIR_EAST] = &_eastStart;
59  _array[DIR_SOUTH] = &_southStart;
60  _array[DIR_WEST] = &_westStart;
61  }
62 
63  Common::Point &operator[](int dir) {
64  return *_array[dir];
65  }
66 };
67 
68 struct DngRoom {
69  Trigger _triggers[DNGROOM_NTRIGGERS];
70  byte _creatureTiles[16];
71  Common::Point _creatureStart[16];
72  PartyEntry _partyStart[8];
73 
74  MapData _mapData; // This is OK to change to MapData since sizeof(DngRoom) or
75  // anything like it is not being used.
76  byte _buffer[7];
77 
81  void load(Common::SeekableReadStream &s);
82 
94  void hythlothFix7();
95  void hythlothFix9();
96 };
97 
101 enum DungeonToken {
102  DUNGEON_CORRIDOR = 0x00,
103  DUNGEON_LADDER_UP = 0x10,
104  DUNGEON_LADDER_DOWN = 0x20,
105  DUNGEON_LADDER_UPDOWN = 0x30,
106  DUNGEON_CHEST = 0x40,
107  DUNGEON_CEILING_HOLE = 0x50,
108  DUNGEON_FLOOR_HOLE = 0x60,
109  DUNGEON_MAGIC_ORB = 0x70,
110  DUNGEON_TRAP = 0x80,
111  DUNGEON_FOUNTAIN = 0x90,
112  DUNGEON_FIELD = 0xA0,
113  DUNGEON_ALTAR = 0xB0,
114  DUNGEON_DOOR = 0xC0,
115  DUNGEON_ROOM = 0xD0,
116  DUNGEON_SECRET_DOOR = 0xE0,
117  DUNGEON_WALL = 0xF0
118 };
119 
120 class Dungeon : public Map {
121 public:
122  Dungeon();
123  ~Dungeon() override {}
124 
125  // Members
129  Common::String getName() override;
130 
134  DungeonToken tokenForTile(MapTile tile);
135 
139  DungeonToken currentToken();
140 
144  byte currentSubToken();
145 
149  DungeonToken tokenAt(MapCoords coords);
150 
158  byte subTokenAt(MapCoords coords);
159 
163  bool ladderUpAt(MapCoords coords);
164 
168  bool ladderDownAt(MapCoords coords);
169 
170  bool validTeleportLocation(MapCoords coords);
171 
172  // Properties
173  Common::String _name;
174  uint _nRooms;
175  Std::vector<byte> _dataSubTokens;
176  DngRoom *_rooms;
177  CombatMap **_roomMaps;
178  int _currentRoom;
179  byte _partyStartX[8];
180  byte _partyStartY[8];
181 };
182 
186 enum TrapType {
187  TRAP_WINDS = 0x0,
188  TRAP_FALLING_ROCK = 0x1,
189  TRAP_PIT = 0xe
190 };
191 
192 enum FountainType {
193  FOUNTAIN_NORMAL = 0x0,
194  FOUNTAIN_HEALING = 0x1,
195  FOUNTAIN_ACID = 0x2,
196  FOUNTAIN_CURE = 0x3,
197  FOUNTAIN_POISON = 0x4
198 };
199 
200 enum FieldType {
201  FIELD_POISON = 0x0,
202  FIELD_ENERGY = 0x1,
203  FIELD_FIRE = 0x2,
204  FIELD_SLEEP = 0x3
205 };
206 
210 void dungeonSearch();
211 
215 void dungeonDrinkFountain();
216 
220 void dungeonTouchOrb();
221 
225 bool dungeonHandleTrap(TrapType trap);
226 
230 bool isDungeon(Map *punknown);
231 
232 } // End of namespace Ultima4
233 } // End of namespace Ultima
234 
235 #endif
Definition: str.h:59
Definition: dungeon.h:120
Definition: dungeon.h:68
Definition: dungeon.h:46
Definition: map.h:134
Definition: dungeon.h:40
Definition: combat_controller.h:212
Definition: stream.h:745
Definition: detection.h:27
Definition: map_tile.h:34
Definition: rect.h:45
Definition: map.h:64