diff Spells.cpp @ 1306:13b7be8b06a0

Слияние
author Ritor1
date Sun, 23 Jun 2013 14:27:57 +0600
parents dcc52e17b517 5450af4f57ef
children 22cb507446a4
line wrap: on
line diff
--- a/Spells.cpp	Sun Jun 23 14:27:32 2013 +0600
+++ b/Spells.cpp	Sun Jun 23 14:27:57 2013 +0600
@@ -11,8 +11,15 @@
 #include "texts.h"
 
 #include "mm7_data.h"
-
-
+#include "Party.h"
+#include "Math.h"
+#include "SpriteObject.h"
+#include "ObjectList.h"
+#include "Indoor.h"
+#include "AudioPlayer.h"
+#include "Actor.h"
+#include "Game.h"
+#include "stru6.h"
 
 
 std::array<TownPortalData, 6> TownPortalList = //4ECBB8
@@ -433,118 +440,779 @@
 		}
 
 	}
-//----- (0045828B) --------------------------------------------------------
-unsigned int __fastcall GetSpellColor(signed int a1)
+//----- (00448DF8) --------------------------------------------------------
+void __fastcall EventCastSpell(int spellnum, int uSkillLevel, int uSkill, int fromx, int fromy, int fromz, int tox, int toy, int toz)//sub_448DF8
 {
-  unsigned __int16 v1; // dx@3
-  unsigned __int16 v2; // cx@6
-  unsigned __int16 v4; // [sp-4h] [bp-4h]@3
+  int v9; // esi@1
+  double v10; // st7@4
+  double v11; // st6@4
+  double v12; // st5@4
+  double v13; // st7@6
+  int v14; // ST44_4@7
+  signed int v15; // ebx@9
+  signed int v16; // edx@15
+  char *v17; // ecx@16
+  unsigned __int16 v18; // ax@20
+  char *v19; // ecx@31
+  int v20; // edx@35
+  signed int v21; // edx@37
+  char *v22; // ecx@38
+  unsigned __int16 v23; // ax@41
+  int i; // esi@42
+  signed int v25; // edx@55
+  char *v26; // ecx@56
+  unsigned __int16 v27; // ax@59
+  int j; // esi@60
+  signed int v29; // edx@66
+  char *v30; // ecx@67
+  unsigned __int16 v31; // ax@70
+  //Player *v32; // eax@80
+  //unsigned __int16 v33; // si@85
+  int v34; // eax@96
+  int v35; // eax@97
+  unsigned __int64 v36; // qax@99
+  SpellBuff *v37; // ecx@99
+  int v38; // esi@103
+  signed __int64 v39; // qax@105
+  int v40; // ebx@108
+  int v41; // ebx@109
+  int v42; // esi@111
+  int v43; // ebx@111
+  int v44; // eax@117
+  //unsigned __int16 v45; // si@137
+  unsigned __int16 v46; // [sp-8h] [bp-BCh]@99
+  int v47; // [sp-4h] [bp-B8h]@35
+  unsigned __int16 v48; // [sp-4h] [bp-B8h]@99
+  int v49; // [sp+0h] [bp-B4h]@35
+  int v50; // [sp+0h] [bp-B4h]@99
+  int v51; // [sp+4h] [bp-B0h]@35
+  unsigned __int8 v52; // [sp+4h] [bp-B0h]@99
+  float v53; // [sp+14h] [bp-A0h]@4
+  float v54; // [sp+18h] [bp-9Ch]@4
+  int v55; // [sp+28h] [bp-8Ch]@7
+  unsigned int yaw; // [sp+30h] [bp-84h]@7
+  int pitch; // [sp+34h] [bp-80h]@7
+  //SpriteObject a1; // [sp+38h] [bp-7Ch]@12
+  int v59; // [sp+A8h] [bp-Ch]@1
+  int v60; // [sp+ACh] [bp-8h]@1
+  //int spellnum_; // [sp+B0h] [bp-4h]@1
+  //signed int levela; // [sp+BCh] [bp+8h]@80
+  int a6_4; // [sp+C8h] [bp+14h]@117
+  float a7a; // [sp+CCh] [bp+18h]@6
+  signed int a7b; // [sp+CCh] [bp+18h]@12
+  int a7c; // [sp+CCh] [bp+18h]@29
+  int a7d; // [sp+CCh] [bp+18h]@55
+  float a8a; // [sp+D0h] [bp+1Ch]@6
+  int a8b; // [sp+D0h] [bp+1Ch]@37
+  int a8c; // [sp+D0h] [bp+1Ch]@55
+  float toza; // [sp+D4h] [bp+20h]@6
 
-  if ( a1 < 1 )
+  v9 = 0;
+  v59 = uSkillLevel + 1;
+  //spellnum_ = spellnum;
+  v60 = 0;
+  if ( tox || toy || toz )
   {
-    if ( a1 < 12 )
-    {
-      if ( a1 < 23 )
-      {
-        if ( a1 < 34 )
-        {
-          if ( a1 < 45 )
-          {
-            if ( a1 < 56 )
-            {
-              if ( a1 < 67 )
-              {
-                if ( a1 < 78 )
-                {
-                  if ( a1 < 89 )
-                    goto LABEL_31;
-                  goto LABEL_28;
-                }
-LABEL_25:
-                if ( a1 < 89 )
-                {
-                  v4 = 155;
-                  v2 = 255;
-                  goto LABEL_30;
-                }
-LABEL_28:
-                if ( a1 < 100 )
-                {
-                  v4 = 240;
-                  v2 = 192;
-                  goto LABEL_30;
-                }
-LABEL_31:
-                v4 = 0;
-                v1 = 0;
-                goto LABEL_32;
-              }
-LABEL_21:
-              if ( a1 < 78 )
-              {
-                v4 = 0;
-                v1 = 128;
-                goto LABEL_23;
-              }
-              goto LABEL_25;
-            }
-LABEL_18:
-            if ( a1 < 67 )
-            {
-              v4 = 255;
-              v1 = 15;
-              v2 = 235;
-              return TargetColor(v2, v1, v4);
-            }
-            goto LABEL_21;
-          }
-LABEL_15:
-          if ( a1 < 56 )
-          {
-            v2 = 225;
-            goto LABEL_13;
-          }
-          goto LABEL_18;
-        }
-LABEL_11:
-        if ( a1 < 45 )
-        {
-          v2 = 128;
-LABEL_13:
-          v4 = v2;
-LABEL_30:
-          v1 = v2;
-          return TargetColor(v2, v1, v4);
-        }
-        goto LABEL_15;
-      }
-LABEL_8:
-      if ( a1 < 34 )
-      {
-        v4 = 255;
-        v1 = 128;
-LABEL_32:
-        v2 = 0;
-        return TargetColor(v2, v1, v4);
-      }
-      goto LABEL_11;
-    }
+    v10 = (double)tox - (double)fromx;
+    v53 = v10;
+    v11 = (double)toy - (double)fromy;
+    v54 = v11;
+    v12 = (double)toz;
+  }
+  else
+  {
+    v10 = (double)pParty->vPosition.x - (double)fromx;
+    v53 = v10;
+    v11 = (double)pParty->vPosition.y - (double)fromy;
+    v54 = v11;
+    v12 = (double)(pParty->vPosition.z + pParty->sEyelevel);
+  }
+  a7a = v12 - (double)fromz;
+  toza = v11 * v11;
+  a8a = v10 * v10;
+  v13 = sqrt(a7a * a7a + a8a + toza);
+  if ( v13 <= 1.0 )
+  {
+    LOBYTE(v55) = 1;
+    yaw = 0;
+    pitch = 0;
   }
   else
   {
-    if ( a1 < 12 )
+    v55 = (signed __int64)v13;
+    v14 = (signed __int64)sqrt(a8a + toza);
+    yaw = stru_5C6E00->Atan2((signed __int64)v53, (signed __int64)v54);
+    pitch = stru_5C6E00->Atan2(v14, (signed __int64)a7a);
+  }
+  v15 = v59;
+  if ( v59 <= 0 || v59 > 4 )
+    v15 = 1;
+  a7b = v15;
+
+  SpriteObject a1; // [sp+38h] [bp-7Ch]@12
+  //SpriteObject::SpriteObject(&a1);
+
+  a1.uType = stru_4E3ACC[spellnum].uType;
+  if ( spellnum > 58 )
+  {
+    if ( spellnum == 69 )
+      goto LABEL_117;
+    if ( spellnum != 83 )
+      return;
+    v40 = v15 - 2;
+    if ( v40 )
     {
-      v4 = 0;
-      v1 = 85;
-LABEL_23:
-      v2 = 255;
-      return TargetColor(v2, v1, v4);
+      v41 = v40 - 1;
+      if ( !v41 )
+      {
+        v42 = 14400 * uSkill;
+        v43 = 4 * uSkill + 10;
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 0);
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 1u);
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u);
+        pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 3u);
+        v39 = (signed __int64)((double)(v42 << 7) * 0.033333335);
+        v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS];
+        v36 = pParty->uTimePlayed + v39;
+        v37->Apply(v36, a7b, v43, 0, 0);
+        goto LABEL_139;
+      }
+      if ( v41 == 1 )
+      {
+        v42 = 18000 * uSkill;
+        v43 = 5 * uSkill + 10;
+       pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 0);
+       pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 1u);
+       pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u);
+       pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 3u);
+       v39 = (signed __int64)((double)(v42 << 7) * 0.033333335);
+       v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS];
+       v36 = pParty->uTimePlayed + v39;
+       v37->Apply(v36, a7b, v43, 0, 0);
+       goto LABEL_139;
+      }
     }
