Mercurial > might-and-magic-trilogy
diff mm7_2.cpp @ 110:430786d916d6
6.11.12 SaveLoad
author | Ritor1 |
---|---|
date | Tue, 06 Nov 2012 17:30:24 +0600 |
parents | 62772029b56d |
children | a64b244da76c d2ca891da89f |
line wrap: on
line diff
--- a/mm7_2.cpp Tue Nov 06 10:07:35 2012 +0600 +++ b/mm7_2.cpp Tue Nov 06 17:30:24 2012 +0600 @@ -11726,27 +11726,23 @@ //----- (0046086A) -------------------------------------------------------- bool Autosave() { - int v0; // esi@3 - int v1; // eax@4 - int v2; // edx@5 + int flag; // esi@3 FILE *v3; // eax@7 LOD::FileHeader this_; // [sp+Ch] [bp-16Ch]@3 LOD::Directory pDir; // [sp+10Ch] [bp-6Ch]@4 LOD::Directory v7; // [sp+12Ch] [bp-4Ch]@9 LOD::Directory a3; // [sp+14Ch] [bp-2Ch]@3 - unsigned int v9; // [sp+16Ch] [bp-Ch]@5 void *pSave; // [sp+170h] [bp-8h]@3 - unsigned int v11; // [sp+174h] [bp-4h]@5 if ( pVideoPlayer->AnyMovieLoaded() ) pVideoPlayer->Unload(); - v0 = 0; + flag = 0; pSave = pAllocator->AllocNamedChunk(0, 0xF4240, 0); pNew_LOD->CloseWriteFile(); remove("data\\new.lod"); this_.Reset(); - strcpy(this_.array_000004, "MMVII"); - strcpy(this_.array_000054, "newmaps for MMVII"); + strcpy(this_.LodVersion, "MMVII"); + strcpy(this_.LodDescription, "newmaps for MMVII"); this_.dword_0000A4 = 100; this_.dword_0000A8 = 0; a3.dword_000018 = 0; @@ -11758,48 +11754,35 @@ pNew_LOD->CreateTempFile(); pNew_LOD->uNumSubIndices = 0; pDir.Reset(); - v1 = (signed int)pGames_LOD->uNumSubIndices / 2; - if ( (signed int)pGames_LOD->uNumSubIndices / 2 < (signed int)pGames_LOD->uNumSubIndices ) - { - v2 = 32 * v1; - v11 = 32 * v1; - v9 = pGames_LOD->uNumSubIndices - v1; - while ( 1 ) - { - memcpy(&pDir, (char *)pGames_LOD->pSubIndices + v2, sizeof(pDir)); - v3 = pGames_LOD->FindContainer((const char *)pGames_LOD->pSubIndices + v2, 1); - fread(pSave, pGames_LOD->pSubIndices[v11 / 0x20].uDataSize, 1u, v3); - pNew_LOD->AppendDirectory(&pDir, pSave); - v11 += 32; - --v9; - if ( !v9 ) - break; - v2 = v11; - } - v0 = 0; - } + for (int i = pGames_LOD->uNumSubIndices / 2; i < pGames_LOD->uNumSubIndices; ++i) + { + memcpy(&pDir, (char *)&pGames_LOD->pSubIndices[i], sizeof(pDir)); + v3 = pGames_LOD->FindContainer((const char *)&pGames_LOD->pSubIndices[i], 1); + fread(pSave, pGames_LOD->pSubIndices[i].uDataSize, 1, v3); + pNew_LOD->AppendDirectory(&pDir, pSave); + } v7.Reset(); strcpy(pSavegameHeader->pLocationName, "out01.odm"); strcpy((char *)&v7, "header.bin"); v7.uDataSize = 100; pNew_LOD->AppendDirectory(&v7, &pSavegameHeader); pNew_LOD->Save(); - pParty->vPrevPosition.y = v0; + pParty->vPrevPosition.y = 0; pParty->vPrevPosition.x = 12552; pParty->vPosition.x = 12552; - pParty->vPosition.z = v0; - pParty->uFallStartY = v0; - pParty->sPrevRotationX = v0; - pParty->sRotationX = v0; + pParty->vPosition.z = 0; + pParty->uFallStartY = 0; + pParty->sPrevRotationX = 0; + pParty->sRotationX = 0; pParty->vPrevPosition.z = 1816; pParty->vPosition.y = 1816; - v0 = 1; + flag = 1; pParty->sPrevRotationY = 512; pParty->sRotationY = 512; SaveGame(1, (__int16 *)1); } pAllocator->FreeChunk(pSave); - return v0; + return flag; }