diff mm7_4.cpp @ 1419:9a1adf08f4ed

more label cleaning 2
author zipi
date Sun, 28 Jul 2013 18:54:40 +0100
parents 3881d2f94eb1
children 5930342f092b
line wrap: on
line diff
--- a/mm7_4.cpp	Sun Jul 28 17:45:21 2013 +0100
+++ b/mm7_4.cpp	Sun Jul 28 18:54:40 2013 +0100
@@ -389,37 +389,41 @@
   }
   v22 = 0;
   v38 = v5;
-  if ( v39 <= (signed int)v5 )
-    goto LABEL_54;
-  v23 = 0;
-  do
+  if ( v39 > (signed int)v5 )
   {
-    v24 = dword_720F20[v5 / 4];
-    v25 = *(int *)((char *)dword_720F20.data() + v23);
-    if ( v24 == v25 )
-      goto LABEL_50;
-    if ( v25 > a3 + 15 )
-    {
-      if ( v24 >= v25 )
-        goto LABEL_51;
-LABEL_50:
-      v22 = v38;
-      v23 = v5;
-      goto LABEL_51;
-    }
-    if ( v24 > v25 && v24 <= a3 + 15 )
-      goto LABEL_50;
-LABEL_51:
-    ++v38;
-    v5 += 4;
+	  v23 = 0;
+	  do
+	  {
+		v24 = dword_720F20[v5 / 4];
+		v25 = *(int *)((char *)dword_720F20.data() + v23);
+		if ( v24 == v25 )
+		{
+		  v22 = v38;
+		  v23 = v5;
+		}
+		else if ( v25 > a3 + 15 )
+		{
+		  if ( v24 < v25 )
+		  {
+			  v22 = v38;
+			  v23 = v5;
+		  }
+		}
+		else if ( v24 > v25 && v24 <= a3 + 15 )
+		{
+		  v22 = v38;
+		  v23 = v5;
+		}
+		++v38;
+		v5 += 4;
+	  }
+	  while ( v38 < v39 );
+	  if ( v22 )
+	  {
+		*(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6);
+		return dword_720F20[v22];
+	  }
   }
-  while ( v38 < v39 );
-  if ( v22 )
-  {
-    *(int *)a4 = dword_720E80[v22] | (dword_720ED0[v22] << 6);
-    return dword_720F20[v22];
-  }
-LABEL_54:
   *(int *)a4 = 0;
   return dword_720F20[v22];
 }
@@ -1231,6 +1235,7 @@
         || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 )
       {
         v58 = 0;
+		v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58);
       }
       else
       {
@@ -1245,12 +1250,13 @@
             strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]);
             GameUI_Footer_TimeLeft = 128;
           }
-          goto LABEL_39;
         }
-        v13 = pPlayers[v12];
+		else
+		{
+			v13 = pPlayers[v12];
+			v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58);
+		}
       }
-      v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58);
-LABEL_39:
       ++v12;
       if ( v12 > 4 )
       {
@@ -1299,18 +1305,19 @@
     if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) + v22 + v21->uEndurance >= 1
       || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 )
     {
-      if ( v22 >= 1 )
-        goto LABEL_59;
-      v59 = 0;
-      v56 = 13;
+      if ( v22 < 1 )
+	  {
+		  v59 = 0;
+		  v56 = 13;
+		  v21->SetCondition(v56, v59);
+	  }
     }
     else
     {
       v59 = 0;
       v56 = 14;
+	  v21->SetCondition(v56, v59);
     }
-    v21->SetCondition(v56, v59);
-LABEL_59:
     v23 = (int)&v21->field_E0;
     if ( v21->field_E0 )
     {
@@ -1598,7 +1605,6 @@
   result = 0;
   if ( (signed int)this->uNumFrames <= 0 )
   {
-LABEL_5:
     result = 0;
   }
   else
@@ -1609,7 +1615,7 @@
       ++result;
       ++v4;
       if ( (signed int)result >= (signed int)_uNumFrames )
-        goto LABEL_5;
+        return 0;
     }
   }
   return result;
@@ -1851,7 +1857,11 @@
     dword_AE336C = a1;
     v10 = 0;
     if ( (signed int)pNPCStats->uNumNPCNames[v4] <= 0 )
-      goto LABEL_17;
+	{
+		v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4];
+	}
+	else
+	{
     v9 = (int **)((char *)pNPCStats->pNPCNames + v4 * 4);
     do
     {
@@ -1870,8 +1880,8 @@
     if ( v8 && v8 != v7 )
       v3 = v8 + rand() % (v7 - v8);
     else
-LABEL_17:
       v3 = rand() % (signed int)pNPCStats->uNumNPCNames[v4];
+	}
   }
   dword_AE3370 = v3;
   return pNPCStats->pNPCNames[0][v11 + 2 * v3];
@@ -2093,10 +2103,34 @@
             goto _continue_strcat;
           case 11:
             v25 = GetPartyReputation();
-            goto LABEL_46;
+                        if ( v25 >= 25 )
+            {
+              v11 = pGlobalTXT_LocalizationStrings[379];
+            }
+            else
+            {
+              if ( v25 < 6 )
+              {
+                if ( v25 >= -5 )
+                {
+                  v11 = pGlobalTXT_LocalizationStrings[399];
+                }
+                else
+                {
+                  if ( v25 < -24 )
+                    v11 = pGlobalTXT_LocalizationStrings[434];
+                  else
+                    v11 = pGlobalTXT_LocalizationStrings[402];
+                }
+              }
+              else
+              {
+                v11 = pGlobalTXT_LocalizationStrings[392];
+              }
+            }
+            goto _continue_strcat;
           case 12:
             v25 = npc->rep;
-LABEL_46:
             if ( v25 >= 25 )
             {
               v11 = pGlobalTXT_LocalizationStrings[379];