forked from diasurgical/devilutionX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
structs.h
485 lines (436 loc) · 12.1 KB
/
structs.h
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
/**
* @file structs.h
*
* Various global structures.
*/
DEVILUTION_BEGIN_NAMESPACE
//////////////////////////////////////////////////
// textdat
//////////////////////////////////////////////////
typedef struct TextDataStruct {
const char *txtstr;
int scrlltxt;
int txtspd; /* calculated dynamically, 01/23/21 */
int sfxnr;
} TextDataStruct;
//////////////////////////////////////////////////
// effects/sound
//////////////////////////////////////////////////
typedef struct TSnd {
const char *sound_path;
SoundSample *DSB;
int start_tc;
} TSnd;
typedef struct TSFX {
unsigned char bFlags;
const char *pszName;
TSnd *pSnd;
} TSFX;
//////////////////////////////////////////////////
// monster
//////////////////////////////////////////////////
typedef struct AnimStruct {
BYTE *CMem;
BYTE *Data[8];
int Frames;
int Rate;
} AnimStruct;
typedef struct MonsterData {
int width;
int mImage;
const char *GraphicType;
BOOL has_special;
const char *sndfile;
BOOL snd_special;
BOOL has_trans;
const char *TransFile;
int Frames[6];
int Rate[6];
const char *mName;
char mMinDLvl;
char mMaxDLvl;
char mLevel;
int mMinHP;
int mMaxHP;
char mAi;
int mFlags;
unsigned char mInt;
unsigned short mHit; // BUGFIX: Some monsters overflow this value on high difficultys (fixed)
unsigned char mAFNum;
unsigned char mMinDamage;
unsigned char mMaxDamage;
unsigned short mHit2; // BUGFIX: Some monsters overflow this value on high difficulty (fixed)
unsigned char mAFNum2;
unsigned char mMinDamage2;
unsigned char mMaxDamage2;
unsigned char mArmorClass;
char mMonstClass;
unsigned short mMagicRes;
unsigned short mMagicRes2;
unsigned short mTreasure;
char mSelFlag;
unsigned short mExp;
} MonsterData;
typedef struct CMonster {
int mtype;
// TODO: Add enum for place flags
unsigned char mPlaceFlags;
AnimStruct Anims[6];
TSnd *Snds[4][2];
int width;
int width2;
unsigned char mMinHP;
unsigned char mMaxHP;
BOOL has_special;
unsigned char mAFNum;
char mdeadval;
const MonsterData *MData;
// A TRN file contains a sequence of color transitions, represented
// as indexes into a palette. (a 256 byte array of palette indices)
BYTE *trans_file;
} CMonster;
typedef struct MonsterStruct { // note: missing field _mAFNum
int _mMTidx;
int _mmode; /* MON_MODE */
unsigned char _mgoal;
int _mgoalvar1;
int _mgoalvar2;
int _mgoalvar3;
unsigned char _pathcount;
int _mx; // Tile X-position of monster
int _my; // Tile Y-position of monster
int _mfutx; // Future tile X-position of monster. Set at start of walking animation
int _mfuty; // Future tile Y-position of monster. Set at start of walking animation
int _moldx; // Most recent X-position in dMonster.
int _moldy; // Most recent Y-position in dMonster.
int _mxoff; // Monster sprite's pixel X-offset from tile.
int _myoff; // Monster sprite's pixel Y-offset from tile.
int _mxvel; // Pixel X-velocity while walking. Applied to _mxoff
int _myvel; // Pixel Y-velocity while walking. Applied to _myoff
int _mdir; // Direction faced by monster (direction enum)
int _menemy; // The current target of the mosnter. An index in to either the plr or monster array based on the _meflag value.
unsigned char _menemyx; // X-coordinate of enemy (usually correspond's to the enemy's futx value)
unsigned char _menemyy; // Y-coordinate of enemy (usually correspond's to the enemy's futy value)
unsigned char *_mAnimData;
int _mAnimDelay; // Tick length of each frame in the current animation
int _mAnimCnt; // Increases by one each game tick, counting how close we are to _pAnimDelay
int _mAnimLen; // Number of frames in current animation
int _mAnimFrame; // Current frame of animation.
BOOL _mDelFlag;
int _mVar1;
int _mVar2;
int _mVar3;
int _mVar4;
int _mVar5;
int _mVar6; // Used as _mxoff but with a higher range so that we can correctly apply velocities of a smaller number
int _mVar7; // Used as _myoff but with a higher range so that we can correctly apply velocities of a smaller number
int _mVar8; // Value used to measure progress for moving from one tile to another
int _mmaxhp;
int _mhitpoints;
unsigned char _mAi;
unsigned char _mint;
Uint32 _mFlags;
BYTE _msquelch;
int _lastx;
int _lasty;
int _mRndSeed;
int _mAISeed;
unsigned char _uniqtype;
unsigned char _uniqtrans;
char _udeadval;
char mWhoHit;
char mLevel;
unsigned short mExp;
unsigned short mHit;
unsigned char mMinDamage;
unsigned char mMaxDamage;
unsigned short mHit2;
unsigned char mMinDamage2;
unsigned char mMaxDamage2;
unsigned char mArmorClass;
unsigned short mMagicRes;
int mtalkmsg;
unsigned char leader;
unsigned char leaderflag;
unsigned char packsize;
Sint8 mlid; // BUGFIX -1 is used when not emitting light this should be signed (fixed)
const char *mName;
CMonster *MType;
const MonsterData *MData;
} MonsterStruct;
typedef struct UniqMonstStruct {
int mtype;
const char *mName;
const char *mTrnName;
unsigned char mlevel;
unsigned short mmaxhp;
unsigned char mAi;
unsigned char mint;
unsigned char mMinDamage;
unsigned char mMaxDamage;
unsigned short mMagicRes;
unsigned short mUnqAttr;
unsigned char mUnqVar1;
unsigned char mUnqVar2;
int mtalkmsg;
} UniqMonstStruct;
//////////////////////////////////////////////////
// objects
//////////////////////////////////////////////////
typedef struct ObjDataStruct {
char oload;
char ofindex;
char ominlvl;
char omaxlvl;
char olvltype;
char otheme;
char oquest;
int oAnimFlag;
int oAnimDelay; // Tick length of each frame in the current animation
int oAnimLen; // Number of frames in current animation
int oAnimWidth;
BOOL oSolidFlag;
BOOL oMissFlag;
BOOL oLightFlag;
char oBreak;
char oSelFlag;
BOOL oTrapFlag;
} ObjDataStruct;
typedef struct ObjectStruct {
int _otype;
int _ox;
int _oy;
bool _oLight;
Uint32 _oAnimFlag;
unsigned char *_oAnimData;
int _oAnimDelay; // Tick length of each frame in the current animation
int _oAnimCnt; // Increases by one each game tick, counting how close we are to _pAnimDelay
int _oAnimLen; // Number of frames in current animation
int _oAnimFrame; // Current frame of animation.
int _oAnimWidth;
int _oAnimWidth2;
BOOL _oDelFlag;
char _oBreak; // check
BOOL _oSolidFlag;
BOOL _oMissFlag;
char _oSelFlag; // check
BOOL _oPreFlag;
BOOL _oTrapFlag;
BOOL _oDoorFlag;
int _olid;
int _oRndSeed;
int _oVar1;
int _oVar2;
int _oVar3;
int _oVar4;
int _oVar5;
int _oVar6;
int _oVar7;
int _oVar8;
} ObjectStruct;
//////////////////////////////////////////////////
// portal
//////////////////////////////////////////////////
typedef struct PortalStruct {
BOOL open;
int x;
int y;
int level;
int ltype;
BOOL setlvl;
} PortalStruct;
//////////////////////////////////////////////////
// gamemenu/gmenu
//////////////////////////////////////////////////
// TPDEF PTR FCN VOID TMenuFcn
typedef struct TMenuItem {
DWORD dwFlags;
const char *pszStr;
void (*fnMenu)(BOOL); /* fix, should have one arg */
} TMenuItem;
// TPDEF PTR FCN VOID TMenuUpdateFcn
//////////////////////////////////////////////////
// spells
//////////////////////////////////////////////////
typedef struct SpellData {
unsigned char sName;
unsigned char sManaCost;
unsigned char sType;
const char *sNameText;
const char *sSkillText;
int sBookLvl;
int sStaffLvl;
BOOL sTargeted;
BOOL sTownSpell;
int sMinInt;
unsigned char sSFX;
unsigned char sMissiles[3];
unsigned char sManaAdj;
unsigned char sMinMana;
int sStaffMin;
int sStaffMax;
int sBookCost;
int sStaffCost;
} SpellData;
//////////////////////////////////////////////////
// drlg
//////////////////////////////////////////////////
typedef struct ShadowStruct {
unsigned char strig;
unsigned char s1;
unsigned char s2;
unsigned char s3;
unsigned char nv1;
unsigned char nv2;
unsigned char nv3;
} ShadowStruct;
typedef struct HALLNODE {
int nHallx1;
int nHally1;
int nHallx2;
int nHally2;
int nHalldir;
struct HALLNODE *pNext;
} HALLNODE;
typedef struct ROOMNODE {
int nRoomx1;
int nRoomy1;
int nRoomx2;
int nRoomy2;
int nRoomDest;
} ROOMNODE;
//////////////////////////////////////////////////
// themes
//////////////////////////////////////////////////
typedef struct ThemeStruct {
char ttype; /* aligned 4 */
int ttval;
} ThemeStruct;
//////////////////////////////////////////////////
// inv
//////////////////////////////////////////////////
typedef struct InvXY {
int X;
int Y;
} InvXY;
//////////////////////////////////////////////////
// diabloui
//////////////////////////////////////////////////
// TPDEF PTR FCN VOID PLAYSND
typedef struct _uidefaultstats {
WORD strength;
WORD magic;
WORD dexterity;
WORD vitality;
} _uidefaultstats;
typedef struct _uiheroinfo {
struct _uiheroinfo *next;
char name[16];
WORD level;
BYTE heroclass;
BYTE herorank;
WORD strength;
WORD magic;
WORD dexterity;
WORD vitality;
int gold;
int hassaved;
BOOL spawned;
} _uiheroinfo;
// TPDEF PTR FCN UCHAR ENUMHEROPROC
// TPDEF PTR FCN UCHAR ENUMHEROS
// TPDEF PTR FCN UCHAR CREATEHERO
// TPDEF PTR FCN UCHAR DELETEHERO
// TPDEF PTR FCN UCHAR GETDEFHERO
// TPDEF PTR FCN INT PROGRESSFCN
//////////////////////////////////////////////////
// storm
//////////////////////////////////////////////////
// TPDEF PTR FCN UCHAR SMSGIDLEPROC
// TPDEF PTR FCN VOID SMSGHANDLER
typedef struct _SNETCAPS {
DWORD size;
DWORD flags;
DWORD maxmessagesize;
DWORD maxqueuesize;
DWORD maxplayers;
DWORD bytessec;
DWORD latencyms;
DWORD defaultturnssec;
DWORD defaultturnsintransit;
} _SNETCAPS;
typedef struct _SNETEVENT {
DWORD eventid;
DWORD playerid;
void *data;
DWORD databytes;
} _SNETEVENT;
// TPDEF PTR FCN UCHAR SNETABORTPROC
// TPDEF PTR FCN UCHAR SNETCATEGORYPROC
// TPDEF PTR FCN UCHAR SNETCHECKAUTHPROC
// TPDEF PTR FCN UCHAR SNETCREATEPROC
// TPDEF PTR FCN UCHAR SNETDRAWDESCPROC
// TPDEF PTR FCN UCHAR SNETENUMDEVICESPROC
// TPDEF PTR FCN UCHAR SNETENUMGAMESPROC
// TPDEF PTR FCN UCHAR SNETENUMPROVIDERSPROC
// TPDEF PTR FCN VOID SNETEVENTPROC
// TPDEF PTR FCN UCHAR SNETGETARTPROC
// TPDEF PTR FCN UCHAR SNETGETDATAPROC
// TPDEF PTR FCN INT SNETMESSAGEBOXPROC
// TPDEF PTR FCN UCHAR SNETPLAYSOUNDPROC
// TPDEF PTR FCN UCHAR SNETSELECTEDPROC
// TPDEF PTR FCN UCHAR SNETSTATUSPROC
typedef struct _SNETPLAYERDATA {
int size;
char *playername;
char *playerdescription;
} _SNETPLAYERDATA;
typedef struct _SNETVERSIONDATA {
int size;
const char *versionstring;
} _SNETVERSIONDATA;
typedef struct _SNETUIDATA {
int size;
void (*selectedcallback)();
void (*statuscallback)();
void (*categorylistcallback)();
void (*newaccountcallback)();
const char **profilefields;
bool (*selectnamecallback)(
const struct _SNETPROGRAMDATA *,
const struct _SNETPLAYERDATA *,
const struct _SNETUIDATA *,
const struct _SNETVERSIONDATA *,
DWORD provider, /* e.g. 'BNET', 'IPXN', 'MODM', 'SCBL' */
char *, DWORD, /* character name will be copied here */
char *, DWORD, /* character "description" will be copied here (used to advertise games) */
bool * /* new character? - unsure about this */
);
void (*changenamecallback)();
} _SNETUIDATA;
// TPDEF PTR FCN UCHAR SNETSPIBIND
// TPDEF PTR FCN UCHAR SNETSPIQUERY
//////////////////////////////////////////////////
// capture
//////////////////////////////////////////////////
typedef struct _PcxHeader {
BYTE Manufacturer;
BYTE Version;
BYTE Encoding;
BYTE BitsPerPixel;
WORD Xmin;
WORD Ymin;
WORD Xmax;
WORD Ymax;
WORD HDpi;
WORD VDpi;
BYTE Colormap[48];
BYTE Reserved;
BYTE NPlanes;
WORD BytesPerLine;
WORD PaletteInfo;
WORD HscreenSize;
WORD VscreenSize;
BYTE Filler[54];
} PCXHEADER;
DEVILUTION_END_NAMESPACE