comparison Engine/Serialization/LegacyImages.h @ 2565:117c219bf913

Party, items and stuff are abstracted from savegame file representation
author a.parshin
date Wed, 20 May 2015 15:12:33 +0200
parents
children d569340b05ff
comparison
equal deleted inserted replaced
2564:f9bdfe26d03d 2565:117c219bf913
1 #pragma once
2 /*
3 * Party, timers, NPCs and other stuff is binary dumped into resources/savegame files, which limits ability to alter
4 * these structures without breaking compatibility.
5 * This module is used to serialzie and deserialize native game structures intro their current representations without
6 * breaking compatibility with original files.
7 */
8
9
10 #pragma pack(push, 1)
11 struct NPCData_Image_MM7
12 {
13 NPCData_Image_MM7();
14
15 void Serialize(struct NPCData *item);
16 void Deserialize(struct NPCData *item);
17
18 /* 00 */ char *pName;
19 /* 04 */ unsigned int uPortraitID;
20 /* 08 */ unsigned int uFlags; // & 0x80 no greeting on dialogue start; looks like hired
21 /* 0C */ int fame;
22 /* 10 */ int rep;
23 /* 14 */ unsigned int Location2D;
24 /* 18 */ unsigned int uProfession;
25 /* 1C */ int greet;
26 /* 20 */ int joins;
27 /* 24 */ int field_24;
28 /* 28 */ unsigned int evt_A;
29 /* 2C */ unsigned int evt_B;
30 /* 30 */ unsigned int evt_C;
31 /* 34 */ unsigned int evt_D;
32 /* 38 */ unsigned int evt_E;
33 /* 3C */ unsigned int evt_F;
34 /* 40 */ unsigned int uSex;
35 /* 44 */ int bHasUsedTheAbility;
36 /* 48 */ int news_topic;
37 /* 4C */
38 };
39
40 struct ItemGen_Image_MM7
41 {
42 ItemGen_Image_MM7();
43
44 void Serialize(struct ItemGen *item);
45 void Deserialize(struct ItemGen *item);
46
47 /* 00 */ int uItemID;
48 /* 04 */ int uEnchantmentType;
49 /* 08 */ int m_enchantmentStrength;
50 /* 0C */ int uSpecEnchantmentType;
51 // 25 +5 levels
52 // 16 Drain Hit Points from target.
53 // 35 Increases chance of disarming.
54 // 39 Double damage vs Demons.
55 // 40 Double damage vs Dragons
56 // 45 +5 Speed and Accuracy
57 // 56 +5 Might and Endurance.
58 // 57 +5 Intellect and Personality.
59 // 58 Increased Value.
60 // 60 +3 Unarmed and Dodging skills
61 // 61 +3 Stealing and Disarm skills.
62 // 59 Increased Weapon speed.
63 // 63 Double Damage vs. Elves.
64 // 64 Double Damage vs. Undead.
65 // 67 Adds 5 points of Body damage and +2 Disarm skill.
66 // 68 Adds 6-8 points of Cold damage and +5 Armor Class.
67 // 71 Prevents drowning damage.
68 // 72 Prevents falling damage.
69 /* 10 */ int uNumCharges;
70 /* 14 */ unsigned int uAttributes;
71 /* 18 */ unsigned __int8 uBodyAnchor;
72 /* 19 */ char uMaxCharges;
73 /* 1A */ char uHolderPlayer;
74 /* 1B */ char field_1B;
75 /* 1C */ unsigned __int64 uExpireTime;
76 };
77
78 struct SpellBuff_Image_MM7
79 {
80 SpellBuff_Image_MM7();
81
82 void Serialize(struct SpellBuff *item);
83 void Deserialize(struct SpellBuff *item);
84
85 /* 00 */ signed __int64 uExpireTime;
86 /* 08 */ unsigned __int16 uPower;
87 /* 0A */ unsigned __int16 uSkill;
88 /* 0C */ unsigned __int16 uOverlayID;
89 /* 0E */ unsigned __int8 uCaster;
90 /* 0F */ unsigned __int8 uFlags;
91 /* 10 */
92 };
93
94 struct PlayerSpellbookChapter_Image_MM7
95 {
96 PlayerSpellbookChapter_Image_MM7();
97
98 /* 00 */ char bIsSpellAvailable[11];
99 /* 0B */
100 };
101 struct PlayerSpells_Image_MM7
102 {
103 PlayerSpells_Image_MM7();
104
105 union
106 {
107 struct
108 {
109 /* 00 */ PlayerSpellbookChapter_Image_MM7 pFireSpellbook;
110 /* 0B */ PlayerSpellbookChapter_Image_MM7 pAirSpellbook;
111 /* 16 */ PlayerSpellbookChapter_Image_MM7 pWaterSpellbook;
112 /* 21 */ PlayerSpellbookChapter_Image_MM7 pEarthSpellbook;
113 /* 2C */ PlayerSpellbookChapter_Image_MM7 pSpiritSpellbook;
114 /* 37 */ PlayerSpellbookChapter_Image_MM7 pMindSpellbook;
115 /* 42 */ PlayerSpellbookChapter_Image_MM7 pBodySpellbook;
116 /* 4D */ PlayerSpellbookChapter_Image_MM7 pLightSpellbook;
117 /* 58 */ PlayerSpellbookChapter_Image_MM7 pDarkSpellbook;
118 /* 63 */ char _pad;
119 /* 64 */
120 };
121 struct
122 {
123 /* 00 */ PlayerSpellbookChapter_Image_MM7 pChapters[9];
124 /* 63 */ char _pad;
125 /* 64 */
126 };
127 struct
128 {
129 /* 00 */ char bHaveSpell[99];
130 /* 63 */ char _pad;
131 /* 64 */
132 };
133 };
134 };
135
136 union PlayerEquipment_Image_MM7
137 {
138 PlayerEquipment_Image_MM7();
139
140 union
141 {
142 struct
143 {
144 /* 00 */ unsigned int uShield;
145 /* 04 */ unsigned int uMainHand;
146 /* 08 */ unsigned int uBow;
147 /* 0C */ unsigned int uArmor;
148 /* 10 */ unsigned int uHelm;
149 /* 14 */ unsigned int uBelt;
150 /* 18 */ unsigned int uCloak;
151 /* 1C */ unsigned int uGlove;
152 /* 20 */ unsigned int uBoot;
153 /* 24 */ unsigned int uAmulet;
154 /* 28 */ unsigned int uRings[6];
155 /* 40 */
156 };
157 unsigned int pIndices[16];
158 };
159 };
160
161 struct LloydBeacon_Image_MM7
162 {
163 LloydBeacon_Image_MM7();
164
165 /* 00 */ unsigned __int64 uBeaconTime;
166 /* 08 */ int PartyPos_X;
167 /* 0C */ int PartyPos_Y;
168 /* 10 */ int PartyPos_Z;
169 /* 14 */ __int16 PartyRot_X;
170 /* 16 */ __int16 PartyRot_Y;
171 /* 18 */ int SaveFileID;
172 /* 1C */
173 };
174
175 struct Player_Image_MM7
176 {
177 Player_Image_MM7();
178
179 void Serialize(struct Player *);
180 void Deserialize(struct Player *);
181
182 /* 0000 */ __int64 pConditions[20];
183 /* 00A0 */ unsigned __int64 uExperience;
184 /* 00A8 */ char pName[16];
185 /* 00B8 */ unsigned char uSex;
186 /* 00B9 */ unsigned char classType;
187 /* 00BA */ unsigned __int8 uCurrentFace;
188 /* 00BB */ char field_BB;
189 /* 00BC */ unsigned __int16 uMight;
190 /* 00BE */ unsigned __int16 uMightBonus;
191 /* 00C0 */ unsigned __int16 uIntelligence;
192 /* 00C2 */ unsigned __int16 uIntelligenceBonus;
193 /* 00C4 */ unsigned __int16 uWillpower;
194 /* 00C6 */ unsigned __int16 uWillpowerBonus;
195 /* 00C8 */ unsigned __int16 uEndurance;
196 /* 00CA */ unsigned __int16 uEnduranceBonus;
197 /* 00CC */ unsigned __int16 uSpeed;
198 /* 00CE */ unsigned __int16 uSpeedBonus;
199 /* 00D0 */ unsigned __int16 uAccuracy;
200 /* 00D2 */ unsigned __int16 uAccuracyBonus;
201 /* 00D4 */ unsigned __int16 uLuck;
202 /* 00D6 */ unsigned __int16 uLuckBonus;
203 /* 00D8 */ __int16 sACModifier;
204 /* 00DA */ unsigned __int16 uLevel;
205 /* 00DC */ __int16 sLevelModifier;
206 /* 00DE */ __int16 sAgeModifier;
207 /* 00E0 */ int field_E0;
208 /* 00E4 */ int field_E4;
209 /* 00E8 */ int field_E8;
210 /* 00EC */ int field_EC;
211 /* 00F0 */ int field_F0;
212 /* 00F4 */ int field_F4;
213 /* 00F8 */ int field_F8;
214 /* 00FC */ int field_FC;
215 /* 0100 */ int field_100;
216 /* 0104 */ int field_104;
217 /* 0108 */ union
218 {
219 struct
220 {
221 unsigned __int16 skillStaff;
222 unsigned __int16 skillSword;
223 unsigned __int16 skillDagger;
224 unsigned __int16 skillAxe;
225 unsigned __int16 skillSpear;
226 unsigned __int16 skillBow;
227 unsigned __int16 skillMace;
228 unsigned __int16 skillBlaster;
229 unsigned __int16 skillShield;
230 unsigned __int16 skillLeather;
231 unsigned __int16 skillChain;
232 unsigned __int16 skillPlate;
233 unsigned __int16 skillFire;
234 unsigned __int16 skillAir;
235 unsigned __int16 skillWater;
236 unsigned __int16 skillEarth;
237 unsigned __int16 skillSpirit;
238 unsigned __int16 skillMind;
239 unsigned __int16 skillBody;
240 unsigned __int16 skillLight;
241 unsigned __int16 skillDark;
242 unsigned __int16 skillItemId;
243 unsigned __int16 skillMerchant;
244 unsigned __int16 skillRepair;
245 unsigned __int16 skillBodybuilding;
246 unsigned __int16 skillMeditation;
247 unsigned __int16 skillPerception;
248 unsigned __int16 skillDiplomacy;
249 unsigned __int16 skillThievery;
250 unsigned __int16 skillDisarmTrap;
251 unsigned __int16 skillDodge;
252 unsigned __int16 skillUnarmed;
253 unsigned __int16 skillMonsterId;
254 unsigned __int16 skillArmsmaster;
255 unsigned __int16 skillStealing;
256 unsigned __int16 skillAlchemy;
257 unsigned __int16 skillLearning;
258 };
259 unsigned __int16 pActiveSkills[37];
260 };
261 /* 0152 */ unsigned char _achieved_awards_bits[64];
262 /* 0192 */ PlayerSpells_Image_MM7 spellbook;
263 /* 01F6 */ char _1F6_pad[2];
264 /* 01F8 */ int pure_luck_used;
265 /* 01FC */ int pure_speed_used;
266 /* 0200 */ int pure_intellect_used;
267 /* 0204 */ int pure_endurance_used;
268 /* 0208 */ int pure_willpower_used;
269 /* 020C */ int pure_accuracy_used;
270 /* 0210 */ int pure_might_used;
271 /* 0214 */ union
272 {
273 struct
274 {
275 ItemGen_Image_MM7 pInventoryItemList[126];
276 ItemGen_Image_MM7 pEquippedItems[12];
277 };
278 struct
279 {
280 ItemGen_Image_MM7 pOwnItems[138];
281 };
282 };
283 /* 157C */ int pInventoryMatrix[126];
284 /* 1774 */ __int16 sResFireBase;
285 /* 1776 */ __int16 sResAirBase;
286 /* 1778 */ __int16 sResWaterBase;
287 /* 177A */ __int16 sResEarthBase;
288 /* 177C */ __int16 field_177C;
289 /* 177E */ __int16 sResMagicBase;
290 /* 1780 */ __int16 sResSpiritBase;
291 /* 1782 */ __int16 sResMindBase;
292 /* 1784 */ __int16 sResBodyBase;
293 /* 1786 */ __int16 sResLightBase;
294 /* 1788 */ __int16 sResDarkBase;
295 /* 178A */ __int16 sResFireBonus;
296 /* 178C */ __int16 sResAirBonus;
297 /* 178E */ __int16 sResWaterBonus;
298 /* 1790 */ __int16 sResEarthBonus;
299 /* 1792 */ __int16 field_1792;
300 /* 1794 */ __int16 sResMagicBonus;
301 /* 1796 */ __int16 sResSpiritBonus;
302 /* 1798 */ __int16 sResMindBonus;
303 /* 179A */ __int16 sResBodyBonus;
304 /* 179C */ __int16 sResLightBonus;
305 /* 179E */ __int16 sResDarkBonus;
306 /* 17A0 */ SpellBuff_Image_MM7 pPlayerBuffs[24];
307 /* 1920 */ unsigned int uVoiceID;
308 /* 1924 */ int uPrevVoiceID;
309 /* 1928 */ int uPrevFace;
310 /* 192C */ int field_192C;
311 /* 1930 */ int field_1930;
312 /* 1934 */ unsigned __int16 uTimeToRecovery;
313 /* 1936 */ char field_1936;
314 /* 1937 */ char field_1937;
315 /* 1938 */ unsigned int uSkillPoints;
316 /* 193C */ int sHealth;
317 /* 1940 */ int sMana;
318 /* 1944 */ unsigned int uBirthYear;
319 /* 1948 */ PlayerEquipment_Image_MM7 pEquipment;
320 /* 1988 */ int field_1988[49];
321 /* 1A4C */ char field_1A4C;
322 /* 1A4D */ char field_1A4D;
323 /* 1A4E */ char lastOpenedSpellbookPage;
324 /* 1A4F */ unsigned __int8 uQuickSpell;
325 /* 1A50 */ char playerEventBits[64];
326 /* 1A90 */ char _some_attack_bonus;
327 /* 1A91 */ char field_1A91;
328 /* 1A92 */ char _melee_dmg_bonus;
329 /* 1A93 */ char field_1A93;
330 /* 1A94 */ char _ranged_atk_bonus;
331 /* 1A95 */ char field_1A95;
332 /* 1A96 */ char _ranged_dmg_bonus;
333 /* 1A97 */ char field_1A97;
334 /* 1A98 */ char uFullHealthBonus;
335 /* 1A99 */ char _health_related;
336 /* 1A9A */ char uFullManaBonus;
337 /* 1A9B */ char _mana_related;
338 /* 1A9C */ unsigned __int16 expression;
339 /* 1A9E */ unsigned __int16 uExpressionTimePassed;
340 /* 1AA0 */ unsigned __int16 uExpressionTimeLength;
341 /* 1AA2 */ __int16 field_1AA2;
342 /* 1AA4 */ int _expression21_animtime;
343 /* 1AA8 */ int _expression21_frameset;
344 /* 1AAC */ LloydBeacon_Image_MM7 pInstalledBeacons[5];
345 /* 1B38 */ char uNumDivineInterventionCastsThisDay;
346 /* 1B39 */ char uNumArmageddonCasts;
347 /* 1B3A */ char uNumFireSpikeCasts;
348 /* 1B3B */ char field_1B3B;
349 /* 1B3C */
350 };
351
352
353 struct PartyTimeStruct_Image_MM7
354 {
355 PartyTimeStruct_Image_MM7();
356
357 /* 000 */ __int64 bountyHunting_next_generation_time[10];
358 /* 050 */ __int64 Shops_next_generation_time[85];//field_50
359 /* 2F8 */ __int64 _shop_ban_times[53];
360 /* 4A0 */ unsigned __int64 CounterEventValues[10]; // (0xACD314h in Silvo's binary)
361 /* 4F0 */ __int64 HistoryEventTimes[29]; // (0xACD364h in Silvo's binary)
362 /* 5D8 */ unsigned __int64 _s_times[20]; //5d8 440h+8*51 //(0xACD44Ch in Silvo's binary)
363 /* 678 */
364 };
365
366 struct Party_Image_MM7
367 {
368 Party_Image_MM7();
369
370 void Serialize(struct Party *);
371 void Deserialize(struct Party *);
372
373 /* 00000 */ int field_0;
374 /* 00004 */ unsigned int uPartyHeight;
375 /* 00008 */ unsigned int uDefaultPartyHeight;
376 /* 0000C */ int sEyelevel;
377 /* 00010 */ unsigned int uDefaultEyelevel;
378 /* 00014 */ int field_14_radius;
379 /* 00018 */ int y_rotation_granularity;
380 /* 0001C */ unsigned int uWalkSpeed;
381 /* 00020 */ int y_rotation_speed; // deg/s
382 /* 00024 */ int field_24;
383 /* 00028 */ int field_28;
384 /* 0002C */ unsigned __int64 uTimePlayed;
385 /* 00034 */ __int64 uLastRegenerationTime;
386 /* 0003C */ PartyTimeStruct_Image_MM7 PartyTimes;
387 /* 006B4 */ Vec3_int_ vPosition;
388 /* 006C0 */ int sRotationY;
389 /* 006C4 */ int sRotationX;
390 /* 006C8 */ Vec3_int_ vPrevPosition;
391 /* 006D4 */ int sPrevRotationY;
392 /* 006D8 */ int sPrevRotationX;
393 /* 006DC */ int sPrevEyelevel;
394 /* 006E0 */ int field_6E0;
395 /* 006E4 */ int field_6E4;
396 /* 006E8 */ int uFallSpeed;
397 /* 006EC */ int field_6EC;
398 /* 006F0 */ int field_6F0;
399 /* 006F4 */ int floor_face_pid; // face we are standing at
400 /* 006F8 */ int walk_sound_timer;
401 /* 006FC */ int field_6FC;
402 /* 00700 */ int uFallStartY;
403 /* 00704 */ unsigned int bFlying;
404 /* 00708 */ char field_708;
405 /* 00709 */ unsigned __int8 hirelingScrollPosition;
406 /* 0070A */ char field_70A;
407 /* 0070B */ char field_70B;
408 /* 0070C */ unsigned int uCurrentYear;
409 /* 00710 */ unsigned int uCurrentMonth;
410 /* 00714 */ unsigned int uCurrentMonthWeek;
411 /* 00718 */ unsigned int uDaysPlayed;
412 /* 0071C */ unsigned int uCurrentHour;
413 /* 00720 */ unsigned int uCurrentMinute;
414 /* 00724 */ unsigned int uCurrentTimeSecond;
415 /* 00728 */ unsigned int uNumFoodRations;
416 /* 0072C */ int field_72C;
417 /* 00730 */ int field_730;
418 /* 00734 */ unsigned int uNumGold;
419 /* 00738 */ unsigned int uNumGoldInBank;
420 /* 0073C */ unsigned int uNumDeaths;
421 /* 00740 */ int field_740;
422 /* 00744 */ int uNumPrisonTerms;
423 /* 00748 */ unsigned int uNumBountiesCollected;
424 /* 0074C */ int field_74C;
425 /* 00750 */ __int16 monster_id_for_hunting[5];
426 /* 0075A */ __int16 monster_for_hunting_killed[5];
427 /* 00764 */ unsigned char days_played_without_rest;
428 /* 00765 */ unsigned __int8 _quest_bits[64];
429 /* 007A5 */ unsigned __int8 pArcomageWins[16];
430 /* 007B5 */ char field_7B5_in_arena_quest;
431 /* 007B6 */ char uNumArenaPageWins;
432 /* 007B7 */ char uNumArenaSquireWins;
433 /* 007B8 */ char uNumArenaKnightWins;
434 /* 007B9 */ char uNumArenaLordWins;
435 /* 007BA */ char pIsArtifactFound[29]; //7ba
436 /* 007D7 */ char field_7d7[39];
437 /* 007FE */ unsigned char _autonote_bits[26];
438 /* 00818 */ char field_818[60];
439 /* 00854 */ char field_854[32];
440 /* 00874 */ int uNumArcomageWins;
441 /* 00878 */ int uNumArcomageLoses;
442 /* 0087C */ unsigned int bTurnBasedModeOn;
443 /* 00880 */ int field_880;
444 /* 00884 */ int uFlags2;
445 /* 00888 */ unsigned int alignment;
446 /* 0088C */ SpellBuff_Image_MM7 pPartyBuffs[20];
447 /* 00954 */ Player_Image_MM7 pPlayers[4];
448 /* 07644 */ NPCData_Image_MM7 pHirelings[2];
449 /* 07754 */ ItemGen_Image_MM7 pPickedItem;
450 /* 07778 */ unsigned int uFlags;
451 /* 0777C */ ItemGen_Image_MM7 StandartItemsInShops[53][12];
452 /* 0D0EC */ ItemGen_Image_MM7 SpecialItemsInShops[53][12];
453 /* 12A5C */ ItemGen_Image_MM7 SpellBooksInGuilds[32][12];
454 /* 1605C */ char field_1605C[24];
455 /* 16074 */ char pHireling1Name[100];
456 /* 160D8 */ char pHireling2Name[100];
457 /* 1613C */ int armageddon_timer;
458 /* 16140 */ int armageddonDamage;
459 /* 16144 */ int pTurnBasedPlayerRecoveryTimes[4];
460 /* 16154 */ int InTheShopFlags[53];
461 /* 16228 */ int uFine;
462 /* 1622C */ float flt_TorchlightColorR;
463 /* 16230 */ float flt_TorchlightColorG;
464 /* 16234 */ float flt_TorchlightColorB;
465 /* 16238 */
466 };
467
468
469
470 struct Timer_Image_MM7
471 {
472 Timer_Image_MM7();
473
474 void Serialize(struct Timer *);
475 void Deserialize(struct Timer *);
476
477 /* 00 */ unsigned int bReady;
478 /* 04 */ unsigned int bPaused;
479 /* 08 */ int bTackGameTime;
480 /* 0C */ unsigned int uStartTime;
481 /* 10 */ unsigned int uStopTime;
482 /* 14 */ int uGameTimeStart;
483 /* 18 */ int field_18;
484 /* 1C */ unsigned int uTimeElapsed;
485 /* 20 */ int dt_in_some_format;
486 /* 24 */ unsigned int uTotalGameTimeElapsed;
487 /* 28 */
488 };
489
490
491
492
493 /* 282 */
494 struct OtherOverlay_Image_MM7
495 {
496 OtherOverlay_Image_MM7();
497
498 /* 00 */ __int16 field_0;
499 /* 02 */ __int16 field_2;
500 /* 04 */ __int16 field_4;
501 /* 06 */ __int16 field_6;
502 /* 08 */ __int16 field_8;
503 /* 0A */ __int16 field_A;
504 /* 0C */ __int16 field_C;
505 /* 0E */ __int16 field_E;
506 /* 10 */ int field_10;
507 /* 14 */
508 };
509
510 /* 63 */
511 struct OtherOverlayList_Image_MM7
512 {
513 OtherOverlayList_Image_MM7();
514
515 void Serialize(struct OtherOverlayList *);
516 void Deserialize(struct OtherOverlayList *);
517
518 /* 000 */ OtherOverlay_Image_MM7 pOverlays[50];
519 /* 3E8 */ int field_3E8;
520 /* 3EC */ int bRedraw;
521 /* 3F0 */
522 };
523
524 #pragma pack(pop)