diff mm7_2.cpp @ 572:cdf3afa8db74

goto clean
author zipi
date Tue, 05 Mar 2013 23:48:32 +0000
parents 0455b0405c17
children f90753ebabe3
line wrap: on
line diff
--- a/mm7_2.cpp	Tue Mar 05 21:28:16 2013 +0000
+++ b/mm7_2.cpp	Tue Mar 05 23:48:32 2013 +0000
@@ -14660,16 +14660,13 @@
     {
       if ( v2 )
       {
-LABEL_7:
         LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
         if ( (signed int)SkillToMastery(v5) < 3 )
         {
-LABEL_8:
           v0->PlaySound(SPEECH_39, 0);
           return;
         }
         v3 = pParty->pPickedItem.uItemID;
-        goto LABEL_16;
       }
     }
     else
@@ -14677,11 +14674,21 @@
       if ( (v4 == 8 || v4 == 1 || v4 == 2)
         && v1
         && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uSkillType == 4 )
-        goto LABEL_7;
-    }
-LABEL_16:
+	  {
+        LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
+        if ( (signed int)SkillToMastery(v5) < 3 )
+        {
+          v0->PlaySound(SPEECH_39, 0);
+          return;
+        }
+	  }
+    }
     if ( !v0->CanEquip_RaceAndAlignmentCheck(v3) )
-      goto LABEL_8;
+    {
+
+        v0->PlaySound(SPEECH_39, 0);
+        return;
+    }
     if ( pParty->pPickedItem.uItemID == 604 )
     {
       sub_467E7F_EquipBody(3u);
@@ -14700,16 +14707,39 @@
       case 9u:
       case 0xBu:
         if ( !v0->HasSkill(v4) )
-          goto LABEL_8;
+        {
+          v0->PlaySound(SPEECH_39, 0);
+          return;
+        }
         if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && (v6 != 3 || bUnderwater) )
-          goto LABEL_95;
+		{
+			v46 = 0;
+			v45 = 0;
+			v44 = 0;
+			v43 = 0;
+			v42 = -1;
+			v41 = 0;
+			v40 = 0;
+			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			return;
+		}
         sub_467E7F_EquipBody(v6);
         if ( pParty->pPickedItem.uItemID == 604 )
           WetsuitOff(uActiveCharacter);
         return;
       case 0xAu:
         if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
-          goto LABEL_95;
+		{
+			v46 = 0;
+			v45 = 0;
+			v44 = 0;
+			v43 = 0;
+			v42 = -1;
+			v41 = 0;
+			v40 = 0;
+			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			return;
+		}
         v52 = 10;
         v7 = (int)&v0->pEquipment.field_28;
         while ( 1 )
@@ -14718,19 +14748,20 @@
           {
             v8 = v0->FindFreeInventorySlot();
             if ( (v8 & 0x80000000u) == 0 )
+			{
+			  v9 = v52;
+			  pParty->pPickedItem.uBodyAnchor = v52 + 1;
+			  memcpy(&v0->pInventoryItems[v8], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v8]));
+			  *(&v0->pEquipment.uOffHand + v9) = v8 + 1;
+			  pMouse->RemoveHoldingItem();
               break;
+			}
           }
           ++v52;
           v7 += 4;
           if ( (signed int)v52 > 15 )
-            goto LABEL_33;
-        }
-        v9 = v52;
-        pParty->pPickedItem.uBodyAnchor = v52 + 1;
-        memcpy(&v0->pInventoryItems[v8], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v8]));
-        *(&v0->pEquipment.uOffHand + v9) = v8 + 1;
-        pMouse->RemoveHoldingItem();
-LABEL_33:
+            break;
+        }
         if ( v52 == 16 )
         {
           v52 = v0->pEquipment.field_3C - 1;
@@ -14747,9 +14778,22 @@
         return;
       case 4u:
         if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
-          goto LABEL_95;
+		{
+			v46 = 0;
+			v45 = 0;
+			v44 = 0;
+			v43 = 0;
+			v42 = -1;
+			v41 = 0;
+			v40 = 0;
+			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			return;
+		}
         if ( !v0->HasSkill(v4) )
-          goto LABEL_8;
+        {
+          v0->PlaySound(SPEECH_39, 0);
+          return;
+        }
         if ( v54 )
         {
           --v54;
@@ -14777,7 +14821,8 @@
             v17 = v52 + 1;
             memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52]));
             v0->pEquipment.uOffHand = v17;
-            goto LABEL_45;
+            pMouse->RemoveHoldingItem();
+	        return;
           }
           memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
           v15 = (int)((char *)v0 + 36 * (v53 - 1));
@@ -14796,9 +14841,22 @@
         if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter)
           && pParty->pPickedItem.uItemID != 64
           && pParty->pPickedItem.uItemID != 65 )
