changeset 108:d543bd89a31e

6.11.12
author Ritor1
date Tue, 06 Nov 2012 10:06:45 +0600
parents ccc0cf95706a
children 62772029b56d
files LOD.cpp LOD.h mm7_2.cpp
diffstat 3 files changed, 30 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/LOD.cpp	Mon Nov 05 09:16:17 2012 +0600
+++ b/LOD.cpp	Tue Nov 06 10:06:45 2012 +0600
@@ -1518,7 +1518,7 @@
   v13 = v12;
   if ( v12 )
   {
-    fwrite(&v1->header, 0x100u, 1u, v12);
+    fwrite(&v1->header, 0x100u, 1, v12);
 
     LOD::Directory v0; // [sp+20Ch] [bp-28h]@11
     //LOD::Directory::LOD::Directory(&v0);
@@ -1530,7 +1530,7 @@
     v0.word_00001E = 0;
     v0.uDataSize = v21;
     v0.uNumSubIndices = LOWORD(v1->uNumSubIndices);
-    fwrite(&v0, 0x20u, 1u, v13);
+    fwrite(&v0, 0x20, 1, v13);
     fwrite(v1->pSubIndices, 0x20u, v1->uNumSubIndices, v13);
     v16 = v1->pOutputFileHandle;
     v22 = v2;
@@ -2043,8 +2043,8 @@
 void LOD::FileHeader::Reset()
 {
   this->pSignature[0] = 0;
-  this->array_000004[0] = 0;
-  this->array_000054[0] = 0;
+  this->LodVersion[0] = 0;
+  this->LodDescription[0] = 0;
   this->dword_0000A4 = 0;
   this->dword_0000A8 = 0;
   this->uNumIndices = 0;
--- a/LOD.h	Mon Nov 05 09:16:17 2012 +0600
+++ b/LOD.h	Tue Nov 06 10:06:45 2012 +0600
@@ -23,8 +23,8 @@
     void Reset();
 
     unsigned __int8 pSignature[4];
-    char array_000004[80];
-    char array_000054[80];
+    char LodVersion[80];
+    char LodDescription[80];
     int dword_0000A4;
     int dword_0000A8;
     unsigned int uNumIndices;
--- a/mm7_2.cpp	Mon Nov 05 09:16:17 2012 +0600
+++ b/mm7_2.cpp	Tue Nov 06 10:06:45 2012 +0600
@@ -11717,29 +11717,33 @@
 //----- (0046086A) --------------------------------------------------------
 bool Autosave()
 {
-  int v0; // esi@3
-  int v1; // eax@4
-  int v2; // edx@5
+  int flag; // esi@3
+  //int i; // eax@4
+  //int v2; // edx@5
   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
+  //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.pFilename[0] = 0;
+  a3.uOfsetFromSubindicesStart = 0;
+  a3.uDataSize = 0;
+  a3.uNumSubIndices = 0;
   a3.dword_000018 = 0;
   a3.word_00001E = 0;
   strcpy(a3.pFilename, "current");
@@ -11749,25 +11753,12 @@
     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, 1u, v3);
+     pNew_LOD->AppendDirectory(&pDir, pSave);
     }
     v7.Reset();
     strcpy(pSavegameHeader->pLocationName, "out01.odm");
@@ -11775,22 +11766,22 @@
     v7.uDataSize = 100;
     pNew_LOD->AppendDirectory(&v7, &pSavegameHeader);
     pNew_LOD->Save();
-    pParty->vPrevPosition.y = v0;
+    pParty->vPrevPosition.y = flag;
     pParty->vPrevPosition.x = 12552;
     pParty->vPosition.x = 12552;
-    pParty->vPosition.z = v0;
-    pParty->uFallStartY = v0;
-    pParty->sPrevRotationX = v0;
-    pParty->sRotationX = v0;
+    pParty->vPosition.z = flag;
+    pParty->uFallStartY = flag;
+    pParty->sPrevRotationX = flag;
+    pParty->sRotationX = flag;
     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;
 }