changeset 1690:95118ff8cc22

Player::_48DCF6 label removal
author Grumpy7
date Sun, 22 Sep 2013 07:57:16 +0200
parents 133a5f62bc8c
children 1c880907575f
files Player.cpp
diffstat 1 files changed, 377 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- a/Player.cpp	Sun Sep 22 07:34:02 2013 +0200
+++ b/Player.cpp	Sun Sep 22 07:57:16 2013 +0200
@@ -2272,7 +2272,6 @@
 {
   signed int v3; // edi@1
   signed int v4; // ebx@1
-  Player *v5; // esi@1
   int v6; // eax@2
   int v7; // eax@5
   int v8; // eax@8
@@ -2318,14 +2317,15 @@
 
   v3 = 0;
   v4 = 0;
-  v5 = this;
   v47 = 0;
   v48 = 0;
   switch ( a2 )
   {
     case 1:
       v6 = GetActualWillpower();
-      goto LABEL_46;
+      v7 = GetParameterBonus(v6);
+      v11 = v7;
+      break;
     case 2:
     case 3:
     case 4:
@@ -2335,24 +2335,30 @@
     case 13:
     case 21:
       v6 = GetActualEndurance();
-      goto LABEL_46;
+      v7 = GetParameterBonus(v6);
+      v11 = v7;
+      break;
     case 5:
     case 12:
     case 23:
       v40 = (CHARACTER_ATTRIBUTE_TYPE)14;
-      goto LABEL_5;
+      v7 = GetActualResistance(v40);
+      v11 = v7;
+      break;
     case 15:
       v40 = (CHARACTER_ATTRIBUTE_TYPE)13;
-      goto LABEL_5;
+      v7 = GetActualResistance(v40);
+      v11 = v7;
+      break;
     case 6:
     case 7:
     case 8:
     case 14:
     case 16:
       v40 = (CHARACTER_ATTRIBUTE_TYPE)15;
-LABEL_5:
       v7 = GetActualResistance(v40);
-      goto LABEL_47;
+      v11 = v7;
+      break;
     case 22:
       v8 = GetActualWillpower();
       v9 = GetParameterBonus(v8);
@@ -2370,7 +2376,11 @@
         ++v13;
       }
       while ( v12 < 138 );
-      goto LABEL_36;
+      if ( !v4 )
+        return 0;
+      v48 = (int)&this->pInventoryItemList[(unsigned __int8)v46[rand() % v4]];
+      v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod);
+      break;
     case 18:
       v14 = 0;
       do
@@ -2378,14 +2388,18 @@
         if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) )
         {
           if ( v14 == EQUIP_ARMOUR )
-            v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1;
+            v46[v4++] = LOBYTE(this->pEquipment.uArmor) - 1;
           if ( (!v14 || v14 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v14) == 4 )
-            v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v14) - 1;
+            v46[v4++] = *((char *)&this->pEquipment.uShield + 4 * v14) - 1;
         }
         v14++;
       }
       while ( v14 < 16 );
-      goto LABEL_36;
+      if ( !v4 )
+        return 0;
+      v48 = (int)&this->pInventoryItemList[(unsigned __int8)v46[rand() % v4]];
+      v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod);
+      break;
     case 19:
       v16 = 0;
       do
@@ -2393,18 +2407,17 @@
         if ( HasItemEquipped((ITEM_EQUIP_TYPE)v16) )
         {
           if ( v16 == 2 )
-            v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1;
+            v46[v4++] = LOBYTE(this->pEquipment.uBow) - 1;
           if ( (!v16 || v16 == 1)
             && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v16) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v16) == 1) )
-            v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v16) - 1;
+            v46[v4++] = *((char *)&this->pEquipment.uShield + 4 * v16) - 1;
         }
         v16++;
       }
       while ( v16 < 16 );
-LABEL_36:
       if ( !v4 )
-        goto LABEL_87;
-      v48 = (int)&v5->pInventoryItemList[(unsigned __int8)v46[rand() % v4]];
+        return 0;
+      v48 = (int)&this->pInventoryItemList[(unsigned __int8)v46[rand() % v4]];
       v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod);
       break;
     case 20:
