changeset 1851:80e897fc2438

Actor::AI_SpellAttack getting rid of labels, constant vars(used in playsound)
author Grumpy7
date Sun, 13 Oct 2013 11:17:09 +0200
parents 521ffedabe19
children 979380004db2
files Actor.cpp
diffstat 1 files changed, 377 insertions(+), 170 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Sun Oct 13 10:45:48 2013 +0200
+++ b/Actor.cpp	Sun Oct 13 11:17:09 2013 +0200
@@ -244,7 +244,6 @@
   int v44; // ecx@100
   int v45; // ecx@101
   int v46; // eax@105
-  unsigned int v47; // ebx@106
   int v48; // ecx@110
   char v49; // zf@123
   int v50; // eax@127
@@ -297,13 +296,7 @@
   int v97; // eax@221
   SoundID v98; // [sp-18h] [bp-E8h]@79
   signed int v99; // [sp-14h] [bp-E4h]@39
-  unsigned int v100; // [sp-10h] [bp-E0h]@39
-  signed int v101; // [sp-Ch] [bp-DCh]@39
-  signed int v102; // [sp-8h] [bp-D8h]@39
-  int v103; // [sp-4h] [bp-D4h]@39
-  unsigned int v104; // [sp+0h] [bp-D0h]@39
   signed int v105; // [sp+4h] [bp-CCh]@23
-  int v106; // [sp+4h] [bp-CCh]@39
   signed int v107; // [sp+4h] [bp-CCh]@42
   signed int v108; // [sp+4h] [bp-CCh]@173
   int pitch; // [sp+2Ch] [bp-A4h]@51
@@ -353,7 +346,16 @@
                 if ( uSpellID != 17 )
                   return;
                 if ( (signed int)v7 <= 0 )
-                  goto LABEL_20;
+                {
+                  v8 = 0;
+                  v5->pActorBuffs[15].Apply(
+                    pParty->uTimePlayed + (signed int)(signed __int64)((double)(v8 << 7) * 0.033333335),
+                    v7,
+                    0,
+                    0,
+                    0);
+                  return;
+                }
                 if ( (signed int)v7 <= 2 )
                 {
                   v9 = 300 * v6;
@@ -365,7 +367,6 @@
                     if ( v7 == 4 )
                     {
                       v8 = 3600 * (v6 + 64);
-LABEL_21:
                       v5->pActorBuffs[15].Apply(
                         pParty->uTimePlayed + (signed int)(signed __int64)((double)(v8 << 7) * 0.033333335),
                         v7,
@@ -374,14 +375,25 @@
                         0);
                       return;
                     }
-LABEL_20:
                     v8 = 0;
-                    goto LABEL_21;
+                    v5->pActorBuffs[15].Apply(
+                      pParty->uTimePlayed + (signed int)(signed __int64)((double)(v8 << 7) * 0.033333335),
+                      v7,
+                      0,
+                      0,
+                      0);
+                    return;
                   }
                   v9 = 900 * v6;
                 }
                 v8 = v9 + 3840;
-                goto LABEL_21;
+                v5->pActorBuffs[15].Apply(
+                  pParty->uTimePlayed + (signed int)(signed __int64)((double)(v8 << 7) * 0.033333335),
+                  v7,
+                  0,
+                  0,
+                  0);
+                return;
               }
               v10 = 3;
               if ( uSkillLevel & 0x0100 )
@@ -466,19 +478,13 @@
               }
               if ( v20 != -1 )
               {
-                v106 = 0;
-                v104 = 0;
-                v103 = 0;
-                v102 = 0;
                 v21 = 8 * v20;
-                v101 = -1;
                 LOBYTE(v21) = v21 | 2;
-                v100 = 0;
                 v99 = v21;
                 v22 = (SoundID)word_4EE088_sound_ids[15];
-LABEL_202:
                 v98 = v22;
-                goto LABEL_222;
+                pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+                return;
               }
               return;
             }
