ScummVM API documentation
automap_eob.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 KYRA_GUI_AUTOMAP_EOB_H
23#define KYRA_GUI_AUTOMAP_EOB_H
24
25#if defined(ENABLE_EOB) || defined(ENABLE_LOL)
26
27#include "common/array.h"
28#include "common/scummsys.h"
29
30namespace Common {
31class OutSaveFile;
32class SeekableReadStreamEndianWrapper;
33} // End of namespace Common
34
35namespace Graphics {
36class Font;
37struct Surface;
38} // End of namespace Graphics
39
40class OSystem;
41
42namespace Kyra {
43
44struct LevelBlockProperty;
45class EoBCoreEngine; // TODO: REMOVE
46
47class Automap_EoB {
48public:
49 Automap_EoB(OSystem *system, LevelBlockProperty **blockData, const uint8 *wllFlags, const uint8 *specialWallTypes, const int8 *wllShapeMap, /* const uint8 *wllVmpMap,*/ int gameID, int lang, bool featureEnabled);
50 ~Automap_EoB();
51
52 void markVisited(uint16 block);
53 void markSeen(uint16 block, int8 dir);
54
55 void draw(int level, uint16 partyBlock, int8 partyDirection);
56 void drawPartyIcon(uint16 partyBlock, int8 partyDirection);
57
58private:
59 // Geometry shared by drawing and click hit-testing.
60 struct AutomapLayout {
61 int cell;
62 int offX, offY; // top-left of the 32x32 grid (mouse hit-test)
63 int frame; // stone frame thickness
64 int mapX, mapY, mapW, mapH; // parchment region (map + footer strip)
65 int sideX, sideY, sideW, sideH; // stone side panel (plaque, legend, keys)
66 int plX, plY, plW, plH; // level/coords plaque inside the side panel
67 int footY; // top of the selected-note footer strip
68 };
69
70 enum {
71 kNumLegendStrings = 15,
72 kNumControlStrings = 6
73 };
74
75 struct TranslateableStrings {
76 const char *const legendStrings[kNumLegendStrings];
77 const char *const controlStrings[kNumControlStrings];
78 const char *const levelNames[2][16];
79 const char *const specialMarkerStrings[2][3];
80 };
81
82 struct SpecialMarkers {
83 int8 level;
84 uint16 block;
85 int8 iconColor;
86 };
87
88 enum IconID : int {
89 kIconNone = -1,
90 kIconPartyNorth = 0,
91 kIconPartyEast = 1,
92 kIconPartySouth = 2,
93 kIconPartyWest = 3,
94 kIconTeleporter = 4,
95 kIconStairsUp = 5,
96 kIconStairsDown = 6,
97 kIconPit = 7,
98 kIconPlate = 8,
99 kIconIllusionWall = 10,
100 kIconWallOfForce = 12,
101 kIconBigObject = 15,
102 kIconDoorButton = 17,
103 kIconSmallObject = 18,
104 kIconNicheNS = 20,
105 kIconNicheEW = 21,
106 kIconPortalNS = 22,
107 kIconPortalEW = 23,
108 kIconDoorNS = 25,
109 kIconDoorEW = 26,
110 kIconSpecial = 30,
111 kIconIDMax = 35
112 };
113
114 AutomapLayout createLayout(int width, int height) const;
115 void recalcScaling(int width, int height);
116 void createColorTable();
117 void createIcons(bool lowResSurface);
118 void releaseIcons();
119 void drawBackground(int width, int height);
120 void drawLegend(int level, uint flags);
121
122 enum IconAlignment : int {
123 kAlignTopLeft = -1,
124 kAlignTopCenter = 0,
125 kAlignRightCenter,
126 kAlignBottomCenter,
127 kAlignLeftCenter,
128 kAlignCenter
129 };
130
131 template<typename T> void drawIconImpl(Graphics::Surface &surf, int iconSet, int iconID, int cellX, int cellY, int boxFitWidth, IconAlignment alignment, int extraX, int extraY, int overrideColor);
132 typedef void (Automap_EoB::*DrawIconFunc)(Graphics::Surface &surf, int iconSet, int iconID, int cellX, int cellY, int boxFitWidth, IconAlignment alignment, int extraX, int extraY, int overrideColor);
133 DrawIconFunc _drawIcon;
134
135 int fitString(const Graphics::Font *f, const Common::String &str, int maxW, int maxSc) const;
136 uint16 calcNewBlockPosition(uint16 block, int8 dir) const;
137 bool isVisited(uint16 block) const;
138 bool isSeen(uint16 block) const;
139
140 enum BreakableObjectType {
141 kNoBreakableObject = 0,
142 kBreakableBlockObject,
143 kBreakableBarrierNS,
144 kBreakableBarrierEW,
145 kBrokenBarrier
146 };
147
148 int checkForBreakableObjectType(uint16 block) const;
149 bool isCenteredSwitch(uint16 block) const;
150
151 bool _visible;
152
153 LevelBlockProperty *&_blockData;
154 const uint8 *const _wllWallFlags;
155 const uint8 *const _specialWallTypes;
156 const int8 *const _wllShapeMap;
157 //const uint8 *const _wllVmpMap;
158 const uint8 _wallOfForceID;
159 const uint8 *_portalParams;
160 int _portalParamsLen;
161 const bool _enabled;
162
163 struct SpecialWallType {
164 uint8 wall;
165 uint8 icon;
166 uint16 legendFlag;
167 };
168 const SpecialWallType *_specialBlockIDs;
169 int _numSpecialBlockIDs;
170
171 static const TranslateableStrings _stringTable[];
172 const char *const *_legendStrings;
173 const char *const *_controlStrings;
174 const char *const *_levelNames;
175 const int _numLevelNames;
176
177 static const SpecialMarkers _specialMarkersEOB1[];
178 static const SpecialMarkers _specialMarkersEOB2[];
179 const SpecialMarkers *_specialMarkers;
180 const char *const *_specialMarkerStrings;
181 int _numSpecialMarkers;
182
183 AutomapLayout _l;
184 int _levelStrScl;
185 int _coordStrScl;
186 int _legendHeadScl;
187 int _legendBodyScl;
188 int _reduceSpace;
189 int _levelStrY;
190 int _coordStrY;
191
192 OSystem *_system;
193 Graphics::Surface *_background;
194 Graphics::Surface *_frame;
197
198private:
199 // Colors
200 enum ColorIndex {
201 kColorStone,
202 kColorStoneDark,
203 kColorStoneEdge,
204 kColorStoneHi,
205 kColorRivet,
206 kColorPaper,
207 kColorPaperHi,
208 kColorPaperLo,
209 kColorPaperEdge,
210 kColorInk,
211 kColorInkSoft,
212 kColorFloor,
213 kColorFloorSeen,
214 kColorGrid,
215 kColorWall,
216 kColorWallSeen,
217 kColorWoF,
218 kColorDoor,
219 kColorStair,
220 kColorTele,
221 kColorPlate,
222 kColorPit,
223 kColorLever,
224 kColorInteractive,
225 kColorNiche,
226 kColorPlaqueBg,
227 kColorPlaqueEd,
228 kColorGold,
229 kColorGoldDim,
230 kColorPanelTxt,
231 kColorSpecial1,
232 kColorSpecial2,
233 kColorSpecial3,
234 kColorSpecial4,
235 kColorSpecial5,
236 kColorSpecial6,
237 kColorSpecial7,
238 kColorTransp,
239 kColorPartyFrame0,
240 kColorPartyFrame1,
241 kColorPartyFrame2,
242 kColorPartyFrame3,
243 kColorPartyFrame4,
244 kColorPartyFrame5,
245 kColorPartyFrame6,
246 kColorPartyFrame7,
247 kColorPartyFrame8,
248 kColorPartyFrame9,
249 kNumColors
250 };
251
252 /* const */uint32 *_colors;
253 int _partyIconColor;
254 int _partyIconColorStep;
255};
256
257} // End of namespace Kyra
258
259#endif // ENABLE_EOB || ENABLE_LOL
260
261#endif // KYRA_GUI_AUTOMAP_EOB_H
Definition: str.h:59
Definition: font.h:83
Definition: system.h:166
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: detection.h:27
Definition: surface.h:67