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 "mm/xeen/dialogs/dialogs.h"
28 #include "mm/xeen/dialogs/dialogs_message.h"
29 #include "mm/xeen/party.h"
30 
31 namespace MM {
32 namespace Xeen {
33 
34 enum LocationAction {
35  BANK = 0, BLACKSMITH = 1, GUILD = 2, TAVERN = 3, TEMPLE = 4,
36  TRAINING = 5, ARENA = 6, NO_ACTION = 7, REAPER = 8, GOLEM = 9,
37  DWARF_MINE = 10, SPHINX = 11, PYRAMID = 12, DWARF_TOWN = 13
38 };
39 
40 class XeenEngine;
41 
42 namespace Locations {
43 
44 class BaseLocation : public ButtonContainer {
45 protected:
46  LocationAction _locationActionId;
47  Common::Array<SpriteResource> _townSprites;
48  SpriteResource _icons1, _icons2;
49  int _townMaxId;
50  const int &_ccNum;
51  int _animFrame;
52  Common::Path _vocName, _songName;
53  Common::Point _animPos;
54  int _drawFrameIndex;
55  uint _farewellTime;
56  int _drawCtr1, _drawCtr2;
57  bool _exitToUi;
58  bool _ttsVoiceText;
59 #ifdef USE_TTS
60  bool _resetText;
61 #endif
62 protected:
66  void drawWindow();
67 
72  return "";
73  }
74 
78  virtual void drawBackground();
79 
83  virtual Character *doOptions(Character *c) {
84  return c;
85  }
86 
87 #ifdef USE_TTS
88  virtual void speakTextAndButtons(const Common::String &text) { }
89 #endif
90 
94  virtual void farewell() {
95  }
96 public:
97  BaseLocation(LocationAction action);
98  ~BaseLocation() override;
99 
103  virtual int show();
104 
108  void drawAnim(bool flag);
109 
113  int wait();
114 };
115 
116 class BankLocation : public BaseLocation {
117 private:
121  void depositWithdrawl(PartyBank whereId);
122 
123 #ifdef USE_TTS
124 
128  void speakTextAndButtons(const Common::String &text) override;
129 
135  void speakDepositWithdrawalText(const Common::String &text, Common::String oldButtonTexts[]);
136 #endif
137 protected:
142 
146  void drawBackground() override;
147 
151  Character *doOptions(Character *c) override;
152 public:
153  BankLocation();
154  ~BankLocation() override {
155  }
156 };
157 
159 private:
160 #ifdef USE_TTS
161 
165  void speakTextAndButtons(const Common::String &text) override;
166 #endif
167 protected:
172 
176  void farewell() override;
177 
181  Character *doOptions(Character *c) override;
182 public:
184  ~BlacksmithLocation() override {
185  }
186 };
187 
188 class GuildLocation : public BaseLocation {
189 private:
190 #ifdef USE_TTS
191 
195  void speakTextAndButtons(const Common::String &text) override;
196 #endif
197 protected:
202 
206  Character *doOptions(Character *c) override;
207 public:
208  GuildLocation();
209  ~GuildLocation() override {
210  }
211 };
212 
213 class TavernLocation : public BaseLocation {
214 private:
215 #ifdef USE_TTS
216 
220  void speakTextAndButtons(const Common::String &text) override;
221 
226  void speakNotificationText(const Common::String &text) const;
227 #endif
228 private:
229  int _v21;
230  uint _v22;
231  int _v23;
232  int _v24;
233 protected:
238 
242  void farewell() override;
243 
247  Character *doOptions(Character *c) override;
248 public:
249  TavernLocation();
250  ~TavernLocation() override {
251  }
252 };
253 
254 class TempleLocation : public BaseLocation {
255 private:
256 #ifdef USE_TTS
257 
261  void speakTextAndButtons(const Common::String &text) override;
262 #endif
263 private:
264  int _currentCharLevel;
265  int _donation;
266  int _healCost;
267  int _uncurseCost;
268  int _dayOfWeek;
269  int _v10, _v11, _v12;
270  int _v13, _v14;
271  bool _blessed;
272  int _v5, _v6;
273 protected:
278 
282  Character *doOptions(Character *c) override;
283 public:
284  TempleLocation();
285  ~TempleLocation() override {
286  }
287 };
288 
290 private:
291 #ifdef USE_TTS
292 
296  void speakTextAndButtons(const Common::String &text) override;
297 #endif
298 private:
299  int _charIndex;
300  bool _charsTrained[MAX_ACTIVE_PARTY];
301  uint _experienceToNextLevel;
302 protected:
306  int maxLevel() const;
307 
312 
316  Character *doOptions(Character *c) override;
317 public:
319  ~TrainingLocation() override {
320  }
321 };
322 
323 class ArenaLocation : public BaseLocation {
324 public:
325  ArenaLocation();
326  ~ArenaLocation() override {
327  }
328 
332  int show() override;
333 };
334 
336 protected:
337  Subtitles _subtitles;
338  int _mazeId;
339  Direction _mazeDir;
340  Common::Point _mazePos;
341  bool _keyFound;
342 protected:
346  void setNewLocation();
347 public:
348  CutsceneLocation(LocationAction action);
349 };
350 
352 private:
356  void getNewLocation();
357 public:
358  ReaperCutscene();
359  ~ReaperCutscene() override {
360  }
361 
365  int show() override;
366 };
367 
369 private:
373  void getNewLocation();
374 public:
375  GolemCutscene();
376  ~GolemCutscene() override {
377  }
378 
382  int show() override;
383 };
384 
386 private:
390  void getNewLocation();
391 public:
392  DwarfCutscene();
393  ~DwarfCutscene() override {
394  }
395 
399  int show() override;
400 };
401 
403 private:
407  void getNewLocation();
408 public:
409  SphinxCutscene();
410  ~SphinxCutscene() override {
411  }
412 
416  int show() override;
417 };
418 
420 public:
421  PyramidLocation();
422  ~PyramidLocation() override {
423  }
424 
428  int show() override;
429 };
430 
431 } // End of namespace Locations
432 
434 private:
435  SpriteResource _iconSprites;
436 
438  setWaitBounds();
439  }
440 
441  bool execute(int portrait, const Common::String &name,
442  const Common::String &text, int confirm);
443 
444  void loadButtons();
445 
446 #ifdef USE_TTS
447  void speakText(const Common::String &text, const Common::String &name, bool voiceName) const;
448 #endif
449 public:
450  static bool showMessage(int portrait, const Common::String &name,
451  const Common::String &text, int confirm);
452 };
453 
455 private:
456  Locations::BaseLocation *_location;
457 public:
458  LocationManager();
459 
463  int doAction(int actionId);
464 
468  bool isActive() const;
469 
473  void drawAnim(bool flag);
474 
478  int wait();
479 };
480 
481 } // End of namespace Xeen
482 } // End of namespace MM
483 
484 #endif
Definition: str.h:59
Definition: locations.h:289
Definition: array.h:52
Definition: sprites.h:52
virtual Common::String createLocationText(Character &ch)
Definition: locations.h:71
Definition: locations.h:351
Definition: subtitles.h:31
Definition: locations.h:158
Definition: path.h:52
virtual void farewell()
Definition: locations.h:94
Definition: locations.h:368
Definition: locations.h:433
Definition: locations.h:323
Definition: locations.h:44
Definition: locations.h:419
Definition: locations.h:402
Definition: character.h:106
Definition: detection.h:27
Definition: rect.h:144
Definition: locations.h:335
Definition: dialogs.h:88
Definition: locations.h:116
Definition: locations.h:385
Definition: locations.h:254
virtual Character * doOptions(Character *c)
Definition: locations.h:83
Definition: locations.h:454
Definition: locations.h:213
Definition: locations.h:188