changeset 113:9a99c386885a

2012/11/7
author Nomad
date Wed, 07 Nov 2012 20:23:04 +0200
parents 142de719a3ea
children 8e802a11b20d
files LOD.h mm7_3.cpp
diffstat 2 files changed, 45 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/LOD.h	Tue Nov 06 06:58:08 2012 +0200
+++ b/LOD.h	Wed Nov 07 20:23:04 2012 +0200
@@ -1,5 +1,6 @@
 #pragma once
 #include <stdio.h>
+#include <memory.h>
 #include "Texture.h"
 
 
--- a/mm7_3.cpp	Tue Nov 06 06:58:08 2012 +0200
+++ b/mm7_3.cpp	Wed Nov 07 20:23:04 2012 +0200
@@ -2178,12 +2178,12 @@
 
 
 //----- (0047253E) --------------------------------------------------------
-void __cdecl UpdateObjects()
+void UpdateObjects()
 {
   unsigned int v0; // ebx@0
-  unsigned int v1; // edi@1
+  //unsigned int v1; // edi@1
   char *v2; // esi@2
-  __int16 v3; // dx@5
+  //__int16 v3; // dx@5
   ObjectDesc *v4; // eax@5
   int v5; // ecx@6
   __int16 v6; // cx@7
@@ -2200,68 +2200,66 @@
   unsigned int v17; // edx@32
   int v18; // [sp+4h] [bp-10h]@27
   int v19; // [sp+8h] [bp-Ch]@27
-  signed int v20; // [sp+10h] [bp-4h]@1
-
-  v1 = 0;
-  v20 = 0;
-  if ( (signed int)uNumLayingItems > 0 )
-  {
-    __debugbreak();
-    v2 = (char *)&pLayingItems[0].uSpriteFrameID;
-    do
-    {
-      LOWORD(v0) = *((short *)v2 - 2);
-      if ( v0 & 0x40 )
-      {
-        v0 &= 0xFFFFFFBFu;
-        *((short *)v2 - 2) = v0;
-      }
-      else
-      {
-        v3 = *((short *)v2 - 14);
-        v4 = &pObjectList->pObjects[*((short *)v2 - 14)];
-        if ( (v0 & 0x80u) != 0 )
-        {
+  //signed int v20; // [sp+10h] [bp-4h]@1
+
+  //v1 = 0;
+  //v20 = 0;
+  for (uint i = 0; i < uNumLayingItems; ++i)
+  {
+    auto item = pLayingItems + i;
+    v2 = (char *)&item->uSpriteFrameID;
+    //do
+    //{
+      //LOWORD(v0) = item->uAttributes;
+    if (item->uAttributes & 0x40)
+      item->uAttributes &= 0xFFBF;
+    else
+    {
+              //v3 = item->uObjectDescID;
+      v4 = &pObjectList->pObjects[item->uObjectDescID];
+      if (item->uAttributes)
+      {
           v5 = *(int *)(v2 + 62) >> 3;
           *(int *)(v2 - 26) = pActors[v5].vPosition.x;
           *(int *)(v2 - 22) = pActors[v5].vPosition.y;
           *(int *)(v2 - 18) = pActors[v5].vPosition.z + pActors[v5].uActorHeight;
-          if ( !v3 || (v6 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2, *(short *)v2 = v6, !(v4->uFlags & 4)) )
+          if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2, *(short *)v2 = v6, !(v4->uFlags & 4)) )
             goto LABEL_36;
           if ( v6 >= 0 )
           {
             v7 = v4->uLifetime;
-            if ( v0 & 2 )
+            if (item->uAttributes & 2)
               v7 = *((short *)v2 + 1);
             if ( v6 < v7 )
               goto LABEL_36;
           }
           goto LABEL_34;
-        }
-        if ( v3 )
-        {
-          v8 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2;
-          *(short *)v2 = v8;
+      }
+
+        if ( item->uObjectDescID )
+        {
+          v8 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID;
+          item->uSpriteFrameID = v8;
           v9 = v4->uFlags;
           if ( !(v9 & 4) )
             goto LABEL_22;
           if ( v8 < 0 )
           {
-            v10 = v1;
+            v10 = i;
 LABEL_35:
             LayingItem::_42F933(v10);
             goto LABEL_36;
           }
           v11 = v4->uLifetime;
-          if ( v0 & 2 )
+          if ( item->uAttributes & 2 )
             v11 = *((short *)v2 + 1);
           if ( v8 < v11 )
           {
 LABEL_22:
             if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
-              LayingItem::UpdateObject_fn0_BLV(v1);
+              LayingItem::UpdateObject_fn0_BLV(i);
             else
-              LayingItem::UpdateObject_fn0_ODM(v1);
+              LayingItem::UpdateObject_fn0_ODM(i);
             if ( pParty->bTurnBasedModeOn != 1 || !(*(v2 - 4) & 4) )
               goto LABEL_36;
             v12 = abs(pParty->vPosition.x - *(int *)(v2 - 26));
@@ -2291,20 +2289,21 @@
             if ( (signed int)(v0 + (v15 >> 2) + v13) <= 5120 )
               goto LABEL_36;
 LABEL_34:
-            v10 = v20;
+            v10 = i;
             goto LABEL_35;
           }
-          v10 = v1;
+          v10 = i;
           if ( !(v9 & 0x40) )
             goto LABEL_35;
-          _46BFFA_check_object_intercept(v1, 8 * v1 | OBJECT_Item);
-        }
-      }
+          _46BFFA_check_object_intercept(i, 8 * i | OBJECT_Item);
+        }
+    }
 LABEL_36:
-      v2 += 112;
-      v1 = v20++ + 1;
-    }
-    while ( v20 < (signed int)uNumLayingItems );
+    ;
+      //v2 += 112;
+      //v1 = v20++ + 1;
+    //}
+    //while ( v20 < (signed int)uNumLayingItems );
   }
 }