Mercurial > mm7
comparison Engine/SaveLoad.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 | 65c97624c047 |
children | d87bfbd3bb3b |
comparison
equal
deleted
inserted
replaced
2564:f9bdfe26d03d | 2565:117c219bf913 |
---|---|
1 #define _CRTDBG_MAP_ALLOC | 1 #define _CRTDBG_MAP_ALLOC |
2 #define _CRT_SECURE_NO_WARNINGS | |
2 #include <stdlib.h> | 3 #include <stdlib.h> |
3 #include <crtdbg.h> | 4 #include <crtdbg.h> |
4 | |
5 #define _CRT_SECURE_NO_WARNINGS | |
6 #include <io.h> | 5 #include <io.h> |
7 #include <direct.h> | 6 #include <direct.h> |
8 | 7 |
9 #include "Engine/Engine.h" | 8 #include "Engine/Engine.h" |
10 | 9 #include "Engine/texts.h" |
11 #include "ZlibWrapper.h" | 10 #include "Engine/ZlibWrapper.h" |
12 #include "SaveLoad.h" | 11 #include "Engine/SaveLoad.h" |
13 #include "Party.h" | 12 #include "Engine/Party.h" |
14 #include "LOD.h" | 13 #include "Engine/LOD.h" |
14 #include "Engine/Timer.h" | |
15 #include "Engine/stru123.h" | |
15 #include "Engine/Graphics/Outdoor.h" | 16 #include "Engine/Graphics/Outdoor.h" |
16 #include "Media/Audio/AudioPlayer.h" | 17 #include "Engine/Graphics/Overlays.h" |
18 #include "Engine/Graphics/Viewport.h" | |
19 #include "Engine/Graphics/Level/Decoration.h" | |
17 #include "Engine/Objects/Actor.h" | 20 #include "Engine/Objects/Actor.h" |
18 #include "Engine/Objects/Chest.h" | 21 #include "Engine/Objects/Chest.h" |
19 #include "Timer.h" | 22 #include "Engine/Objects/SpriteObject.h" |
23 #include "Engine/Serialization/LegacyImages.h" | |
24 | |
20 #include "GUI/GUIWindow.h" | 25 #include "GUI/GUIWindow.h" |
21 #include "GUI/GUIFont.h" | 26 #include "GUI/GUIFont.h" |
22 #include "Engine/Graphics/Overlays.h" | 27 |
23 #include "Engine/Objects/SpriteObject.h" | 28 #include "Media/Audio/AudioPlayer.h" |
24 #include "Engine/Graphics/Viewport.h" | |
25 #include "stru123.h" | |
26 #include "texts.h" | |
27 #include "Engine/Graphics/Level/Decoration.h" | |
28 | 29 |
29 #include "MMT.h" | 30 #include "MMT.h" |
30 | 31 |
31 | 32 |
32 | 33 |
33 struct SavegameList *pSavegameList = new SavegameList; | 34 struct SavegameList *pSavegameList = new SavegameList; |
34 unsigned int uNumSavegameFiles; | 35 unsigned int uNumSavegameFiles; |
35 std::array<unsigned int, 45> pSavegameUsedSlots; | 36 std::array<unsigned int, 45> pSavegameUsedSlots; |
36 std::array<struct RGBTexture, 45> pSavegameThumbnails; | 37 std::array<struct RGBTexture, 45> pSavegameThumbnails; |
37 std::array<SavegameHeader, 45> pSavegameHeader; | 38 std::array<SavegameHeader, 45> pSavegameHeader; |
39 | |
40 | |
38 | 41 |
39 //----- (0045EE8A) -------------------------------------------------------- | 42 //----- (0045EE8A) -------------------------------------------------------- |
40 void __fastcall LoadGame(unsigned int uSlot) | 43 void __fastcall LoadGame(unsigned int uSlot) |
41 { | 44 { |
42 bool v25; // esi@62 | 45 bool v25; // esi@62 |
92 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:549", 0); | 95 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:549", 0); |
93 } | 96 } |
94 Assert(sizeof(SavegameHeader) == 100); | 97 Assert(sizeof(SavegameHeader) == 100); |
95 fread(&header, sizeof(SavegameHeader), 1, file); | 98 fread(&header, sizeof(SavegameHeader), 1, file); |
96 | 99 |
97 file = pNew_LOD->FindContainer("party.bin", 1); | 100 { |
98 if (!file) | 101 file = pNew_LOD->FindContainer("party.bin", 1); |
99 { | 102 if (!file) |
100 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 101);//Сохраненная игра повреждена! Code=%d | 103 { |
101 Log::Warning(L"%S", Str); | 104 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 101);//Сохраненная игра повреждена! Code=%d |
102 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:559", 0); | 105 Log::Warning(L"%S", Str); |
103 } | 106 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:559", 0); |
104 if (sizeof(Party) != 0x16238) | 107 } |
105 Log::Warning(L"class Party: deserialization warning"); | 108 else |
106 fread(pParty, sizeof(Party), 1, file); | 109 { |
107 | 110 Party_Image_MM7 serialization; |
108 | 111 fread(&serialization, sizeof(serialization), 1, file); |
109 file = pNew_LOD->FindContainer("clock.bin", 1); | 112 |
110 if (!file) | 113 serialization.Deserialize(pParty); |
111 { | 114 } |
112 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 102);//Сохраненная игра повреждена! Code=%d | 115 } |
113 Log::Warning(L"%S", Str); | 116 |
114 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:569", 0); | 117 { |
115 } | 118 file = pNew_LOD->FindContainer("clock.bin", 1); |
116 if (sizeof(Timer) != 0x28) | 119 if (!file) |
117 Log::Warning(L"class Timer: deserialization warning"); | 120 { |
118 fread(pEventTimer, sizeof(Timer), 1, file); | 121 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 102);//Сохраненная игра повреждена! Code=%d |
119 | 122 Log::Warning(L"%S", Str); |
120 file = pNew_LOD->FindContainer("overlay.bin", 1); | 123 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:569", 0); |
121 if (!file) | 124 } |
122 { | 125 else |
123 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 103);//Сохраненная игра повреждена! Code=%d | 126 { |
124 Log::Warning(L"%S", Str); | 127 Timer_Image_MM7 serialization; |
125 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:579", 0); | 128 fread(&serialization, sizeof(serialization), 1, file); |
126 } | 129 |
127 if (sizeof(OtherOverlayList) != 0x3F0) | 130 serialization.Deserialize(pEventTimer); |
128 Log::Warning(L"class OtherOverlayList: deserialization warning"); | 131 } |
129 fread(pOtherOverlayList, sizeof(OtherOverlayList), 1, file); | 132 } |
130 | 133 |
131 file = pNew_LOD->FindContainer("npcdata.bin", 0); | 134 { |
132 if (!file) | 135 file = pNew_LOD->FindContainer("overlay.bin", 1); |
133 { | 136 if (!file) |
134 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 104);//Сохраненная игра повреждена! Code=%d | 137 { |
135 Log::Warning(L"%S", Str); | 138 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 103);//Сохраненная игра повреждена! Code=%d |
136 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:590", 0); | 139 Log::Warning(L"%S", Str); |
137 } | 140 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:579", 0); |
138 if (sizeof(pNPCStats->pNewNPCData) != 0x94BC) | 141 } |
139 Log::Warning(L"NPCStats: deserialization warning"); | 142 else |
140 fread(pNPCStats->pNewNPCData, sizeof(pNPCStats->pNewNPCData), 1, file); | 143 { |
141 pNPCStats->_476C60(); | 144 OtherOverlayList_Image_MM7 serialization; |
145 fread(&serialization, sizeof(serialization), 1, file); | |
146 | |
147 serialization.Deserialize(pOtherOverlayList); | |
148 } | |
149 } | |
150 | |
151 { | |
152 file = pNew_LOD->FindContainer("npcdata.bin", 0); | |
153 if (!file) | |
154 { | |
155 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 104);//Сохраненная игра повреждена! Code=%d | |
156 Log::Warning(L"%S", Str); | |
157 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:590", 0); | |
158 } | |
159 else | |
160 { | |
161 NPCData_Image_MM7 serialization[501]; | |
162 fread(serialization, sizeof(serialization), 1, file); | |
163 | |
164 for (unsigned int i = 0; i < 501; ++i) | |
165 serialization[i].Deserialize(pNPCStats->pNewNPCData + i); | |
166 | |
167 pNPCStats->_476C60_on_load_game(); | |
168 } | |
169 } | |
142 | 170 |
143 file = pNew_LOD->FindContainer("npcgroup.bin", 0); | 171 file = pNew_LOD->FindContainer("npcgroup.bin", 0); |
144 if (!file) | 172 if (!file) |
145 { | 173 { |
146 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 105);//Сохраненная игра повреждена! Code=%d | 174 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 105);//Сохраненная игра повреждена! Code=%d |
217 bFlashQuestBook = false; | 245 bFlashQuestBook = false; |
218 viewparams->bRedrawGameUI = true; | 246 viewparams->bRedrawGameUI = true; |
219 } | 247 } |
220 | 248 |
221 //----- (0045F469) -------------------------------------------------------- | 249 //----- (0045F469) -------------------------------------------------------- |
222 void SaveGame( bool IsAutoSAve, bool NotSaveWorld ) | 250 void SaveGame(bool IsAutoSAve, bool NotSaveWorld) |
223 { | 251 { |
224 int text_pos; // eax@6 | 252 int text_pos; // eax@6 |
225 FILE *pLLoidFile; // edi@24 | 253 FILE *pLLoidFile; // edi@24 |
226 char* compressed_buf; // edi@30 | 254 char* compressed_buf; // edi@30 |
227 char *data_write_pos; // esi@41 | 255 char *data_write_pos; // esi@41 |
228 CHAR Buffer[128]; // [sp+Ch] [bp-264h]@59 | 256 CHAR Buffer[128]; // [sp+Ch] [bp-264h]@59 |
229 char Dir[255]; // [sp+8Ch] [bp-1E4h]@51 | 257 char Dir[255]; // [sp+8Ch] [bp-1E4h]@51 |
230 char Drive[255]; // [sp+ACh] [bp-1C4h]@51 | 258 char Drive[255]; // [sp+ACh] [bp-1C4h]@51 |
231 SavegameHeader save_header; // [sp+CCh] [bp-1A4h]@10 | 259 SavegameHeader save_header; // [sp+CCh] [bp-1A4h]@10 |
232 char Filename[255]; // [sp+130h] [bp-140h]@51 | 260 char Filename[255]; // [sp+130h] [bp-140h]@51 |
233 char Ext[255]; // [sp+150h] [bp-120h]@51 | 261 char Ext[255]; // [sp+150h] [bp-120h]@51 |
234 char Source[32]; // [sp+170h] [bp-100h]@51 | 262 char Source[32]; // [sp+170h] [bp-100h]@51 |
235 char work_string[120]; // [sp+190h] [bp-E0h]@8 | 263 char work_string[120]; // [sp+190h] [bp-E0h]@8 |
236 int pPositionY; // [sp+208h] [bp-68h]@2 | 264 int pPositionY; // [sp+208h] [bp-68h]@2 |
237 int pPositionX; // [sp+20Ch] [bp-64h]@2 | 265 int pPositionX; // [sp+20Ch] [bp-64h]@2 |
238 int sPRotationY; // [sp+210h] [bp-60h]@2 | 266 int sPRotationY; // [sp+210h] [bp-60h]@2 |
239 int sPRotationX; // [sp+214h] [bp-5Ch]@2 | 267 int sPRotationX; // [sp+214h] [bp-5Ch]@2 |
240 ODMHeader odm_data; // [sp+218h] [bp-58h]@30 | 268 ODMHeader odm_data; // [sp+218h] [bp-58h]@30 |
241 int res; // [sp+224h] [bp-4Ch]@30 | 269 int res; // [sp+224h] [bp-4Ch]@30 |
242 int pPositionZ; // [sp+228h] [bp-48h]@2 | 270 int pPositionZ; // [sp+228h] [bp-48h]@2 |
243 size_t Size; // [sp+250h] [bp-20h]@26 | 271 size_t Size; // [sp+250h] [bp-20h]@26 |
244 char *uncompressed_buff; // [sp+258h] [bp-18h]@2 | 272 char *uncompressed_buff; // [sp+258h] [bp-18h]@2 |
245 unsigned int compressed_block_size; // [sp+260h] [bp-10h]@23 | 273 unsigned int compressed_block_size; // [sp+260h] [bp-10h]@23 |
246 | 274 |
247 //v66 = a2; | 275 //v66 = a2; |
248 strcpy(byte_6BE3B0.data(), pCurrentMapName);//byte_6BE3B0 - save_map_name | 276 strcpy(byte_6BE3B0.data(), pCurrentMapName);//byte_6BE3B0 - save_map_name |
249 if (!_stricmp(pCurrentMapName, "d05.blv")) // arena | 277 if (!_stricmp(pCurrentMapName, "d05.blv")) // arena |
250 return; | 278 return; |
251 | 279 |
252 uncompressed_buff = (char*)malloc(1000000); | 280 uncompressed_buff = (char*)malloc(1000000); |
253 | 281 |
254 LOD::Directory pLodDirectory; // [sp+22Ch] [bp-44h]@2 | 282 LOD::Directory pLodDirectory; // [sp+22Ch] [bp-44h]@2 |
255 pPositionX = pParty->vPosition.x; | 283 pPositionX = pParty->vPosition.x; |
256 pPositionY = pParty->vPosition.y; | 284 pPositionY = pParty->vPosition.y; |
257 pPositionZ = pParty->vPosition.z; | 285 pPositionZ = pParty->vPosition.z; |
258 sPRotationY = pParty->sRotationY; | 286 sPRotationY = pParty->sRotationY; |
259 sPRotationX = pParty->sRotationX; | 287 sPRotationX = pParty->sRotationX; |
260 pParty->vPosition.x = pParty->vPrevPosition.x; | 288 pParty->vPosition.x = pParty->vPrevPosition.x; |
261 pParty->vPosition.z = pParty->vPrevPosition.z; | 289 pParty->vPosition.z = pParty->vPrevPosition.z; |
262 pParty->vPosition.y = pParty->vPrevPosition.y; | 290 pParty->vPosition.y = pParty->vPrevPosition.y; |
263 | 291 |
264 pParty->uFallStartY = pParty->vPrevPosition.z; | 292 pParty->uFallStartY = pParty->vPrevPosition.z; |
265 | 293 |
266 pParty->sRotationY = pParty->sPrevRotationY; | 294 pParty->sRotationY = pParty->sPrevRotationY; |
267 pParty->sRotationX = pParty->sPrevRotationX; | 295 pParty->sRotationX = pParty->sPrevRotationX; |
268 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | 296 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
269 pIndoor->stru1.uLastVisitDay = pParty->uTimePlayed; | 297 pIndoor->stru1.uLastVisitDay = pParty->uTimePlayed; |
270 else | 298 else |
271 pOutdoor->loc_time.uLastVisitDay = pParty->uTimePlayed; | 299 pOutdoor->loc_time.uLastVisitDay = pParty->uTimePlayed; |
272 | 300 |
273 pRenderer->PackScreenshot(150, 112, uncompressed_buff, 1000000, &pLodDirectory.uDataSize);//создание скриншота | 301 pRenderer->PackScreenshot(150, 112, uncompressed_buff, 1000000, &pLodDirectory.uDataSize);//создание скриншота |
274 strcpy(pLodDirectory.pFilename, "image.pcx"); | 302 strcpy(pLodDirectory.pFilename, "image.pcx"); |
275 | 303 |
276 if (current_screen_type == SCREEN_SAVEGAME) | 304 if (current_screen_type == SCREEN_SAVEGAME) |
277 { | 305 { |
278 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); | 306 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); |
279 pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); | 307 pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); |
280 text_pos = pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[190]); | 308 text_pos = pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[190]); |
281 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, text_pos + 25, 219, 0, pGlobalTXT_LocalizationStrings[190], 0, 0, 0); //Сохранение | 309 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, text_pos + 25, 219, 0, pGlobalTXT_LocalizationStrings[190], 0, 0, 0); //Сохранение |
282 text_pos = pFontSmallnum->AlignText_Center(186, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); | 310 text_pos = pFontSmallnum->AlignText_Center(186, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); |
283 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, text_pos + 25, 259, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0); | 311 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, text_pos + 25, 259, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0); |
284 text_pos = pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[165]); | 312 text_pos = pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[165]); |
285 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, text_pos + 25, 299, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0); //Пожалуйста, подождите | 313 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, text_pos + 25, 299, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0); //Пожалуйста, подождите |
286 pRenderer->Present(); | 314 pRenderer->Present(); |
287 } | 315 } |
288 | 316 |
289 if (pNew_LOD->Write(&pLodDirectory, uncompressed_buff, 0)) | 317 if (pNew_LOD->Write(&pLodDirectory, uncompressed_buff, 0)) |
290 { | 318 { |
291 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 200); //Сохраненная игра повреждена! Code=%d | 319 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 200); //Сохраненная игра повреждена! Code=%d |
292 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:773", 0); | 320 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:773", 0); |
293 } | 321 } |
294 | 322 |
295 Assert(sizeof(SavegameHeader) == 100); | 323 Assert(sizeof(SavegameHeader) == 100); |
296 memset(save_header.pName, 0, 20); | 324 memset(save_header.pName, 0, 20); |
297 memset(save_header.pLocationName, 0, 20); | 325 memset(save_header.pLocationName, 0, 20); |
298 memset(save_header.field_30, 0, 52); | 326 memset(save_header.field_30, 0, 52); |
299 strcpy(save_header.pLocationName, pCurrentMapName); | 327 strcpy(save_header.pLocationName, pCurrentMapName); |
300 save_header.uWordTime = pParty->uTimePlayed; | 328 save_header.uWordTime = pParty->uTimePlayed; |
301 strcpy(pLodDirectory.pFilename, "header.bin"); | 329 strcpy(pLodDirectory.pFilename, "header.bin"); |
302 pLodDirectory.uDataSize = sizeof(SavegameHeader); | 330 pLodDirectory.uDataSize = sizeof(SavegameHeader); |
303 if (pNew_LOD->Write(&pLodDirectory, &save_header, 0)) | 331 if (pNew_LOD->Write(&pLodDirectory, &save_header, 0)) |
304 { | 332 { |
305 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 201); | 333 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 201); |
306 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:784", 0); | 334 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:784", 0); |
307 } | 335 } |
308 strcpy(pLodDirectory.pFilename, "party.bin"); | 336 |
309 pLodDirectory.uDataSize = sizeof(Party); //90680; | 337 |
310 if ( pNew_LOD->Write(&pLodDirectory, pParty, 0) ) | 338 { |
311 { | 339 Party_Image_MM7 serialization; |
312 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 202);//Save game corrupted! Code=%d | 340 serialization.Serialize(pParty); |
313 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:793", 0); | 341 |
314 } | 342 pLodDirectory.uDataSize = sizeof(serialization); |
315 strcpy(pLodDirectory.pFilename, "clock.bin"); | 343 strcpy(pLodDirectory.pFilename, "party.bin"); |
316 pLodDirectory.uDataSize =sizeof(Timer);// 40; | 344 if (pNew_LOD->Write(&pLodDirectory, &serialization, 0)) |
317 if ( pNew_LOD->Write(&pLodDirectory, pEventTimer, 0) ) | 345 { |
318 { | 346 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 202);//Save game corrupted! Code=%d |
319 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 203); | 347 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:793", 0); |
320 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:802", 0); | 348 } |
321 } | 349 } |
322 strcpy(pLodDirectory.pFilename, "overlay.bin"); | 350 |
323 pLodDirectory.uDataSize =sizeof(OtherOverlayList);// 1008; | 351 { |
324 if ( pNew_LOD->Write(&pLodDirectory, pOtherOverlayList, 0) ) | 352 Timer_Image_MM7 serialization; |
325 { | 353 serialization.Serialize(pEventTimer); |
326 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 204); | 354 |
327 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:811", 0); | 355 pLodDirectory.uDataSize = sizeof(serialization); |
328 } | 356 strcpy(pLodDirectory.pFilename, "clock.bin"); |
329 strcpy(pLodDirectory.pFilename, "npcdata.bin"); | 357 if (pNew_LOD->Write(&pLodDirectory, &serialization, 0)) |
330 pLodDirectory.uDataSize = 501 * sizeof(NPCData); | 358 { |
331 Assert(pLodDirectory.uDataSize == 38076); | 359 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 203); |
332 if ( pNew_LOD->Write(&pLodDirectory, pNPCStats->pNewNPCData, 0) ) | 360 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:802", 0); |
333 { | 361 } |
334 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 205); | 362 } |
335 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:820", 0); | 363 |
336 } | 364 { |
365 OtherOverlayList_Image_MM7 serialization; | |
366 serialization.Serialize(pOtherOverlayList); | |
367 | |
368 pLodDirectory.uDataSize = sizeof(serialization); | |
369 strcpy(pLodDirectory.pFilename, "overlay.bin"); | |
370 if (pNew_LOD->Write(&pLodDirectory, &serialization, 0)) | |
371 { | |
372 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 204); | |
373 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:811", 0); | |
374 } | |
375 } | |
376 | |
377 { | |
378 NPCData_Image_MM7 serialization[501]; | |
379 for (unsigned int i = 0; i < 501; ++i) | |
380 serialization[i].Serialize(pNPCStats->pNewNPCData + i); | |
381 | |
382 pLodDirectory.uDataSize = sizeof(serialization); | |
383 strcpy(pLodDirectory.pFilename, "npcdata.bin"); | |
384 if (pNew_LOD->Write(&pLodDirectory, serialization, 0)) | |
385 { | |
386 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 205); | |
387 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:820", 0); | |
388 } | |
389 } | |
390 | |
337 strcpy(pLodDirectory.pFilename, "npcgroup.bin"); | 391 strcpy(pLodDirectory.pFilename, "npcgroup.bin"); |
338 pLodDirectory.uDataSize = 102; | 392 pLodDirectory.uDataSize = 102; |
339 if ( pNew_LOD->Write(&pLodDirectory, pNPCStats->pGroups_copy, 0) ) | 393 if ( pNew_LOD->Write(&pLodDirectory, pNPCStats->pGroups_copy, 0) ) |
340 { | 394 { |
341 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 206); | 395 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 206); |
342 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:829", 0); | 396 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:829", 0); |
343 } | 397 } |
398 | |
344 for (int i = 1; i <= 4; ++i) // 4 - players | 399 for (int i = 1; i <= 4; ++i) // 4 - players |
345 { | 400 { |
346 for (int j = 1; j <= 5; ++j) // 5 - images | 401 for (int j = 1; j <= 5; ++j) // 5 - images |
347 { | 402 { |
348 sprintf(work_string, "data\\lloyd%d%d.pcx", i, j); | 403 sprintf(work_string, "data\\lloyd%d%d.pcx", i, j); |
365 Size = 5080748; | 420 Size = 5080748; |
366 } | 421 } |
367 } | 422 } |
368 } | 423 } |
369 } | 424 } |
425 | |
370 if ( !NotSaveWorld )//autosave for change location | 426 if ( !NotSaveWorld )//autosave for change location |
371 { | 427 { |
372 //__debugbreak(); | 428 //__debugbreak(); |
373 CompactLayingItemsList(); | 429 CompactLayingItemsList(); |
374 compressed_buf = (char*)malloc(1000000); | 430 compressed_buf = (char*)malloc(1000000); |