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 "mm/xeen/character.h"
30#include "mm/xeen/combat.h"
31#include "mm/xeen/dialogs/dialogs_message.h"
32
33namespace MM {
34namespace Xeen {
35
36enum Direction {
37 DIR_NORTH = 0, DIR_EAST = 1, DIR_SOUTH = 2, DIR_WEST = 3, DIR_ALL = 4
38};
39
40enum Difficulty {
41 ADVENTURER = 0, WARRIOR = 1
42};
43
44enum ConsumableType {
45 CONS_GOLD = 0, CONS_GEMS = 1, CONS_FOOD = 2, CONS_CONDITION = 3
46};
47
48enum PartyBank {
49 WHERE_PARTY = 0, WHERE_BANK = 1
50};
51
52#define TOTAL_CHARACTERS 30
53#define XEEN_TOTAL_CHARACTERS 24
54#define MAX_ACTIVE_PARTY 6
55#define MAX_PARTY_COUNT 8
56#define TOTAL_STATS 7
57#define TOTAL_QUEST_ITEMS 85
58#define TOTAL_QUEST_ITEMS_SWORDS 51
59#define TOTAL_QUEST_FLAGS 56
60#define MAX_TREASURE_ITEMS 10
61
62class Roster : public Common::Array<Character> {
63public:
64 SpriteResource _charFaces[TOTAL_CHARACTERS];
65public:
66 Roster();
67
68 void synchronize(Common::Serializer &s);
69};
70
71class Treasure {
72public:
73 XeenItem _misc[MAX_TREASURE_ITEMS];
74 XeenItem _accessories[MAX_TREASURE_ITEMS];
75 XeenItem _armor[MAX_TREASURE_ITEMS];
76 XeenItem _weapons[MAX_TREASURE_ITEMS];
77 XeenItem *_categories[4];
78 bool _hasItems;
79 int _gems, _gold;
80public:
81 Treasure();
82
86 XeenItem *operator[](int category) {
87 return _categories[category];
88 }
89
93 void clear();
94
98 void reset();
99};
100
104typedef XeenItem BlacksmithItems[2][4][INV_ITEMS_TOTAL];
105
107private:
111 uint getSlotIndex() const;
112
113public:
114 BlacksmithItems _weapons;
115 BlacksmithItems _armor;
116 BlacksmithItems _accessories;
117 BlacksmithItems _misc;
118public:
123 clear();
124 }
125
129 void clear();
130
135
139 BlacksmithItems &operator[](ItemCategory category);
140
146
152
156 void synchronize(Common::Serializer &s, int ccNum);
157};
158
159class Party {
160 friend class Character;
161 friend class InventoryItems;
162private:
163 static XeenEngine *_vm;
164 Character _itemsCharacter;
165
169 const char *getFoundForm(const Character &c);
170
174 void giveTreasureToCharacter(Character &c, ItemCategory category, int itemIndex);
175
179 int howMuch();
180
184 void subPartyTime(int time);
185
186 void resetYearlyBits();
187
191 void giveBankInterest();
192public:
193 // Dynamic data that's saved
194 Direction _mazeDirection;
195 Common::Point _mazePosition;
196 int _mazeId;
197 int _priorMazeId;
198 int _levitateCount;
199 bool _automapOn;
200 bool _wizardEyeActive;
201 bool _clairvoyanceActive;
202 bool _walkOnWaterActive;
203 int _blessed;
204 int _powerShield;
205 int _holyBonus;
206 int _heroism;
207 Difficulty _difficulty;
208 BlacksmithWares _blacksmithWares;
209 bool _cloudsCompleted;
210 bool _darkSideCompleted;
211 bool _worldCompleted;
212 int _ctr24; // Unused counter
213 int _day;
214 uint _year;
215 int _minutes;
216 uint _food;
217 int _lightCount;
218 int _torchCount;
219 int _fireResistance;
220 int _electricityResistance;
221 int _coldResistance;
222 int _poisonResistance;
223 int _deathCount;
224 int _winCount;
225 int _lossCount;
226 uint _gold;
227 uint _gems;
228 uint _bankGold;
229 uint _bankGems;
230 int _totalTime;
231 bool _rested;
232 bool _gameFlags[2][256];
233 bool _worldFlags[129];
234 bool _questFlags[60];
235 int _questItems[TOTAL_QUEST_ITEMS];
236 bool _characterFlags[30][32];
237public:
238 // Other party related runtime data
239 Roster _roster;
240 CharacterArray _activeParty;
241 bool _newDay;
242 bool _isNight;
243 bool _stepped;
244 Common::Point _fallPosition;
245 int _fallMaze;
246 int _fallDamage;
247 bool _dead;
248 Treasure _treasure;
249 Treasure _savedTreasure;
250public:
251 Party(XeenEngine *vm);
252
257
258 void loadActiveParty();
259
260 bool checkSkill(Skill skillId);
261
262 bool isInParty(int charId);
263
268
273 void changeTime(int numMinutes);
274
275 void addTime(int numMinutes);
276
277 void resetTemps();
278
279 void handleLight();
280
281 int subtract(ConsumableType consumableId, uint amount, PartyBank whereId, MessageWaitType wait = WT_FREEZE_WAIT);
282
283 const char *getConsumableForm(ConsumableType consumableId);
284
285 void notEnough(ConsumableType consumableId, PartyBank whereId, bool mode, MessageWaitType wait);
286
287 void checkPartyDead();
288
293
298
302 bool arePacksFull() const;
303
304 bool canShoot() const;
305
309 bool giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int charIdx);
310
311 /*
312 * Get gender form 'picks'
313 */
314 const char *getPickLockForm(const Character &c);
315
316 /*
317 * Get gender form 'unable to pick'
318 */
319 const char *getUnablePickLockForm(const Character &c);
320
324 bool giveExt(int mode1, uint val1, int mode2, uint val2, int mode3, uint val3, int charId);
325
330
334 uint getScore();
335};
336
337} // End of namespace Xeen
338} // End of namespace MM
339
340#endif
Definition: array.h:52
Definition: serializer.h:80
Definition: sprites.h:52
Definition: party.h:106
void synchronize(Common::Serializer &s, int ccNum)
void blackData2CharData(Character &c)
BlacksmithWares()
Definition: party.h:122
BlacksmithItems & operator[](ItemCategory category)
void charData2BlackData(Character &c)
Definition: character.h:374
Definition: character.h:106
Definition: item.h:175
Definition: party.h:159
void changeTime(int numMinutes)
void moveToRunLocation()
void copyPartyToRoster()
void synchronize(Common::Serializer &s)
bool giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int charIdx)
bool giveExt(int mode1, uint val1, int mode2, uint val2, int mode3, uint val3, int charId)
void resetBlacksmithWares()
bool arePacksFull() const
Definition: party.h:62
Definition: party.h:71
XeenItem * operator[](int category)
Definition: party.h:86
Definition: xeen.h:107
Definition: item.h:111
Definition: detection.h:27
Definition: rect.h:144