changeset 1417:1dd0c79e1502

more mm7_2 cleaning
author zipi
date Sun, 28 Jul 2013 17:12:25 +0100
parents b69805ffeb4b
children 483b1b453986
files mm7_2.cpp
diffstat 1 files changed, 69 insertions(+), 100 deletions(-) [+]
line wrap: on
line diff
--- a/mm7_2.cpp	Sun Jul 28 16:34:52 2013 +0100
+++ b/mm7_2.cpp	Sun Jul 28 17:12:25 2013 +0100
@@ -1442,7 +1442,7 @@
   int v14; // edx@10
   signed int v15; // ebx@20
   unsigned __int16 v16; // dx@20
-  char *v17; // ecx@21
+  ObjectDesc *v17; // ecx@21
   unsigned __int16 v18; // ax@24
   int v19; // ST0C_4@27
   int v20; // ST08_4@27
@@ -1450,7 +1450,7 @@
   int v22; // eax@27
   signed int v23; // ebx@29
   unsigned __int16 v24; // dx@29
-  char *v25; // ecx@30
+  ObjectDesc *v25; // ecx@30
   unsigned __int16 v26; // ax@33
   //int v27; // ecx@35
   //int v28; // eax@35
@@ -1492,98 +1492,75 @@
     if ( a2->uIndex == 1 )
     {
       v14 = rand() % 51 + 50;
-    }
-    else
+	  a1a.stru_24.uItemID = 197;
+	  v34 = v14;
+	}
+    else if ( a2->uIndex == 2 )
     {
-      if ( a2->uIndex != 2 )
-      {
-        if ( a2->uIndex == 3 )
+		v14 = rand() % 101 + 100;
+		a1a.stru_24.uItemID = 197;
+		v34 = v14;
+	}
+        else if ( a2->uIndex == 3 )
         {
           v14 = rand() % 301 + 200;
+          a1a.stru_24.uItemID = 198;
+		  v34 = v14;
         }
-        else
+        else if ( a2->uIndex == 4 )
         {
-          if ( a2->uIndex != 4 )
-          {
-            if ( a2->uIndex == 5 )
-            {
-              v14 = rand() % 1001 + 1000;
-            }
-            else
-            {
-              if ( a2->uIndex != 6 )
-              {
-LABEL_20:
-                v15 = 0;
-                v16 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
-                a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
-                if ( (signed int)pObjectList->uNumObjects <= 0 )
-                {
-LABEL_24:
-                  v18 = 0;
-                }
-                else
-                {
-                  v17 = (char *)&pObjectList->pObjects->uObjectID;
-                  while ( v16 != *(short *)v17 )
-                  {
-                    ++v15;
-                    v17 += 56;
-                    if ( v15 >= (signed int)pObjectList->uNumObjects )
-                      goto LABEL_24;
-                  }
-                  v18 = v15;
-                }
-                a1a.stru_24.SetIdentified();
-                a1a.uObjectDescID = v18;
-                a1a.stru_24.uSpecEnchantmentType = v34;
-                goto LABEL_35;
-              }
-              v14 = rand() % 3001 + 2000;
-            }
+			  v14 = rand() % 501 + 500;
+			  a1a.stru_24.uItemID = 198;
+			  v34 = v14;
+		}
+		else if ( a2->uIndex == 5 )
+        {
+			v14 = rand() % 1001 + 1000;
             a1a.stru_24.uItemID = 199;
             v34 = v14;
-            goto LABEL_20;
-          }
-          v14 = rand() % 501 + 500;
         }
-        a1a.stru_24.uItemID = 198;
-        v34 = v14;
-        goto LABEL_20;
-      }
-      v14 = rand() % 101 + 100;
-    }
-    a1a.stru_24.uItemID = 197;
-    v34 = v14;
-    goto LABEL_20;
-  }
-  result = a1a.stru_24.GenerateArtifact();
-  if ( !result )
-    return result;
-  v23 = 0;
-  v24 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
-  a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
-  if ( (signed int)pObjectList->uNumObjects <= 0 )
-  {
-LABEL_33:
-    v26 = 0;
+        else if ( a2->uIndex == 6 )
+        {
+				  v14 = rand() % 3001 + 2000;
+				  a1a.stru_24.uItemID = 199;
+				  v34 = v14;
+		}	 
+            v15 = 0;
+            v16 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
+            a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
+            v18 = 0;
+			for( int i = 0; i < pObjectList->uNumObjects; i++ )
+            {
+				if ( pObjectList->pObjects[i].uObjectID == v16 )
+				{
+					v18 = i;
+					break;
+				}
+            }
+            a1a.stru_24.SetIdentified();
+            a1a.uObjectDescID = v18;
+            a1a.stru_24.uSpecEnchantmentType = v34;
   }
   else
   {
-    v25 = (char *)&pObjectList->pObjects->uObjectID;
-    while ( v24 != *(short *)v25 )
-    {
-      ++v23;
-      v25 += 56;
-      if ( v23 >= (signed int)pObjectList->uNumObjects )
-        goto LABEL_33;
-    }
-    v26 = v23;
-  }
-  a1a.uObjectDescID = v26;
-  a1a.stru_24.Reset();
-
-LABEL_35:
+	  result = a1a.stru_24.GenerateArtifact();
+	  if ( !result )
+		return result;
+	  v23 = 0;
+	  v24 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
+	  a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
+	  v26 = 0;
+		for( int i = 0; i < pObjectList->uNumObjects; i++ )
+		{
+			if( v24 == pObjectList->pObjects[i].uObjectID )
+			{
+				v26 = i;
+				break;
+			}
+		}
+	  a1a.uObjectDescID = v26;
+	  a1a.stru_24.Reset();
+  }
   a1a.vPosition.y = a2->vPosition.y;
   a1a.uAttributes = 0;
   a1a.uSoundID = 0;
@@ -1617,23 +1594,15 @@
   v8 = 0;
   v9 = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID;
   a1.uType = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID;
-  if ( (signed int)pObjectList->uNumObjects <= 0 )
-  {
-LABEL_5:
-    v11 = 0;
-  }
-  else
-  {
-    v10 = (char *)&pObjectList->pObjects->uObjectID;
-    while ( v9 != *(short *)v10 )
-    {
-      ++v8;
-      v10 += 56;
-      if ( v8 >= (signed int)pObjectList->uNumObjects )
-        goto LABEL_5;
-    }
-    v11 = v8;
-  }
+  v11 = 0;
+	for( int i = 0; i < pObjectList->uNumObjects; i++ )
+	{
+		if( v9 == pObjectList->pObjects[i].uObjectID )
+		{
+			v11 = i;
+			break;
+		}
+	}
   a1.uObjectDescID = v11;
   a1.vPosition.y = a4;
   a1.vPosition.x = a3;