Mercurial > might-and-magic-trilogy
comparison LOD.cpp @ 110:430786d916d6
6.11.12 SaveLoad
author | Ritor1 |
---|---|
date | Tue, 06 Nov 2012 17:30:24 +0600 |
parents | d543bd89a31e |
children | 8feb2dfd2f89 |
comparison
equal
deleted
inserted
replaced
109:62772029b56d | 110:430786d916d6 |
---|---|
1017 strcpy((char *)v4->pLODName, Source); | 1017 strcpy((char *)v4->pLODName, Source); |
1018 v6 = fopen((const char *)v4->pLODName, "wb+"); | 1018 v6 = fopen((const char *)v4->pLODName, "wb+"); |
1019 v4->pFile = v6; | 1019 v4->pFile = v6; |
1020 if ( !v6 ) | 1020 if ( !v6 ) |
1021 return 3; | 1021 return 3; |
1022 fwrite(pHeader, 0x100u, 1u, v6); | 1022 fwrite(pHeader, 0x100, 1, v6); |
1023 fwrite(pDir, 0x20u, 1u, v4->pFile); | 1023 fwrite(pDir, 0x20, 1, v4->pFile); |
1024 fclose(v4->pFile); | 1024 fclose(v4->pFile); |
1025 v4->pFile = 0; | 1025 v4->pFile = 0; |
1026 return 0; | 1026 return 0; |
1027 } | 1027 } |
1028 | 1028 |
1516 strcpy(OldFilename, "lod.tmp"); | 1516 strcpy(OldFilename, "lod.tmp"); |
1517 v12 = fopen(OldFilename, "wb+"); | 1517 v12 = fopen(OldFilename, "wb+"); |
1518 v13 = v12; | 1518 v13 = v12; |
1519 if ( v12 ) | 1519 if ( v12 ) |
1520 { | 1520 { |
1521 fwrite(&v1->header, 0x100u, 1, v12); | 1521 fwrite(&v1->header, 0x100, 1, v12); |
1522 | 1522 |
1523 LOD::Directory v0; // [sp+20Ch] [bp-28h]@11 | 1523 LOD::Directory v0; // [sp+20Ch] [bp-28h]@11 |
1524 //LOD::Directory::LOD::Directory(&v0); | 1524 //LOD::Directory::LOD::Directory(&v0); |
1525 | 1525 |
1526 strcpy((char *)&v0, "chapter"); | 1526 strcpy((char *)&v0, "chapter"); |
1529 v0.uOfsetFromSubindicesStart = v15; | 1529 v0.uOfsetFromSubindicesStart = v15; |
1530 v0.word_00001E = 0; | 1530 v0.word_00001E = 0; |
1531 v0.uDataSize = v21; | 1531 v0.uDataSize = v21; |
1532 v0.uNumSubIndices = LOWORD(v1->uNumSubIndices); | 1532 v0.uNumSubIndices = LOWORD(v1->uNumSubIndices); |
1533 fwrite(&v0, 0x20, 1, v13); | 1533 fwrite(&v0, 0x20, 1, v13); |
1534 fwrite(v1->pSubIndices, 0x20u, v1->uNumSubIndices, v13); | 1534 fwrite(v1->pSubIndices, 0x20, v1->uNumSubIndices, v13); |
1535 v16 = v1->pOutputFileHandle; | 1535 v16 = v1->pOutputFileHandle; |
1536 v22 = v2; | 1536 v22 = v2; |
1537 fseek(v16, 0, 0); | 1537 fseek(v16, 0, 0); |
1538 if ( v2 > 0 ) | 1538 if ( v2 > 0 ) |
1539 { | 1539 { |
1540 do | 1540 do |
1541 { | 1541 { |
1542 v17 = v1->uIOBufferSize; | 1542 v17 = v1->uIOBufferSize; |
1543 if ( v22 <= (signed int)v17 ) | 1543 if ( v22 <= (signed int)v17 ) |
1544 v17 = v22; | 1544 v17 = v22; |
1545 fread(v1->pIOBuffer, 1u, v17, v1->pOutputFileHandle); | 1545 fread(v1->pIOBuffer, 1, v17, v1->pOutputFileHandle); |
1546 fwrite(v1->pIOBuffer, 1u, v17, v13); | 1546 fwrite(v1->pIOBuffer, 1, v17, v13); |
1547 v22 -= v17; | 1547 v22 -= v17; |
1548 } | 1548 } |
1549 while ( v22 > 0 ); | 1549 while ( v22 > 0 ); |
1550 } | 1550 } |
1551 strcpy(NewFilename, (const char *)v1->pLODName); | 1551 strcpy(NewFilename, (const char *)v1->pLODName); |