Mercurial > might-and-magic-trilogy
comparison mm7_2.cpp @ 108:d543bd89a31e
6.11.12
author | Ritor1 |
---|---|
date | Tue, 06 Nov 2012 10:06:45 +0600 |
parents | ccc0cf95706a |
children | 62772029b56d |
comparison
equal
deleted
inserted
replaced
107:ccc0cf95706a | 108:d543bd89a31e |
---|---|
11715 | 11715 |
11716 | 11716 |
11717 //----- (0046086A) -------------------------------------------------------- | 11717 //----- (0046086A) -------------------------------------------------------- |
11718 bool Autosave() | 11718 bool Autosave() |
11719 { | 11719 { |
11720 int v0; // esi@3 | 11720 int flag; // esi@3 |
11721 int v1; // eax@4 | 11721 //int i; // eax@4 |
11722 int v2; // edx@5 | 11722 //int v2; // edx@5 |
11723 FILE *v3; // eax@7 | 11723 FILE *v3; // eax@7 |
11724 LOD::FileHeader this_; // [sp+Ch] [bp-16Ch]@3 | 11724 LOD::FileHeader this_; // [sp+Ch] [bp-16Ch]@3 |
11725 LOD::Directory pDir; // [sp+10Ch] [bp-6Ch]@4 | 11725 LOD::Directory pDir; // [sp+10Ch] [bp-6Ch]@4 |
11726 LOD::Directory v7; // [sp+12Ch] [bp-4Ch]@9 | 11726 LOD::Directory v7; // [sp+12Ch] [bp-4Ch]@9 |
11727 LOD::Directory a3; // [sp+14Ch] [bp-2Ch]@3 | 11727 LOD::Directory a3; // [sp+14Ch] [bp-2Ch]@3 |
11728 unsigned int v9; // [sp+16Ch] [bp-Ch]@5 | 11728 //unsigned int v9; // [sp+16Ch] [bp-Ch]@5 |
11729 void *pSave; // [sp+170h] [bp-8h]@3 | 11729 void *pSave; // [sp+170h] [bp-8h]@3 |
11730 unsigned int v11; // [sp+174h] [bp-4h]@5 | 11730 unsigned int v11; // [sp+174h] [bp-4h]@5 |
11731 | 11731 |
11732 if ( pVideoPlayer->AnyMovieLoaded() ) | 11732 if ( pVideoPlayer->AnyMovieLoaded() ) |
11733 pVideoPlayer->Unload(); | 11733 pVideoPlayer->Unload(); |
11734 v0 = 0; | 11734 flag = 0; |
11735 pSave = pAllocator->AllocNamedChunk(0, 0xF4240, 0); | 11735 pSave = pAllocator->AllocNamedChunk(0, 0xF4240, 0); |
11736 pNew_LOD->CloseWriteFile(); | 11736 pNew_LOD->CloseWriteFile(); |
11737 remove("data\\new.lod"); | 11737 remove("data\\new.lod"); |
11738 this_.Reset(); | 11738 this_.Reset(); |
11739 strcpy(this_.array_000004, "MMVII"); | 11739 strcpy(this_.LodVersion, "MMVII"); |
11740 strcpy(this_.array_000054, "newmaps for MMVII"); | 11740 strcpy(this_.LodDescription, "newmaps for MMVII"); |
11741 this_.dword_0000A4 = 100; | 11741 this_.dword_0000A4 = 100; |
11742 this_.dword_0000A8 = 0; | 11742 this_.dword_0000A8 = 0; |
11743 a3.pFilename[0] = 0; | |
11744 a3.uOfsetFromSubindicesStart = 0; | |
11745 a3.uDataSize = 0; | |
11746 a3.uNumSubIndices = 0; | |
11743 a3.dword_000018 = 0; | 11747 a3.dword_000018 = 0; |
11744 a3.word_00001E = 0; | 11748 a3.word_00001E = 0; |
11745 strcpy(a3.pFilename, "current"); | 11749 strcpy(a3.pFilename, "current"); |
11746 pNew_LOD->_461492(&this_, &a3, "data\\new.lod"); | 11750 pNew_LOD->_461492(&this_, &a3, "data\\new.lod"); |
11747 if ( pNew_LOD->LoadFile("data\\new.lod", 0) ) | 11751 if ( pNew_LOD->LoadFile("data\\new.lod", 0) ) |
11748 { | 11752 { |
11749 pNew_LOD->CreateTempFile(); | 11753 pNew_LOD->CreateTempFile(); |
11750 pNew_LOD->uNumSubIndices = 0; | 11754 pNew_LOD->uNumSubIndices = 0; |
11751 pDir.Reset(); | 11755 pDir.Reset(); |
11752 v1 = (signed int)pGames_LOD->uNumSubIndices / 2; | 11756 for (int i = pGames_LOD->uNumSubIndices / 2; i < pGames_LOD->uNumSubIndices; ++i) |
11753 if ( (signed int)pGames_LOD->uNumSubIndices / 2 < (signed int)pGames_LOD->uNumSubIndices ) | 11757 { |
11754 { | 11758 memcpy(&pDir, (char *)&pGames_LOD->pSubIndices[i], sizeof(pDir)); |
11755 v2 = 32 * v1; | 11759 v3 = pGames_LOD->FindContainer((const char *)&pGames_LOD->pSubIndices[i], 1); |
11756 v11 = 32 * v1; | 11760 fread(pSave, pGames_LOD->pSubIndices[i].uDataSize, 1u, v3); |
11757 v9 = pGames_LOD->uNumSubIndices - v1; | 11761 pNew_LOD->AppendDirectory(&pDir, pSave); |
11758 while ( 1 ) | |
11759 { | |
11760 memcpy(&pDir, (char *)pGames_LOD->pSubIndices + v2, sizeof(pDir)); | |
11761 v3 = pGames_LOD->FindContainer((const char *)pGames_LOD->pSubIndices + v2, 1); | |
11762 fread(pSave, pGames_LOD->pSubIndices[v11 / 0x20].uDataSize, 1u, v3); | |
11763 pNew_LOD->AppendDirectory(&pDir, pSave); | |
11764 v11 += 32; | |
11765 --v9; | |
11766 if ( !v9 ) | |
11767 break; | |
11768 v2 = v11; | |
11769 } | |
11770 v0 = 0; | |
11771 } | 11762 } |
11772 v7.Reset(); | 11763 v7.Reset(); |
11773 strcpy(pSavegameHeader->pLocationName, "out01.odm"); | 11764 strcpy(pSavegameHeader->pLocationName, "out01.odm"); |
11774 strcpy((char *)&v7, "header.bin"); | 11765 strcpy((char *)&v7, "header.bin"); |
11775 v7.uDataSize = 100; | 11766 v7.uDataSize = 100; |
11776 pNew_LOD->AppendDirectory(&v7, &pSavegameHeader); | 11767 pNew_LOD->AppendDirectory(&v7, &pSavegameHeader); |
11777 pNew_LOD->Save(); | 11768 pNew_LOD->Save(); |
11778 pParty->vPrevPosition.y = v0; | 11769 pParty->vPrevPosition.y = flag; |
11779 pParty->vPrevPosition.x = 12552; | 11770 pParty->vPrevPosition.x = 12552; |
11780 pParty->vPosition.x = 12552; | 11771 pParty->vPosition.x = 12552; |
11781 pParty->vPosition.z = v0; | 11772 pParty->vPosition.z = flag; |
11782 pParty->uFallStartY = v0; | 11773 pParty->uFallStartY = flag; |
11783 pParty->sPrevRotationX = v0; | 11774 pParty->sPrevRotationX = flag; |
11784 pParty->sRotationX = v0; | 11775 pParty->sRotationX = flag; |
11785 pParty->vPrevPosition.z = 1816; | 11776 pParty->vPrevPosition.z = 1816; |
11786 pParty->vPosition.y = 1816; | 11777 pParty->vPosition.y = 1816; |
11787 v0 = 1; | 11778 flag = 1; |
11788 pParty->sPrevRotationY = 512; | 11779 pParty->sPrevRotationY = 512; |
11789 pParty->sRotationY = 512; | 11780 pParty->sRotationY = 512; |
11790 SaveGame(1, (__int16 *)1); | 11781 SaveGame(1, (__int16 *)1); |
11791 } | 11782 } |
11792 pAllocator->FreeChunk(pSave); | 11783 pAllocator->FreeChunk(pSave); |
11793 return v0; | 11784 return flag; |
11794 } | 11785 } |
11795 | 11786 |
11796 | 11787 |
11797 //----- (004610AA) -------------------------------------------------------- | 11788 //----- (004610AA) -------------------------------------------------------- |
11798 void __fastcall PrepareToLoadODM(unsigned int bLoading, OutdoorCamera *a2) | 11789 void __fastcall PrepareToLoadODM(unsigned int bLoading, OutdoorCamera *a2) |