diff mm7_2.cpp @ 472:7dfe960c323c

BLV_UpdateDoors
author Nomad
date Tue, 26 Feb 2013 05:00:40 +0200
parents c43f156a95c9
children 442afd6c34a4
line wrap: on
line diff
--- a/mm7_2.cpp	Mon Feb 25 23:33:15 2013 +0400
+++ b/mm7_2.cpp	Tue Feb 26 05:00:40 2013 +0200
@@ -7871,9 +7871,9 @@
 //----- (0044FFD8) --------------------------------------------------------
 int MapInfo::SpawnRandomTreasure(SpawnPointMM7 *a2)
 {
-  MapInfo *v2; // ebx@1
-  SpawnPointMM7 *v3; // esi@1
-  int v4; // eax@1
+  //MapInfo *v2; // ebx@1
+  //SpawnPointMM7 *v3; // esi@1
+  //int v4; // eax@1
   int v5; // edx@1
   int v6; // eax@1
   int v7; // ecx@1
@@ -7896,69 +7896,66 @@
   unsigned __int16 v24; // dx@29
   char *v25; // ecx@30
   unsigned __int16 v26; // ax@33
-  int v27; // ecx@35
-  int v28; // eax@35
-  int v29; // esi@35
-  __int16 v30; // ax@35
+  //int v27; // ecx@35
+  //int v28; // eax@35
+  //int v29; // esi@35
+  //__int16 v30; // ax@35
   LayingItem a1a; // [sp+Ch] [bp-7Ch]@1
-  int v32; // [sp+7Ch] [bp-Ch]@1
-  int v33; // [sp+80h] [bp-8h]@1
+  //int v32; // [sp+7Ch] [bp-Ch]@1
+  //int v33; // [sp+80h] [bp-8h]@1
   int v34; // [sp+84h] [bp-4h]@1
 
-  __debugbreak();
-
-  auto a1 = this;
-
-  v2 = a1;
-  v3 = a2;
-  v4 = rand();
+  //auto a1 = this;
+  //v2 = a1;
+  //v3 = a2;
+  //v4 = rand();
   v34 = 0;
-  v5 = v4 % 100;
+  v5 = rand() % 100;
  // v6 = 2 * (v2->Treasure_prob + 7 * v3->uIndex) - 14;
-  v7 = (unsigned __int8)byte_4E8168[v3->uIndex-1][2*v2->Treasure_prob];
-  v8 = (unsigned __int8)byte_4E8168[v3->uIndex-1][2*v2->Treasure_prob+1];
-  v32 = v5;
-  v33 = v7;
+  v7 = (unsigned __int8)byte_4E8168[a2->uIndex - 1][2 * Treasure_prob];
+  v8 = (unsigned __int8)byte_4E8168[a2->uIndex - 1][2 * Treasure_prob + 1];
+  //v32 = v5;
+  //v33 = v7;
   v9 = rand();
-  v10 = v8 - v33 + 1;
+  v10 = v8 - v7 + 1;
   v12 = v9;
   result = v9 / v10;
-  v13 = v33 + (unsigned __int64)(v12 % v10);
+  v13 = v7 + (unsigned __int64)(v12 % v10);
   if ( v13 < 7 )
   {
-    if ( v32 < 20 )
+    if ( v5 < 20 )
       return result;
-    if ( v32 >= 60 )
-    {
-      v19 = v3->vPosition.z;
-      v20 = v3->vPosition.y;
-      v21 = v3->vPosition.x;
+    if ( v5 >= 60 )
+    {
+      v19 = a2->vPosition.z;
+      v20 = a2->vPosition.y;
+      v21 = a2->vPosition.x;
       v22 = rand();
       return sub_450521_ProllyDropItemAt(v13, v22 % 27 + 20, v21, v20, v19, 0);
     }
-    if ( v3->uIndex == 1 )
+    if ( a2->uIndex == 1 )
     {
       v14 = rand() % 51 + 50;
     }
     else
     {
-      if ( v3->uIndex != 2 )
-      {
-        if ( v3->uIndex == 3 )
+      if ( a2->uIndex != 2 )
+      {
+        if ( a2->uIndex == 3 )
         {
           v14 = rand() % 301 + 200;
         }
         else
         {
-          if ( v3->uIndex != 4 )
-          {
-            if ( v3->uIndex == 5 )
+          if ( a2->uIndex != 4 )
+          {
+            if ( a2->uIndex == 5 )
             {
               v14 = rand() % 1001 + 1000;
             }
             else
             {
-              if ( v3->uIndex != 6 )
+              if ( a2->uIndex != 6 )
               {
 LABEL_20:
                 v15 = 0;
@@ -8028,24 +8025,21 @@
   }
   a1a.uObjectDescID = v26;
   a1a.stru_24.Reset();
+
 LABEL_35:
-  v27 = v3->vPosition.y;
-  v28 = v3->vPosition.x;
-  v29 = v3->vPosition.z;
-  a1a.vPosition.y = v27;
+  a1a.vPosition.y = a2->vPosition.y;
   a1a.uAttributes = 0;
   a1a.uSoundID = 0;
   a1a.uFacing = 0;
-  a1a.vPosition.z = v29;
-  a1a.vPosition.x = v28;
+  a1a.vPosition.z = a2->vPosition.z;
+  a1a.vPosition.x = a2->vPosition.x;
   a1a.field_50 = 0;
   a1a.field_4C = 0;
   a1a.field_48 = 0;
-  v30 = pIndoor->GetSector(v28, v27, v29);
   a1a.field_5C = 0;
   a1a.field_58_pid = 0;
   a1a.uSpriteFrameID = 0;
-  a1a.uSectorID = v30;
+  a1a.uSectorID = pIndoor->GetSector(a2->vPosition.x, a2->vPosition.y, a2->vPosition.z);;
   return a1a.Create(0, 0, 0, 0);
 }
 
@@ -13368,7 +13362,7 @@
     }
   }
   else
-  Log::Warning(L"MM init: failed");
+    Log::Warning(L"MM init: failed");
   pGame->Deinitialize();
 }