comparison SaveLoad.cpp @ 1588:e6ac4919b22c

Слияние
author Ritor1
date Mon, 09 Sep 2013 09:13:40 +0600
parents c4ab816fcc5e
children 75fafd8ced59
comparison
equal deleted inserted replaced
1587:b42e6f35e03d 1588:e6ac4919b22c
2 #define _CRT_SECURE_NO_WARNINGS 2 #define _CRT_SECURE_NO_WARNINGS
3 #endif 3 #endif
4 4
5 #include <io.h> 5 #include <io.h>
6 #include <direct.h> 6 #include <direct.h>
7 #include <assert.h>
8 7
9 #include "SaveLoad.h" 8 #include "SaveLoad.h"
10 #include "BSPModel.h" 9 #include "BSPModel.h"
11 #include "Party.h" 10 #include "Party.h"
12 #include "LOD.h" 11 #include "LOD.h"
103 { 102 {
104 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 100); 103 sprintf(Str, pGlobalTXT_LocalizationStrings[612], 100);
105 Log::Warning(L"%S", Str); 104 Log::Warning(L"%S", Str);
106 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:549", 0); 105 MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:549", 0);
107 } 106 }
108 assert(sizeof(SavegameHeader) == 100); 107 Assert(sizeof(SavegameHeader) == 100);
109 fread(&header, sizeof(SavegameHeader), 1, f); 108 fread(&header, sizeof(SavegameHeader), 1, f);
110 109
111 f = pNew_LOD->FindContainer("party.bin", 1); 110 f = pNew_LOD->FindContainer("party.bin", 1);
112 if (!f) 111 if (!f)
113 { 112 {
209 208
210 v25 = pGames_LOD->DoesContainerExist(header.pLocationName); 209 v25 = pGames_LOD->DoesContainerExist(header.pLocationName);
211 sprintf(pTmpBuf.data(), "levels\\%s", header.pLocationName); 210 sprintf(pTmpBuf.data(), "levels\\%s", header.pLocationName);
212 v26 = _access(pTmpBuf.data(), 4) != -1; 211 v26 = _access(pTmpBuf.data(), 4) != -1;
213 if ( !v25 && !v26 ) 212 if ( !v25 && !v26 )
214 { 213 Error("Unable to find: %s!", header.pLocationName);
215 sprintf(pTmpBuf.data(), "Unable to find: %s!", header.pLocationName);
216 Abortf(pTmpBuf.data());
217 }
218 214
219 strcpy(pCurrentMapName, header.pLocationName); 215 strcpy(pCurrentMapName, header.pLocationName);
220 dword_6BE364_game_settings_1 |= 0x2001; 216 dword_6BE364_game_settings_1 |= 0x2001;
221 217
222 for (uint i = 0; i < uNumSavegameFiles; ++i) 218 for (uint i = 0; i < uNumSavegameFiles; ++i)
306 { 302 {
307 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 200); // ! Code=%d 303 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 200); // ! Code=%d
308 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:773", 0); 304 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:773", 0);
309 } 305 }
310 306
311 assert(sizeof(SavegameHeader) == 100); 307 Assert(sizeof(SavegameHeader) == 100);
312 memset(save_header.pName, 0, 20); 308 memset(save_header.pName, 0, 20);
313 memset(save_header.pLocationName, 0, 20); 309 memset(save_header.pLocationName, 0, 20);
314 memset(save_header.field_30, 0, 52); 310 memset(save_header.field_30, 0, 52);
315 strcpy(save_header.pLocationName, pCurrentMapName); 311 strcpy(save_header.pLocationName, pCurrentMapName);
316 save_header.uWordTime = pParty->uTimePlayed; 312 save_header.uWordTime = pParty->uTimePlayed;
342 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 204); 338 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 204);
343 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:811", 0); 339 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:811", 0);
344 } 340 }
345 strcpy(pLodDirectory.pFilename, "npcdata.bin"); 341 strcpy(pLodDirectory.pFilename, "npcdata.bin");
346 pLodDirectory.uDataSize = 501 * sizeof(NPCData); 342 pLodDirectory.uDataSize = 501 * sizeof(NPCData);
347 assert(pLodDirectory.uDataSize == 38076); 343 Assert(pLodDirectory.uDataSize == 38076);
348 if ( pNew_LOD->Write(&pLodDirectory, pNPCStats->pNewNPCData, 0) ) 344 if ( pNew_LOD->Write(&pLodDirectory, pNPCStats->pNewNPCData, 0) )
349 { 345 {
350 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 205); 346 sprintf(work_string, pGlobalTXT_LocalizationStrings[612], 205);
351 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:820", 0); 347 MessageBoxA(nullptr, work_string, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:820", 0);
352 } 348 }
735 auto dst = pPixels; 731 auto dst = pPixels;
736 for (uint y = 0; y < height; ++y) 732 for (uint y = 0; y < height; ++y)
737 { 733 {
738 //uint src_y = (game_viewport_y + y * v25) * (Dst.lPitch / sizeof(short)); 734 //uint src_y = (game_viewport_y + y * v25) * (Dst.lPitch / sizeof(short));
739 uint src_y = game_viewport_y + y * v25; 735 uint src_y = game_viewport_y + y * v25;
740 assert(game_viewport_y + y * v25 < src_height); 736 Assert(game_viewport_y + y * v25 < src_height);
741 assert(y < height); 737 Assert(y < height);
742 738
743 for (uint x = 0; x < width; ++x) 739 for (uint x = 0; x < width; ++x)
744 { 740 {
745 //uint src_x = game_viewport_x + x * v23; 741 //uint src_x = game_viewport_x + x * v23;
746 uint src_x = game_viewport_x + x * v23; 742 uint src_x = game_viewport_x + x * v23;
747 assert(src_x < src_width); 743 Assert(src_x < src_width);
748 assert(x < width); 744 Assert(x < width);
749 745
750 dst[y * width + x] = (((63*y)/117) << 5) | 31*x/155;//31*y/117;//src[src_y * src_width + src_x]; 746 dst[y * width + x] = (((63*y)/117) << 5) | 31*x/155;//31*y/117;//src[src_y * src_width + src_x];
751 } 747 }
752 } 748 }
753 ErrD3D(pRenderer->pBackBuffer4->Unlock(0)); 749 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));