@@ -2414,7 +2427,7 @@
       {
         if ( *v20 > 0 )
         {
-          v21 = *(int *)&v5->pInventoryItemList[*v20-1];
+          v21 = *(int *)&this->pInventoryItemList[*v20-1];
           if ( v21 > 0 )
           {
             if ( v21 <= 134 )
@@ -2426,12 +2439,10 @@
       }
       while ( v19 < 126 );
       if ( !v4 )
-        goto LABEL_87;
+        return 0;
       v47 = (unsigned __int8)v46[rand() % v4];
       v6 = GetActualAccuracy();
-LABEL_46:
       v7 = GetParameterBonus(v6);
-LABEL_47:
       v11 = v7;
       break;
     default:
@@ -2442,8 +2453,7 @@
   v23 = GetParameterBonus(v22) + v11 + 30;
   if ( rand() % v23 >= 30 )
   {
-LABEL_87:
-    result = 0;
+    return 0;
   }
   else
   {
@@ -2452,23 +2462,75 @@
       case 1:
         v41 = 1;
         v36 = 0;
-        goto LABEL_56;
+        SetCondition(v36, v41);
+        v42 = 0;
+        v37 = 0;
+        v35 = 0;
+        v34 = 0;
+        v33 = -1;
+        v32 = 0;
+        v31 = 0;
+        v30 = (SoundID)221;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
       case 2:
         v41 = 1;
         v36 = 1;
-        goto LABEL_56;
+        SetCondition(v36, v41);
+        v42 = 0;
+        v37 = 0;
+        v35 = 0;
+        v34 = 0;
+        v33 = -1;
+        v32 = 0;
+        v31 = 0;
+        v30 = (SoundID)221;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
       case 3:
         v41 = 1;
         v36 = 2;
-        goto LABEL_56;
+        SetCondition(v36, v41);
+        v42 = 0;
+        v37 = 0;
+        v35 = 0;
+        v34 = 0;
+        v33 = -1;
+        v32 = 0;
+        v31 = 0;
+        v30 = (SoundID)221;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
       case 23:
         v41 = 1;
         v36 = 3;
-        goto LABEL_56;
-      case 4:
-        v41 = 1;
-        v36 = 4;
-LABEL_56:
         SetCondition(v36, v41);
         v42 = 0;
         v37 = 0;
@@ -2478,32 +2540,122 @@
         v32 = 0;
         v31 = 0;
         v30 = (SoundID)221;
-        goto LABEL_83;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
+      case 4:
+        v41 = 1;
+        v36 = 4;
+        SetCondition(v36, v41);
+        v42 = 0;
+        v37 = 0;
+        v35 = 0;
+        v34 = 0;
+        v33 = -1;
+        v32 = 0;
+        v31 = 0;
+        v30 = (SoundID)221;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
       case 5:
         v43 = 1;
         v38 = 5;
-        goto LABEL_70;
+        SetCondition(v38, v43);
+        v42 = 0;
+        v37 = 0;
+        v35 = 0;
+        v34 = 0;
+        v33 = -1;
+        v32 = 0;
+        v31 = 0;
+        v30 = (SoundID)224;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
       case 6:
       case 7:
       case 8:
         if ( a2 == 6 )
         {
           v44 = 6;
-          goto LABEL_60;
+          v24 = v44;
+          SetCondition(v24, 1);
+          v42 = 0;
+          v37 = 0;
+          v35 = 0;
+          v34 = 0;
+          v33 = -1;
+          v32 = 0;
+          v31 = 0;
+          v30 = (SoundID)222;
+          pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+          do
+          {
+            if ( this == pPlayers[v3 + 1] )
+              break;
+            ++v3;
+          }
+          while ( v3 < 4 );
+          pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+          return 1;
+          break;
         }
         v25 = 2 * (a2 != 8) + 8;
-        goto LABEL_65;
+        v24 = v25;
+        SetCondition(v24, 1);
+        v42 = 0;
+        v37 = 0;
+        v35 = 0;
+        v34 = 0;
+        v33 = -1;
+        v32 = 0;
+        v31 = 0;
+        v30 = (SoundID)222;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
       case 9:
         if ( a2 == 6 )
         {
           v44 = 7;
-LABEL_60:
           v24 = v44;
         }
         else
         {
           v25 = 2 * (a2 != 8) + 9;
-LABEL_65:
           v24 = v25;
         }
         SetCondition(v24, 1);
@@ -2515,31 +2667,20 @@
         v32 = 0;
         v31 = 0;
         v30 = (SoundID)222;
-LABEL_83:
         pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
         do
         {
-LABEL_84:
-          if ( v5 == pPlayers[v3 + 1] )
+          if ( this == pPlayers[v3 + 1] )
             break;
           ++v3;
         }
         while ( v3 < 4 );
         pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
-        result = 1;
+        return 1;
         break;
       case 12:
         v43 = 1;
         v38 = 12;
-        goto LABEL_70;
-      case 15:
-        v45 = 1;
-        v39 = 15;
-        goto LABEL_73;
-      case 13:
-        v43 = 1;
-        v38 = 13;
-LABEL_70:
         SetCondition(v38, v43);
         v42 = 0;
         v37 = 0;
@@ -2549,15 +2690,89 @@
         v32 = 0;
         v31 = 0;
         v30 = (SoundID)224;
-        goto LABEL_83;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
+      case 15:
+        v45 = 1;
+        v39 = 15;
+        SetCondition(v39, v45);
+        v42 = 0;
+        v37 = 0;
+        v35 = 0;
+        v34 = 0;
+        v33 = -1;
+        v32 = 0;
+        v31 = 0;
+        v30 = (SoundID)225;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
+      case 13:
+        v43 = 1;
+        v38 = 13;
+        SetCondition(v38, v43);
+        v42 = 0;
+        v37 = 0;
+        v35 = 0;
+        v34 = 0;
+        v33 = -1;
+        v32 = 0;
+        v31 = 0;
+        v30 = (SoundID)224;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
       case 14:
         v45 = 1;
         v39 = 14;
-        goto LABEL_73;
+        SetCondition(v39, v45);
+        v42 = 0;
+        v37 = 0;
+        v35 = 0;
+        v34 = 0;
+        v33 = -1;
+        v32 = 0;
+        v31 = 0;
+        v30 = (SoundID)225;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
       case 16:
         v45 = 1;
         v39 = 16;
-LABEL_73:
         SetCondition(v39, v45);
         v42 = 0;
         v37 = 0;
@@ -2567,29 +2782,35 @@
         v32 = 0;
         v31 = 0;
         v30 = (SoundID)225;
-        goto LABEL_83;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
       case 17:
       case 18:
       case 19:
         v26 = v48;
         if ( *(char *)(v48 + 21) & 2 )
-          goto LABEL_84;
+        {
+          do
+          {
+            if ( this == pPlayers[v3 + 1] )
+              break;
+            ++v3;
+          }
+          while ( v3 < 4 );
+          pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+          return 1;
+        }
         PlaySound(SPEECH_40, 0);
         *(int *)(v26 + 20) |= 2u;
-        goto LABEL_79;
-      case 20:
-        PlaySound(SPEECH_40, 0);
-        v27 = pActor->array_000234;
-        if ( pActor->array_000234[0].uItemID )
-        {
-          v27 = &pActor->array_000234[1];
-          if ( pActor->array_000234[1].uItemID )
-            goto LABEL_84;
-        }
-        v28 = v47;
-        memcpy(v27, &v5->pInventoryItemList[v5->pInventoryMatrix[v47]-1], 0x24u);
-        RemoveItemAtInventoryIndex(v28);
-LABEL_79:
         v42 = 0;
         v37 = 0;
         v35 = 0;
@@ -2598,15 +2819,61 @@
         v32 = 0;
         v31 = 0;
         v30 = (SoundID)47;
-        goto LABEL_83;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
+      case 20:
+        PlaySound(SPEECH_40, 0);
+        v27 = pActor->array_000234;
+        if ( pActor->array_000234[0].uItemID )
+        {
+          v27 = &pActor->array_000234[1];
+          if ( pActor->array_000234[1].uItemID )
+          {
+            do
+            {
+              if ( this == pPlayers[v3 + 1] )
+                break;
+              ++v3;
+            }
+            while ( v3 < 4 );
+            pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+            return 1;
+          }
+        }
+        v28 = v47;
+        memcpy(v27, &this->pInventoryItemList[this->pInventoryMatrix[v47]-1], 0x24u);
+        RemoveItemAtInventoryIndex(v28);
+        v42 = 0;
+        v37 = 0;
+        v35 = 0;
+        v34 = 0;
+        v33 = -1;
+        v32 = 0;
+        v31 = 0;
+        v30 = (SoundID)47;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
       case 21:
         PlaySound(SPEECH_42, 0);
-        ++v5->sAgeModifier;
-        goto LABEL_82;
-      case 22:
-        PlaySound(SPEECH_41, 0);
-        v5->sMana = 0;
-LABEL_82:
+        ++this->sAgeModifier;
         v42 = 0;
         v37 = 0;
         v35 = 0;
@@ -2615,9 +2882,41 @@
         v32 = 0;
         v31 = 0;
         v30 = (SoundID)226;
-        goto LABEL_83;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
+      case 22:
+        PlaySound(SPEECH_41, 0);
+        this->sMana = 0;
+        v42 = 0;
+        v37 = 0;
+        v35 = 0;
+        v34 = 0;
+        v33 = -1;
+        v32 = 0;
+        v31 = 0;
+        v30 = (SoundID)226;
+        pAudioPlayer->PlaySound(v30, v31, v32, v33, v34, v35, v37, v42);
+        do
+        {
+          if ( this == pPlayers[v3 + 1] )
+            break;
+          ++v3;
+        }
+        while ( v3 < 4 );
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
+        return 1;
+        break;
       default:
-        goto LABEL_87;
+        return 0;
     }
   }
   return result;