comparison Engine/Serialization/LegacyImages.cpp @ 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 #include "Engine/Engine.h"
2 #include "Engine/Timer.h"
3 #include "Engine/Party.h"
4 #include "Engine/Objects/NPC.h"
5 #include "Engine/Graphics/Overlays.h"
6 #include "Engine/Serialization/LegacyImages.h"
7
8 NPCData_Image_MM7::NPCData_Image_MM7()
9 {
10 Assert(sizeof(*this) == 0x4C);
11 memset(this, 0, sizeof(*this));
12 }
13
14 ItemGen_Image_MM7::ItemGen_Image_MM7()
15 {
16 Assert(sizeof(*this) == 0x24);
17 memset(this, 0, sizeof(*this));
18 }
19
20 SpellBuff_Image_MM7::SpellBuff_Image_MM7()
21 {
22 Assert(sizeof(*this) == 0x10);
23 memset(this, 0, sizeof(*this));
24 }
25
26 PlayerSpellbookChapter_Image_MM7::PlayerSpellbookChapter_Image_MM7()
27 {
28 Assert(sizeof(*this) == 0xB);
29 memset(this, 0, sizeof(*this));
30 }
31
32 PlayerSpells_Image_MM7::PlayerSpells_Image_MM7()
33 {
34 Assert(sizeof(*this) == 0x64);
35 memset(this, 0, sizeof(*this));
36 }
37
38 PlayerEquipment_Image_MM7::PlayerEquipment_Image_MM7()
39 {
40 Assert(sizeof(*this) == 0x40);
41 memset(this, 0, sizeof(*this));
42 }
43
44 LloydBeacon_Image_MM7::LloydBeacon_Image_MM7()
45 {
46 Assert(sizeof(*this) == 0x1C);
47 memset(this, 0, sizeof(*this));
48 }
49
50 Player_Image_MM7::Player_Image_MM7()
51 {
52 Assert(sizeof(*this) == 0x1B3C);
53 memset(this, 0, sizeof(*this));
54 }
55
56 PartyTimeStruct_Image_MM7::PartyTimeStruct_Image_MM7()
57 {
58 Assert(sizeof(*this) == 0x678);
59 memset(this, 0, sizeof(*this));
60 }
61
62 Party_Image_MM7::Party_Image_MM7()
63 {
64 Assert(sizeof(*this) == 0x16238);
65 memset(this, 0, sizeof(*this));
66 }
67
68 Timer_Image_MM7::Timer_Image_MM7()
69 {
70 Assert(sizeof(*this) == 0x28);
71 memset(this, 0, sizeof(*this));
72 }
73
74 OtherOverlay_Image_MM7::OtherOverlay_Image_MM7()
75 {
76 Assert(sizeof(*this) == 0x14);
77 memset(this, 0, sizeof(*this));
78 }
79
80 OtherOverlayList_Image_MM7::OtherOverlayList_Image_MM7()
81 {
82 Assert(sizeof(*this) == 0x3F0);
83 memset(this, 0, sizeof(*this));
84 }
85
86
87
88
89
90 void Timer_Image_MM7::Serialize(Timer *timer)
91 {
92 memset(this, 0, sizeof(*this));
93
94 this->bReady = timer->bReady;
95 this->bPaused = timer->bPaused;
96 this->bTackGameTime = timer->bTackGameTime;
97 this->uStartTime = timer->uStartTime;
98 this->uStopTime = timer->uStopTime;
99 this->uGameTimeStart = timer->uGameTimeStart;
100 this->field_18 = timer->field_18;
101 this->uTimeElapsed = timer->uTimeElapsed;
102 this->dt_in_some_format = timer->dt_in_some_format;
103 this->uTotalGameTimeElapsed = timer->uTotalGameTimeElapsed;
104 }
105
106 void Timer_Image_MM7::Deserialize(Timer *timer)
107 {
108 timer->bReady = this->bReady;
109 timer->bPaused = this->bPaused;
110 timer->bTackGameTime = this->bTackGameTime;
111 timer->uStartTime = this->uStartTime;
112 timer->uStopTime = this->uStopTime;
113 timer->uGameTimeStart = this->uGameTimeStart;
114 timer->field_18 = this->field_18;
115 timer->uTimeElapsed = this->uTimeElapsed;
116 timer->dt_in_some_format = this->dt_in_some_format;
117 timer->uTotalGameTimeElapsed = this->uTotalGameTimeElapsed;
118 }
119
120 void NPCData_Image_MM7::Serialize(NPCData *npc)
121 {
122 memset(this, 0, sizeof(*this));
123
124 this->pName = npc->pName;
125 this->uPortraitID = npc->uPortraitID;
126 this->uFlags = npc->uFlags;
127 this->fame = npc->fame;
128 this->rep = npc->rep;
129 this->Location2D = npc->Location2D;
130 this->uProfession = npc->uProfession;
131 this->greet = npc->greet;
132 this->joins = npc->joins;
133 this->field_24 = npc->field_24;
134 this->evt_A = npc->evt_A;
135 this->evt_B = npc->evt_B;
136 this->evt_C = npc->evt_C;
137 this->evt_D = npc->evt_D;
138 this->evt_E = npc->evt_E;
139 this->evt_F = npc->evt_F;
140 this->uSex = npc->uSex;
141 this->bHasUsedTheAbility = npc->bHasUsedTheAbility;
142 this->news_topic = npc->news_topic;
143 }
144
145 void NPCData_Image_MM7::Deserialize(NPCData *npc)
146 {
147 npc->pName = this->pName;
148 npc->uPortraitID = this->uPortraitID;
149 npc->uFlags = this->uFlags;
150 npc->fame = this->fame;
151 npc->rep = this->rep;
152 npc->Location2D = this->Location2D;
153 npc->uProfession = this->uProfession;
154 npc->greet = this->greet;
155 npc->joins = this->joins;
156 npc->field_24 = this->field_24;
157 npc->evt_A = this->evt_A;
158 npc->evt_B = this->evt_B;
159 npc->evt_C = this->evt_C;
160 npc->evt_D = this->evt_D;
161 npc->evt_E = this->evt_E;
162 npc->evt_F = this->evt_F;
163 npc->uSex = this->uSex;
164 npc->bHasUsedTheAbility = this->bHasUsedTheAbility;
165 npc->news_topic = this->news_topic;
166 }
167
168
169 void OtherOverlayList_Image_MM7::Serialize(OtherOverlayList *list)
170 {
171 memset(this, 0, sizeof(*this));
172
173 this->bRedraw = list->bRedraw;
174 this->field_3E8 = list->field_3E8;
175
176 for (unsigned int i = 0; i < 50; ++i)
177 {
178 memset(&this->pOverlays[i], 0, sizeof(this->pOverlays[i]));
179
180 this->pOverlays[i].field_0 = list->pOverlays[i].field_0;
181 this->pOverlays[i].field_2 = list->pOverlays[i].field_2;
182 this->pOverlays[i].field_4 = list->pOverlays[i].field_4;
183 this->pOverlays[i].field_6 = list->pOverlays[i].field_6;
184 this->pOverlays[i].field_8 = list->pOverlays[i].field_8;
185 this->pOverlays[i].field_A = list->pOverlays[i].field_A;
186 this->pOverlays[i].field_C = list->pOverlays[i].field_C;
187 this->pOverlays[i].field_E = list->pOverlays[i].field_E;
188 this->pOverlays[i].field_10 = list->pOverlays[i].field_10;
189 }
190 }
191
192
193 void OtherOverlayList_Image_MM7::Deserialize(OtherOverlayList *list)
194 {
195 list->bRedraw = this->bRedraw;
196 list->field_3E8 = this->field_3E8;
197
198 for (unsigned int i = 0; i < 50; ++i)
199 {
200 memset(&list->pOverlays[i], 0, sizeof(list->pOverlays[i]));
201
202 list->pOverlays[i].field_0 = this->pOverlays[i].field_0;
203 list->pOverlays[i].field_2 = this->pOverlays[i].field_2;
204 list->pOverlays[i].field_4 = this->pOverlays[i].field_4;
205 list->pOverlays[i].field_6 = this->pOverlays[i].field_6;
206 list->pOverlays[i].field_8 = this->pOverlays[i].field_8;
207 list->pOverlays[i].field_A = this->pOverlays[i].field_A;
208 list->pOverlays[i].field_C = this->pOverlays[i].field_C;
209 list->pOverlays[i].field_E = this->pOverlays[i].field_E;
210 list->pOverlays[i].field_10 = this->pOverlays[i].field_10;
211 }
212 }
213
214
215
216 void SpellBuff_Image_MM7::Serialize(SpellBuff *buff)
217 {
218 memset(this, 0, sizeof(*this));
219
220 this->uExpireTime = buff->uExpireTime;
221 this->uPower = buff->uPower;
222 this->uSkill = buff->uSkill;
223 this->uOverlayID = buff->uOverlayID;
224 this->uCaster = buff->uCaster;
225 this->uFlags = buff->uFlags;
226 }
227
228 void SpellBuff_Image_MM7::Deserialize(SpellBuff *buff)
229 {
230 buff->uExpireTime = this->uExpireTime;
231 buff->uPower = this->uPower;
232 buff->uSkill = this->uSkill;
233 buff->uOverlayID = this->uOverlayID;
234 buff->uCaster = this->uCaster;
235 buff->uFlags = this->uFlags;
236 }
237
238
239
240 void ItemGen_Image_MM7::Serialize(ItemGen *item)
241 {
242 memset(this, 0, sizeof(*this));
243
244 this->uItemID = item->uItemID;
245 this->uEnchantmentType = item->uEnchantmentType;
246 this->m_enchantmentStrength = item->m_enchantmentStrength;
247 this->uSpecEnchantmentType = item->uSpecEnchantmentType;
248 this->uNumCharges = item->uNumCharges;
249 this->uAttributes = item->uAttributes;
250 this->uBodyAnchor = item->uBodyAnchor;
251 this->uMaxCharges = item->uMaxCharges;
252 this->uHolderPlayer = item->uHolderPlayer;
253 this->field_1B = item->field_1B;
254 this->uExpireTime = item->uExpireTime;
255 }
256
257 void ItemGen_Image_MM7::Deserialize(ItemGen *item)
258 {
259 item->uItemID = this->uItemID;
260 item->uEnchantmentType = this->uEnchantmentType;
261 item->m_enchantmentStrength = this->m_enchantmentStrength;
262 item->uSpecEnchantmentType = this->uSpecEnchantmentType;
263 item->uNumCharges = this->uNumCharges;
264 item->uAttributes = this->uAttributes;
265 item->uBodyAnchor = this->uBodyAnchor;
266 item->uMaxCharges = this->uMaxCharges;
267 item->uHolderPlayer = this->uHolderPlayer;
268 item->field_1B = this->field_1B;
269 item->uExpireTime = this->uExpireTime;
270 }
271
272
273 void Party_Image_MM7::Serialize(Party *party)
274 {
275 memset(this, 0, sizeof(*this));
276
277 this->field_0 = party->field_0;
278 this->uPartyHeight = party->uPartyHeight;
279 this->uDefaultPartyHeight = party->uDefaultPartyHeight;
280 this->sEyelevel = party->sEyelevel;
281 this->uDefaultEyelevel = party->uDefaultEyelevel;
282 this->field_14_radius = party->field_14_radius;
283 this->y_rotation_granularity = party->y_rotation_granularity;
284 this->uWalkSpeed = party->uWalkSpeed;
285 this->y_rotation_speed = party->y_rotation_speed;
286 this->field_24 = party->field_24;
287 this->field_28 = party->field_28;
288 this->uTimePlayed = party->uTimePlayed;
289 this->uLastRegenerationTime = party->uLastRegenerationTime;
290
291 for (unsigned int i = 0; i < 10; ++i)
292 this->PartyTimes.bountyHunting_next_generation_time[i] = party->PartyTimes.bountyHunting_next_generation_time[i];
293 for (unsigned int i = 0; i < 85; ++i)
294 this->PartyTimes.Shops_next_generation_time[i] = party->PartyTimes.Shops_next_generation_time[i];
295 for (unsigned int i = 0; i < 53; ++i)
296 this->PartyTimes._shop_ban_times[i] = party->PartyTimes._shop_ban_times[i];
297 for (unsigned int i = 0; i < 10; ++i)
298 this->PartyTimes.CounterEventValues[i] = party->PartyTimes.CounterEventValues[i];
299 for (unsigned int i = 0; i < 29; ++i)
300 this->PartyTimes.HistoryEventTimes[i] = party->PartyTimes.HistoryEventTimes[i];
301 for (unsigned int i = 0; i < 20; ++i)
302 this->PartyTimes._s_times[i] = party->PartyTimes._s_times[i];
303
304 this->vPosition.x = party->vPosition.x;
305 this->vPosition.y = party->vPosition.y;
306 this->vPosition.z = party->vPosition.z;
307 this->sRotationY = party->sRotationY;
308 this->sRotationX = party->sRotationX;
309 this->vPrevPosition.x = party->vPrevPosition.x;
310 this->vPrevPosition.y = party->vPrevPosition.y;
311 this->vPrevPosition.z = party->vPrevPosition.z;
312 this->sPrevRotationY = party->sPrevRotationY;
313 this->sPrevRotationX = party->sPrevRotationX;
314 this->sPrevEyelevel = party->sPrevEyelevel;
315 this->field_6E0 = party->field_6E0;
316 this->field_6E4 = party->field_6E4;
317 this->uFallSpeed = party->uFallSpeed;
318 this->field_6EC = party->field_6EC;
319 this->field_6F0 = party->field_6F0;
320 this->floor_face_pid = party->floor_face_pid;
321 this->walk_sound_timer = party->walk_sound_timer;
322 this->field_6FC = party->field_6FC;
323 this->uFallStartY = party->uFallStartY;
324 this->bFlying = party->bFlying;
325 this->field_708 = party->field_708;
326 this->hirelingScrollPosition = party->hirelingScrollPosition;
327 this->field_70A = party->field_70A;
328 this->field_70B = party->field_70B;
329 this->uCurrentYear = party->uCurrentYear;
330 this->uCurrentMonth = party->uCurrentMonth;
331 this->uCurrentMonthWeek = party->uCurrentMonthWeek;
332 this->uDaysPlayed = party->uDaysPlayed;
333 this->uCurrentHour = party->uCurrentHour;
334 this->uCurrentMinute = party->uCurrentMinute;
335 this->uCurrentTimeSecond = party->uCurrentTimeSecond;
336 this->uNumFoodRations = party->uNumFoodRations;
337 this->field_72C = party->field_72C;
338 this->field_730 = party->field_730;
339 this->uNumGold = party->uNumGold;
340 this->uNumGoldInBank = party->uNumGoldInBank;
341 this->uNumDeaths = party->uNumDeaths;
342 this->field_740 = party->field_740;
343 this->uNumPrisonTerms = party->uNumPrisonTerms;
344 this->uNumBountiesCollected = party->uNumBountiesCollected;
345 this->field_74C = party->field_74C;
346
347 for (unsigned int i = 0; i < 5; ++i)
348 this->monster_id_for_hunting[i] = party->monster_id_for_hunting[i];
349 for (unsigned int i = 0; i < 5; ++i)
350 this->monster_for_hunting_killed[i] = party->monster_for_hunting_killed[i];
351
352 this->days_played_without_rest = party->days_played_without_rest;
353
354 for (unsigned int i = 0; i < 64; ++i)
355 this->_quest_bits[i] = party->_quest_bits[i];
356 for (unsigned int i = 0; i < 16; ++i)
357 this->pArcomageWins[i] = party->pArcomageWins[i];
358
359 this->field_7B5_in_arena_quest = party->field_7B5_in_arena_quest;
360 this->uNumArenaPageWins = party->uNumArenaPageWins;
361 this->uNumArenaSquireWins = party->uNumArenaSquireWins;
362 this->uNumArenaKnightWins = party->uNumArenaKnightWins;
363 this->uNumArenaLordWins = party->uNumArenaLordWins;
364
365 for (unsigned int i = 0; i < 29; ++i)
366 this->pIsArtifactFound[i] = party->pIsArtifactFound[i];
367 for (unsigned int i = 0; i < 39; ++i)
368 this->field_7d7[i] = party->field_7d7[i];
369 for (unsigned int i = 0; i < 26; ++i)
370 this->_autonote_bits[i] = party->_autonote_bits[i];
371 for (unsigned int i = 0; i < 60; ++i)
372 this->field_818[i] = party->field_818[i];
373 for (unsigned int i = 0; i < 32; ++i)
374 this->field_854[i] = party->field_854[i];
375
376 this->uNumArcomageWins = party->uNumArcomageWins;
377 this->uNumArcomageLoses = party->uNumArcomageLoses;
378 this->bTurnBasedModeOn = party->bTurnBasedModeOn;
379 this->field_880 = party->field_880;
380 this->uFlags2 = party->uFlags2;
381 this->alignment = party->alignment;
382
383 for (unsigned int i = 0; i < 20; ++i)
384 this->pPartyBuffs[i].Serialize(&party->pPartyBuffs[i]);
385 for (unsigned int i = 0; i < 4; ++i)
386 this->pPlayers[i].Serialize(&party->pPlayers[i]);
387 for (unsigned int i = 0; i < 2; ++i)
388 this->pHirelings[i].Serialize(&party->pHirelings[i]);
389
390 this->pPickedItem.Serialize(&party->pPickedItem);
391
392 this->uFlags = party->uFlags;
393
394 for (unsigned int i = 0; i < 53; ++i)
395 for (unsigned int j = 0; j < 12; ++j)
396 this->StandartItemsInShops[i][j].Serialize(&party->StandartItemsInShops[i][j]);
397
398 for (unsigned int i = 0; i < 53; ++i)
399 for (unsigned int j = 0; j < 12; ++j)
400 this->SpecialItemsInShops[i][j].Serialize(&party->SpecialItemsInShops[i][j]);
401
402 for (unsigned int i = 0; i < 32; ++i)
403 for (unsigned int j = 0; j < 12; ++j)
404 this->SpellBooksInGuilds[i][j].Serialize(&party->SpellBooksInGuilds[i][j]);
405
406 for (unsigned int i = 0; i < 24; ++i)
407 this->field_1605C[i] = party->field_1605C[i];
408
409 strcpy(this->pHireling1Name, party->pHireling1Name);
410 strcpy(this->pHireling2Name, party->pHireling2Name);
411
412 this->armageddon_timer = party->armageddon_timer;
413 this->armageddonDamage = party->armageddonDamage;
414
415 for (unsigned int i = 0; i < 4; ++i)
416 this->pTurnBasedPlayerRecoveryTimes[i] = party->pTurnBasedPlayerRecoveryTimes[i];
417
418 for (unsigned int i = 0; i < 53; ++i)
419 this->InTheShopFlags[i] = party->InTheShopFlags[i];
420
421 this->uFine = party->uFine;
422 this->flt_TorchlightColorR = party->flt_TorchlightColorR;
423 this->flt_TorchlightColorG = party->flt_TorchlightColorG;
424 this->flt_TorchlightColorB = party->flt_TorchlightColorB;
425 }
426
427
428 void Party_Image_MM7::Deserialize(Party *party)
429 {
430 party->field_0 = this->field_0;
431 party->uPartyHeight = this->uPartyHeight;
432 party->uDefaultPartyHeight = this->uDefaultPartyHeight;
433 party->sEyelevel = this->sEyelevel;
434 party->uDefaultEyelevel = this->uDefaultEyelevel;
435 party->field_14_radius = this->field_14_radius;
436 party->y_rotation_granularity = this->y_rotation_granularity;
437 party->uWalkSpeed = this->uWalkSpeed;
438 party->y_rotation_speed = this->y_rotation_speed;
439 party->field_24 = this->field_24;
440 party->field_28 = this->field_28;
441 party->uTimePlayed = this->uTimePlayed;
442 party->uLastRegenerationTime = this->uLastRegenerationTime;
443
444 for (unsigned int i = 0; i < 10; ++i)
445 party->PartyTimes.bountyHunting_next_generation_time[i] = this->PartyTimes.bountyHunting_next_generation_time[i];
446 for (unsigned int i = 0; i < 85; ++i)
447 party->PartyTimes.Shops_next_generation_time[i] = this->PartyTimes.Shops_next_generation_time[i];
448 for (unsigned int i = 0; i < 53; ++i)
449 party->PartyTimes._shop_ban_times[i] = this->PartyTimes._shop_ban_times[i];
450 for (unsigned int i = 0; i < 10; ++i)
451 party->PartyTimes.CounterEventValues[i] = this->PartyTimes.CounterEventValues[i];
452 for (unsigned int i = 0; i < 29; ++i)
453 party->PartyTimes.HistoryEventTimes[i] = this->PartyTimes.HistoryEventTimes[i];
454 for (unsigned int i = 0; i < 20; ++i)
455 party->PartyTimes._s_times[i] = this->PartyTimes._s_times[i];
456
457 party->vPosition.x = this->vPosition.x;
458 party->vPosition.y = this->vPosition.y;
459 party->vPosition.z = this->vPosition.z;
460 party->sRotationY = this->sRotationY;
461 party->sRotationX = this->sRotationX;
462 party->vPrevPosition.x = this->vPrevPosition.x;
463 party->vPrevPosition.y = this->vPrevPosition.y;
464 party->vPrevPosition.z = this->vPrevPosition.z;
465 party->sPrevRotationY = this->sPrevRotationY;
466 party->sPrevRotationX = this->sPrevRotationX;
467 party->sPrevEyelevel = this->sPrevEyelevel;
468 party->field_6E0 = this->field_6E0;
469 party->field_6E4 = this->field_6E4;
470 party->uFallSpeed = this->uFallSpeed;
471 party->field_6EC = this->field_6EC;
472 party->field_6F0 = this->field_6F0;
473 party->floor_face_pid = this->floor_face_pid;
474 party->walk_sound_timer = this->walk_sound_timer;
475 party->field_6FC = this->field_6FC;
476 party->uFallStartY = this->uFallStartY;
477 party->bFlying = this->bFlying;
478 party->field_708 = this->field_708;
479 party->hirelingScrollPosition = this->hirelingScrollPosition;
480 party->field_70A = this->field_70A;
481 party->field_70B = this->field_70B;
482 party->uCurrentYear = this->uCurrentYear;
483 party->uCurrentMonth = this->uCurrentMonth;
484 party->uCurrentMonthWeek = this->uCurrentMonthWeek;
485 party->uDaysPlayed = this->uDaysPlayed;
486 party->uCurrentHour = this->uCurrentHour;
487 party->uCurrentMinute = this->uCurrentMinute;
488 party->uCurrentTimeSecond = this->uCurrentTimeSecond;
489 party->uNumFoodRations = this->uNumFoodRations;
490 party->field_72C = this->field_72C;
491 party->field_730 = this->field_730;
492 party->uNumGold = this->uNumGold;
493 party->uNumGoldInBank = this->uNumGoldInBank;
494 party->uNumDeaths = this->uNumDeaths;
495 party->field_740 = this->field_740;
496 party->uNumPrisonTerms = this->uNumPrisonTerms;
497 party->uNumBountiesCollected = this->uNumBountiesCollected;
498 party->field_74C = this->field_74C;
499
500 for (unsigned int i = 0; i < 5; ++i)
501 party->monster_id_for_hunting[i] = this->monster_id_for_hunting[i];
502 for (unsigned int i = 0; i < 5; ++i)
503 party->monster_for_hunting_killed[i] = this->monster_for_hunting_killed[i];
504
505 party->days_played_without_rest = this->days_played_without_rest;
506
507 for (unsigned int i = 0; i < 64; ++i)
508 party->_quest_bits[i] = this->_quest_bits[i];
509 for (unsigned int i = 0; i < 16; ++i)
510 party->pArcomageWins[i] = this->pArcomageWins[i];
511
512 party->field_7B5_in_arena_quest = this->field_7B5_in_arena_quest;
513 party->uNumArenaPageWins = this->uNumArenaPageWins;
514 party->uNumArenaSquireWins = this->uNumArenaSquireWins;
515 party->uNumArenaKnightWins = this->uNumArenaKnightWins;
516 party->uNumArenaLordWins = this->uNumArenaLordWins;
517
518 for (unsigned int i = 0; i < 29; ++i)
519 party->pIsArtifactFound[i] = this->pIsArtifactFound[i];
520 for (unsigned int i = 0; i < 39; ++i)
521 party->field_7d7[i] = this->field_7d7[i];
522 for (unsigned int i = 0; i < 26; ++i)
523 party->_autonote_bits[i] = this->_autonote_bits[i];
524 for (unsigned int i = 0; i < 60; ++i)
525 party->field_818[i] = this->field_818[i];
526 for (unsigned int i = 0; i < 32; ++i)
527 party->field_854[i] = this->field_854[i];
528
529 party->uNumArcomageWins = this->uNumArcomageWins;
530 party->uNumArcomageLoses = this->uNumArcomageLoses;
531 party->bTurnBasedModeOn = this->bTurnBasedModeOn;
532 party->field_880 = this->field_880;
533 party->uFlags2 = this->uFlags2;
534
535 switch (this->alignment)
536 {
537 case 0: party->alignment = PartyAlignment_Good; break;
538 case 1: party->alignment = PartyAlignment_Neutral; break;
539 case 2: party->alignment = PartyAlignment_Evil; break;
540 default:
541 Assert(false);
542 }
543
544 for (unsigned int i = 0; i < 20; ++i)
545 this->pPartyBuffs[i].Deserialize(&party->pPartyBuffs[i]);
546 for (unsigned int i = 0; i < 4; ++i)
547 this->pPlayers[i].Deserialize(&party->pPlayers[i]);
548 for (unsigned int i = 0; i < 2; ++i)
549 this->pHirelings[i].Deserialize(&party->pHirelings[i]);
550
551 this->pPickedItem.Deserialize(&party->pPickedItem);
552
553 party->uFlags = this->uFlags;
554
555 for (unsigned int i = 0; i < 53; ++i)
556 for (unsigned int j = 0; j < 12; ++j)
557 this->StandartItemsInShops[i][j].Deserialize(&party->StandartItemsInShops[i][j]);
558
559 for (unsigned int i = 0; i < 53; ++i)
560 for (unsigned int j = 0; j < 12; ++j)
561 this->SpecialItemsInShops[i][j].Deserialize(&party->SpecialItemsInShops[i][j]);
562
563 for (unsigned int i = 0; i < 32; ++i)
564 for (unsigned int j = 0; j < 12; ++j)
565 this->SpellBooksInGuilds[i][j].Deserialize(&party->SpellBooksInGuilds[i][j]);
566
567 for (unsigned int i = 0; i < 24; ++i)
568 party->field_1605C[i] = this->field_1605C[i];
569
570 strcpy(party->pHireling1Name, this->pHireling1Name);
571 strcpy(party->pHireling2Name, this->pHireling2Name);
572
573 party->armageddon_timer = this->armageddon_timer;
574 party->armageddonDamage = this->armageddonDamage;
575
576 for (unsigned int i = 0; i < 4; ++i)
577 party->pTurnBasedPlayerRecoveryTimes[i] = this->pTurnBasedPlayerRecoveryTimes[i];
578
579 for (unsigned int i = 0; i < 53; ++i)
580 party->InTheShopFlags[i] = this->InTheShopFlags[i];
581
582 party->uFine = this->uFine;
583 party->flt_TorchlightColorR = this->flt_TorchlightColorR;
584 party->flt_TorchlightColorG = this->flt_TorchlightColorG;
585 party->flt_TorchlightColorB = this->flt_TorchlightColorB;
586 }
587
588
589 void Player_Image_MM7::Serialize(Player *player)
590 {
591 memset(this, 0, sizeof(*this));
592
593 for (unsigned int i = 0; i < 20; ++i)
594 this->pConditions[i] = player->pConditions[i];
595
596 this->uExperience = player->uExperience;
597
598 strcpy(this->pName, player->pName);
599
600 this->uSex = player->uSex;
601 this->classType = player->classType;
602 this->uCurrentFace = player->uCurrentFace;
603 this->field_BB = player->field_BB;
604 this->uMight = player->uMight;
605 this->uMightBonus = player->uMightBonus;
606 this->uIntelligence = player->uIntelligence;
607 this->uIntelligenceBonus = player->uIntelligenceBonus;
608 this->uWillpower = player->uWillpower;
609 this->uWillpowerBonus = player->uWillpowerBonus;
610 this->uEndurance = player->uEndurance;
611 this->uEnduranceBonus = player->uEnduranceBonus;
612 this->uSpeed = player->uSpeed;
613 this->uSpeedBonus = player->uSpeedBonus;
614 this->uAccuracy = player->uAccuracy;
615 this->uAccuracyBonus = player->uAccuracyBonus;
616 this->uLuck = player->uLuck;
617 this->uLuckBonus = player->uLuckBonus;
618 this->sACModifier = player->sACModifier;
619 this->uLevel = player->uLevel;
620 this->sLevelModifier = player->sLevelModifier;
621 this->sAgeModifier = player->sAgeModifier;
622 this->field_E0 = player->field_E0;
623 this->field_E4 = player->field_E4;
624 this->field_E8 = player->field_E8;
625 this->field_EC = player->field_EC;
626 this->field_F0 = player->field_F0;
627 this->field_F4 = player->field_F4;
628 this->field_F8 = player->field_F8;
629 this->field_FC = player->field_FC;
630 this->field_100 = player->field_100;
631 this->field_104 = player->field_104;
632
633 for (unsigned int i = 0; i < 37; ++i)
634 this->pActiveSkills[i] = player->pActiveSkills[i];
635
636 for (unsigned int i = 0; i < 64; ++i)
637 this->_achieved_awards_bits[i] = player->_achieved_awards_bits[i];
638
639 for (unsigned int i = 0; i < 99; ++i)
640 this->spellbook.bHaveSpell[i] = player->spellbook.bHaveSpell[i];
641
642 this->pure_luck_used = player->pure_luck_used;
643 this->pure_speed_used = player->pure_speed_used;
644 this->pure_intellect_used = player->pure_intellect_used;
645 this->pure_endurance_used = player->pure_endurance_used;
646 this->pure_willpower_used = player->pure_willpower_used;
647 this->pure_accuracy_used = player->pure_accuracy_used;
648 this->pure_might_used = player->pure_might_used;
649
650 for (unsigned int i = 0; i < 138; ++i)
651 this->pOwnItems[i].Serialize(&player->pOwnItems[i]);
652
653 for (unsigned int i = 0; i < 126; ++i)
654 this->pInventoryMatrix[i] = player->pInventoryMatrix[i];
655
656 this->sResFireBase = player->sResFireBase;
657 this->sResAirBase = player->sResAirBase;
658 this->sResWaterBase = player->sResWaterBase;
659 this->sResEarthBase = player->sResEarthBase;
660 this->field_177C = player->field_177C;
661 this->sResMagicBase = player->sResMagicBase;
662 this->sResSpiritBase = player->sResSpiritBase;
663 this->sResMindBase = player->sResMindBase;
664 this->sResBodyBase = player->sResBodyBase;
665 this->sResLightBase = player->sResLightBase;
666 this->sResDarkBase = player->sResDarkBase;
667 this->sResFireBonus = player->sResFireBonus;
668 this->sResAirBonus = player->sResAirBonus;
669 this->sResWaterBonus = player->sResWaterBonus;
670 this->sResEarthBonus = player->sResEarthBonus;
671 this->field_1792 = player->field_1792;
672 this->sResMagicBonus = player->sResMagicBonus;
673 this->sResSpiritBonus = player->sResSpiritBonus;
674 this->sResMindBonus = player->sResMindBonus;
675 this->sResBodyBonus = player->sResBodyBonus;
676 this->sResLightBonus = player->sResLightBonus;
677 this->sResDarkBonus = player->sResDarkBonus;
678
679 for (unsigned int i = 0; i < 24; ++i)
680 this->pPlayerBuffs[i].Serialize(&player->pPlayerBuffs[i]);
681
682 this->uVoiceID = player->uVoiceID;
683 this->uPrevVoiceID = player->uPrevVoiceID;
684 this->uPrevFace = player->uPrevFace;
685 this->field_192C = player->field_192C;
686 this->field_1930 = player->field_1930;
687 this->uTimeToRecovery = player->uTimeToRecovery;
688 this->field_1936 = player->field_1936;
689 this->field_1937 = player->field_1937;
690 this->uSkillPoints = player->uSkillPoints;
691 this->sHealth = player->sHealth;
692 this->sMana = player->sMana;
693 this->uBirthYear = player->uBirthYear;
694
695 for (unsigned int i = 0; i < 16; ++i)
696 this->pEquipment.pIndices[i] = player->pEquipment.pIndices[i];
697
698 for (unsigned int i = 0; i < 49; ++i)
699 this->field_1988[i] = player->field_1988[i];
700
701 this->field_1A4C = player->field_1A4C;
702 this->field_1A4D = player->field_1A4D;
703 this->lastOpenedSpellbookPage = player->lastOpenedSpellbookPage;
704 this->uQuickSpell = player->uQuickSpell;
705
706 for (unsigned int i = 0; i < 49; ++i)
707 this->playerEventBits[i] = player->playerEventBits[i];
708
709 this->_some_attack_bonus = player->_some_attack_bonus;
710 this->field_1A91 = player->field_1A91;
711 this->_melee_dmg_bonus = player->_melee_dmg_bonus;
712 this->field_1A93 = player->field_1A93;
713 this->_ranged_atk_bonus = player->_ranged_atk_bonus;
714 this->field_1A95 = player->field_1A95;
715 this->_ranged_dmg_bonus = player->_ranged_dmg_bonus;
716 this->field_1A97 = player->field_1A97;
717 this->uFullHealthBonus = player->uFullHealthBonus;
718 this->_health_related = player->_health_related;
719 this->uFullManaBonus = player->uFullManaBonus;
720 this->_mana_related = player->_mana_related;
721 this->expression = player->expression;
722 this->uExpressionTimePassed = player->uExpressionTimePassed;
723 this->uExpressionTimeLength = player->uExpressionTimeLength;
724 this->field_1AA2 = player->field_1AA2;
725 this->_expression21_animtime = player->_expression21_animtime;
726 this->_expression21_frameset = player->_expression21_frameset;
727
728 for (unsigned int i = 0; i < 5; ++i)
729 {
730 this->pInstalledBeacons[i].uBeaconTime = player->pInstalledBeacons[i].uBeaconTime;
731 this->pInstalledBeacons[i].PartyPos_X = player->pInstalledBeacons[i].PartyPos_X;
732 this->pInstalledBeacons[i].PartyPos_Y = player->pInstalledBeacons[i].PartyPos_Y;
733 this->pInstalledBeacons[i].PartyPos_Z = player->pInstalledBeacons[i].PartyPos_Z;
734 this->pInstalledBeacons[i].PartyRot_X = player->pInstalledBeacons[i].PartyRot_X;
735 this->pInstalledBeacons[i].PartyRot_Y = player->pInstalledBeacons[i].PartyRot_Y;
736 this->pInstalledBeacons[i].SaveFileID = player->pInstalledBeacons[i].SaveFileID;
737 }
738
739 this->uNumDivineInterventionCastsThisDay = player->uNumDivineInterventionCastsThisDay;
740 this->uNumArmageddonCasts = player->uNumArmageddonCasts;
741 this->uNumFireSpikeCasts = player->uNumFireSpikeCasts;
742 this->field_1B3B = player->field_1B3B;
743 }
744
745 void Player_Image_MM7::Deserialize(Player *player)
746 {
747 for (unsigned int i = 0; i < 20; ++i)
748 player->pConditions[i] = this->pConditions[i];
749
750 player->uExperience = this->uExperience;
751
752 strcpy(player->pName, this->pName);
753
754 switch (this->uSex)
755 {
756 case 0: player->uSex = SEX_MALE; break;
757 case 1: player->uSex = SEX_FEMALE; break;
758 default:
759 Assert(false);
760 }
761
762 switch (this->classType)
763 {
764 case 0: classType = PLAYER_CLASS_KNIGHT; break;
765 case 1: classType = PLAYER_CLASS_CHEVALIER; break;
766 case 2: classType = PLAYER_CLASS_CHAMPION; break;
767 case 3: classType = PLAYER_CLASS_BLACK_KNIGHT; break;
768 case 4: classType = PLAYER_CLASS_THEIF; break;
769 case 5: classType = PLAYER_CLASS_ROGUE; break;
770 case 6: classType = PLAYER_CLASS_SPY; break;
771 case 7: classType = PLAYER_CLASS_ASSASSIN; break;
772 case 8: classType = PLAYER_CLASS_MONK; break;
773 case 9: classType = PLAYER_CLASS_INITIATE; break;
774 case 10: classType = PLAYER_CLASS_MASTER; break;
775 case 11: classType = PLAYER_CLASS_NINJA; break;
776 case 12: classType = PLAYER_CLASS_PALADIN; break;
777 case 13: classType = PLAYER_CLASS_CRUSADER; break;
778 case 14: classType = PLAYER_CLASS_HERO; break;
779 case 15: classType = PLAYER_CLASS_VILLIAN; break;
780 case 16: classType = PLAYER_CLASS_ARCHER; break;
781 case 17: classType = PLAYER_CLASS_WARRIOR_MAGE; break;
782 case 18: classType = PLAYER_CLASS_MASTER_ARCHER; break;
783 case 19: classType = PLAYER_CLASS_SNIPER; break;
784 case 20: classType = PLAYER_CLASS_RANGER; break;
785 case 21: classType = PLAYER_CLASS_HUNTER; break;
786 case 22: classType = PLAYER_CLASS_RANGER_LORD; break;
787 case 23: classType = PLAYER_CLASS_BOUNTY_HUNTER; break;
788 case 24: classType = PLAYER_CLASS_CLERIC; break;
789 case 25: classType = PLAYER_CLASS_PRIEST; break;
790 case 26: classType = PLAYER_CLASS_PRIEST_OF_SUN; break;
791 case 27: classType = PLAYER_CLASS_PRIEST_OF_MOON; break;
792 case 28: classType = PLAYER_CLASS_DRUID; break;
793 case 29: classType = PLAYER_CLASS_GREAT_DRUID; break;
794 case 30: classType = PLAYER_CLASS_ARCH_DRUID; break;
795 case 31: classType = PLAYER_CLASS_WARLOCK; break;
796 case 32: classType = PLAYER_CLASS_SORCERER; break;
797 case 33: classType = PLAYER_CLASS_WIZARD; break;
798 case 34: classType = PLAYER_CLASS_ARCHMAGE; break;
799 case 35: classType = PLAYER_CLASS_LICH; break;
800 default:
801 Assert(false);
802 }
803
804 player->uCurrentFace = this->uCurrentFace;
805 player->field_BB = this->field_BB;
806 player->uMight = this->uMight;
807 player->uMightBonus = this->uMightBonus;
808 player->uIntelligence = this->uIntelligence;
809 player->uIntelligenceBonus = this->uIntelligenceBonus;
810 player->uWillpower = this->uWillpower;
811 player->uWillpowerBonus = this->uWillpowerBonus;
812 player->uEndurance = this->uEndurance;
813 player->uEnduranceBonus = this->uEnduranceBonus;
814 player->uSpeed = this->uSpeed;
815 player->uSpeedBonus = this->uSpeedBonus;
816 player->uAccuracy = this->uAccuracy;
817 player->uAccuracyBonus = this->uAccuracyBonus;
818 player->uLuck = this->uLuck;
819 player->uLuckBonus = this->uLuckBonus;
820 player->sACModifier = this->sACModifier;
821 player->uLevel = this->uLevel;
822 player->sLevelModifier = this->sLevelModifier;
823 player->sAgeModifier = this->sAgeModifier;
824 player->field_E0 = this->field_E0;
825 player->field_E4 = this->field_E4;
826 player->field_E8 = this->field_E8;
827 player->field_EC = this->field_EC;
828 player->field_F0 = this->field_F0;
829 player->field_F4 = this->field_F4;
830 player->field_F8 = this->field_F8;
831 player->field_FC = this->field_FC;
832 player->field_100 = this->field_100;
833 player->field_104 = this->field_104;
834
835 for (unsigned int i = 0; i < 37; ++i)
836 player->pActiveSkills[i] = this->pActiveSkills[i];
837
838 for (unsigned int i = 0; i < 64; ++i)
839 player->_achieved_awards_bits[i] = this->_achieved_awards_bits[i];
840
841 for (unsigned int i = 0; i < 99; ++i)
842 player->spellbook.bHaveSpell[i] = this->spellbook.bHaveSpell[i];
843
844 player->pure_luck_used = this->pure_luck_used;
845 player->pure_speed_used = this->pure_speed_used;
846 player->pure_intellect_used = this->pure_intellect_used;
847 player->pure_endurance_used = this->pure_endurance_used;
848 player->pure_willpower_used = this->pure_willpower_used;
849 player->pure_accuracy_used = this->pure_accuracy_used;
850 player->pure_might_used = this->pure_might_used;
851
852 for (unsigned int i = 0; i < 138; ++i)
853 this->pOwnItems[i].Deserialize(&player->pOwnItems[i]);
854
855 for (unsigned int i = 0; i < 126; ++i)
856 player->pInventoryMatrix[i] = this->pInventoryMatrix[i];
857
858 player->sResFireBase = this->sResFireBase;
859 player->sResAirBase = this->sResAirBase;
860 player->sResWaterBase = this->sResWaterBase;
861 player->sResEarthBase = this->sResEarthBase;
862 player->field_177C = this->field_177C;
863 player->sResMagicBase = this->sResMagicBase;
864 player->sResSpiritBase = this->sResSpiritBase;
865 player->sResMindBase = this->sResMindBase;
866 player->sResBodyBase = this->sResBodyBase;
867 player->sResLightBase = this->sResLightBase;
868 player->sResDarkBase = this->sResDarkBase;
869 player->sResFireBonus = this->sResFireBonus;
870 player->sResAirBonus = this->sResAirBonus;
871 player->sResWaterBonus = this->sResWaterBonus;
872 player->sResEarthBonus = this->sResEarthBonus;
873 player->field_1792 = this->field_1792;
874 player->sResMagicBonus = this->sResMagicBonus;
875 player->sResSpiritBonus = this->sResSpiritBonus;
876 player->sResMindBonus = this->sResMindBonus;
877 player->sResBodyBonus = this->sResBodyBonus;
878 player->sResLightBonus = this->sResLightBonus;
879 player->sResDarkBonus = this->sResDarkBonus;
880
881 for (unsigned int i = 0; i < 24; ++i)
882 this->pPlayerBuffs[i].Deserialize(&player->pPlayerBuffs[i]);
883
884 player->uVoiceID = this->uVoiceID;
885 player->uPrevVoiceID = this->uPrevVoiceID;
886 player->uPrevFace = this->uPrevFace;
887 player->field_192C = this->field_192C;
888 player->field_1930 = this->field_1930;
889 player->uTimeToRecovery = this->uTimeToRecovery;
890 player->field_1936 = this->field_1936;
891 player->field_1937 = this->field_1937;
892 player->uSkillPoints = this->uSkillPoints;
893 player->sHealth = this->sHealth;
894 player->sMana = this->sMana;
895 player->uBirthYear = this->uBirthYear;
896
897 for (unsigned int i = 0; i < 16; ++i)
898 player->pEquipment.pIndices[i] = this->pEquipment.pIndices[i];
899
900 for (unsigned int i = 0; i < 49; ++i)
901 player->field_1988[i] = this->field_1988[i];
902
903 player->field_1A4C = this->field_1A4C;
904 player->field_1A4D = this->field_1A4D;
905 player->lastOpenedSpellbookPage = this->lastOpenedSpellbookPage;
906 player->uQuickSpell = this->uQuickSpell;
907
908 for (unsigned int i = 0; i < 49; ++i)
909 player->playerEventBits[i] = this->playerEventBits[i];
910
911 player->_some_attack_bonus = this->_some_attack_bonus;
912 player->field_1A91 = this->field_1A91;
913 player->_melee_dmg_bonus = this->_melee_dmg_bonus;
914 player->field_1A93 = this->field_1A93;
915 player->_ranged_atk_bonus = this->_ranged_atk_bonus;
916 player->field_1A95 = this->field_1A95;
917 player->_ranged_dmg_bonus = this->_ranged_dmg_bonus;
918 player->field_1A97 = this->field_1A97;
919 player->uFullHealthBonus = this->uFullHealthBonus;
920 player->_health_related = this->_health_related;
921 player->uFullManaBonus = this->uFullManaBonus;
922 player->_mana_related = this->_mana_related;
923 player->expression = (CHARACTER_EXPRESSION_ID)this->expression;
924 player->uExpressionTimePassed = this->uExpressionTimePassed;
925 player->uExpressionTimeLength = this->uExpressionTimeLength;
926 player->field_1AA2 = this->field_1AA2;
927 player->_expression21_animtime = this->_expression21_animtime;
928 player->_expression21_frameset = this->_expression21_frameset;
929
930 for (unsigned int i = 0; i < 5; ++i)
931 {
932 player->pInstalledBeacons[i].uBeaconTime = this->pInstalledBeacons[i].uBeaconTime;
933 player->pInstalledBeacons[i].PartyPos_X = this->pInstalledBeacons[i].PartyPos_X;
934 player->pInstalledBeacons[i].PartyPos_Y = this->pInstalledBeacons[i].PartyPos_Y;
935 player->pInstalledBeacons[i].PartyPos_Z = this->pInstalledBeacons[i].PartyPos_Z;
936 player->pInstalledBeacons[i].PartyRot_X = this->pInstalledBeacons[i].PartyRot_X;
937 player->pInstalledBeacons[i].PartyRot_Y = this->pInstalledBeacons[i].PartyRot_Y;
938 player->pInstalledBeacons[i].SaveFileID = this->pInstalledBeacons[i].SaveFileID;
939 }
940
941 player->uNumDivineInterventionCastsThisDay = this->uNumDivineInterventionCastsThisDay;
942 player->uNumArmageddonCasts = this->uNumArmageddonCasts;
943 player->uNumFireSpikeCasts = this->uNumFireSpikeCasts;
944 player->field_1B3B = this->field_1B3B;
945 }