ScummVM API documentation
party.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_PARTY_H
23 #define XEEN_PARTY_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/rect.h"
28 #include "common/serializer.h"
29 #include "xeen/character.h"
30 #include "xeen/combat.h"
31 #include "xeen/dialogs/dialogs_message.h"
32 
33 namespace Xeen {
34 
35 enum Direction {
36  DIR_NORTH = 0, DIR_EAST = 1, DIR_SOUTH = 2, DIR_WEST = 3, DIR_ALL = 4
37 };
38 
39 enum Difficulty { ADVENTURER = 0, WARRIOR = 1 };
40 
41 enum ConsumableType {
42  CONS_GOLD = 0, CONS_GEMS = 1, CONS_FOOD = 2, CONS_CONDITION = 3
43 };
44 
45 enum PartyBank {
46  WHERE_PARTY = 0, WHERE_BANK = 1
47 };
48 
49 #define TOTAL_CHARACTERS 30
50 #define XEEN_TOTAL_CHARACTERS 24
51 #define MAX_ACTIVE_PARTY 6
52 #define MAX_PARTY_COUNT 8
53 #define TOTAL_STATS 7
54 #define TOTAL_QUEST_ITEMS 85
55 #define TOTAL_QUEST_ITEMS_SWORDS 51
56 #define TOTAL_QUEST_FLAGS 56
57 #define MAX_TREASURE_ITEMS 10
58 
59 class Roster: public Common::Array<Character> {
60 public:
61  SpriteResource _charFaces[TOTAL_CHARACTERS];
62 public:
63  Roster();
64 
65  void synchronize(Common::Serializer &s);
66 };
67 
68 class Treasure {
69 public:
70  XeenItem _misc[MAX_TREASURE_ITEMS];
71  XeenItem _accessories[MAX_TREASURE_ITEMS];
72  XeenItem _armor[MAX_TREASURE_ITEMS];
73  XeenItem _weapons[MAX_TREASURE_ITEMS];
74  XeenItem *_categories[4];
75  bool _hasItems;
76  int _gems, _gold;
77 public:
78  Treasure();
79 
83  XeenItem *operator[](int category) { return _categories[category]; }
84 
88  void clear();
89 
93  void reset();
94 };
95 
99 typedef XeenItem BlacksmithItems[2][4][INV_ITEMS_TOTAL];
100 
102 private:
106  uint getSlotIndex() const;
107 
108 public:
109  BlacksmithItems _weapons;
110  BlacksmithItems _armor;
111  BlacksmithItems _accessories;
112  BlacksmithItems _misc;
113 public:
118 
122  void clear();
123 
127  void regenerate();
128 
132  BlacksmithItems &operator[](ItemCategory category);
133 
138  void blackData2CharData(Character &c);
139 
144  void charData2BlackData(Character &c);
145 
149  void synchronize(Common::Serializer &s, int ccNum);
150 };
151 
152 class Party {
153  friend class Character;
154  friend class InventoryItems;
155 private:
156  static XeenEngine *_vm;
157  Character _itemsCharacter;
158 
162  const char *getFoundForm(const Character &c);
163 
167  void giveTreasureToCharacter(Character &c, ItemCategory category, int itemIndex);
168 
172  int howMuch();
173 
177  void subPartyTime(int time);
178 
179  void resetYearlyBits();
180 
184  void giveBankInterest();
185 public:
186  // Dynamic data that's saved
187  Direction _mazeDirection;
188  Common::Point _mazePosition;
189  int _mazeId;
190  int _priorMazeId;
191  int _levitateCount;
192  bool _automapOn;
193  bool _wizardEyeActive;
194  bool _clairvoyanceActive;
195  bool _walkOnWaterActive;
196  int _blessed;
197  int _powerShield;
198  int _holyBonus;
199  int _heroism;
200  Difficulty _difficulty;
201  BlacksmithWares _blacksmithWares;
202  bool _cloudsCompleted;
203  bool _darkSideCompleted;
204  bool _worldCompleted;
205  int _ctr24; // Unused counter
206  int _day;
207  uint _year;
208  int _minutes;
209  uint _food;
210  int _lightCount;
211  int _torchCount;
212  int _fireResistence;
213  int _electricityResistence;
214  int _coldResistence;
215  int _poisonResistence;
216  int _deathCount;
217  int _winCount;
218  int _lossCount;
219  uint _gold;
220  uint _gems;
221  uint _bankGold;
222  uint _bankGems;
223  int _totalTime;
224  bool _rested;
225  bool _gameFlags[2][256];
226  bool _worldFlags[129];
227  bool _questFlags[60];
228  int _questItems[TOTAL_QUEST_ITEMS];
229  bool _characterFlags[30][32];
230 public:
231  // Other party related runtime data
232  Roster _roster;
233  CharacterArray _activeParty;
234  bool _newDay;
235  bool _isNight;
236  bool _stepped;
237  Common::Point _fallPosition;
238  int _fallMaze;
239  int _fallDamage;
240  bool _dead;
241  Treasure _treasure;
242  Treasure _savedTreasure;
243 public:
244  Party(XeenEngine *vm);
245 
249  void synchronize(Common::Serializer &s);
250 
251  void loadActiveParty();
252 
253  bool checkSkill(Skill skillId);
254 
255  bool isInParty(int charId);
256 
260  void copyPartyToRoster();
261 
266  void changeTime(int numMinutes);
267 
268  void addTime(int numMinutes);
269 
270  void resetTemps();
271 
272  void handleLight();
273 
274  int subtract(ConsumableType consumableId, uint amount, PartyBank whereId, MessageWaitType wait = WT_FREEZE_WAIT);
275 
276  const char *getConsumableForm(ConsumableType consumableId);
277 
278  void notEnough(ConsumableType consumableId, PartyBank whereId, bool mode, MessageWaitType wait);
279 
280  void checkPartyDead();
281 
285  void moveToRunLocation();
286 
290  void giveTreasure();
291 
295  bool arePacksFull() const;
296 
297  bool canShoot() const;
298 
302  bool giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int charIdx);
303 
304  /*
305  * Get gender form 'picks'
306  */
307  const char *getPickLockForm(const Character &c);
308 
309  /*
310  * Get gender form 'unable to pick'
311  */
312  const char *getUnablePickLockForm(const Character &c);
313 
317  bool giveExt(int mode1, uint val1, int mode2, uint val2, int mode3, uint val3, int charId);
318 
322  void resetBlacksmithWares();
323 
327  uint getScore();
328 };
329 
330 } // End of namespace Xeen
331 
332 #endif /* XEEN_PARTY_H */
Definition: item.h:97
Definition: array.h:52
void clear()
Definition: array.h:277
Definition: sprites.h:48
Character & operator[](size_type idx)
Definition: array.h:230
Definition: character.h:365
XeenItem BlacksmithItems[2][4][INV_ITEMS_TOTAL]
Definition: party.h:99
Definition: serializer.h:79
Definition: item.h:155
BlacksmithWares()
Definition: party.h:117
Definition: rect.h:45
Definition: party.h:59
Definition: xeen.h:100
Definition: party.h:152
XeenItem * operator[](int category)
Definition: party.h:83
Definition: party.h:68
Definition: character.h:101
Definition: party.h:101
Definition: character.h:33