-          goto LABEL_95;
+		{
+			v46 = 0;
+			v45 = 0;
+			v44 = 0;
+			v43 = 0;
+			v42 = -1;
+			v41 = 0;
+			v40 = 0;
+			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			return;
+		}
         if ( !v0->HasSkill(v4) )
-          goto LABEL_8;
+        {
+          v0->PlaySound(SPEECH_39, 0);
+          return;
+        }
         v50 = 0;
         if ( v4 == 2 && (unsigned __int16)(v0->pActiveSkills[2] & 0xFFC0)
           || v4 == 1 && (signed int)SkillToMastery(v0->pActiveSkills[1]) >= 3 )
@@ -14834,9 +14892,12 @@
                 if ( !v14 )
                   return;
                 v22 = _this.uItemID;
-LABEL_73:
                 v50 = v22;
-                goto LABEL_74;
+				if ( v50 )
+				  stru_A750F8[uActiveCharacter - 1]._494836(
+					*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
+					uActiveCharacter - 1 + 9);
+				break;
               }
               v23 = v0->FindFreeInventorySlot();
               if ( (v23 & 0x80000000u) != 0 )
@@ -14845,12 +14906,16 @@
               v50 = (unsigned int)&v0->pInventoryItems[v23];
               memcpy(&v0->pInventoryItems[v23], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v23]));
               v0->pEquipment.uOffHand = v23 + 1;
-LABEL_71:
               pMouse->RemoveHoldingItem();
               if ( v52 != 12 )
                 return;
               v22 = *(int *)v50;
-              goto LABEL_73;
+			  v50 = v22;
+			  if ( v50 )
+				stru_A750F8[uActiveCharacter - 1]._494836(
+				*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
+				uActiveCharacter - 1 + 9);
+			  break;
             }
           }
         }
@@ -14863,7 +14928,16 @@
           v50 = (unsigned int)&v0->pInventoryItems[v26];
           memcpy(&v0->pInventoryItems[v26], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v26]));
           v0->pEquipment.uMainHand = v26 + 1;
-          goto LABEL_71;
+              pMouse->RemoveHoldingItem();
+              if ( v52 != 12 )
+                return;
+              v22 = *(int *)v50;
+			  v50 = v22;
+			  if ( v50 )
+				stru_A750F8[uActiveCharacter - 1]._494836(
+				*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
+				uActiveCharacter - 1 + 9);
+			  break;
         }
         --v53;
         memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
@@ -14880,7 +14954,6 @@
           v50 = _this.uItemID;
         if ( v51 )
           v0->pEquipment.uOffHand = 0;
-LABEL_74:
         if ( v50 )
           stru_A750F8[uActiveCharacter - 1]._494836(
             *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
@@ -14888,9 +14961,22 @@
         break;
       case 1u:
         if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
-          goto LABEL_95;
+		{
+			v46 = 0;
+			v45 = 0;
+			v44 = 0;
+			v43 = 0;
+			v42 = -1;
+			v41 = 0;
+			v40 = 0;
+			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			return;
+		}
         if ( !v0->HasSkill(v4) )
-          goto LABEL_8;
+        {
+          v0->PlaySound(SPEECH_39, 0);
+          return;
+        }
         if ( v53 )
         {
           if ( v54 )
@@ -14902,7 +14988,8 @@
             v42 = -1;
             v41 = 0;
             v40 = 0;
-            goto LABEL_96;
+			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			return;
           }
           --v53;
           memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
@@ -14939,7 +15026,6 @@
               v31 = v52 + 1;
               memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52]));
               v0->pEquipment.uMainHand = v31;
-LABEL_45:
               pMouse->RemoveHoldingItem();
             }
           }
@@ -14976,7 +15062,6 @@
     {
       if ( bUnderwater )
       {
-LABEL_95:
         v46 = 0;
         v45 = 0;
         v44 = 0;
@@ -14984,7 +15069,6 @@
         v42 = -1;
         v41 = 0;
         v40 = 0;
-LABEL_96:
         pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
         return;
       }
@@ -15109,71 +15193,75 @@
   }
   v22 = 0;
   v1 = (int *)((signed int)(viewparams->uScreenZ + viewparams->uScreenX) >> 1);
