RTX-Remix/Vibe-Reverse-Engineering-Signature-DB
0
1// Devilution reference knowledge base
2// Source: https://github.com/diasurgical/devilution
3// Compiler: MSVC 4.2 (Visual C++ 4.2)
4// NOTE: Addresses are for DIABLO.EXE, not the current binary.
5// Struct/enum definitions are portable across binaries.
6
7// === Struct definitions (from Diablo 1 decomp) ===
8
9
10//////////////////////////////////////////////////
11// control
12//////////////////////////////////////////////////
13
14typedef struct RECT32 {
15 int x;
16 int y;
17 int w;
18 int h;
19} RECT32;
20
21//////////////////////////////////////////////////
22// items
23//////////////////////////////////////////////////
24
25typedef struct PLStruct {
26 const char *PLName;
27 int PLPower;
28 int PLParam1;
29 int PLParam2;
30 char PLMinLvl;
31 int PLIType;
32 BYTE PLGOE;
33 BOOL PLDouble;
34 BOOL PLOk;
35 int PLMinVal;
36 int PLMaxVal;
37 int PLMultVal;
38} PLStruct;
39
40typedef struct UItemStruct {
41 const char *UIName;
42 char UIItemId;
43 char UIMinLvl;
44 char UINumPL;
45 int UIValue;
46 char UIPower1;
47 int UIParam1;
48 int UIParam2;
49 char UIPower2;
50 int UIParam3;
51 int UIParam4;
52 char UIPower3;
53 int UIParam5;
54 int UIParam6;
55 char UIPower4;
56 int UIParam7;
57 int UIParam8;
58 char UIPower5;
59 int UIParam9;
60 int UIParam10;
61 char UIPower6;
62 int UIParam11;
63 int UIParam12;
64} UItemStruct;
65
66typedef struct ItemDataStruct {
67 int iRnd;
68 char iClass;
69 char iLoc;
70 int iCurs;
71 char itype;
72 char iItemId;
73 const char *iName;
74 const char *iSName;
75 char iMinMLvl;
76 int iDurability;
77 int iMinDam;
78 int iMaxDam;
79 int iMinAC;
80 int iMaxAC;
81 char iMinStr;
82 char iMinMag;
83 char iMinDex;
84 // item_special_effect
85 int iFlags;
86 // item_misc_id
87 int iMiscId;
88 // spell_id
89 int iSpell;
90 BOOL iUsable;
91 int iValue;
92 int iMaxValue;
93} ItemDataStruct;
94
95typedef struct ItemGetRecordStruct {
96 int nSeed;
97 unsigned short wCI;
98 int nIndex;
99 unsigned int dwTimestamp;
100} ItemGetRecordStruct;
101
102typedef struct ItemStruct {
103 int _iSeed;
104 WORD _iCreateInfo;
105 int _itype;
106 int _ix;
107 int _iy;
108 BOOL _iAnimFlag;
109 unsigned char *_iAnimData; // PSX name -> ItemFrame
110 int _iAnimLen; // Number of frames in current animation
111 int _iAnimFrame; // Current frame of animation.
112 int _iAnimWidth;
113 int _iAnimWidth2; // width 2?
114 BOOL _iDelFlag; // set when item is flagged for deletion, deprecated in 1.02
115 char _iSelFlag;
116 BOOL _iPostDraw;
117 BOOL _iIdentified;
118 char _iMagical;
119 char _iName[64];
120 char _iIName[64];
121 char _iLoc;
122 // item_class enum
123 char _iClass;
124 int _iCurs;
125 int _ivalue;
126 int _iIvalue;
127 int _iMinDam;
128 int _iMaxDam;
129 int _iAC;
130 // item_special_effect
131 int _iFlags;
132 // item_misc_id
133 int _iMiscId;
134 // spell_id
135 int _iSpell;
136 int _iCharges;
137 int _iMaxCharges;
138 int _iDurability;
139 int _iMaxDur;
140 int _iPLDam;
141 int _iPLToHit;
142 int _iPLAC;
143 int _iPLStr;
144 int _iPLMag;
145 int _iPLDex;
146 int _iPLVit;
147 int _iPLFR;
148 int _iPLLR;
149 int _iPLMR;
150 int _iPLMana;
151 int _iPLHP;
152 int _iPLDamMod;
153 int _iPLGetHit;
154 int _iPLLight;
155 char _iSplLvlAdd;
156 char _iRequest;
157 int _iUid;
158 int _iFMinDam;
159 int _iFMaxDam;
160 int _iLMinDam;
161 int _iLMaxDam;
162 int _iPLEnAc;
163 char _iPrePower;
164 char _iSufPower;
165 int _iVAdd1;
166 int _iVMult1;
167 int _iVAdd2;
168 int _iVMult2;
169 char _iMinStr;
170 unsigned char _iMinMag;
171 char _iMinDex;
172 BOOL _iStatFlag;
173 int IDidx;
174 int offs016C; // _oldlight or _iInvalid
175#ifdef HELLFIRE
176 int _iDamAcFlags;
177#endif
178} ItemStruct;
179
180//////////////////////////////////////////////////
181// player
182//////////////////////////////////////////////////
183
184typedef struct PlayerStruct {
185 int _pmode;
186 char walkpath[MAX_PATH_LENGTH];
187 BOOLEAN plractive;
188 int destAction;
189 int destParam1;
190 int destParam2;
191 int destParam3;
192 int destParam4;
193 int plrlevel;
194 int _px; // Tile X-position of player
195 int _py; // Tile Y-position of player
196 int _pfutx; // Future tile X-position of player. Set at start of walking animation
197 int _pfuty; // Future tile Y-position of player. Set at start of walking animation
198 int _ptargx; // Target tile X-position for player movment. Set during pathfinding
199 int _ptargy; // Target tile Y-position for player movment. Set during pathfinding
200 int _pownerx; // Tile X-position of player. Set via network on player input
201 int _pownery; // Tile X-position of player. Set via network on player input
202 int _poldx; // Most recent X-position in dPlayer.
203 int _poldy; // Most recent Y-position in dPlayer.
204 int _pxoff; // Player sprite's pixel X-offset from tile.
205 int _pyoff; // Player sprite's pixel Y-offset from tile.
206 int _pxvel; // Pixel X-velocity while walking. Indirectly applied to _pxoff via _pvar6
207 int _pyvel; // Pixel Y-velocity while walking. Indirectly applied to _pyoff via _pvar7
208 int _pdir; // Direction faced by player (direction enum)
209 int _nextdir; // Unused
210 int _pgfxnum; // Bitmask indicating what variant of the sprite the player is using. Lower byte define weapon (anim_weapon_id) and higher values define armour (starting with anim_armor_id)
211 unsigned char *_pAnimData;
212 int _pAnimDelay; // Tick length of each frame in the current animation
213 int _pAnimCnt; // Increases by one each game tick, counting how close we are to _pAnimDelay
214 int _pAnimLen; // Number of frames in current animation
215 int _pAnimFrame; // Current frame of animation.
216 int _pAnimWidth;
217 int _pAnimWidth2;
218 int _peflag;
219 int _plid;
220 int _pvid;
221 int _pSpell;
222 char _pSplType;
223 char _pSplFrom;
224 int _pTSpell;
225 char _pTSplType;
226 int _pRSpell;
227 // enum spell_type
228 char _pRSplType;
229 int _pSBkSpell;
230 char _pSBkSplType;
231 char _pSplLvl[64];
232 unsigned __int64 _pMemSpells; // Bitmask of learned spells
233 unsigned __int64 _pAblSpells; // Bitmask of abilities
234 unsigned __int64 _pScrlSpells; // Bitmask of spells avalible via scrolls
235 UCHAR _pSpellFlags;
236 int _pSplHotKey[4];
237 char _pSplTHotKey[4];
238 int _pwtype;
239 BOOLEAN _pBlockFlag;
240 BOOLEAN _pInvincible;
241 char _pLightRad;
242 BOOLEAN _pLvlChanging; // True when the player is transitioning between levels
243 char _pName[PLR_NAME_LEN];
244 // plr_class enum value.
245 // TODO: this could very well be `enum plr_class _pClass`
246 // since there are 3 bytes of alingment after this field.
247 // it could just be that the compiler optimized away all accesses to
248 // the higher bytes by using byte instructions, since all possible values
249 // of plr_class fit into one byte.
250 char _pClass;
251 int _pStrength;
252 int _pBaseStr;
253 int _pMagic;
254 int _pBaseMag;
255 int _pDexterity;
256 int _pBaseDex;
257 int _pVitality;
258 int _pBaseVit;
259 int _pStatPts;
260 int _pDamageMod;
261 int _pBaseToBlk;
262 int _pHPBase;
263 int _pMaxHPBase;
264 int _pHitPoints;
265 int _pMaxHP;
266 int _pHPPer;
267 int _pManaBase;
268 int _pMaxManaBase;
269 int _pMana;
270 int _pMaxMana;
271 int _pManaPer;
272 char _pLevel;
273 char _pMaxLvl;
274 int _pExperience;
275 int _pMaxExp;
276 int _pNextExper;
277 char _pArmorClass;
278 char _pMagResist;
279 char _pFireResist;
280 char _pLghtResist;
281 int _pGold;
282 BOOL _pInfraFlag;
283 int _pVar1; // Used for referring to X-position of player when finishing moving one tile (also used to define target coordinates for spells and ranged attacks)
284 int _pVar2; // Used for referring to Y-position of player when finishing moving one tile (also used to define target coordinates for spells and ranged attacks)
285 int _pVar3; // Player's direction when ending movement. Also used for casting direction of SPL_FIREWALL.
286 int _pVar4; // Used for storing X-position of a tile which should have its BFLAG_PLAYERLR flag removed after walking. When starting to walk the game places the player in the dPlayer array -1 in the Y coordinate, and uses BFLAG_PLAYERLR to check if it should be using -1 to the Y coordinate when rendering the player (also used for storing the level of a spell when the player casts it)
287 int _pVar5; // Used for storing Y-position of a tile which should have its BFLAG_PLAYERLR flag removed after walking. When starting to walk the game places the player in the dPlayer array -1 in the Y coordinate, and uses BFLAG_PLAYERLR to check if it should be using -1 to the Y coordinate when rendering the player (also used for storing the level of a spell when the player casts it)
288 int _pVar6; // Same as _pxoff but contains the value in a higher range
289 int _pVar7; // Same as _pyoff but contains the value in a higher range
290 int _pVar8; // Used for counting how close we are to reaching the next tile when walking (usually counts to 8, which is equal to the walk animation length). Also used for stalling the appearance of the options screen after dying in singleplayer
291 BOOLEAN _pLvlVisited[NUMLEVELS];
292 BOOLEAN _pSLvlVisited[NUMLEVELS]; // only 10 used
293 int _pGFXLoad;
294 unsigned char *_pNAnim[8]; // Stand animations
295 int _pNFrames;
296 int _pNWidth;
297 unsigned char *_pWAnim[8]; // Walk animations
298 int _pWFrames;
299 int _pWWidth;
300 unsigned char *_pAAnim[8]; // Attack animations
301 int _pAFrames;
302 int _pAWidth;
303 int _pAFNum;
304 unsigned char *_pLAnim[8]; // Lightning spell cast animations
305 unsigned char *_pFAnim[8]; // Fire spell cast animations
306 unsigned char *_pTAnim[8]; // Generic spell cast animations
307 int _pSFrames;
308 int _pSWidth;
309 int _pSFNum;
310 unsigned char *_pHAnim[8]; // Getting hit animations
311 int _pHFrames;
312 int _pHWidth;
313 unsigned char *_pDAnim[8]; // Death animations
314 int _pDFrames;
315 int _pDWidth;
316 unsigned char *_pBAnim[8]; // Block animations
317 int _pBFrames;
318 int _pBWidth;
319 ItemStruct InvBody[NUM_INVLOC];
320 ItemStruct InvList[NUM_INV_GRID_ELEM];
321 int _pNumInv;
322 char InvGrid[NUM_INV_GRID_ELEM];
323 ItemStruct SpdList[MAXBELTITEMS];
324 ItemStruct HoldItem;
325 int _pIMinDam;
326 int _pIMaxDam;
327 int _pIAC;
328 int _pIBonusDam;
329 int _pIBonusToHit;
330 int _pIBonusAC;
331 int _pIBonusDamMod;
332 unsigned __int64 _pISpells; // Bitmask of staff spell
333 int _pIFlags;
334 int _pIGetHit;
335 char _pISplLvlAdd;
336 char _pISplCost;
337 int _pISplDur;
338 int _pIEnAc;
339 int _pIFMinDam;
340 int _pIFMaxDam;
341 int _pILMinDam;
342 int _pILMaxDam;
343 int _pOilType;
344 unsigned char pTownWarps;
345 unsigned char pDungMsgs;
346 unsigned char pLvlLoad;
347#ifdef HELLFIRE
348 unsigned char pDungMsgs2;
349#else
350 unsigned char pBattleNet;
351#endif
352 BOOLEAN pManaShield;
353 char bReserved[3];
354 WORD wReflections;
355 short wReserved[7];
356 DWORD pDiabloKillLevel;
357 int pDifficulty;
358 int pDamAcFlags;
359 int dwReserved[5];
360 unsigned char *_pNData;
361 unsigned char *_pWData;
362 unsigned char *_pAData;
363 unsigned char *_pLData;
364 unsigned char *_pFData;
365 unsigned char *_pTData;
366 unsigned char *_pHData;
367 unsigned char *_pDData;
368 unsigned char *_pBData;
369 void *pReserved;
370} PlayerStruct;
371
372//////////////////////////////////////////////////
373// textdat
374//////////////////////////////////////////////////
375
376typedef struct TextDataStruct {
377 const char *txtstr;
378 int scrlltxt;
379 int txtspd;
380 int sfxnr;
381} TextDataStruct;
382
383//////////////////////////////////////////////////
384// missiles
385//////////////////////////////////////////////////
386
387// TPDEF PTR FCN VOID MIADDPRC
388// TPDEF PTR FCN VOID MIPROC
389
390typedef struct MissileData {
391 unsigned char mName;
392 void (*mAddProc)(int, int, int, int, int, int, char, int, int);
393 void (*mProc)(int);
394 BOOL mDraw;
395 unsigned char mType;
396 unsigned char mResist;
397 unsigned char mFileNum;
398 int mlSFX;
399 int miSFX;
400} MissileData;
401
402typedef struct MisFileData {
403 unsigned char mAnimName;
404 unsigned char mAnimFAmt;
405 const char *mName;
406 int mFlags;
407 unsigned char *mAnimData[16];
408 unsigned char mAnimDelay[16];
409 unsigned char mAnimLen[16];
410 int mAnimWidth[16];
411 int mAnimWidth2[16];
412} MisFileData;
413
414typedef struct ChainStruct {
415 int idx;
416 int _mitype;
417 int _mirange;
418} ChainStruct;
419
420typedef struct MissileStruct {
421 int _mitype; // Type of projectile (missile_id)
422 int _mix; // Tile X-position of the missile
423 int _miy; // Tile Y-position of the missile
424 int _mixoff; // Sprite pixel X-offset for the missile
425 int _miyoff; // Sprite pixel Y-offset for the missile
426 int _mixvel; // Missile tile X-velocity while walking. This gets added onto _mitxoff each game tick
427 int _miyvel; // Missile tile Y-velocity while walking. This gets added onto _mitxoff each game tick
428 int _misx; // Initial tile X-position for missile
429 int _misy; // Initial tile Y-position for missile
430 int _mitxoff; // How far the missile has travelled in its lifespan along the X-axis. mix/miy/mxoff/myoff get updated every game tick based on this
431 int _mityoff; // How far the missile has travelled in its lifespan along the Y-axis. mix/miy/mxoff/myoff get updated every game tick based on this
432 int _mimfnum; // The direction of the missile (direction enum)
433 int _mispllvl;
434 BOOL _miDelFlag; // Indicate weather the missile should be deleted
435 BYTE _miAnimType;
436 int _miAnimFlags;
437 unsigned char *_miAnimData;
438 int _miAnimDelay; // Tick length of each frame in the current animation
439 int _miAnimLen; // Number of frames in current animation
440 int _miAnimWidth;
441 int _miAnimWidth2;
442 int _miAnimCnt; // Increases by one each game tick, counting how close we are to _pAnimDelay
443 int _miAnimAdd;
444 int _miAnimFrame; // Current frame of animation.
445 BOOL _miDrawFlag;
446 BOOL _miLightFlag;
447 BOOL _miPreFlag;
448 int _miUniqTrans;
449 int _mirange; // Time to live for the missile in game ticks, oncs 0 the missile will be marked for deletion via _miDelFlag
450 int _misource;
451 int _micaster;
452 int _midam;
453 BOOL _miHitFlag;
454 int _midist; // Used for arrows to measure distance travelled (increases by 1 each game tick). Higher value is a penalty for accuracy calculation when hitting enemy
455 int _mlid;
456 int _mirnd;
457 int _miVar1;
458 int _miVar2;
459 int _miVar3;
460 int _miVar4;
461 int _miVar5;
462 int _miVar6;
463 int _miVar7;
464 int _miVar8;
465} MissileStruct;
466
467//////////////////////////////////////////////////
468// effects/sound
469//////////////////////////////////////////////////
470
471typedef struct CKINFO {
472 DWORD dwSize;
473 DWORD dwOffset;
474} CKINFO;
475
476typedef struct TSnd {
477 WAVEFORMATEX fmt;
478 CKINFO chunk;
479 const char *sound_path;
480 LPDIRECTSOUNDBUFFER DSB;
481 int start_tc;
482} TSnd;
483
484#pragma pack(push, 1)
485typedef struct TSFX {
486 unsigned char bFlags;
487 const char *pszName;
488 TSnd *pSnd;
489} TSFX;
490#pragma pack(pop)
491
492//////////////////////////////////////////////////
493// monster
494//////////////////////////////////////////////////
495
496typedef struct AnimStruct {
497 BYTE *CMem;
498 BYTE *Data[8];
499 int Frames;
500 int Rate;
501} AnimStruct;
502
503typedef struct MonsterData {
504 int width;
505 int mImage;
506 const char *GraphicType;
507 BOOL has_special;
508 const char *sndfile;
509 BOOL snd_special;
510 BOOL has_trans;
511 const char *TransFile;
512 int Frames[6];
513 int Rate[6];
514 const char *mName;
515 char mMinDLvl;
516 char mMaxDLvl;
517 char mLevel;
518 int mMinHP;
519 int mMaxHP;
520 char mAi;
521 int mFlags;
522 unsigned char mInt;
523 unsigned char mHit; // BUGFIX: Some monsters overflow this value on high difficulty
524 unsigned char mAFNum;
525 unsigned char mMinDamage;
526 unsigned char mMaxDamage;
527 unsigned char mHit2; // BUGFIX: Some monsters overflow this value on high difficulty
528 unsigned char mAFNum2;
529 unsigned char mMinDamage2;
530 unsigned char mMaxDamage2;
531 unsigned char mArmorClass;
532 char mMonstClass;
533 unsigned short mMagicRes;
534 unsigned short mMagicRes2;
535 unsigned short mTreasure;
536 char mSelFlag;
537 unsigned short mExp;
538} MonsterData;
539
540typedef struct CMonster {
541#ifdef HELLFIRE
542 int mtype;
543#else
544 unsigned char mtype;
545#endif
546 // TODO: Add enum for place flags
547 unsigned char mPlaceFlags;
548 AnimStruct Anims[6];
549 TSnd *Snds[4][2];
550 int width;
551 int width2;
552#ifdef HELLFIRE
553 int mMinHP;
554 int mMaxHP;
555#else
556 unsigned char mMinHP;
557 unsigned char mMaxHP;
558#endif
559 BOOL has_special;
560 unsigned char mAFNum;
561 char mdeadval;
562 MonsterData *MData;
563 // A TRN file contains a sequence of colour transitions, represented
564 // as indexes into a palette. (a 256 byte array of palette indices)
565 BYTE *trans_file;
566} CMonster;
567
568typedef struct MonsterStruct { // note: missing field _mAFNum
569 int _mMTidx;
570 int _mmode; /* MON_MODE */
571 unsigned char _mgoal;
572 int _mgoalvar1;
573 int _mgoalvar2;
574 int _mgoalvar3;
575 int field_18;
576 unsigned char _pathcount;
577 int _mx; // Tile X-position of monster
578 int _my; // Tile Y-position of monster
579 int _mfutx; // Future tile X-position of monster. Set at start of walking animation
580 int _mfuty; // Future tile Y-position of monster. Set at start of walking animation
581 int _moldx; // Most recent X-position in dMonster.
582 int _moldy; // Most recent Y-position in dMonster.
583 int _mxoff; // Monster sprite's pixel X-offset from tile.
584 int _myoff; // Monster sprite's pixel Y-offset from tile.
585 int _mxvel; // Pixel X-velocity while walking. Applied to _mxoff
586 int _myvel; // Pixel Y-velocity while walking. Applied to _myoff
587 int _mdir; // Direction faced by monster (direction enum)
588 int _menemy; // The current target of the monster. An index into either the plr or monster array based on the _meflag value.
589 unsigned char _menemyx; // X-coordinate of enemy (usually correspond's to the enemy's futx value)
590 unsigned char _menemyy; // Y-coordinate of enemy (usually correspond's to the enemy's futy value)
591 short falign_52; // probably _mAFNum (unused)
592 unsigned char *_mAnimData;
593 int _mAnimDelay; // Tick length of each frame in the current animation
594 int _mAnimCnt; // Increases by one each game tick, counting how close we are to _pAnimDelay
595 int _mAnimLen; // Number of frames in current animation
596 int _mAnimFrame; // Current frame of animation.
597 BOOL _meflag;
598 BOOL _mDelFlag;
599 int _mVar1;
600 int _mVar2;
601 int _mVar3;
602 int _mVar4;
603 int _mVar5;
604 int _mVar6; // Used as _mxoff but with a higher range so that we can correctly apply velocities of a smaller number
605 int _mVar7; // Used as _myoff but with a higher range so that we can correctly apply velocities of a smaller number
606 int _mVar8; // Value used to measure progress for moving from one tile to another
607 int _mmaxhp;
608 int _mhitpoints;
609 unsigned char _mAi;
610 unsigned char _mint;
611 short falign_9A;
612 int _mFlags;
613 BYTE _msquelch;
614 int falign_A4;
615 int _lastx;
616 int _lasty;
617 int _mRndSeed;
618 int _mAISeed;
619 int falign_B8;
620 unsigned char _uniqtype;
621 unsigned char _uniqtrans;
622 char _udeadval;
623 char mWhoHit;
624 char mLevel;
625 unsigned short mExp;
626 unsigned char mHit;
627 unsigned char mMinDamage;
628 unsigned char mMaxDamage;
629 unsigned char mHit2;
630 unsigned char mMinDamage2;
631 unsigned char mMaxDamage2;
632#ifdef HELLFIRE
633 char mArmorClass;
634#else
635 unsigned char mArmorClass;
636#endif
637 char falign_CB;
638 unsigned short mMagicRes;
639 int mtalkmsg;
640 unsigned char leader;
641 unsigned char leaderflag;
642 unsigned char packsize;
643 unsigned char mlid;
644 const char *mName;
645 CMonster *MType;
646 MonsterData *MData;
647} MonsterStruct;
648
649typedef struct UniqMonstStruct {
650#ifdef HELLFIRE
651 int mtype;
652#else
653 char mtype;
654#endif
655 const char *mName;
656 const char *mTrnName;
657 unsigned char mlevel;
658 unsigned short mmaxhp;
659 unsigned char mAi;
660 unsigned char mint;
661 unsigned char mMinDamage;
662 unsigned char mMaxDamage;
663 unsigned short mMagicRes;
664 unsigned short mUnqAttr;
665 unsigned char mUnqVar1;
666 unsigned char mUnqVar2;
667 int mtalkmsg;
668} UniqMonstStruct;
669
670//////////////////////////////////////////////////
671// objects
672//////////////////////////////////////////////////
673
674typedef struct ObjDataStruct {
675 char oload;
676 char ofindex;
677 char ominlvl;
678 char omaxlvl;
679 char olvltype;
680 char otheme;
681 char oquest;
682 int oAnimFlag;
683 int oAnimDelay; // Tick length of each frame in the current animation
684 int oAnimLen; // Number of frames in current animation
685 int oAnimWidth;
686 BOOL oSolidFlag;
687 BOOL oMissFlag;
688 BOOL oLightFlag;
689 char oBreak;
690 char oSelFlag;
691 BOOL oTrapFlag;
692} ObjDataStruct;
693
694typedef struct ObjectStruct {
695 int _otype;
696 int _ox;
697 int _oy;
698 int _oLight;
699 int _oAnimFlag;
700 unsigned char *_oAnimData;
701 int _oAnimDelay; // Tick length of each frame in the current animation
702 int _oAnimCnt; // Increases by one each game tick, counting how close we are to _pAnimDelay
703 int _oAnimLen; // Number of frames in current animation
704 int _oAnimFrame; // Current frame of animation.
705 int _oAnimWidth;
706 int _oAnimWidth2;
707 BOOL _oDelFlag;
708 char _oBreak; // check
709 BOOL _oSolidFlag;
710 BOOL _oMissFlag;
711 char _oSelFlag; // check
712 BOOL _oPreFlag;
713 BOOL _oTrapFlag;
714 BOOL _oDoorFlag;
715 int _olid;
716 int _oRndSeed;
717 int _oVar1;
718 int _oVar2;
719 int _oVar3;
720 int _oVar4;
721 int _oVar5;
722 int _oVar6;
723 int _oVar7;
724 int _oVar8;
725} ObjectStruct;
726
727//////////////////////////////////////////////////
728// portal
729//////////////////////////////////////////////////
730
731typedef struct PortalStruct {
732 BOOL open;
733 int x;
734 int y;
735 int level;
736 int ltype;
737 BOOL setlvl;
738} PortalStruct;
739
740//////////////////////////////////////////////////
741// msg
742//////////////////////////////////////////////////
743
744#pragma pack(push, 1)
745typedef struct TCmd {
746 BYTE bCmd;
747} TCmd;
748
749typedef struct TCmdLoc {
750 BYTE bCmd;
751 BYTE x;
752 BYTE y;
753} TCmdLoc;
754
755typedef struct TCmdLocParam1 {
756 BYTE bCmd;
757 BYTE x;
758 BYTE y;
759 WORD wParam1;
760} TCmdLocParam1;
761
762typedef struct TCmdLocParam2 {
763 BYTE bCmd;
764 BYTE x;
765 BYTE y;
766 WORD wParam1;
767 WORD wParam2;
768} TCmdLocParam2;
769
770typedef struct TCmdLocParam3 {
771 BYTE bCmd;
772 BYTE x;
773 BYTE y;
774 WORD wParam1;
775 WORD wParam2;
776 WORD wParam3;
777} TCmdLocParam3;
778
779typedef struct TCmdParam1 {
780 BYTE bCmd;
781 WORD wParam1;
782} TCmdParam1;
783
784typedef struct TCmdParam2 {
785 BYTE bCmd;
786 WORD wParam1;
787 WORD wParam2;
788} TCmdParam2;
789
790typedef struct TCmdParam3 {
791 BYTE bCmd;
792 WORD wParam1;
793 WORD wParam2;
794 WORD wParam3;
795} TCmdParam3;
796
797typedef struct TCmdGolem {
798 BYTE bCmd;
799 BYTE _mx;
800 BYTE _my;
801 BYTE _mdir;
802 char _menemy;
803 int _mhitpoints;
804 BYTE _currlevel;
805} TCmdGolem;
806
807typedef struct TCmdQuest {
808 BYTE bCmd;
809 BYTE q;
810 BYTE qstate;
811 BYTE qlog;
812 BYTE qvar1;
813} TCmdQuest;
814
815typedef struct TCmdGItem {
816 BYTE bCmd;
817 BYTE bMaster;
818 BYTE bPnum;
819 BYTE bCursitem;
820 BYTE bLevel;
821 BYTE x;
822 BYTE y;
823 WORD wIndx;
824 WORD wCI;
825 int dwSeed;
826 BYTE bId;
827 BYTE bDur;
828 BYTE bMDur;
829 BYTE bCh;
830 BYTE bMCh;
831 WORD wValue;
832 DWORD dwBuff;
833 int dwTime;
834#ifdef HELLFIRE
835 WORD wToHit;
836 WORD wMaxDam;
837 BYTE bMinStr;
838 BYTE bMinMag;
839 BYTE bMinDex;
840 BYTE bAC;
841#endif
842} TCmdGItem;
843
844typedef struct TCmdPItem {
845 BYTE bCmd;
846 BYTE x;
847 BYTE y;
848 WORD wIndx;
849 WORD wCI;
850 int dwSeed;
851 BYTE bId;
852 BYTE bDur;
853 BYTE bMDur;
854 BYTE bCh;
855 BYTE bMCh;
856 WORD wValue;
857 DWORD dwBuff;
858#ifdef HELLFIRE
859 WORD wToHit;
860 WORD wMaxDam;
861 BYTE bMinStr;
862 BYTE bMinMag;
863 BYTE bMinDex;
864 BYTE bAC;
865#endif
866} TCmdPItem;
867
868typedef struct TCmdChItem {
869 BYTE bCmd;
870 BYTE bLoc;
871 WORD wIndx;
872 WORD wCI;
873 int dwSeed;
874 BOOLEAN bId;
875} TCmdChItem;
876
877typedef struct TCmdDelItem {
878 BYTE bCmd;
879 BYTE bLoc;
880} TCmdDelItem;
881
882typedef struct TCmdDamage {
883 BYTE bCmd;
884 BYTE bPlr;
885 DWORD dwDam;
886} TCmdDamage;
887
888#ifdef HELLFIRE
889typedef struct TCmdMonDamage {
890 BYTE bCmd;
891 WORD wMon;
892 DWORD dwDam;
893} TCmdMonDamage;
894#endif
895
896typedef struct TCmdPlrInfoHdr {
897 BYTE bCmd;
898 WORD wOffset;
899 WORD wBytes;
900} TCmdPlrInfoHdr;
901
902typedef struct TCmdString {
903 BYTE bCmd;
904 char str[MAX_SEND_STR_LEN];
905} TCmdString;
906
907typedef struct TFakeCmdPlr {
908 BYTE bCmd;
909 BYTE bPlr;
910} TFakeCmdPlr;
911
912typedef struct TFakeDropPlr {
913 BYTE bCmd;
914 BYTE bPlr;
915 DWORD dwReason;
916} TFakeDropPlr;
917
918typedef struct TSyncHeader {
919 BYTE bCmd;
920 BYTE bLevel;
921 WORD wLen;
922 BYTE bObjId;
923 BYTE bObjCmd;
924 BYTE bItemI;
925 BYTE bItemX;
926 BYTE bItemY;
927 WORD wItemIndx;
928 WORD wItemCI;
929 DWORD dwItemSeed;
930 BYTE bItemId;
931 BYTE bItemDur;
932 BYTE bItemMDur;
933 BYTE bItemCh;
934 BYTE bItemMCh;
935 WORD wItemVal;
936 DWORD dwItemBuff;
937 BYTE bPInvLoc;
938 WORD wPInvIndx;
939 WORD wPInvCI;
940 DWORD dwPInvSeed;
941 BYTE bPInvId;
942#ifdef HELLFIRE
943 WORD wToHit;
944 WORD wMaxDam;
945 BYTE bMinStr;
946 BYTE bMinMag;
947 BYTE bMinDex;
948 BYTE bAC;
949#endif
950} TSyncHeader;
951
952typedef struct TSyncMonster {
953 BYTE _mndx;
954 BYTE _mx;
955 BYTE _my;
956 BYTE _menemy;
957 BYTE _mdelta;
958} TSyncMonster;
959
960typedef struct TPktHdr {
961 BYTE px;
962 BYTE py;
963 BYTE targx;
964 BYTE targy;
965 int php;
966 int pmhp;
967 BYTE bstr;
968 BYTE bmag;
969 BYTE bdex;
970 WORD wCheck;
971 WORD wLen;
972} TPktHdr;
973
974typedef struct TPkt {
975 TPktHdr hdr;
976 BYTE body[493];
977} TPkt;
978
979typedef struct DMonsterStr {
980 BYTE _mx;
981 BYTE _my;
982 BYTE _mdir;
983 BYTE _menemy;
984 BYTE _mactive;
985 int _mhitpoints;
986} DMonsterStr;
987
988typedef struct DObjectStr {
989 BYTE bCmd;
990} DObjectStr;
991
992typedef struct DLevel {
993 TCmdPItem item[MAXITEMS];
994 DObjectStr object[MAXOBJECTS];
995 DMonsterStr monster[MAXMONSTERS];
996} DLevel;
997
998typedef struct LocalLevel {
999 BYTE automapsv[DMAXX][DMAXY];
1000} LocalLevel;
1001
1002typedef struct DPortal {
1003 BYTE x;
1004 BYTE y;
1005 BYTE level;
1006 BYTE ltype;
1007 BYTE setlvl;
1008} DPortal;
1009
1010typedef struct MultiQuests {
1011 BYTE qstate;
1012 BYTE qlog;
1013 BYTE qvar1;
1014} MultiQuests;
1015
1016typedef struct DJunk {
1017 DPortal portal[MAXPORTAL];
1018 MultiQuests quests[MAXMULTIQUESTS];
1019} DJunk;
1020#pragma pack(pop)
1021
1022typedef struct TMegaPkt {
1023 struct TMegaPkt *pNext;
1024 DWORD dwSpaceLeft;
1025 BYTE data[32000];
1026} TMegaPkt;
1027
1028typedef struct TBuffer {
1029 DWORD dwNextWriteOffset;
1030 BYTE bData[4096];
1031} TBuffer;
1032
1033//////////////////////////////////////////////////
1034// quests
1035//////////////////////////////////////////////////
1036
1037typedef struct QuestStruct {
1038 unsigned char _qlevel;
1039 unsigned char _qtype;
1040 unsigned char _qactive;
1041 unsigned char _qlvltype;
1042 int _qtx;
1043 int _qty;
1044 unsigned char _qslvl;
1045 unsigned char _qidx;
1046#ifndef HELLFIRE
1047 unsigned char _qmsg;
1048#else
1049 unsigned int _qmsg;
1050#endif
1051 unsigned char _qvar1;
1052 unsigned char _qvar2;
1053 BOOL _qlog;
1054} QuestStruct;
1055
1056typedef struct QuestData {
1057 unsigned char _qdlvl;
1058 char _qdmultlvl;
1059 unsigned char _qlvlt;
1060 unsigned char _qdtype;
1061 unsigned char _qdrnd;
1062 unsigned char _qslvl;
1063 int _qflags; /* unsigned char */
1064 int _qdmsg;
1065 const char *_qlstr;
1066} QuestData;
1067
1068#ifdef HELLFIRE
1069typedef struct CornerStoneStruct {
1070 int x;
1071 int y;
1072 BOOL activated;
1073 ItemStruct item;
1074} CornerStoneStruct;
1075#endif
1076
1077//////////////////////////////////////////////////
1078// gamemenu/gmenu
1079//////////////////////////////////////////////////
1080
1081// TPDEF PTR FCN VOID TMenuFcn
1082
1083typedef struct TMenuItem {
1084 DWORD dwFlags;
1085 const char *pszStr;
1086 void (*fnMenu)(BOOL); /* fix, should have one arg */
1087} TMenuItem;
1088
1089// TPDEF PTR FCN VOID TMenuUpdateFcn
1090
1091//////////////////////////////////////////////////
1092// spells
1093//////////////////////////////////////////////////
1094
1095typedef struct SpellData {
1096 unsigned char sName;
1097 unsigned char sManaCost;
1098 unsigned char sType;
1099 const char *sNameText;
1100 const char *sSkillText;
1101 int sBookLvl;
1102 int sStaffLvl;
1103 BOOL sTargeted;
1104 BOOL sTownSpell;
1105 int sMinInt;
1106 unsigned char sSFX;
1107 unsigned char sMissiles[3];
1108 unsigned char sManaAdj;
1109 unsigned char sMinMana;
1110 int sStaffMin;
1111 int sStaffMax;
1112 int sBookCost;
1113 int sStaffCost;
1114} SpellData;
1115
1116//////////////////////////////////////////////////
1117// towners
1118//////////////////////////////////////////////////
1119
1120typedef struct TNQ {
1121 unsigned char _qsttype;
1122 unsigned char _qstmsg;
1123 BOOLEAN _qstmsgact;
1124} TNQ;
1125
1126typedef struct TownerStruct {
1127 int _tmode;
1128 int _ttype;
1129 int _tx; // Tile X-position of NPC
1130 int _ty; // Tile Y-position of NPC
1131 int _txoff; // Sprite X-offset (unused)
1132 int _tyoff; // Sprite Y-offset (unused)
1133 int _txvel; // X-velocity during movement (unused)
1134 int _tyvel; // Y-velocity during movement (unused)
1135 int _tdir; // Facing of NPC (unused)
1136 unsigned char *_tAnimData;
1137 int _tAnimDelay; // Tick length of each frame in the current animation
1138 int _tAnimCnt; // Increases by one each game tick, counting how close we are to _pAnimDelay
1139 int _tAnimLen; // Number of frames in current animation
1140 int _tAnimFrame; // Current frame of animation.
1141 int _tAnimFrameCnt;
1142 char _tAnimOrder;
1143 int _tAnimWidth;
1144 int _tAnimWidth2;
1145 int _tTenPer;
1146 int _teflag;
1147 int _tbtcnt;
1148 int _tSelFlag;
1149 BOOL _tMsgSaid;
1150 TNQ qsts[MAXQUESTS];
1151 int _tSeed;
1152 int _tVar1;
1153 int _tVar2;
1154 int _tVar3;
1155 int _tVar4;
1156 char _tName[PLR_NAME_LEN];
1157 unsigned char *_tNAnim[8];
1158 int _tNFrames;
1159 unsigned char *_tNData;
1160} TownerStruct;
1161
1162typedef struct QuestTalkData {
1163 int _qinfra;
1164 int _qblkm;
1165 int _qgarb;
1166 int _qzhar;
1167 int _qveil;
1168 int _qmod;
1169 int _qbutch;
1170 int _qbol;
1171 int _qblind;
1172 int _qblood;
1173 int _qanvil;
1174 int _qwarlrd;
1175 int _qking;
1176 int _qpw;
1177 int _qbone;
1178 int _qvb;
1179#ifdef HELLFIRE
1180 int _qgrv;
1181 int _qfarm;
1182 int _qgirl;
1183 int _qtrade;
1184 int _qdefiler;
1185 int _qnakrul;
1186 int _qjersy;
1187 int _qhf8;
1188#endif
1189} QuestTalkData;
1190
1191//////////////////////////////////////////////////
1192// gendung
1193//////////////////////////////////////////////////
1194
1195typedef struct ScrollStruct {
1196 int _sxoff; // X-offset of camera position. This usually corresponds to a negative version of plr[myplr]._pxoff
1197 int _syoff; // Y-offset of camera position. This usually corresponds to a negative version of plr[myplr]._pyoff
1198 int _sdx;
1199 int _sdy;
1200 int _sdir;
