-
Notifications
You must be signed in to change notification settings - Fork 0
/
AVA.HXX
548 lines (431 loc) · 10.5 KB
/
AVA.HXX
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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
// ===========================================================================
//
// AVA.HXX
//
// Class to read/write AVA file data.
//
// ===========================================================================
#if !defined (_AVA_HXX_)
#define _AVA_HXX_
#include "alignmnt.hxx"
#include "gamemap.hxx"
#include "main.hxx"
#include "scene.hxx"
#include "playclas.hxx"
#include "appear.hxx"
#include "bloodreq.hxx"
#include "playstat.hxx"
#include "chared.hxx"
class AVA_FILE {
public:
enum {
_MAX_REALM = 64
};
private:
// Data
LONG fFileVersion;
THINGTYPE fThingType;
LONG fStatsVersion;
LONG fStrength;
LONG fDexterity;
LONG fConstitution;
LONG fIntelligence;
LONG fWisdom;
LONG fCharisma;
LONG fRace;
char fszName[MAX_NAME_LEN + 1];
LONG fTitle;
LONG fDescription;
LONG fAlignment;
LONG fHitPoints;
LONG fArmorClass;
LONG fArmorType;
LONG fWeapon;
LONG fMorale;
LONG fTotalHitPoints;
LONG fTHAC0;
LONG fDamageDice[6];
LONG fHitDice[3];
LONG fExperience;
LONG fClass1[3];
LONG fClass2[3];
LONG fAttacksPerRound;
LONG fBloodlineGrade;
LONG fBloodlineDerivation;
LONG fBloodlineStrength;
// Store selected realm name; just for reference, not for AVA file.
char fszRealmName[AVA_FILE::_MAX_REALM + 1];
public:
// Not from AVA file; used to determine available spells when we go
// to the inventory dialog. (Reflects current selection.)
LONG m_class1;
LONG m_level1;
LONG m_class2;
LONG m_level2;
// Functions
LONG mfReadTextData (FILE *fp);
LONG mfWriteTextData (FILE *fp);
// Get member variables.
/*inline THINGTYPE mfGetThingType() const;
inline LONG mfGetStrength () const;
inline LONG mfGetDexterity () const;
inline LONG mfGetConstitution () const;
inline LONG mfGetIntelligence () const;
inline LONG mfGetWisdom () const;
inline LONG mfGetCharisma () const;
inline LONG mfGetRace () const;
inline char * mfGetName ();
inline LONG mfGetTitle () const;
inline LONG mfGetDescription () const;
inline LONG mfGetAlignment () const;
inline LONG mfGetHitPoints () const;
inline LONG mfGetArmorClass () const;
inline LONG mfGetArmorType () const;
inline LONG mfGetWeapon () const;
inline LONG mfGetMorale () const;
inline LONG mfGetTotalHitPoints () const;
inline LONG mfGetTHAC0 () const;
// Damage dice?
// Hit dice?
inline LONG mfGetExperience () const;
inline LONG mfGetClass1 () const;
inline LONG mfGetClass1Level () const;
inline LONG mfGetClass1Experience () const;
inline LONG mfGetClass2 () const;
inline LONG mfGetClass2Level () const;
inline LONG mfGetClass2Experience () const;
inline LONG mfGetAttacksPerRound () const;
inline LONG mfGetBloodlineGrade () const;
inline LONG mfGetBloodlineDerivation () const;
inline LONG mfGetBloodlineStrength () const;
// Set member variables.
inline void mfSetThingType (THINGTYPE thingType);
inline void mfSetStrength (LONG newVal);
inline void mfSetDexterity (LONG newVal);
inline void mfSetConstitution (LONG newVal);
inline void mfSetIntelligence (LONG newVal);
inline void mfSetWisdom (LONG newVal);
inline void mfSetCharisma (LONG newVal);
inline void mfSetRace (LONG newVal);
inline void mfSetName (char * szName);
inline void mfSetTitle (LONG newVal);
inline void mfSetDescription (LONG newVal);
inline void mfSetAlignment (LONG newVal);
inline void mfSetHitPoints (LONG newVal);
inline void mfSetArmorClass (LONG newVal);
inline void mfSetArmorType (LONG newVal);
inline void mfSetWeapon (LONG newVal);
inline void mfSetMorale (LONG newVal);
inline void mfSetTotalHitPoints (LONG newVal);
inline void mfSetTHAC0 (LONG newVal);
// Damage dice?
// Hit dice?
inline void mfSetExperience (LONG newVal);
inline void mfSetClass1 (LONG newVal);
inline void mfSetClass1Level (LONG newVal);
inline void mfSetClass1Experience (LONG newVal);
inline void mfSetClass2 (LONG newVal);
inline void mfSetClass2Level (LONG newVal);
inline void mfSetClass2Experience (LONG newVal);
inline void mfSetAttacksPerRound (LONG newVal);
inline void mfSetBloodlineGrade (LONG newVal);
inline void mfSetBloodlineDerivation (LONG newVal);
inline void mfSetBloodlineStrength (LONG newVal);
// Functions dealing with temporary data (not saved in the AVA file).
// Get/set character flags.
inline BOOL mfIsWizard ();
inline BOOL mfIsBard ();
inline BOOL mfIsWizardOrBard ();
inline LONG mfGetWizardLevel ();
inline LONG mfGetBardLevel ();
// Get/set realm name (just for printing in the dialog for
// user's convenient reference).
inline void mfSetRealmName (char * szName);
inline char * mfGetRealmName ();*/
// ---------------------------------------------------------------------------
// "GET" functions.
inline THINGTYPE AVA_FILE::mfGetThingType() const
{
return fThingType;
}
inline char * AVA_FILE::mfGetName()
{
return fszName;
}
inline LONG AVA_FILE::mfGetTitle () const
{
return fTitle;
}
inline LONG AVA_FILE::mfGetRace () const
{
return fRace;
}
inline LONG AVA_FILE::mfGetClass1 () const
{
return fClass1[0];
}
inline LONG AVA_FILE::mfGetClass1Level () const
{
return fClass1[1];
}
inline LONG AVA_FILE::mfGetClass1Experience () const
{
return fClass1[2];
}
inline LONG AVA_FILE::mfGetClass2 () const
{
// Can return -1, meaning there is no class 2.
return fClass2[0];
}
inline LONG AVA_FILE::mfGetClass2Level () const
{
return fClass2[1];
}
inline LONG AVA_FILE::mfGetClass2Experience () const
{
return fClass2[2];
}
inline LONG AVA_FILE::mfGetStrength () const
{
return fStrength;
}
inline LONG AVA_FILE::mfGetIntelligence () const
{
return fIntelligence;
}
inline LONG AVA_FILE::mfGetDexterity () const
{
return fDexterity;
}
inline LONG AVA_FILE::mfGetWisdom () const
{
return fWisdom;
}
inline LONG AVA_FILE::mfGetConstitution () const
{
return fConstitution;
}
inline LONG AVA_FILE::mfGetCharisma () const
{
return fCharisma;
}
inline LONG AVA_FILE::mfGetTHAC0 () const
{
return fTHAC0;
}
inline LONG AVA_FILE::mfGetAlignment () const
{
return fAlignment;
}
inline LONG AVA_FILE::mfGetHitPoints () const
{
return fHitPoints;
}
inline LONG AVA_FILE::mfGetArmorClass () const
{
return fArmorClass;
}
inline LONG AVA_FILE::mfGetArmorType () const
{
return fArmorType;
}
inline LONG AVA_FILE::mfGetWeapon () const
{
return fWeapon;
}
inline LONG AVA_FILE::mfGetMorale () const
{
return fMorale;
}
inline LONG AVA_FILE::mfGetTotalHitPoints () const
{
return fTotalHitPoints;
}
inline LONG AVA_FILE::mfGetExperience () const
{
// TODO: Figure out how fExperience relates to class experience. I suppose
// they might be the same things, or related somehow?
return fExperience;
}
inline LONG AVA_FILE::mfGetAttacksPerRound () const
{
return fAttacksPerRound;
}
inline LONG AVA_FILE::mfGetBloodlineGrade () const
{
return fBloodlineGrade;
}
inline LONG AVA_FILE::mfGetBloodlineDerivation () const
{
return fBloodlineDerivation;
}
inline LONG AVA_FILE::mfGetBloodlineStrength () const
{
return fBloodlineStrength;
}
// ---------------------------------------------------------------------------
// "SET" functions.
inline void AVA_FILE::mfSetThingType (THINGTYPE thingType)
{
fThingType = thingType;
}
inline void AVA_FILE::mfSetStrength (LONG newVal)
{
fStrength = newVal;
}
inline void AVA_FILE::mfSetDexterity (LONG newVal)
{
fDexterity = newVal;
}
inline void AVA_FILE::mfSetConstitution (LONG newVal)
{
fConstitution = newVal;
}
inline void AVA_FILE::mfSetIntelligence (LONG newVal)
{
fIntelligence = newVal;
}
inline void AVA_FILE::mfSetWisdom (LONG newVal)
{
fWisdom = newVal;
}
inline void AVA_FILE::mfSetCharisma (LONG newVal)
{
fCharisma = newVal;
}
inline void AVA_FILE::mfSetRace (LONG newVal)
{
fRace = newVal;
}
inline void AVA_FILE::mfSetName (char * szNewName)
{
strncpy (fszName, szNewName, MAX_NAME_LEN);
}
inline void AVA_FILE::mfSetTitle (LONG newVal)
{
fTitle = newVal;
}
inline void AVA_FILE::mfSetDescription (LONG newVal)
{
fDescription = newVal;
}
inline void AVA_FILE::mfSetAlignment (LONG newVal)
{
fAlignment = newVal;
}
inline void AVA_FILE::mfSetHitPoints (LONG newVal)
{
fHitPoints = newVal;
}
inline void AVA_FILE::mfSetArmorClass (LONG newVal)
{
fArmorClass = newVal;
}
inline void AVA_FILE::mfSetArmorType (LONG newVal)
{
fArmorType = newVal;
}
inline void AVA_FILE::mfSetWeapon (LONG newVal)
{
fWeapon = newVal;
}
inline void AVA_FILE::mfSetMorale (LONG newVal)
{
fMorale = newVal;
}
inline void AVA_FILE::mfSetTotalHitPoints (LONG newVal)
{
fTotalHitPoints = newVal;
}
inline void AVA_FILE::mfSetTHAC0 (LONG newVal)
{
fTHAC0 = newVal;
}
inline void AVA_FILE::mfSetExperience (LONG newVal)
{
fExperience = newVal;
}
inline void AVA_FILE::mfSetClass1 (LONG newVal)
{
fClass1[0] = newVal;
}
inline void AVA_FILE::mfSetClass1Level (LONG newVal)
{
fClass1[1] = newVal;
}
inline void AVA_FILE::mfSetClass1Experience (LONG newVal)
{
fClass1[2] = newVal;
}
inline void AVA_FILE::mfSetClass2 (LONG newVal)
{
fClass2[0] = newVal;
}
inline void AVA_FILE::mfSetClass2Level (LONG newVal)
{
fClass2[1] = newVal;
}
inline void AVA_FILE::mfSetClass2Experience (LONG newVal)
{
fClass2[2] = newVal;
}
inline void AVA_FILE::mfSetAttacksPerRound (LONG newVal)
{
fAttacksPerRound = newVal;
}
inline void AVA_FILE::mfSetBloodlineGrade (LONG iGrade)
{
fBloodlineGrade = iGrade;
}
inline void AVA_FILE::mfSetBloodlineDerivation (LONG iDerivation)
{
fBloodlineDerivation = iDerivation;
}
inline void AVA_FILE::mfSetBloodlineStrength (LONG iStrength)
{
fBloodlineStrength = iStrength;
}
// ---------------------------------------------------------------------------
// Misc. functions
inline BOOL AVA_FILE::mfIsWizard ()
{
return m_class1 == CLASS_WIZARD || m_class2 == CLASS_WIZARD;
}
inline BOOL AVA_FILE::mfIsBard ()
{
return m_class1 == CLASS_BARD || m_class2 == CLASS_BARD;
}
inline BOOL AVA_FILE::mfIsWizardOrBard ()
{
return mfIsWizard () || mfIsBard ();
}
inline void AVA_FILE::mfSetRealmName (char * szName)
{
strncpy (fszRealmName, szName, AVA_FILE::_MAX_REALM);
}
inline char * AVA_FILE::mfGetRealmName ()
{
return fszRealmName;
}
inline LONG AVA_FILE::mfGetWizardLevel ()
{
LONG level1 = 0;
LONG level2 = 0;
if (m_class1 == CLASS_WIZARD)
level1 = m_level1;
if (m_class2 == CLASS_WIZARD)
level2 = m_level2;
return MAX (level1, level2);
}
inline LONG AVA_FILE::mfGetBardLevel ()
{
LONG level1 = 0;
LONG level2 = 0;
if (m_class1 == CLASS_BARD)
level1 = m_level1;
if (m_class2 == CLASS_BARD)
level2 = m_level2;
return MAX (level1, level2);
}
};
#endif