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