+    v42 = 10800 * uSkill;
+    v43 = 3 * uSkill + 10;
+    pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 0);
+    pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 1u);
+    pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u);
+    pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 3u);
+    v39 = (signed __int64)((double)(v42 << 7) * 0.033333335);
+    v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS];
+    v36 = pParty->uTimePlayed + v39;
+    v37->Apply(v36, a7b, v43, 0, 0);
+    goto LABEL_139;
   }
-  if ( a1 >= 23 )
-    goto LABEL_8;
-  v4 = 255;
-  v1 = 212;
-  v2 = 150;
-  return TargetColor(v2, v1, v4);
+  if ( spellnum != 58 )
+  {
+    switch ( spellnum )
+    {
+      case 2:
+      case 6:
+      case 18:
+      case 26:
+      case 29:
+      case 32:
+      case 39:
+      case 41:
+        a1.stru_24.Reset();
+        v16 = 0;
+        a1.spell_id = spellnum;
+        a1.spell_level = uSkill;
+        a1.spell_skill = v15;
+        if ( (signed int)pObjectList->uNumObjects <= 0 )
+        {
+          v18 = 0;
+          a1.uObjectDescID = v18;
+          *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy);
+          a1.vPosition.x = fromx;
+          a1.uAttributes = 16;
+          a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz);
+          a1.field_60_distance_related_prolly_lod = v55;
+          v20 = yaw;
+          a1.uSpriteFrameID = 0;
+          a1.spell_caster_pid = 8000 | OBJECT_Item;
+          a1.spell_target_pid = 0;
+          a1.uFacing = yaw;
+          a1.uSoundID = 0;
+          v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed;
+          a1.Create(v20, pitch, v49, 0);
+          goto LABEL_139;
+        }
+        v17 = (char *)&pObjectList->pObjects->uObjectID;
+        while ( (short)a1.uType != *(short *)v17 )
+        {
+          ++v16;
+          v17 += 56;
+          if ( v16 >= (signed int)pObjectList->uNumObjects )
+          {
+            v18 = 0;
+            a1.uObjectDescID = v18;
+            *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy);
+            a1.vPosition.x = fromx;
+            a1.uAttributes = 16;
+            a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz);
+            a1.field_60_distance_related_prolly_lod = v55;
+            v20 = yaw;
+            a1.uSpriteFrameID = 0;
+            a1.spell_caster_pid = 8000 | OBJECT_Item;
+            a1.spell_target_pid = 0;
+            a1.uFacing = yaw;
+            a1.uSoundID = 0;
+            v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed;
+            a1.Create(v20, pitch, v49, 0);
+            goto LABEL_139;
+          }
+        }
+        v18 = v16;
+        a1.uObjectDescID = v18;
+        *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy);
+        a1.vPosition.x = fromx;
+        a1.uAttributes = 16;
+        a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz);
+        a1.field_60_distance_related_prolly_lod = v55;
+        v20 = yaw;
+        a1.uSpriteFrameID = 0;
+        a1.spell_caster_pid = 8000 | OBJECT_Item;
+        a1.spell_target_pid = 0;
+        a1.uFacing = yaw;
+        a1.uSoundID = 0;
+        v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed;
+        a1.Create(v20, pitch, v49, 0);
+        goto LABEL_139;
+      case 24:
+        switch ( v15 )
+        {
+          case 1:
+            v60 = 1;
+            break;
+          case 2:
+            v60 = 3;
+            break;
+          case 3:
+            v60 = 5;
+            break;
+          case 4:
+            v60 = 7;
+            break;
+        }
+        a7c = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
+        if ( v60 != 1 )
+        {
+          a8b = a7c / (v60 - 1);
+          a1.stru_24.Reset();
+          v21 = 0;
+          a1.spell_id = spellnum;
+          a1.spell_level = uSkill;
+          a1.spell_skill = v15;
+          if ( (signed int)pObjectList->uNumObjects <= 0 )
+          {
+            v23 = 0;
+          }
+          else
+          {
+            v22 = (char *)&pObjectList->pObjects->uObjectID;
+            while ( (short)a1.uType != *(short *)v22 )
+            {
+              ++v21;
+              v22 += 56;
+              if ( v21 >= (signed int)pObjectList->uNumObjects )
+              {
+                v23 = 0;
+                a1.uObjectDescID = v23;
+                *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy);
+                a1.vPosition.x = fromx;
+                a1.uAttributes = 16;
+                a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz);
+                a1.field_60_distance_related_prolly_lod = v55;
+                a1.uSpriteFrameID = 0;
+                a1.spell_caster_pid = 8000 | OBJECT_Item;
+                a1.spell_target_pid = 4;
+                a1.uSoundID = 0;
+                for ( i = a7c / -2; i <= a7c / 2; i += a8b )
+                {
+                  a1.uFacing = i + yaw;
+                  a1.Create((signed __int16)(i + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0);
+                }
+                goto LABEL_139;
+              }
+            }
+            v23 = v21;
+          }
+          a1.uObjectDescID = v23;
+          *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy);
+          a1.vPosition.x = fromx;
+          a1.uAttributes = 16;
+          a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz);
+          a1.field_60_distance_related_prolly_lod = v55;
+          a1.uSpriteFrameID = 0;
+          a1.spell_caster_pid = 8000 | OBJECT_Item;
+          a1.spell_target_pid = 4;
+          a1.uSoundID = 0;
+          for ( i = a7c / -2; i <= a7c / 2; i += a8b )
+          {
+            a1.uFacing = i + yaw;
+            a1.Create((signed __int16)(i + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0);
+          }
+          goto LABEL_139;
+        }
+        a1.stru_24.Reset();
+        v16 = 0;
+        a1.spell_id = spellnum;
+        a1.spell_level = uSkill;
+        a1.spell_skill = v15;
+        if ( (signed int)pObjectList->uNumObjects <= 0 )
+       {
+         v18 = 0;
+         a1.uObjectDescID = v18;
+         *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy);
+         a1.vPosition.x = fromx;
+         a1.uAttributes = 16;
+         a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz);
+         a1.field_60_distance_related_prolly_lod = v55;
+         v20 = yaw;
+         a1.uSpriteFrameID = 0;
+         a1.spell_caster_pid = 8000 | OBJECT_Item;
+         a1.spell_target_pid = 0;
+         a1.uFacing = yaw;
+         a1.uSoundID = 0;
+         v51 = 0;
+         v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed;
+         v47 = pitch;
+         a1.Create(v20, v47, v49, v51);
+         goto LABEL_139;
+       }
+        v19 = (char *)&pObjectList->pObjects->uObjectID;
+        do
+        {
+          if ( (short)a1.uType == *(short *)v19 )
+          {
+            v18 = v16;
+            a1.uObjectDescID = v18;
+            *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy);
+            a1.vPosition.x = fromx;
+            a1.uAttributes = 16;
+            a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz);
+            a1.field_60_distance_related_prolly_lod = v55;
+            v20 = yaw;
+            a1.uSpriteFrameID = 0;
+            a1.spell_caster_pid = 8000 | OBJECT_Item;
+            a1.spell_target_pid = 0;
+            a1.uFacing = yaw;
+            a1.uSoundID = 0;
+            v51 = 0;
+            v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed;
+            v47 = pitch;
+            a1.Create(v20, v47, v49, v51);
+            goto LABEL_139;
+          }
+          ++v16;
+          v19 += 56;
+        }
+        while ( v16 < (signed int)pObjectList->uNumObjects );
+        v18 = 0;
+        a1.uObjectDescID = v18;
+        *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy);
+        a1.vPosition.x = fromx;
+        a1.uAttributes = 16;
+        a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz);
+        a1.field_60_distance_related_prolly_lod = v55;
+        v20 = yaw;
+        a1.uSpriteFrameID = 0;
+        a1.spell_caster_pid = 8000 | OBJECT_Item;
+        a1.spell_target_pid = 0;
+        a1.uFacing = yaw;
+        a1.uSoundID = 0;
+        v51 = 0;
+        v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed;
+        v47 = pitch;
+        a1.Create(v20, v47, v49, v51);
+        goto LABEL_139;
+      case 15:
+        switch ( v15 )
+        {
+          case 1:
+            v60 = 3;
+            break;
+          case 2:
+            v60 = 5;
+            break;
+          case 3:
+            v60 = 7;
+            break;
+          case 4:
+            v60 = 9;
+            break;
+        }
+        a7d = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
+        a8c = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v60 - 1);
+        a1.stru_24.Reset();
+        v25 = 0;
+        a1.spell_id = spellnum;
+        a1.spell_level = uSkill;
+        a1.spell_skill = v15;
+        if ( (signed int)pObjectList->uNumObjects <= 0 )
+        {
+          v27 = 0;
+          a1.uObjectDescID = v27;
+          *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy);
+          a1.vPosition.x = fromx;
+          a1.uAttributes = 16;
+          a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz);
+          a1.field_60_distance_related_prolly_lod = v55;
+          a1.uSpriteFrameID = 0;
+          a1.spell_caster_pid = 8000 | OBJECT_Item;
+          a1.spell_target_pid = 4;
+          a1.uSoundID = 0;
+          for ( j = a7d / -2; j <= a7d / 2; j += a8c )
+          {
+            a1.uFacing = j + yaw;
+            a1.Create((signed __int16)(j + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0);
+          }
+          goto LABEL_139;
+        }
+        v26 = (char *)&pObjectList->pObjects->uObjectID;
+        while ( (short)a1.uType != *(short *)v26 )
+        {
+          ++v25;
+          v26 += 56;
+          if ( v25 >= (signed int)pObjectList->uNumObjects )
+          {
+            v27 = 0;
+            a1.uObjectDescID = v27;
+            *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy);
+            a1.vPosition.x = fromx;
+            a1.uAttributes = 16;
+            a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz);
+            a1.field_60_distance_related_prolly_lod = v55;
+            a1.uSpriteFrameID = 0;
+            a1.spell_caster_pid = 8000 | OBJECT_Item;
+            a1.spell_target_pid = 4;
+            a1.uSoundID = 0;
+            for ( j = a7d / -2; j <= a7d / 2; j += a8c )
+            {
+              a1.uFacing = j + yaw;
+              a1.Create((signed __int16)(j + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0);
+            }
+            goto LABEL_139;
+          }
+        }
+        v27 = v25;
+        a1.uObjectDescID = v27;
+        *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy);
+        a1.vPosition.x = fromx;
+        a1.uAttributes = 16;
+        a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz);
+        a1.field_60_distance_related_prolly_lod = v55;
+        a1.uSpriteFrameID = 0;
+        a1.spell_caster_pid = 8000 | OBJECT_Item;
+        a1.spell_target_pid = 4;
+        a1.uSoundID = 0;
+        for ( j = a7d / -2; j <= a7d / 2; j += a8c )
+        {
+          a1.uFacing = j + yaw;
+          a1.Create(
+            (signed __int16)(j + (short)yaw),
+            pitch,
+            pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
+            0);
+        }
+        goto LABEL_139;
+      case 43:
+        if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
+          return;
+        a1.stru_24.Reset();
+        v29 = 0;
+        a1.spell_id = spellnum;
+        a1.spell_level = uSkill;
+        a1.spell_skill = v15;
+        if ( (signed int)pObjectList->uNumObjects <= 0 )
+        {
+          v31 = 0;
+          a1.uObjectDescID = v31;
+          *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy);
+          a1.vPosition.x = fromx;
+          a1.uAttributes = 16;
+          a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz);
+          a1.field_60_distance_related_prolly_lod = v55;
+          a1.uSpriteFrameID = 0;
+          a1.spell_caster_pid = 8000 | OBJECT_Item;
+          a1.spell_target_pid = 4;
+          a1.uSoundID = 0;
+          v51 = 0;
+          v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed;
+          v20 = yaw;
+          v47 = (signed int)stru_5C6E00->uIntegerHalfPi / 2;
+          a1.Create(v20, v47, v49, v51);
+          goto LABEL_139;
+        }
+        v30 = (char *)&pObjectList->pObjects->uObjectID;
+        break;
+
+      case SPELL_FIRE_HASTE:
+        if ( v15 > 0 )
+        {
+          if ( v15 <= 2 )
+          {
+            v9 = 60 * (uSkill + 60);
+          }
+          else
+          {
+            if ( v15 == 3 )
+            {
+              v9 = 180 * (uSkill + 20);
+            }
+            else
+            {
+              if ( v15 == 4 )
+                v9 = 240 * (uSkill + 15);
+            }
+          }
+        }
+        //levela = 1;
+        //v32 = pParty->pPlayers;//[0].pConditions[1];
+        //do
+        for (uint i = 0; i < 4; ++i)
+          if (pParty->pPlayers[i].pConditions[Player::Condition_Weak])
+            return;
+		//while ( v32 <= &pParty->pPlayers[3] );
+        //if ( !levela )
+        //  return;
+        pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 * 128) * 0.033333335),
+          v15,
+          0,
+          0,
+          0);
+        //v33 = spellnum_;
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3);
+        goto LABEL_138;
+      case 17:
+      case 38:
+      case 51:
+        switch ( v15 )
+        {
+          case 1:
+          case 2:
+            v9 = 300 * (uSkill + 12);
+            break;
+          case 3:
+            v9 = 900 * (uSkill + 4);
+            break;
+          case 4:
+            v9 = 3600 * (uSkill + 1);
+            break;
+        }
+        switch ( spellnum )
+        {
+          case 17:
+            v60 = 0;
+            uSkill = 14;
+            break;
+          case 38:
+            v35 = uSkill + 5;
+            uSkill = 15;
+            v60 = v35;
+            break;
+          case 51:
+            v34 = uSkill + 5;
+            uSkill = 9;
+            v60 = v34;
+            break;
+        }
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3);
+        v52 = 0;
+        v50 = 0;
+        v48 = v60;
+        v46 = v15;
+        v36 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 << 7) * 0.033333335);
+        v37 = &pParty->pPartyBuffs[uSkill];
+        v37->Apply(v36, v46, v48, v50, v52);
+        goto LABEL_139;;
+      case 8:
+        if ( v15 == 2 || v15 == 3 || v15 != 4 )
+          v38 = 60 * uSkill;
+        else
+          v38 = 600 * uSkill;
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3);
+        v52 = 0;
+        v50 = 0;
+        v48 = uSkill;
+        v46 = v15;
+        v39 = (signed __int64)((double)(v38 << 7) * 0.033333335);
+        v37 = &pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION];
+        v36 = pParty->uTimePlayed + v39;
+        v37->Apply(v36, v46, v48, v50, v52);
+        goto LABEL_139;
+      case 3:
+      case 14:
+      case 25:
+      case 36:
+        goto LABEL_117;
+      default:
+        return;
+    }
+    while ( (short)a1.uType != *(short *)v30 )
+    {
+      ++v29;
+      v30 += 56;
+      if ( v29 >= (signed int)pObjectList->uNumObjects )
+      {
+        v31 = 0;
+        a1.uObjectDescID = v31;
+        *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy);
+        a1.vPosition.x = fromx;
+        a1.uAttributes = 16;
+        a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz);
+        a1.field_60_distance_related_prolly_lod = v55;
+        a1.uSpriteFrameID = 0;
+        a1.spell_caster_pid = 8000 | OBJECT_Item;
+        a1.spell_target_pid = 4;
+        a1.uSoundID = 0;
+        v51 = 0;
+        v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed;
+        v20 = yaw;
+        v47 = (signed int)stru_5C6E00->uIntegerHalfPi / 2;
+        a1.Create(v20, v47, v49, v51);
+        goto LABEL_139;
+      }
+    }
+    v31 = v29;
+    a1.uObjectDescID = v31;
+    *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy);
+    a1.vPosition.x = fromx;
+    a1.uAttributes = 16;
+    a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz);
+    a1.field_60_distance_related_prolly_lod = v55;
+    a1.uSpriteFrameID = 0;
+    a1.spell_caster_pid = 8000 | OBJECT_Item;
+    a1.spell_target_pid = 4;
+    a1.uSoundID = 0;
+    v51 = 0;
+    v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed;
+    v20 = yaw;
+    v47 = (signed int)stru_5C6E00->uIntegerHalfPi / 2;
+    a1.Create(v20, v47, v49, v51);
+    goto LABEL_139;
+  }
+LABEL_117:
+  v44 = uSkill;
+  a6_4 = 3600 * uSkill;
+  if ( v15 == 1 )
+  {
+    v60 = v44;
+    goto LABEL_125;
+  }
+  if ( v15 == 2 )
+  {
+    v44 = 2 * uSkill;
+    v60 = v44;
+    goto LABEL_125;
+  }
+  if ( v15 == 3 )
+  {
+    v44 = 3 * uSkill;
+    v60 = v44;
+    goto LABEL_125;
+  }
+  if ( v15 == 4 )
+  {
+    v44 = 4 * uSkill;
+    v60 = v44;
+    goto LABEL_125;
+  }
+LABEL_125:
+  switch ( spellnum )
+  {
+    case 3:
+      uSkill = 6;
+      break;
+    case 14:
+      uSkill = 0;
+      break;
+    case 25:
+      uSkill = 17;
+      break;
+    case 36:
+      uSkill = 4;
+      break;
+    case 58:
+      uSkill = 12;
+      break;
+    case 69:
+      uSkill = 1;
+      break;
+  }
+  //v45 = spellnum_;
+  pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0);
+  pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1);
+  pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2);
+  pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3);
+  pParty->pPartyBuffs[uSkill].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)a6_4 * 4.2666669), v15, v60, 0, 0);
+  //levela = 1;
+LABEL_138:
+  //if ( levela )
+LABEL_139:
+    pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[spellnum], 0, 0, fromx, fromy, 0, 0, 0);
+}
+//----- (00427769) --------------------------------------------------------
+bool __fastcall sub_427769_spell(unsigned int uSpellID)
+{
+  bool result; // eax@2
+
+  __debugbreak(); // refactor
+  if ( *(&pSpellDatas[0].field_12 + 20 * uSpellID) & 0xC )
+    result = 1;
+  else
+    result = 0;
+  return result;
+}
+//----- (0043AFE3) --------------------------------------------------------
+int __fastcall _43AFE3_calc_spell_damage(int a1, int a2, signed int a3, int a4)
+{
+  int result; // eax@1
+  unsigned int v5; // [sp-4h] [bp-8h]@9
+
+  result = 0;
+  if ( a1 == 7 )
+  {
+    if ( a3 <= 0 )
+      return result;
+    if ( a3 <= 2 )
+    {
+      v5 = 6;
+    }
+    else
+    {
+      if ( a3 == 3 )
+      {
+        v5 = 8;
+      }
+      else
+      {
+        if ( a3 != 4 )
+          return result;
+        v5 = 10;
+      }
+    }
+    result = GetDiceResult(a2, v5);
+  }
+  else
+  {
+    if ( a1 == 44 )
+      result = a4 * (LOBYTE(pSpellDatas[40].field_10) + 2 * a2) / 100;
+    else
+      result = *((char *)&pSpellDatas[0].field_10 + 20 * a1)
+             + GetDiceResult(a2, *((char *)&pSpellDatas[0].field_10 + 20 * a1 + 1));
+  }
+  return result;
 }
\ No newline at end of file