1 /**
2  * @file pack.h
3  *
4  * Interface of functions for minifying player data structure.
5  */
6 #ifndef __PACK_H__
7 #define __PACK_H__
8 
9 #include "items.h"
10 
11 DEVILUTION_BEGIN_NAMESPACE
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 #pragma pack(push, 1)
18 typedef struct PkItemStruct {
19 	Uint32 iSeed;
20 	Uint16 iCreateInfo;
21 	Uint16 idx;
22 	Uint8 bId;
23 	Uint8 bDur;
24 	Uint8 bMDur;
25 	Uint8 bCh;
26 	Uint8 bMCh;
27 	Uint16 wValue;
28 	Uint32 dwBuff;
29 } PkItemStruct;
30 
31 typedef struct PkPlayerStruct {
32 	Uint32 dwLowDateTime;
33 	Uint32 dwHighDateTime;
34 	Sint8 destAction;
35 	Sint8 destParam1;
36 	Sint8 destParam2;
37 	Uint8 plrlevel;
38 	Uint8 px;
39 	Uint8 py;
40 	Uint8 targx;
41 	Uint8 targy;
42 	char pName[PLR_NAME_LEN];
43 	Sint8 pClass;
44 	Uint8 pBaseStr;
45 	Uint8 pBaseMag;
46 	Uint8 pBaseDex;
47 	Uint8 pBaseVit;
48 	Sint8 pLevel;
49 	Uint8 pStatPts;
50 	Sint32 pExperience;
51 	Sint32 pGold;
52 	Sint32 pHPBase;
53 	Sint32 pMaxHPBase;
54 	Sint32 pManaBase;
55 	Sint32 pMaxManaBase;
56 	Sint8 pSplLvl[37]; // Should be MAX_SPELLS but set to 37 to make save games compatible
57 	Uint64 pMemSpells;
58 	PkItemStruct InvBody[NUM_INVLOC];
59 	PkItemStruct InvList[NUM_INV_GRID_ELEM];
60 	Sint8 InvGrid[NUM_INV_GRID_ELEM];
61 	Uint8 _pNumInv;
62 	PkItemStruct SpdList[MAXBELTITEMS];
63 	Sint8 pTownWarps;
64 	Sint8 pDungMsgs;
65 	Sint8 pLvlLoad;
66 	Uint8 pBattleNet;
67 	Uint8 pManaShield;
68 	Uint8 pDungMsgs2;
69 	Sint8 bIsHellfire;
70 	Sint8 bReserved; // For future use
71 	Uint16 wReflections;
72 	Sint16 wReserved2;  // For future use
73 	Sint8 pSplLvl2[10]; // Hellfire spells
74 	Sint16 wReserved8;  // For future use
75 	Uint32 pDiabloKillLevel;
76 	Uint32 pDifficulty;
77 	Sint32 pDamAcFlags;
78 	Sint32 dwReserved[5]; // For future use
79 } PkPlayerStruct;
80 #pragma pack(pop)
81 
82 void PackPlayer(PkPlayerStruct *pPack, int pnum, BOOL manashield);
83 void UnPackPlayer(PkPlayerStruct *pPack, int pnum, BOOL netSync);
84 void PackItem(PkItemStruct *id, const ItemStruct *is);
85 void UnPackItem(const PkItemStruct *is, ItemStruct *id, bool isHellfire);
86 
87 /* rdata */
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 DEVILUTION_END_NAMESPACE
93 
94 #endif /* __PACK_H__ */
95