Mercurial > might-and-magic-trilogy
diff Outdoor.cpp @ 129:fe45d65251a5
Слияние
author | Ritor1 |
---|---|
date | Sun, 04 Nov 2012 17:04:05 +0600 |
parents | 32805a956f49 67f843a23f8b |
children | 7b12505a23c0 |
line wrap: on
line diff
--- a/Outdoor.cpp Sun Nov 04 17:03:51 2012 +0600 +++ b/Outdoor.cpp Sun Nov 04 17:04:05 2012 +0600 @@ -2045,53 +2045,47 @@ pNumItems = 29030400; if ( Str2 ) { - __debugbreak(); - //memset(Dst, 0, 0x3C8u); - //memset(Src, 0, 0x3C8u); - //goto LABEL_112; + memset(Dst, 0, 0x3C8u); + memset(Src, 0, 0x3C8u); + goto LABEL_112; } //v81 = ddm.uLastRepawnDay; - if ( (unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay ) + if ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay) { - __debugbreak(); - /* memcpy(Dst, pSrc, 0x3C8u); memcpy(Src, pSrc + 968, 0x3C8u); LABEL_112: free(pSrcMem); - v25 = Str2 == 0; + ddm.uLastRepawnDay = (int)File; - if ( v25 ) + if (Str2 == 0) ++ddm.uNumRespawns; v108 = 0; *(int *)thisa = 1; - v151 = (int)pGames_LOD->FindContainer(pContainer, v108); - fread(&header, 0x10u, 1u, (FILE *)v151); - pFilename = (char *)header.uCompressedSize; - pDestLen = header.uDecompressedSize; - v82 = malloc(header.uDecompressedSize); - v149 = v82; - if ( (unsigned int)pFilename <= pDestLen ) + v39 = pGames_LOD->FindContainer(Str, 0); + fread(&header, 0x10, 1u, v39); + //pFilename = (char *)header.uCompressedSize; + //pDestLen = header.uDecompressedSize; + //v82 = malloc(header.uDecompressedSize); + pSrcMem = (unsigned char *)malloc(header.uDecompressedSize); + //v149 = v82; + if (header.uCompressedSize == header.uDecompressedSize) + fread(pSrcMem, header.uDecompressedSize, 1, v39); + else if (header.uCompressedSize < header.uDecompressedSize) { - if ( pFilename == (const char *)pDestLen ) - { - fread(v82, pDestLen, 1u, (FILE *)v151); - } - else - { - uSourceLen = malloc((size_t)pFilename); - fread(uSourceLen, (size_t)pFilename, 1u, (FILE *)v151); - zlib::MemUnzip(v82, &pDestLen, uSourceLen, (unsigned int)pFilename); - free(uSourceLen); - } + auto compressedMem = malloc(header.uCompressedSize); + fread(compressedMem, header.uCompressedSize, 1u, v39); + + uint actualDecompressedSize = header.uDecompressedSize; + zlib::MemUnzip(pSrcMem, &actualDecompressedSize, compressedMem, header.uCompressedSize); + free(compressedMem); } else - { - MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:857", 0); - } - v74 = (int)((char *)v82 + 40); + MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:857", 0); + + pSrc = pSrcMem + 40; goto LABEL_120; - */ + } *(int *)thisa = 0; LABEL_120: @@ -2108,7 +2102,6 @@ if ( *(int *)thisa ) { - __debugbreak(); memcpy(array_528, Dst, 0x3C8u); memcpy(array_8F0, Src, 0x3C8u); }