diff SaveLoad.cpp @ 76:75994455e457

BLV collisions
author Nomad
date Sat, 27 Oct 2012 22:25:38 +0200
parents 05e4b4bd4d64
children a84fb3752681
line wrap: on
line diff
--- a/SaveLoad.cpp	Sun Oct 28 00:49:10 2012 +0600
+++ b/SaveLoad.cpp	Sat Oct 27 22:25:38 2012 +0200
@@ -289,7 +289,7 @@
   int v61; // [sp+224h] [bp-4Ch]@30
   int v62; // [sp+228h] [bp-48h]@2
   LOD::Directory pDir; // [sp+22Ch] [bp-44h]@2
-  std::string *v64; // [sp+24Ch] [bp-24h]@1
+  //std::string *v64; // [sp+24Ch] [bp-24h]@1
   size_t Size; // [sp+250h] [bp-20h]@26
   __int16 *v66; // [sp+254h] [bp-1Ch]@1
   void *DstBuf; // [sp+258h] [bp-18h]@2
@@ -300,42 +300,49 @@
   int a3; // [sp+26Fh] [bp-1h]@8
 
   v66 = a2;
-  v64 = (std::string *)a1;
+  //v64 = (std::string *)a1;
+
   strcpy(byte_6BE3B0, pCurrentMapName);
-  result = _strcmpi(pCurrentMapName, "d05.blv");
-  if ( result )
-  {
-    DstBuf = operator new(0xF4240u);
-    pDir.Reset();
+  if (!_strcmpi(pCurrentMapName, "d05.blv"))
+    return false;
+
+  DstBuf = malloc(0xF4240u);
+  pDir.Reset();
     v52 = pParty->vPosition.x;
     v51 = pParty->vPosition.y;
     v62 = pParty->vPosition.z;
     v53 = pParty->sRotationY;
     v54 = pParty->sRotationX;
-    pParty->vPosition.x = pParty->vPrevPosition.x;
-    pParty->vPosition.y = pParty->vPrevPosition.z;
-    pParty->vPosition.z = pParty->vPrevPosition.y;
-    pParty->uFallStartY = pParty->vPrevPosition.y;
-    pParty->sRotationY = pParty->sPrevRotationY;
-    pParty->sRotationX = pParty->sPrevRotationX;
-    if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
-      pIndoor->stru1.uLastVisitDay = pParty->uTimePlayed;
-    else
-      pOutdoor->uLastVisitDay = pParty->uTimePlayed;
-    v3 = MakeScreenshot(150, 112);
-    strcpy((char *)&pDir, "image.pcx");
+  pParty->vPosition.x = pParty->vPrevPosition.x;
+  pParty->vPosition.y = pParty->vPrevPosition.z;
+  pParty->vPosition.z = pParty->vPrevPosition.y;
+  pParty->uFallStartY = pParty->vPrevPosition.y;
+  pParty->sRotationY = pParty->sPrevRotationY;
+  pParty->sRotationX = pParty->sPrevRotationX;
+
+  if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
+    pIndoor->stru1.uLastVisitDay = pParty->uTimePlayed;
+  else
+    pOutdoor->uLastVisitDay = pParty->uTimePlayed;
+
+  v3 = MakeScreenshot(150, 112);
+  {
+    strcpy(pDir.pFilename, "image.pcx");
+
     pRenderer->_49F5A2((int)v3, 150, 112, DstBuf, 1000000, (int)&pDir.uDataSize);
-    free(v3);
+  }
+  free(v3);
+
     if ( pCurrentScreen == 11 )
     {
       pRenderer->DrawTextureIndexed(
         8u,
         8u,
-        (Texture *)(uTextureID_loadsave != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
+        (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
       pRenderer->DrawTextureIndexed(
         0x12u,
         0x8Du,
-        (Texture *)(uTextureID_save_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_save_up] : 0));
+        (Texture *)(uTextureID_save_up != -1 ? &pIcons_LOD->pTextures[uTextureID_save_up] : 0));
       v36 = pGlobalTXT_LocalizationStrings[190];
       v4 = pFontSmallnum->AlignText_Center(0xBAu, pGlobalTXT_LocalizationStrings[190]);
       pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v4 + 25, 219, 0, v36, 0, 0, 0);
@@ -443,7 +450,7 @@
       ++v70;
     }
     while ( v70 <= 4 );
-    if ( !v66 )
+    if ( !a2 )
     {
       sub_42FA22_mess_with_laying_item_list();
       v9 = (int)malloc(0xF4240u);
@@ -625,7 +632,7 @@
       free((void *)v9);
     }
     free(DstBuf);
-    if ( v64 )
+    if ( a1 )
     {
       if ( !CopyFileA("data\\new.lod", "saves\\autosave.mm7", 0) )
       {
@@ -643,7 +650,7 @@
     pParty->sRotationY = v53;
     result = v54;
     pParty->sRotationX = v54;
-  }
+
   return result;
 }