ScummVM API documentation
locations.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 XEEN_LOCATIONS_H
23 #define XEEN_LOCATIONS_H
24 
25 #include "common/scummsys.h"
26 #include "common/str-array.h"
27 #include "xeen/dialogs/dialogs.h"
28 #include "xeen/dialogs/dialogs_message.h"
29 #include "xeen/party.h"
30 
31 namespace Xeen {
32 
33 enum LocationAction {
34  BANK = 0, BLACKSMITH = 1, GUILD = 2, TAVERN = 3, TEMPLE = 4,
35  TRAINING = 5, ARENA = 6, NO_ACTION = 7, REAPER = 8, GOLEM = 9,
36  DWARF_MINE = 10, SPHINX = 11, PYRAMID = 12, DWARF_TOWN = 13
37 };
38 
39 class XeenEngine;
40 
41 namespace Locations {
42 
43 class BaseLocation : public ButtonContainer {
44 protected:
45  LocationAction _locationActionId;
46  Common::Array<SpriteResource> _townSprites;
47  SpriteResource _icons1, _icons2;
48  int _townMaxId;
49  const int &_ccNum;
50  int _animFrame;
51  Common::String _vocName, _songName;
52  Common::Point _animPos;
53  int _drawFrameIndex;
54  uint _farewellTime;
55  int _drawCtr1, _drawCtr2;
56  bool _exitToUi;
57 protected:
61  void drawWindow();
62 
66  virtual Common::String createLocationText(Character &ch) { return ""; }
67 
71  virtual void drawBackground();
72 
76  virtual Character *doOptions(Character *c) { return c; }
77 
81  virtual void farewell() {}
82 public:
83  BaseLocation(LocationAction action);
84  ~BaseLocation() override;
85 
89  virtual int show();
90 
94  void drawAnim(bool flag);
95 
99  int wait();
100 };
101 
102 class BankLocation : public BaseLocation {
103 private:
107  void depositWithdrawl(PartyBank whereId);
108 protected:
113 
117  void drawBackground() override;
118 
122  Character *doOptions(Character *c) override;
123 public:
124  BankLocation();
125  ~BankLocation() override {}
126 };
127 
129 protected:
134 
138  void farewell() override;
139 
143  Character *doOptions(Character *c) override;
144 public:
146  ~BlacksmithLocation() override {}
147 };
148 
149 class GuildLocation : public BaseLocation {
150 protected:
155 
159  Character *doOptions(Character *c) override;
160 public:
161  GuildLocation();
162  ~GuildLocation() override {}
163 };
164 
165 class TavernLocation : public BaseLocation {
166 private:
167  int _v21;
168  uint _v22;
169  int _v23;
170  int _v24;
171 protected:
176 
180  void farewell() override;
181 
185  Character *doOptions(Character *c) override;
186 public:
187  TavernLocation();
188  ~TavernLocation() override {}
189 };
190 
191 class TempleLocation : public BaseLocation {
192 private:
193  int _currentCharLevel;
194  int _donation;
195  int _healCost;
196  int _uncurseCost;
197  int _dayOfWeek;
198  int _v10, _v11, _v12;
199  int _v13, _v14;
200  bool _blessed;
201  int _v5, _v6;
202 protected:
207 
211  Character *doOptions(Character *c) override;
212 public:
213  TempleLocation();
214  ~TempleLocation() override {}
215 };
216 
218 private:
219  int _charIndex;
220  bool _charsTrained[MAX_ACTIVE_PARTY];
221  uint _experienceToNextLevel;
222 protected:
226  int maxLevel() const;
227 
232 
236  Character *doOptions(Character *c) override;
237 public:
239  ~TrainingLocation() override {}
240 };
241 
242 class ArenaLocation : public BaseLocation {
243 public:
244  ArenaLocation();
245  ~ArenaLocation() override {}
246 
250  int show() override;
251 };
252 
254 protected:
255  Subtitles _subtitles;
256  int _mazeId;
257  Direction _mazeDir;
258  Common::Point _mazePos;
259  bool _keyFound;
260 protected:
264  void setNewLocation();
265 public:
266  CutsceneLocation(LocationAction action);
267 };
268 
270 private:
274  void getNewLocation();
275 public:
276  ReaperCutscene();
277  ~ReaperCutscene() override {}
278 
282  int show() override;
283 };
284 
286 private:
290  void getNewLocation();
291 public:
292  GolemCutscene();
293  ~GolemCutscene() override {}
294 
298  int show() override;
299 };
300 
302 private:
306  void getNewLocation();
307 public:
308  DwarfCutscene();
309  ~DwarfCutscene() override {}
310 
314  int show() override;
315 };
316 
318 private:
322  void getNewLocation();
323 public:
324  SphinxCutscene();
325  ~SphinxCutscene() override {}
326 
330  int show() override;
331 };
332 
334 public:
335  PyramidLocation();
336  ~PyramidLocation() override {}
337 
341  int show() override;
342 };
343 
344 } // End of namespace Locations
345 
347 private:
348  SpriteResource _iconSprites;
349 
351 
352  bool execute(int portrait, const Common::String &name,
353  const Common::String &text, int confirm);
354 
355  void loadButtons();
356 public:
357  static bool show(int portrait, const Common::String &name,
358  const Common::String &text, int confirm);
359 };
360 
362 private:
363  Locations::BaseLocation *_location;
364 public:
365  LocationManager();
366 
370  int doAction(int actionId);
371 
375  bool isActive() const;
376 
380  void drawAnim(bool flag);
381 
385  int wait();
386 };
387 
388 } // End of namespace Xeen
389 
390 #endif /* XEEN_LOCATIONS_H */
Definition: locations.h:217
Definition: str.h:59
virtual void farewell()
Definition: locations.h:81
Definition: locations.h:43
Definition: locations.h:317
Definition: array.h:52
Definition: locations.h:242
Definition: sprites.h:48
Definition: locations.h:333
Definition: locations.h:102
Definition: subtitles.h:30
Definition: locations.h:149
Definition: locations.h:253
Definition: locations.h:128
Definition: locations.h:269
Definition: locations.h:191
Definition: locations.h:361
Definition: locations.h:346
Definition: rect.h:45
Definition: locations.h:301
Definition: locations.h:165
Definition: character.h:101
virtual Common::String createLocationText(Character &ch)
Definition: locations.h:66
Definition: locations.h:285
virtual Character * doOptions(Character *c)
Definition: locations.h:76
Definition: character.h:33
Definition: dialogs.h:73