ScummVM API documentation
maps.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 MM1_MAPS_MAPS_H
23 #define MM1_MAPS_MAPS_H
24 
25 #include "common/array.h"
26 #include "common/rect.h"
27 #include "graphics/managed_surface.h"
28 #include "mm/mm1/maps/map.h"
29 
30 namespace MM {
31 namespace MM1 {
32 namespace Maps {
33 
34 enum TownId {
35  NO_TOWN = 0, SORPIGAL = 1, PORTSMITH = 2,
36  ALGARY = 3, DUSK = 4, ERLIQUIN = 5
37 };
38 
39 enum DirMask {
40  DIRMASK_N = 0xC0, DIRMASK_E = 0x30,
41  DIRMASK_S = 0xC, DIRMASK_W = 3
42 };
43 
44 enum StateFlag {
45  SFLAG_SPELLS_DISALLOWED = 2
46 };
47 
48 enum Visited {
49  VISITED_NONE = 0, VISITED_NORMAL = 1, VISITED_SPECIAL = 2,
50  VISITED_EXIT = 3, VISITED_BUSINESS = 4
51 };
52 
56 class Maps {
57  friend class Map;
58 private:
60  uint16 _id = 0;
61  uint8 _section = 0;
62 private:
66  uint getIndex(uint16 id, byte section);
67 
71  void load(uint mapId);
72 
76  void loadTiles();
77  void loadTile();
78 
82  void town15setup();
83 
87  void town23setup();
88 
92  void town4setup();
93 
97  void updateMasksOffsets();
98 
99 public:
101  uint _mapId = (uint)-1;
102  Common::Point _mapPos;
103  uint _mapOffset = 0;
104  Map *_currentMap = nullptr;
105  byte _currentWalls = 0;
106  byte _currentState = 0;
107  int _colorOffset = 0;
108 
109  DirMask _forwardMask = DIRMASK_N,
110  _leftMask = DIRMASK_W,
111  _rightMask = DIRMASK_E,
112  _backwardsMask = DIRMASK_S;
113  int8 _forwardOffset = 0, _leftOffset = 0;
114  int8 _rightOffset = 0, _backwardsOffset = 0;
115  int _loadId = 0;
116  int _loadArea = 0;
117  int _loadSection = 0;
118  byte _loadFlag = 0;
119 public:
120  Maps();
121  ~Maps();
122 
127 
132 
136  void select(uint16 id, byte section);
137 
141  void display(uint16 id, byte section = 1);
142 
146  void loadTown(TownId townId);
147 
151  Map *getMap(uint mapId) const { return _maps[mapId]; }
152 
156  void turnLeft();
157 
161  void turnRight();
162 
166  void turnAround();
167 
171  void step(const Common::Point &delta);
172 
177  void changeMap(uint16 id, byte section);
178 
182  void visitedTile();
183 
189  void clearSpecial();
190 
194  static Common::Point getMoveDelta(byte mask);
195 };
196 
197 } // namespace Maps
198 
199 extern Maps::Maps *g_maps;
200 
201 } // namespace MM1
202 } // namespace MM
203 
204 #endif
Map * getMap(uint mapId) const
Definition: maps.h:151
void synchronize(Common::Serializer &s)
void select(uint16 id, byte section)
Definition: array.h:52
void step(const Common::Point &delta)
void synchronizeCurrent(Common::Serializer &s)
static Common::Point getMoveDelta(byte mask)
Definition: serializer.h:79
void display(uint16 id, byte section=1)
Definition: map.h:97
void changeMap(uint16 id, byte section)
void loadTown(TownId townId)
Definition: maps.h:56
Definition: detection.h:27
Definition: rect.h:45