@@ -557,17 +563,13 @@
                     0);
             if ( v91 != -1 )
             {
-              v106 = 0;
-              v104 = 0;
-              v103 = 0;
-              v102 = 0;
               v92 = 8 * v91;
-              v101 = -1;
               LOBYTE(v92) = v92 | 2;
-              v100 = 0;
               v99 = v92;
               v22 = (SoundID)word_4EE088_sound_ids[uSpellID];
-              goto LABEL_202;
+              v98 = v22;
+              pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+              return;
             }
             return;
           }
@@ -714,17 +716,23 @@
           if ( (signed int)v7 <= 2 )
           {
             v39 = 60 * (v6 + 60);
-            goto LABEL_79;
+            v5->pActorBuffs[19].Apply(
+              pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335),
+              v7,
+              0,
+              0,
+              0);
+            pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFF3C1Eu);
+            v40 = 8 * LODWORD(v120);
+            LOBYTE(v40) = PID(OBJECT_Actor,LOBYTE(v120));
+            v99 = v40;
+            v98 = (SoundID)10040;
+            pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+            return;
           }
           if ( v7 == 3 )
           {
             v39 = 180 * (v6 + 20);
-            goto LABEL_79;
-          }
-          if ( v7 == 4 )
-          {
-            v39 = 240 * (v6 + 15);
-LABEL_79:
             v5->pActorBuffs[19].Apply(
               pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335),
               v7,
@@ -732,23 +740,45 @@
               0,
               0);
             pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFF3C1Eu);
-            v106 = 0;
-            v104 = 0;
-            v103 = 0;
-            v102 = 0;
             v40 = 8 * LODWORD(v120);
-            v101 = -1;
             LOBYTE(v40) = PID(OBJECT_Actor,LOBYTE(v120));
-            v100 = 0;
             v99 = v40;
             v98 = (SoundID)10040;
-LABEL_222:
-            pAudioPlayer->PlaySound(v98, v99, v100, v101, v102, v103, v104, v106);
+            pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+            return;
+          }
+          if ( v7 == 4 )
+          {
+            v39 = 240 * (v6 + 15);
+            v5->pActorBuffs[19].Apply(
+              pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335),
+              v7,
+              0,
+              0,
+              0);
+            pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFF3C1Eu);
+            v40 = 8 * LODWORD(v120);
+            LOBYTE(v40) = PID(OBJECT_Actor,LOBYTE(v120));
+            v99 = v40;
+            v98 = (SoundID)10040;
+            pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
             return;
           }
         }
         v39 = 0;
-        goto LABEL_79;
+        v5->pActorBuffs[19].Apply(
+          pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335),
+          v7,
+          0,
+          0,
+          0);
+        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFF3C1Eu);
+        v40 = 8 * LODWORD(v120);
+        LOBYTE(v40) = PID(OBJECT_Actor,LOBYTE(v120));
+        v99 = v40;
+        v98 = (SoundID)10040;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
       }
       if ( uSpellID == 26 || uSpellID == 29 )
         goto LABEL_159;
@@ -763,19 +793,25 @@
           if ( (signed int)v7 <= 2 )
           {
             v41 = 300 * v6;
-            goto LABEL_91;
+            v42 = v41 + 3840;
+            v5->pActorBuffs[17].Apply(
+              pParty->uTimePlayed + (signed int)(signed __int64)((double)(v42 << 7) * 0.033333335),
+              v7,
+              v6 + 5,
+              0,
+              0);
+            pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
+            v43 = 8 * LODWORD(v120);
+            LOBYTE(v43) = PID(OBJECT_Actor,LOBYTE(v120));
+            v99 = v43;
+            v98 = (SoundID)14010;
+            pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+            return;
           }
           if ( v7 == 3 )
           {
             v41 = 900 * v6;
-            goto LABEL_91;
-          }
-          if ( v7 == 4 )
-          {
-            v41 = 1200 * v6;
-LABEL_91:
             v42 = v41 + 3840;
-LABEL_95:
             v5->pActorBuffs[17].Apply(
               pParty->uTimePlayed + (signed int)(signed __int64)((double)(v42 << 7) * 0.033333335),
               v7,
@@ -783,24 +819,64 @@
               0,
               0);
             pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
-            v106 = 0;
-            v104 = 0;
-            v103 = 0;
-            v102 = 0;
             v43 = 8 * LODWORD(v120);
-            v101 = -1;
             LOBYTE(v43) = PID(OBJECT_Actor,LOBYTE(v120));
-            v100 = 0;
             v99 = v43;
             v98 = (SoundID)14010;
-            goto LABEL_222;
+            pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+            return;
+          }
+          if ( v7 == 4 )
+          {
+            v41 = 1200 * v6;
+            v42 = v41 + 3840;
+            v5->pActorBuffs[17].Apply(
+              pParty->uTimePlayed + (signed int)(signed __int64)((double)(v42 << 7) * 0.033333335),
+              v7,
+              v6 + 5,
+              0,
+              0);
+            pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
+            v43 = 8 * LODWORD(v120);
+            LOBYTE(v43) = PID(OBJECT_Actor,LOBYTE(v120));
+            v99 = v43;
+            v98 = (SoundID)14010;
+            pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+            return;
           }
         }
         v42 = 0;
-        goto LABEL_95;
+        v5->pActorBuffs[17].Apply(
+          pParty->uTimePlayed + (signed int)(signed __int64)((double)(v42 << 7) * 0.033333335),
+          v7,
+          v6 + 5,
+          0,
+          0);
+        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
+        v43 = 8 * LODWORD(v120);
+        LOBYTE(v43) = PID(OBJECT_Actor,LOBYTE(v120));
+        v99 = v43;
+        v98 = (SoundID)14010;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
       }
       if ( (signed int)v7 <= 0 )
-        goto LABEL_104;
+      {
+        v44 = 0;
+        v5->pActorBuffs[16].Apply(
+          pParty->uTimePlayed + (signed int)(signed __int64)((double)(v44 << 7) * 0.033333335),
+          v7,
+          v6 + 5,
+          0,
+          0);
+        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0x5C310Eu);
+        v46 = 8 * LODWORD(v120);
+        LOBYTE(v46) = PID(OBJECT_Actor,LOBYTE(v120));
+        v99 = v46;
+        v98 = (SoundID)13040;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
+      }
       if ( (signed int)v7 <= 2 )
       {
         v45 = 300 * v6;
@@ -812,7 +888,6 @@
           if ( v7 == 4 )
           {
             v44 = 3600 * (v6 + 64);
-LABEL_105:
             v5->pActorBuffs[16].Apply(
               pParty->uTimePlayed + (signed int)(signed __int64)((double)(v44 << 7) * 0.033333335),
               v7,
@@ -820,62 +895,93 @@
               0,
               0);
             pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0x5C310Eu);
-            v106 = 0;
-            v104 = 0;
-            v103 = 0;
-            v102 = 0;
             v46 = 8 * LODWORD(v120);
-            v101 = -1;
             LOBYTE(v46) = PID(OBJECT_Actor,LOBYTE(v120));
-            v100 = 0;
             v99 = v46;
             v98 = (SoundID)13040;
-            goto LABEL_222;
+            pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+            return;
           }
-LABEL_104:
           v44 = 0;
-          goto LABEL_105;
+          v5->pActorBuffs[16].Apply(
+            pParty->uTimePlayed + (signed int)(signed __int64)((double)(v44 << 7) * 0.033333335),
+            v7,
+            v6 + 5,
+            0,
+            0);
+          pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0x5C310Eu);
+          v46 = 8 * LODWORD(v120);
+          LOBYTE(v46) = PID(OBJECT_Actor,LOBYTE(v120));
+          v99 = v46;
+          v98 = (SoundID)13040;
+          pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+          return;
         }
         v45 = 900 * v6;
       }
       v44 = v45 + 3840;
-      goto LABEL_105;
+      v5->pActorBuffs[16].Apply(
+        pParty->uTimePlayed + (signed int)(signed __int64)((double)(v44 << 7) * 0.033333335),
+        v7,
+        v6 + 5,
+        0,
+        0);
+      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0x5C310Eu);
+      v46 = 8 * LODWORD(v120);
+      LOBYTE(v46) = PID(OBJECT_Actor,LOBYTE(v120));
+      v99 = v46;
+      v98 = (SoundID)13040;
+      pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+      return;
     }
-    v47 = 0;
     if ( (signed int)v7 > 0 )
     {
       if ( (signed int)v7 <= 2 )
       {
         v48 = 2 * v6 + 40;
-        goto LABEL_114;
+        v5->pActorBuffs[11].Apply(pParty->uTimePlayed + 1280, v7, v48, 0, 0);
+        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
+        v50 = 8 * LODWORD(v120);
+        LOBYTE(v50) = PID(OBJECT_Actor,LOBYTE(v120));
+        v99 = v50;
+        v98 = (SoundID)14020;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
       }
       if ( v7 == 3 )
       {
         v48 = 3 * v6 + 60;
-        goto LABEL_114;
+        v5->pActorBuffs[11].Apply(pParty->uTimePlayed + 1280, v7, v48, 0, 0);
+        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
+        v50 = 8 * LODWORD(v120);
+        LOBYTE(v50) = PID(OBJECT_Actor,LOBYTE(v120));
+        v99 = v50;
+        v98 = (SoundID)14020;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
       }
       if ( v7 == 4 )
       {
         LOWORD(v48) = 2 * (3 * v6 + 60);
-LABEL_114:
         v5->pActorBuffs[11].Apply(pParty->uTimePlayed + 1280, v7, v48, 0, 0);
         pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
-LABEL_127:
-        v106 = v47;
-        v104 = v47;
-        v103 = v47;
         v50 = 8 * LODWORD(v120);
-        v102 = v47;
-        v101 = -1;
         LOBYTE(v50) = PID(OBJECT_Actor,LOBYTE(v120));
-        v100 = v47;
         v99 = v50;
         v98 = (SoundID)14020;
-        goto LABEL_222;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
       }
     }
     LOWORD(v48) = 0;
-    goto LABEL_114;
+    v5->pActorBuffs[11].Apply(pParty->uTimePlayed + 1280, v7, v48, 0, 0);
+    pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
+    v50 = 8 * LODWORD(v120);
+    LOBYTE(v50) = PID(OBJECT_Actor,LOBYTE(v120));
+    v99 = v50;
+    v98 = (SoundID)14020;
+    pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+    return;
   }
   if ( uSpellID <= 80 )
   {
@@ -913,17 +1019,13 @@
         ++v57;
       }
       while ( (signed int)v57 <= (signed int)&pPlayers[4] );
-      v106 = 0;
-      v104 = 0;
-      v103 = 0;
       v65 = 8 * LODWORD(v120);
-      v102 = 0;
-      v101 = -1;
       LOBYTE(v65) = PID(OBJECT_Actor,LOBYTE(v120));
-      v100 = 0;
       v99 = v65;
       v22 = (SoundID)word_4EE088_sound_ids[80];
-      goto LABEL_202;
+      v98 = v22;
+      pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+      return;
     }
     if ( uSpellID != 51 )
     {
@@ -942,17 +1044,12 @@
           0,
           0);
         pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xA81376u);
-        v106 = 0;
-        v104 = 0;
-        v103 = 0;
-        v102 = 0;
         v52 = 8 * LODWORD(v120);
-        v101 = -1;
         LOBYTE(v52) = PID(OBJECT_Actor,LOBYTE(v120));
-        v100 = 0;
         v99 = v52;
         v98 = (SoundID)16060;
-        goto LABEL_222;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
       }
       if ( uSpellID == 77 )
       {
@@ -960,8 +1057,12 @@
         if ( v5->sCurrentHP >= (signed int)v5->pMonsterInfo.uHP )
           v5->sCurrentHP = LOWORD(v5->pMonsterInfo.uHP);
         pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xA81376u);
-        v47 = 0;
-        goto LABEL_127;
+        v50 = 8 * LODWORD(v120);
+        LOBYTE(v50) = PID(OBJECT_Actor,LOBYTE(v120));
+        v99 = v50;
+        v98 = (SoundID)14020;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
       }
       v49 = uSpellID == 78;
 LABEL_158:
@@ -974,19 +1075,25 @@
       if ( (signed int)v7 <= 2 )
       {
         v53 = 300 * v6;
-        goto LABEL_138;
+        v54 = v53 + 3840;
+        v5->pActorBuffs[18].Apply(
+          pParty->uTimePlayed + (signed int)(signed __int64)((double)(v54 << 7) * 0.033333335),
+          v7,
+          v6 + 5,
+          0,
+          0);
+        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
+        v55 = 8 * LODWORD(v120);
+        LOBYTE(v55) = PID(OBJECT_Actor,LOBYTE(v120));
+        v99 = v55;
+        v98 = (SoundID)14060;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
       }
       if ( v7 == 3 )
       {
         v53 = 900 * v6;
-        goto LABEL_138;
-      }
-      if ( v7 == 4 )
-      {
-        v53 = 1200 * v6;
-LABEL_138:
         v54 = v53 + 3840;
-LABEL_142:
         v5->pActorBuffs[18].Apply(
           pParty->uTimePlayed + (signed int)(signed __int64)((double)(v54 << 7) * 0.033333335),
           v7,
@@ -994,21 +1101,46 @@
           0,
           0);
         pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
-        v106 = 0;
-        v104 = 0;
-        v103 = 0;
-        v102 = 0;
         v55 = 8 * LODWORD(v120);
-        v101 = -1;
         LOBYTE(v55) = PID(OBJECT_Actor,LOBYTE(v120));
-        v100 = 0;
         v99 = v55;
         v98 = (SoundID)14060;
-        goto LABEL_222;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
+      }
+      if ( v7 == 4 )
+      {
+        v53 = 1200 * v6;
+        v54 = v53 + 3840;
+        v5->pActorBuffs[18].Apply(
+          pParty->uTimePlayed + (signed int)(signed __int64)((double)(v54 << 7) * 0.033333335),
+          v7,
+          v6 + 5,
+          0,
+          0);
+        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
+        v55 = 8 * LODWORD(v120);
+        LOBYTE(v55) = PID(OBJECT_Actor,LOBYTE(v120));
+        v99 = v55;
+        v98 = (SoundID)14060;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
       }
     }
     v54 = 0;
-    goto LABEL_142;
+    v5->pActorBuffs[18].Apply(
+      pParty->uTimePlayed + (signed int)(signed __int64)((double)(v54 << 7) * 0.033333335),
+      v7,
+      v6 + 5,
+      0,
+      0);
+    pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u);
+    v55 = 8 * LODWORD(v120);
+    LOBYTE(v55) = PID(OBJECT_Actor,LOBYTE(v120));
+    v99 = v55;
+    v98 = (SoundID)14060;
+    pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+    return;
   }
   if ( uSpellID == 85 )
   {
@@ -1017,19 +1149,24 @@
       if ( (signed int)v7 <= 2 )
       {
         v96 = 300 * v6 + 3840;
-        goto LABEL_221;
+        v5->pActorBuffs[13].Apply(
+          pParty->uTimePlayed + (signed int)(signed __int64)((double)(v96 << 7) * 0.033333335),
+          v7,
+          v6,
+          0,
+          0);
+        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu);
+        v97 = 8 * LODWORD(v120);
+        LOBYTE(v97) = PID(OBJECT_Actor,LOBYTE(v120));
+        v99 = v97;
+        v98 = (SoundID)17070;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
       }
       if ( v7 == 3 )
       {
         LOWORD(v6) = 3 * v6;
         v96 = 900 * (uSkillLevel & 0x3F) + 3840;
-        goto LABEL_221;
-      }
-      if ( v7 == 4 )
-      {
-        v96 = 1200 * v6 + 3840;
-        LOWORD(v6) = 4 * v6;
-LABEL_221:
         v5->pActorBuffs[13].Apply(
           pParty->uTimePlayed + (signed int)(signed __int64)((double)(v96 << 7) * 0.033333335),
           v7,
@@ -1037,22 +1174,47 @@
           0,
           0);
         pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu);
-        v106 = 0;
-        v104 = 0;
-        v103 = 0;
-        v102 = 0;
         v97 = 8 * LODWORD(v120);
-        v101 = -1;
         LOBYTE(v97) = PID(OBJECT_Actor,LOBYTE(v120));
-        v100 = 0;
         v99 = v97;
         v98 = (SoundID)17070;
-        goto LABEL_222;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
+      }
+      if ( v7 == 4 )
+      {
+        v96 = 1200 * v6 + 3840;
+        LOWORD(v6) = 4 * v6;
+        v5->pActorBuffs[13].Apply(
+          pParty->uTimePlayed + (signed int)(signed __int64)((double)(v96 << 7) * 0.033333335),
+          v7,
+          v6,
+          0,
+          0);
+        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu);
+        v97 = 8 * LODWORD(v120);
+        LOBYTE(v97) = PID(OBJECT_Actor,LOBYTE(v120));
+        v99 = v97;
+        v98 = (SoundID)17070;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
       }
     }
     LOWORD(v6) = uSkillLevel;
     v96 = 0;
-    goto LABEL_221;
+    v5->pActorBuffs[13].Apply(
+      pParty->uTimePlayed + (signed int)(signed __int64)((double)(v96 << 7) * 0.033333335),
+      v7,
+      v6,
+      0,
+      0);
+    pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu);
+    v97 = 8 * LODWORD(v120);
+    LOBYTE(v97) = PID(OBJECT_Actor,LOBYTE(v120));
+    v99 = v97;
+    v98 = (SoundID)17070;
+    pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+    return;
   }
   if ( uSpellID == 86 )
   {
@@ -1061,19 +1223,25 @@
       if ( (signed int)v7 <= 2 )
       {
         v93 = 300 * v6;
-        goto LABEL_208;
+        v94 = v93 + 3840;
+        v5->pActorBuffs[14].Apply(
+          pParty->uTimePlayed + (signed int)(signed __int64)((double)(v94 << 7) * 0.033333335),
+          v7,
+          v6 + 5,
+          0,
+          0);
+        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu);
+        v95 = 8 * LODWORD(v120);
+        LOBYTE(v95) = PID(OBJECT_Actor,LOBYTE(v120));
+        v99 = v95;
+        v98 = (SoundID)17080;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
       }
       if ( v7 == 3 )
       {
         v93 = 900 * v6;
-        goto LABEL_208;
-      }
-      if ( v7 == 4 )
-      {
-        v93 = 1200 * v6;
-LABEL_208:
         v94 = v93 + 3840;
-LABEL_212:
         v5->pActorBuffs[14].Apply(
           pParty->uTimePlayed + (signed int)(signed __int64)((double)(v94 << 7) * 0.033333335),
           v7,
@@ -1081,21 +1249,46 @@
           0,
           0);
         pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu);
-        v106 = 0;
-        v104 = 0;
-        v103 = 0;
-        v102 = 0;
         v95 = 8 * LODWORD(v120);
-        v101 = -1;
         LOBYTE(v95) = PID(OBJECT_Actor,LOBYTE(v120));
-        v100 = 0;
         v99 = v95;
         v98 = (SoundID)17080;
-        goto LABEL_222;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
+      }
+      if ( v7 == 4 )
+      {
+        v93 = 1200 * v6;
+        v94 = v93 + 3840;
+        v5->pActorBuffs[14].Apply(
+          pParty->uTimePlayed + (signed int)(signed __int64)((double)(v94 << 7) * 0.033333335),
+          v7,
+          v6 + 5,
+          0,
+          0);
+        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu);
+        v95 = 8 * LODWORD(v120);
+        LOBYTE(v95) = PID(OBJECT_Actor,LOBYTE(v120));
+        v99 = v95;
+        v98 = (SoundID)17080;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
       }
     }
     v94 = 0;
-    goto LABEL_212;
+    v5->pActorBuffs[14].Apply(
+      pParty->uTimePlayed + (signed int)(signed __int64)((double)(v94 << 7) * 0.033333335),
+      v7,
+      v6 + 5,
+      0,
+      0);
+    pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu);
+    v95 = 8 * LODWORD(v120);
+    LOBYTE(v95) = PID(OBJECT_Actor,LOBYTE(v120));
+    v99 = v95;
+    v98 = (SoundID)17080;
+    pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+    return;
   }
   if ( uSpellID == 90 )
     goto LABEL_159;
@@ -1111,14 +1304,7 @@
       if ( (signed int)v7 <= 3 )
       {
         v67 = 300 * v6;
-        goto LABEL_168;
-      }
-      if ( v7 == 4 )
-      {
-        v67 = 900 * v6;
-LABEL_168:
         v68 = v67 + 3840;
-LABEL_171:
         v5->pActorBuffs[20].Apply(
           pParty->uTimePlayed + (signed int)(signed __int64)((double)(v68 << 7) * 0.033333335),
           v7,
@@ -1126,21 +1312,46 @@
           0,
           0);
         pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0x7E7E7Eu);
-        v106 = 0;
-        v104 = 0;
-        v103 = 0;
-        v102 = 0;
         v69 = 8 * LODWORD(v120);
-        v101 = -1;
         LOBYTE(v69) = PID(OBJECT_Actor,LOBYTE(v120));
-        v100 = 0;
         v99 = v69;
         v98 = (SoundID)18060;
-        goto LABEL_222;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
+      }
+      if ( v7 == 4 )
+      {
+        v67 = 900 * v6;
+        v68 = v67 + 3840;
+        v5->pActorBuffs[20].Apply(
+          pParty->uTimePlayed + (signed int)(signed __int64)((double)(v68 << 7) * 0.033333335),
+          v7,
+          0,
+          0,
+          0);
+        pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0x7E7E7Eu);
+        v69 = 8 * LODWORD(v120);
+        LOBYTE(v69) = PID(OBJECT_Actor,LOBYTE(v120));
+        v99 = v69;
+        v98 = (SoundID)18060;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
       }
     }
     v68 = 0;
-    goto LABEL_171;
+    v5->pActorBuffs[20].Apply(
+      pParty->uTimePlayed + (signed int)(signed __int64)((double)(v68 << 7) * 0.033333335),
+      v7,
+      0,
+      0,
+      0);
+    pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0x7E7E7Eu);
+    v69 = 8 * LODWORD(v120);
+    LOBYTE(v69) = PID(OBJECT_Actor,LOBYTE(v120));
+    v99 = v69;
+    v98 = (SoundID)18060;
+    pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+    return;
   }
   v70 = 3;
   if ( uSkillLevel & 0x100 )
@@ -1225,17 +1436,13 @@
   }
   if ( v80 != -1 )
   {
-    v106 = 0;
-    v104 = 0;
-    v103 = 0;
-    v102 = 0;
     v81 = 8 * v80;
-    v101 = -1;
     LOBYTE(v81) = v81 | 2;
-    v100 = 0;
     v99 = v81;
     v22 = (SoundID)word_4EE088_sound_ids[93];
-    goto LABEL_202;
+    v98 = v22;
+    pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+    return;
   }
 }