-  if ( (signed int)viewparams->uScreenY >= (signed int)viewparams->uScreenW )
-    goto LABEL_21;
-  v2 = (char *)v1 - 50;
-  v1 = (int *)((char *)v1 + 50);
-  v3 = 640 * viewparams->uScreenY;
-  v17 = v2;
-  v20 = v1;
-  v18 = ((viewparams->uScreenW - viewparams->uScreenY - 1) >> 1) + 1;
-  do
-  {
-    if ( (signed int)v2 >= (signed int)v20 )
-      goto LABEL_20;
-    v1 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
-    v21 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
-    v4 = v22;
-    v5 = (((char *)v20 - v2 - 1) >> 1) + 1;
-    do
-    {
-      v6 = 0;
-      v7 = *v1 & 0xFFFF;
-      v19 = 0;
-      if ( v4 > 0 )
-      {
-        do
-        {
-          if ( dword_7207F0[v6] == v7 )
-            break;
-          ++v6;
-          v19 = v6;
-        }
-        while ( v6 < v22 );
-      }
-      if ( (v7 & 7) == OBJECT_Decoration)
-      {
-        v16 = (unsigned int)v7 >> 3;
-        if ( (signed int)(((unsigned int)*v21 >> 16)
-                        - pDecorationList->pDecorations[pLevelDecorations[(unsigned int)v7 >> 3].uDecorationDescID].uRadius) > 512 )
-          goto LABEL_18;
-      }
-      else
-      {
-        if ( (unsigned int)*v21 > 0x2000000 )
-          goto LABEL_18;
-      }
-      if ( v19 == v22 && v4 < 100 )
-      {
-        ++v22;
-        ++v4;
-        v8 = *v21;
-        dword_7207EC[v4] = v7;
-        dword_72065C[v4] = v8;
-      }
-LABEL_18:
-      v1 = v21 + 2;
-      --v5;
-      v21 += 2;
-    }
-    while ( v5 );
-    v2 = v17;
-LABEL_20:
-    v3 += 1280;
-    --v18;
-  }
-  while ( v18 );
-LABEL_21:
+  if ( (signed int)viewparams->uScreenY < (signed int)viewparams->uScreenW )
+  {
+	  v2 = (char *)v1 - 50;
+	  v1 = (int *)((char *)v1 + 50);
+	  v3 = 640 * viewparams->uScreenY;
+	  v17 = v2;
+	  v20 = v1;
+	  v18 = ((viewparams->uScreenW - viewparams->uScreenY - 1) >> 1) + 1;
+	  do
+	  {
+		if ( (signed int)v2 < (signed int)v20 )
+		{
+			v1 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
+			v21 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
+			v4 = v22;
+			v5 = (((char *)v20 - v2 - 1) >> 1) + 1;
+			do
+			{
+			  v6 = 0;
+			  v7 = *v1 & 0xFFFF;
+			  v19 = 0;
+			  if ( v4 > 0 )
+			  {
+				do
+				{
+				  if ( dword_7207F0[v6] == v7 )
+					break;
+				  ++v6;
+				  v19 = v6;
+				}
+				while ( v6 < v22 );
+			  }
+			  if ( (v7 & 7) == OBJECT_Decoration)
+			  {
+				v16 = (unsigned int)v7 >> 3;
+				if ( (signed int)(((unsigned int)*v21 >> 16)
+								- pDecorationList->pDecorations[pLevelDecorations[(unsigned int)v7 >> 3].uDecorationDescID].uRadius) <= 512 )
+				  if ( v19 == v22 && v4 < 100 )
+				  {
+					++v22;
+					++v4;
+					v8 = *v21;
+					dword_7207EC[v4] = v7;
+					dword_72065C[v4] = v8;
+				  }
+			  }
+			  else if ( (unsigned int)*v21 <= 0x2000000 )
+			  {
+				  if ( v19 == v22 && v4 < 100 )
+				  {
+					++v22;
+					++v4;
+					v8 = *v21;
+					dword_7207EC[v4] = v7;
+					dword_72065C[v4] = v8;
+				  }
+			  }
+			  v1 = v21 + 2;
+			  --v5;
+			  v21 += 2;
+			}
+			while ( v5 );
+			v2 = v17;
+		}
+		v3 += 1280;
+		--v18;
+	  }
+	  while ( v18 );
+  }
   if ( v22 > 0 )
   {
     v9 = dword_720660;
@@ -15348,7 +15436,6 @@
           || (v7 = &pOutdoor->pBModels[a1 >> 9].pFaces[(a1 >> 3) & 0x3F], BYTE2(v7->uAttributes) & 0x10)
           || (v6 = v7->sCogTriggeredID) == 0 )
           return 1;
-LABEL_13:
         EventProcessor((signed __int16)v6, v2, 1);
         return 0;
       }
@@ -15362,7 +15449,10 @@
       if ( v5 & 0x100000 || (v6 = pIndoor->pFaceExtras[v4->uFaceExtraID].uEventID) == 0 )
         return 1;
       if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG )
-        goto LABEL_13;
+	  {
+        EventProcessor((signed __int16)v6, v2, 1);
+        return 0;
+	  }
       break;
   }
   return 0;