1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* MIT License:
*
* Copyright (c) 2009 Alexei Svitkine, Eugene Sandulenko
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef WAGE_ENTITIES_H
#define WAGE_ENTITIES_H
namespace Graphics {
class ManagedSurface;
}
namespace Wage {
class Design;
class Script;
enum StatVariable {
/** The base physical accuracy of the player. */
PHYS_ACC_BAS = 0,
/** The current physical accuracy of the player. */
PHYS_ACC_CUR = 1,
/** The base physical armor of the player. */
PHYS_ARM_BAS = 2,
/** The current physical armor of the player. */
PHYS_ARM_CUR = 3,
/** The base physical hit points of the player. */
PHYS_HIT_BAS = 4,
/** The current physical hit points of the player. */
PHYS_HIT_CUR = 5,
/** The base physical speed of the player. */
PHYS_SPE_BAS = 6,
/** The current physical speed of the player. */
PHYS_SPE_CUR = 7,
/** The base physical strength of the player. */
PHYS_STR_BAS = 8,
/** The current physical strength of the player. */
PHYS_STR_CUR = 9,
/** The base spiritual accuracy of the player. */
SPIR_ACC_BAS = 10,
/** The current spiritual accuracy of the player. */
SPIR_ACC_CUR = 11,
/** The base spiritual armor of the player. */
SPIR_ARM_BAS = 12,
/** The current spiritual armor of the player. */
SPIR_ARM_CUR = 13,
/** The base spiritual hit points of the player. */
SPIR_HIT_BAS = 14,
/** The current spiritual hit points of the player. */
SPIR_HIT_CUR = 15,
/** The base spiritual strength of the player. */
SPIR_STR_BAS = 16,
/** The current spiritual strength of the player. */
SPIR_STR_CUR = 17
};
class Context {
public:
Context();
int16 _visits; // Number of scenes visited, including repeated visits
int16 _kills; // Number of characters killed
int16 _experience;
bool _frozen;
int16 _userVariables[26 * 9];
int16 _statVariables[18];
};
class Designed {
public:
Designed() : _design(NULL), _designBounds(NULL), _classType(UNKNOWN) {}
~Designed();
Common::String _name;
Design *_design;
Common::Rect *_designBounds;
OperandType _classType;
Common::Rect *getDesignBounds() {
return _designBounds == NULL ? NULL : new Common::Rect(*_designBounds);
}
void setDesignBounds(Common::Rect *bounds);
Common::String toString() { if (!this) return "<NULL>"; return _name; }
};
class Chr : public Designed {
public:
enum ChrDestination {
RETURN_TO_STORAGE = 0,
RETURN_TO_RANDOM_SCENE = 1,
RETURN_TO_INITIAL_SCENE = 2
};
enum ChrPart {
HEAD = 0,
CHEST = 1,
SIDE = 2
};
enum ChrArmorType {
HEAD_ARMOR = 0,
BODY_ARMOR = 1,
SHIELD_ARMOR = 2,
MAGIC_ARMOR = 3,
NUMBER_OF_ARMOR_TYPES = 4
};
Chr(Common::String name, Common::SeekableReadStream *data);
int _index;
Common::String _initialScene;
int _gender;
bool _nameProperNoun;
bool _playerCharacter;
uint _maximumCarriedObjects;
int _returnTo;
int _physicalStrength;
int _physicalHp;
int _naturalArmor;
int _physicalAccuracy;
int _spiritualStength;
int _spiritialHp;
int _resistanceToMagic;
int _spiritualAccuracy;
int _runningSpeed;
uint _rejectsOffers;
int _followsOpponent;
Common::String _initialSound;
Common::String _scoresHitSound;
Common::String _receivesHitSound;
Common::String _dyingSound;
Common::String _nativeWeapon1;
Common::String _operativeVerb1;
int _weaponDamage1;
Common::String _weaponSound1;
Common::String _nativeWeapon2;
Common::String _operativeVerb2;
int _weaponDamage2;
Common::String _weaponSound2;
int _winningWeapons;
int _winningMagic;
int _winningRun;
int _winningOffer;
int _losingWeapons;
int _losingMagic;
int _losingRun;
int _losingOffer;
Common::String _initialComment;
Common::String _scoresHitComment;
Common::String _receivesHitComment;
Common::String _makesOfferComment;
Common::String _rejectsOfferComment;
Common::String _acceptsOfferComment;
Common::String _dyingWords;
Scene *_currentScene;
ObjArray _inventory;
Obj *_armor[NUMBER_OF_ARMOR_TYPES];
Context _context;
ObjArray *getWeapons(bool includeMagic);
ObjArray *getMagicalObjects();
const char *getDefiniteArticle(bool capitalize);
Obj *_weapon1;
Obj *_weapon2;
public:
int wearObjIfPossible(Obj *obj);
void wearObjs();
void resetState();
bool isWearing(Obj *obj);
};
class Obj : public Designed {
public:
Obj();
Obj(Common::String name, Common::SeekableReadStream *data);
~Obj();
enum ObjectType {
REGULAR_WEAPON = 1,
THROW_WEAPON = 2,
MAGICAL_OBJECT = 3,
HELMET = 4,
SHIELD = 5,
CHEST_ARMOR = 6,
SPIRITUAL_ARMOR = 7,
MOBILE_OBJECT = 8,
IMMOBILE_OBJECT = 9
};
enum AttackType {
CAUSES_PHYSICAL_DAMAGE = 0,
CAUSES_SPIRITUAL_DAMAGE = 1,
CAUSES_PHYSICAL_AND_SPIRITUAL_DAMAGE = 2,
HEALS_PHYSICAL_DAMAGE = 3,
HEALS_SPIRITUAL_DAMAGE = 4,
HEALS_PHYSICAL_AND_SPIRITUAL_DAMAGE = 5,
FREEZES_OPPONENT = 6
};
public:
int _index;
bool _namePlural;
uint _value;
int _attackType;
int _numberOfUses;
bool _returnToRandomScene;
Common::String _sceneOrOwner;
Common::String _clickMessage;
Common::String _failureMessage;
Common::String _useMessage;
Scene *_currentScene;
Chr *_currentOwner;
int _type;
uint _accuracy;
Common::String _operativeVerb;
int _damage;
Common::String _sound;
public:
void setCurrentOwner(Chr *currentOwner) {
_currentOwner = currentOwner;
if (currentOwner != NULL)
_currentScene = NULL;
}
void setCurrentScene(Scene *currentScene) {
_currentScene = currentScene;
if (currentScene != NULL)
_currentOwner = NULL;
}
Chr *removeFromChr();
Designed *removeFromCharOrScene();
void resetState(Chr *owner, Scene *scene);
};
class Scene : public Designed {
public:
enum SceneTypes {
PERIODIC = 0,
RANDOM = 1
};
Script *_script;
Common::String _text;
Common::Rect *_textBounds;
int _fontSize;
int _fontType; // 3 => Geneva, 22 => Courier, param to TextFont() function
bool _blocked[4];
Common::String _messages[4];
int _soundFrequency; // times a minute, max 3600
int _soundType;
Common::String _soundName;
int _worldX;
int _worldY;
bool _visited;
ObjList _objs;
ChrList _chrs;
Scene();
Scene(Common::String name, Common::SeekableReadStream *data);
~Scene();
Designed *lookUpEntity(int x, int y);
Common::Rect *getTextBounds() {
return _textBounds == NULL ? NULL : new Common::Rect(*_textBounds);
}
void paint(Graphics::ManagedSurface *screen, int x, int y);
const char *getFontName();
};
} // End of namespace Wage
#endif
|