changeset 2329:4791895e4396

EventCastSpell extracting comming code from projectile spell events
author Grumpy7
date Tue, 01 Apr 2014 23:43:05 +0200
parents 04efed9483ff
children 5133eea7a4ca
files Spells.cpp
diffstat 1 files changed, 25 insertions(+), 111 deletions(-) [+]
line wrap: on
line diff
--- a/Spells.cpp	Tue Apr 01 23:32:14 2014 +0200
+++ b/Spells.cpp	Tue Apr 01 23:43:05 2014 +0200
@@ -363,28 +363,19 @@
   uint skillMasteryPlusOne; // ebx@9
   uint v16; // edx@15
   int i; // esi@42
-  uint v25; // edx@55
   int j; // esi@60
-  unsigned __int16 v31; // ax@70
   unsigned __int64 v36; // qax@99
   SpellBuff *v37; // ecx@99
   int v38; // esi@103
   signed __int64 v39; // qax@105
   int v42; // esi@111
   int v43; // ebx@111
-  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
-  unsigned __int8 v52; // [sp+4h] [bp-B0h]@99
   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 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
   int a7c; // [sp+CCh] [bp+18h]@29
   int a7d; // [sp+CCh] [bp+18h]@55
@@ -430,7 +421,6 @@
   SpriteObject a1; // [sp+38h] [bp-7Ch]@12
   //SpriteObject::SpriteObject(&a1);
 
-  a1.uType = stru_4E3ACC[uSpellID].uType;
   switch ( uSpellID )
   {
     case SPELL_FIRE_FIRE_BOLT:
@@ -441,11 +431,15 @@
     case SPELL_WATER_ICE_BLAST:
     case SPELL_EARTH_BLADES:
     case SPELL_EARTH_ROCK_BLAST:
+    case SPELL_WATER_POISON_SPRAY:
+    case SPELL_AIR_SPARKS:
+    case SPELL_EARTH_DEATH_BLOSSOM:
+      a1.uType = stru_4E3ACC[uSpellID].uType;
       a1.stru_24.Reset();
-      v16 = 0;
       a1.spell_id = uSpellID;
       a1.spell_level = uSkill;
       a1.spell_skill = skillMasteryPlusOne;
+      v16 = 0;
       while (v16 < pObjectList->uNumObjects)
       {
         if ( a1.uType == pObjectList->pObjects[v16].uObjectID)
@@ -455,14 +449,29 @@
         v16++;
       }
       a1.uObjectDescID = v16;
-      *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy);
       a1.vPosition.x = fromx;
+      a1.vPosition.y = fromy;
+      a1.vPosition.z = fromz;
       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.uSoundID = 0;
+      break;
+  }
+
+  switch ( uSpellID )
+  {
+    case SPELL_FIRE_FIRE_BOLT:
+    case SPELL_FIRE_FIREBALL:
+    case SPELL_AIR_LIGHNING_BOLT:
+    case SPELL_WATER_ICE_BOLT:
+    case SPELL_WATER_ACID_BURST:
+    case SPELL_WATER_ICE_BLAST:
+    case SPELL_EARTH_BLADES:
+    case SPELL_EARTH_ROCK_BLAST:
+      //v20 = yaw;
       a1.spell_target_pid = 0;
       a1.uFacing = yaw;
       a1.uSoundID = 0;
@@ -486,36 +495,11 @@
           v60 = 7;
           break;
       }
-      a1.stru_24.Reset();
-      a1.spell_id = uSpellID;
-      a1.spell_level = uSkill;
-      a1.spell_skill = skillMasteryPlusOne;
-      v16 = 0;
-      while (v16 < pObjectList->uNumObjects)
-      {
-        if ( a1.uType == pObjectList->pObjects[v16].uObjectID)
-        {
-          break;
-        }
-        v16++;
-      }
-      a1.uObjectDescID = v16;
-      *(_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;
       if ( v60 == 1 )
       {
         v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed;
-        //v47 = pitch;
         a1.Create(yaw, pitch, v49, 0);
       }
       else
@@ -548,29 +532,7 @@
       }
       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 = uSpellID;
-      a1.spell_level = uSkill;
-      a1.spell_skill = skillMasteryPlusOne;
-      while (v25 < pObjectList->uNumObjects)
-      {
-        if ( a1.uType == pObjectList->pObjects[v25].uObjectID)
-        {
-          break;
-        }
-        v25++;
-      }
-      a1.uObjectDescID = v25;
-      *(_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;
@@ -581,32 +543,8 @@
     case SPELL_EARTH_DEATH_BLOSSOM:
       if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
         return;
-      a1.stru_24.Reset();
-      v31 = 0;
-      a1.spell_id = uSpellID;
-      a1.spell_level = uSkill;
-      a1.spell_skill = skillMasteryPlusOne;
-      while (v31 < pObjectList->uNumObjects)
-      {
-        if ( a1.uType == pObjectList->pObjects[v31].uObjectID)
-        {
-          break;
-        }
-        v31++;
-      }
-      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(yaw, v47, v49, 0);
       pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);
@@ -622,18 +560,10 @@
         else if ( skillMasteryPlusOne == 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].IsWeak())
           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),
-        skillMasteryPlusOne, 0, 0, 0);
-      //v33 = spellnum_;
+      pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 * 128) * 0.033333335), skillMasteryPlusOne, 0, 0, 0);
       pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0);
       pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1);
       pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2);
@@ -675,12 +605,7 @@
       pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1);
       pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2);
       pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 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];
       pParty->pPartyBuffs[uSkill].Apply(v36, skillMasteryPlusOne, v60, 0, 0);
       pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);
       return;
@@ -693,14 +618,9 @@
       pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1);
       pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2);
       pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3);
-      v52 = 0;
-      v50 = 0;
-      v48 = uSkill;
-      v46 = skillMasteryPlusOne;
       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);
+      pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(v36, skillMasteryPlusOne, uSkill, 0, 0);
       pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);
       return;
     case SPELL_FIRE_PROTECTION_FROM_FIRE:
@@ -746,16 +666,11 @@
         uSkill = PARTY_BUFF_RESIST_BODY;
         break;
       }
-      //v45 = spellnum_;
       pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0);
       pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1);
       pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2);
       pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3);
       pParty->pPartyBuffs[uSkill].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)a6_4 * 4.2666669), skillMasteryPlusOne, v60, 0, 0);
-      //levela = 1;
-      //LABEL_138:
-      //if ( levela )
-      //LABEL_139:
       pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);
       return;
     case SPELL_LIGHT_DAY_OF_THE_GODS :
@@ -779,9 +694,8 @@
       pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2);
       pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3);
       v39 = (signed __int64)((double)(v42 << 7) * 0.033333335);
-      v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS];
       v36 = pParty->uTimePlayed + v39;
-      v37->Apply(v36, skillMasteryPlusOne, v43, 0, 0);
+      pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(v36, skillMasteryPlusOne, v43, 0, 0);
       pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);
       return;
     default: