diff Actor.cpp @ 1856:656962b05d32

Actor::AI_SpellAttack label 159 removed
author Grumpy7
date Mon, 14 Oct 2013 00:46:09 +0200
parents 51e9b4621d0a
children f357e4cbd169
line wrap: on
line diff
--- a/Actor.cpp	Mon Oct 14 00:40:25 2013 +0200
+++ b/Actor.cpp	Mon Oct 14 00:46:09 2013 +0200
@@ -321,31 +321,91 @@
   int a1c; // [sp+E0h] [bp+10h]@184
 
 
-
-  if ( uSpellID == 6 )
-    goto LABEL_159;
-  if ( uSpellID == 11 )
-    goto LABEL_159;
-  if ( uSpellID == 18 || uSpellID == 2 )
-    goto LABEL_159;
-  if ( uSpellID == 26 || uSpellID == 29 )
-    goto LABEL_159;
-  if ( uSpellID == 39 || uSpellID == 41 )
-    goto LABEL_159;
-  if ( uSpellID == 57 || uSpellID == 65 || uSpellID == 70 )
-    goto LABEL_159;
-  if ( uSpellID == 78 )
-    goto LABEL_159;
-  if ( uSpellID == 90 )
-    goto LABEL_159;
-  if ( uSpellID == 97 )
-    goto LABEL_159;
-
   LODWORD(v120) = uActorID;
   v5 = &pActors[uActorID];
   v117 = pDir;
   realPoints = uSkillLevel & 0x3F;
   masteryLevel = SkillToMastery(uSkillLevel);
+
+  switch (uSpellID)
+  {
+    case 2:
+    case 6:
+    case 11:
+    case 18:
+    case 26:
+    case 29:
+    case 39:
+    case 41:
+    case 57:
+    case 65:
+    case 70:
+    case 78:
+    case 90:
+    case 97:
+      a1.uType = stru_4E3ACC[uSpellID].uType;
+      v119 = 0.0;
+      v82 = 0;
+      for (int i = 0; i < pObjectList->uNumObjects; i++)
+      {
+        if (a1.uType == pObjectList->pObjects[i].uObjectID)
+        {
+          v82 = i;
+          break;
+        }
+      }
+      a1.uObjectDescID = v82;
+      a1.stru_24.Reset();
+      a1.spell_id = uSpellID;
+      v83 = v5->vPosition.x;
+      v84 = v5->vPosition.y;
+      a1.spell_level = uSkillLevel;
+      a1.vPosition.x = v83;
+      v85 = v5->vPosition.z + ((signed int)v5->uActorHeight >> 1);
+      v86 = v117;
+      v87 = LOWORD(v117->uYawAngle);
+      a1.spell_skill = 0;
+      a1.vPosition.y = v84;
+      a1.vPosition.z = v85;
+      a1.uFacing = v87;
+      a1.uSoundID = 0;
+      a1.uAttributes = 0;
+      v88 = pIndoor->GetSector(v83, v84, v85);
+      v89 = v86->uDistance;
+      a1.uSectorID = v88;
+      LODWORD(v119) = v89;
+      a1.uSpriteFrameID = 0;
+      a1.spell_caster_pid = PID(OBJECT_Actor, LODWORD(v120));
+      a1.spell_target_pid = 0;
+      if ((double)v89 < 307.2 )
+        a1.field_60_distance_related_prolly_lod = 0;
+      else if ( v89 < 1024 )
+        a1.field_60_distance_related_prolly_lod = 1;
+      else if ( v89 < 2560 )
+        a1.field_60_distance_related_prolly_lod = 2;
+      else 
+        a1.field_60_distance_related_prolly_lod = 3;
+
+      a1.field_61 = 2;
+      v91 = a1.Create(
+        v86->uYawAngle,
+        v86->uPitchAngle,
+        pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
+        0);
+      if ( v91 != -1 )
+      {
+        v92 = 8 * v91;
+        LOBYTE(v92) = v92 | 2;
+        v99 = v92;
+        v22 = (SoundID)word_4EE088_sound_ids[uSpellID];
+        v98 = v22;
+        pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
+        return;
+      }
+      return;
+      break;
+  }
+
   if ( uSpellID <= 47 )
   {
     if ( uSpellID != 47 )
@@ -462,67 +522,6 @@
               }
               return;
             }
-LABEL_159:
-            a1.uType = stru_4E3ACC[uSpellID].uType;
-            v119 = 0.0;
-            v82 = 0;
-            for (int i = 0; i < pObjectList->uNumObjects; i++)
-            {
-              if (a1.uType == pObjectList->pObjects[i].uObjectID)
-              {
-                v82 = i;
-                break;
-              }
-            }
-            a1.uObjectDescID = v82;
-            a1.stru_24.Reset();
-            a1.spell_id = uSpellID;
-            v83 = v5->vPosition.x;
-            v84 = v5->vPosition.y;
-            a1.spell_level = uSkillLevel;
-            a1.vPosition.x = v83;
-            v85 = v5->vPosition.z + ((signed int)v5->uActorHeight >> 1);
-            v86 = v117;
-            v87 = LOWORD(v117->uYawAngle);
-            a1.spell_skill = 0;
-            a1.vPosition.y = v84;
-            a1.vPosition.z = v85;
-            a1.uFacing = v87;
-            a1.uSoundID = 0;
-            a1.uAttributes = 0;
-            v88 = pIndoor->GetSector(v83, v84, v85);
-            v89 = v86->uDistance;
-            a1.uSectorID = v88;
-            LODWORD(v119) = v89;
-            a1.uSpriteFrameID = 0;
-            a1.spell_caster_pid = PID(OBJECT_Actor, LODWORD(v120));
-            a1.spell_target_pid = 0;
-            if ((double)v89 < 307.2 )
-              a1.field_60_distance_related_prolly_lod = 0;
-            else if ( v89 < 1024 )
-              a1.field_60_distance_related_prolly_lod = 1;
-            else if ( v89 < 2560 )
-              a1.field_60_distance_related_prolly_lod = 2;
-            else 
-              a1.field_60_distance_related_prolly_lod = 3;
-
-            a1.field_61 = 2;
-            v91 = a1.Create(
-                    v86->uYawAngle,
-                    v86->uPitchAngle,
-                    pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
-                    0);
-            if ( v91 != -1 )
-            {
-              v92 = 8 * v91;
-              LOBYTE(v92) = v92 | 2;
-              v99 = v92;
-              v22 = (SoundID)word_4EE088_sound_ids[uSpellID];
-              v98 = v22;
-              pAudioPlayer->PlaySound(v98, v99, 0, -1, 0, 0, 0, 0);
-              return;
-            }
-            return;
           }
           if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
             return;