diff stru6.cpp @ 486:7887a9cf9e7b

Spells
author Nomad
date Wed, 27 Feb 2013 17:29:05 +0200
parents 58b71c1af7d8
children a3939d5067c4
line wrap: on
line diff
--- a/stru6.cpp	Wed Feb 27 02:26:16 2013 +0400
+++ b/stru6.cpp	Wed Feb 27 17:29:05 2013 +0200
@@ -86,13 +86,13 @@
 //----- (004A71FE) --------------------------------------------------------
 void stru6::DoAddProjectile(float srcX, float srcY, float srcZ, float dstX, float dstY, float dstZ, unsigned int uTextureID)
 {
-  int v8; // eax@1
+  //int v8; // eax@1
 
-  v8 = uNumProjectiles;
-  if ( v8 != 32 )
+  //v8 = uNumProjectiles;
+  if (uNumProjectiles < 32)
   {
-    pProjectiles[v8].srcX = srcX;
-    *((float *)&this->array_0[0].uSpellAnimLength + 7 * (uNumProjectiles + 21)) = srcY;
+    pProjectiles[uNumProjectiles].srcX = srcX;
+    pProjectiles[uNumProjectiles].srcY = srcY;
     pProjectiles[uNumProjectiles].srcZ = srcZ;
     pProjectiles[uNumProjectiles].dstX = dstX;
     pProjectiles[uNumProjectiles].dstY = dstY;
@@ -164,10 +164,10 @@
   v6 = a2->field_54;
   if ( v6 )
   {
-    v7 = &v4->array_0[v6 & 0x1F];
-    x = ((double)a2->vPosition.x - v7->flt_4) * 0.5 + v7->flt_4;
-    v8 = ((double)v5->vPosition.y - v7->flt_8) * 0.5 + v7->flt_8;
-    v9 = ((double)v5->vPosition.z - v7->flt_C) * 0.5 + v7->flt_C;
+    v7 = &v4->array_4[v6 & 0x1F];
+    x = ((double)a2->vPosition.x - v7->flt_0_x) * 0.5 + v7->flt_0_x;
+    v8 = ((double)v5->vPosition.y - v7->flt_4_y) * 0.5 + v7->flt_4_y;
+    v9 = ((double)v5->vPosition.z - v7->flt_8_z) * 0.5 + v7->flt_8_z;
     local_0.bFree = 1036;
     local_0.uDiffuse = uDiffuse;
     local_0.x = x + 4.0;
@@ -188,16 +188,16 @@
     pGame->pParticleEngine->AddParticle(&local_0);
     local_0.x = (double)v5->vPosition.x - 4.0;
     pGame->pParticleEngine->AddParticle(&local_0);
-    v4->array_0[v5->field_54 & 0x1F].flt_4 = (double)v5->vPosition.x;
-    v4->array_0[v5->field_54 & 0x1F].flt_8 = (double)v5->vPosition.y;
-    v4->array_0[v5->field_54 & 0x1F].flt_C = (double)v5->vPosition.z;
+    v4->array_4[v5->field_54 & 0x1F].flt_0_x = (double)v5->vPosition.x;
+    v4->array_4[v5->field_54 & 0x1F].flt_4_y = (double)v5->vPosition.y;
+    v4->array_4[v5->field_54 & 0x1F].flt_8_z = (double)v5->vPosition.z;
   }
   else
   {
-    a2->field_54 = v4->array_0[0].uSpellAnimLength++;
-    v4->array_0[a2->field_54 & 0x1F].flt_4 = (double)a2->vPosition.x;
-    v4->array_0[a2->field_54 & 0x1F].flt_8 = (double)a2->vPosition.y;
-    v4->array_0[a2->field_54 & 0x1F].flt_C = (double)a2->vPosition.z;
+    a2->field_54 = v4->field_0++;
+    v4->array_4[a2->field_54 & 0x1F].flt_0_x = (double)a2->vPosition.x;
+    v4->array_4[a2->field_54 & 0x1F].flt_4_y = (double)a2->vPosition.y;
+    v4->array_4[a2->field_54 & 0x1F].flt_8_z = (double)a2->vPosition.z;
     v10 = (double)a2->vPosition.x;
     local_0.bFree = 1036;
     local_0.uDiffuse = uDiffuse;
@@ -511,10 +511,10 @@
   v5 = &pObjectList->pObjects[a2->uObjectDescID];
   if ( v4 )
   {
-    v6 = &v2->array_0[v4 & 0x1F];
-    v7 = ((double)a2->vPosition.x - v6->flt_4) * 0.5 + v6->flt_4;
-    v8 = ((double)a2->vPosition.y - v6->flt_8) * 0.5 + v6->flt_8;
-    v9 = ((double)a2->vPosition.z - v6->flt_C) * 0.5 + v6->flt_C;
+    v6 = &v2->array_4[v4 & 0x1F];
+    v7 = ((double)a2->vPosition.x - v6->flt_0_x) * 0.5 + v6->flt_0_x;
+    v8 = ((double)a2->vPosition.y - v6->flt_4_y) * 0.5 + v6->flt_4_y;
+    v9 = ((double)a2->vPosition.z - v6->flt_8_z) * 0.5 + v6->flt_8_z;
     local_0.bFree = 2048;
     local_0.uDiffuse = 0xFFFFFFu;
     a2a = v9;
@@ -536,16 +536,16 @@
     local_0.z = (double)v3->vPosition.z;
     local_0.timeToLive = (rand() & 0x3F) + 64;
     pGame->pParticleEngine->AddParticle(&local_0);
-    v2->array_0[v3->field_54 & 0x1F].flt_4 = (double)v3->vPosition.x;
-    v2->array_0[v3->field_54 & 0x1F].flt_8 = (double)v3->vPosition.y;
-    v2->array_0[v3->field_54 & 0x1F].flt_C = (double)v3->vPosition.z;
+    v2->array_4[v3->field_54 & 0x1F].flt_0_x = (double)v3->vPosition.x;
+    v2->array_4[v3->field_54 & 0x1F].flt_4_y = (double)v3->vPosition.y;
+    v2->array_4[v3->field_54 & 0x1F].flt_8_z = (double)v3->vPosition.z;
   }
   else
   {
-    a2->field_54 = v2->array_0[0].uSpellAnimLength++;
-    v2->array_0[a2->field_54 & 0x1F].flt_4 = (double)a2->vPosition.x;
-    v2->array_0[a2->field_54 & 0x1F].flt_8 = (double)a2->vPosition.y;
-    v2->array_0[a2->field_54 & 0x1F].flt_C = (double)a2->vPosition.z;
+    a2->field_54 = v2->field_0++;
+    v2->array_4[a2->field_54 & 0x1F].flt_0_x = (double)a2->vPosition.x;
+    v2->array_4[a2->field_54 & 0x1F].flt_4_y = (double)a2->vPosition.y;
+    v2->array_4[a2->field_54 & 0x1F].flt_8_z = (double)a2->vPosition.z;
     v12 = (double)a2->vPosition.x;
     local_0.bFree = 2048;
     local_0.uDiffuse = 0xFFFFFFu;
@@ -577,9 +577,9 @@
     v6 = (double)a2->vPosition.y;
     v7 = (double)a2->vPosition.x;
     DoAddProjectile(
-      this->array_0[v4 & 0x1F].flt_4,
-      this->array_0[v4 & 0x1F].flt_8,
-      this->array_0[v4 & 0x1F].flt_C,
+      this->array_4[v4 & 0x1F].flt_0_x,
+      this->array_4[v4 & 0x1F].flt_4_y,
+      this->array_4[v4 & 0x1F].flt_8_z,
       v7,
       v6,
       v5,
@@ -587,10 +587,10 @@
   }
   else
   {
-    a2->field_54 = this->array_0[0].uSpellAnimLength++;
-    this->array_0[a2->field_54 & 0x1F].flt_4 = (double)a2->vPosition.x;
-    this->array_0[a2->field_54 & 0x1F].flt_8 = (double)a2->vPosition.y;
-    this->array_0[a2->field_54 & 0x1F].flt_C = (double)a2->vPosition.z;
+    a2->field_54 = this->field_0++;
+    this->array_4[a2->field_54 & 0x1F].flt_0_x = (double)a2->vPosition.x;
+    this->array_4[a2->field_54 & 0x1F].flt_4_y = (double)a2->vPosition.y;
+    this->array_4[a2->field_54 & 0x1F].flt_8_z = (double)a2->vPosition.z;
   }
 }
 
@@ -1319,119 +1319,106 @@
 }
 
 //----- (004A89BD) --------------------------------------------------------
-int stru6::SetPlayerBuffAnim(unsigned __int16 uSpellID, unsigned __int16 uPlayerID)
+void stru6::SetPlayerBuffAnim(unsigned __int16 uSpellID, unsigned __int16 uPlayerID)
 {
-  stru6 *v3; // edi@1
+  //stru6 *v3; // edi@1
   PlayerBuffAnim *v4; // esi@1
-  int result; // eax@1
   const char *v6; // [sp-4h] [bp-10h]@2
 
-  v3 = this;
-  v4 = (PlayerBuffAnim *)((char *)this + 16 * (signed __int16)uPlayerID);
-  v4[32].uSpellIconID_ = 0;
-  v4[32].uSpellID = uSpellID;
-  result = (signed __int16)uSpellID - 3;
-  switch ( uSpellID )
+  //v3 = this;
+  //v4 = &array_0[uPlayerID];
+  //v4[32].uSpellIconID_ = 0;    pPlayerBuffs[]::field_4
+  //v4[32].uSpellID = uSpellID;  pPlayerBuffs[]::bRender
+
+  v4 = &pPlayerBuffs[uPlayerID];
+  v4->field_4 = 0;
+  v4->bRender = uSpellID != 0;
+
+  switch (uSpellID)
   {
-    case (SPELL_WATER_PROTECTION_FROM_WATER|0x80):
+    case 153:
+      __debugbreak(); // spell id == 153 wtf
       v6 = "zapp";
-      goto LABEL_24;
+    break;
+      
+    case 150:
+      __debugbreak(); // spell id == 150 wtf
     case SPELL_AIR_FEATHER_FALL:
     case SPELL_SPIRIT_DETECT_LIFE:
-    case SPELL_SPIRIT_DOOM:
-    case 0x96u:
+    case SPELL_SPIRIT_FATE:
       v6 = "spboost1";
-      goto LABEL_24;
-    case SPELL_AIR_SHIELD|0x2:
+    break;
+      
+    case 151:
+      __debugbreak(); // spell id == 151 wtf
+    case SPELL_AIR_INVISIBILITY:
     case SPELL_WATER_WATER_WALK:
-    case SPELL_SPIRIT_PRESERVE:
-    case 0x97u:
+    case SPELL_SPIRIT_PRESERVATION:
       v6 = "spboost2";
-      goto LABEL_24;
-    case SPELL_BODY_CURE_WEAKNESS|0x10:
-    case SPELL_BODY_FIRST_AID|SPELL_AIR_SHIELD:
-    case 0x56u:
-    case SPELL_BODY_CURE_POISON|0x10:
-    case 0x98u:
+    break;
+      
+    case 152:
+      __debugbreak(); // spell id == 152 wtf
+    case SPELL_LIGHT_HOUR_OF_POWER:
+    case SPELL_LIGHT_DAY_OF_THE_GODS:
+    case SPELL_LIGHT_DAY_OF_PROTECTION:
+    case SPELL_LIGHT_DIVINE_INTERVENTION:
       v6 = "spboost3";
-      goto LABEL_24;
-    case (SPELL_AIR_SHIELD|0x20):
+    break;
+
+    case SPELL_SPIRIT_REMOVE_CURSE:
     case SPELL_MIND_REMOVE_FEAR:
     case SPELL_BODY_CURE_WEAKNESS:
       v6 = "spheal1";
-      goto LABEL_24;
-    case SPELL_SPIRIT_PRESERVE|0x4:
+    break;
+
+    case SPELL_SPIRIT_SHARED_LIFE:
     case SPELL_MIND_CURE_PARALYSIS:
-    case 0x40u:
+    case SPELL_MIND_CURE_INSANITY:
     case SPELL_BODY_FIRST_AID:
     case SPELL_BODY_CURE_POISON:
     case SPELL_BODY_CURE_DISEASE:
-    case 0x60u:
+    case SPELL_DARK_SACRIFICE:
       v6 = "spheal2";
-      goto LABEL_24;
-    case SPELL_BODY_HAMMERHANDS|0x4:
-    case SPELL_BODY_CURE_WEAKNESS|0x20:
+    break;
+
+    case SPELL_BODY_POWER_CURE:
+    case SPELL_DARK_SOULDRINKER:
       v6 = "spheal3";
-      goto LABEL_24;
+    break;
+
     case SPELL_FIRE_PROTECTION_FROM_FIRE:
-    case SPELL_FIRE_FIRE_RING:
+    case SPELL_FIRE_IMMOLATION:
       v6 = "spell03";
-      goto LABEL_24;
-    case SPELL_FIRE_HASTE:
-      v6 = "spell05";
-      goto LABEL_24;
-    case SPELL_AIR_PROTECTION_FROM_AIR:
-      v6 = "spell14";
-      goto LABEL_24;
-    case SPELL_AIR_SHIELD:
-      v6 = "spell17";
-      goto LABEL_24;
-    case SPELL_WATER_PROTECTION_FROM_WATER:
-      v6 = "spell25";
-      goto LABEL_24;
-    case SPELL_EARTH_PROTECTION_FROM_EARTH:
-      v6 = "spell36";
-      goto LABEL_24;
-    case SPELL_EARTH_STONESKIN:
-      v6 = "spell38";
-      goto LABEL_24;
-    case SPELL_SPIRIT_BLESS:
-      v6 = "spell46";
-      goto LABEL_24;
-    case SPELL_SPIRIT_HEROISM:
-      v6 = "spell51";
-      goto LABEL_24;
-    case SPELL_SPIRIT_HEROISM|0x4:
-      v6 = "spell55";
-      goto LABEL_24;
-    case SPELL_MIND_PROTECTION_FROM_MIND:
-      v6 = "spell58";
-      goto LABEL_24;
-    case SPELL_BODY_FIRST_AID|0x1:
-      v6 = "spell69";
-      goto LABEL_24;
-    case SPELL_BODY_FIRST_AID|SPELL_FIRE_PROTECTION_FROM_FIRE:
-      v6 = "spell71";
-      goto LABEL_24;
-    case SPELL_BODY_HAMMERHANDS:
-      v6 = "spell73";
-      goto LABEL_24;
-    case SPELL_BODY_PROTECTION_FROM_MAGIC:
-      v6 = "spell75";
-LABEL_24:
-      result = pIconsFrameTable->FindIcon(v6);
-      v4[33].uSpellIconID = result;
-      break;
+    break;
+
+    case SPELL_FIRE_HASTE:                  v6 = "spell05"; break;
+    case SPELL_AIR_PROTECTION_FROM_AIR:     v6 = "spell14"; break;
+    case SPELL_AIR_SHIELD:                  v6 = "spell17"; break;
+    case SPELL_WATER_PROTECTION_FROM_WATER: v6 = "spell25"; break;
+    case SPELL_EARTH_PROTECTION_FROM_EARTH: v6 = "spell36"; break;
+    case SPELL_EARTH_STONESKIN:             v6 = "spell38"; break;
+    case SPELL_SPIRIT_BLESS:                v6 = "spell46"; break;
+    case SPELL_SPIRIT_HEROISM:              v6 = "spell51"; break;
+    case SPELL_SPIRIT_RESSURECTION:         v6 = "spell55"; break;
+    case SPELL_MIND_PROTECTION_FROM_MIND:   v6 = "spell58"; break;
+    case SPELL_BODY_PROTECTION_FROM_BODY:   v6 = "spell69"; break;
+    case SPELL_BODY_REGENERATION:           v6 = "spell71"; break;
+    case SPELL_BODY_HAMMERHANDS:            v6 = "spell73"; break;
+    case SPELL_BODY_PROTECTION_FROM_MAGIC:  v6 = "spell75"; break;
+
     default:
-      v4[32].uSpellID = 0;
-      break;
+      //v4[32].uSpellID = 0;
+      v4->bRender = false;
+      return;
   }
-  if ( v4[32].uSpellID )
-  {
-    result = 8 * pIconsFrameTable->pIcons[v4[33].uSpellIconID].uAnimLength;
-    v3->array_0[(signed __int16)uPlayerID + 33].uSpellAnimLength = result;
-  }
-  return result;
+  
+  //v4[33].uSpellIconID = pIconsFrameTable->FindIcon(v6);
+  v4->uSpellIconID = pIconsFrameTable->FindIcon(v6);
+  //if ( v4[32].uSpellID )
+  if (v4->bRender)
+    //v3->array_0[(signed __int16)uPlayerID + 33].uSpellAnimLength = 8 * pIconsFrameTable->pIcons[v4[33].uSpellIconID].uAnimLength;
+    v4->uSpellAnimTime = 8 * pIconsFrameTable->pIcons[v4->uSpellIconID].uAnimLength;
 }
 
 //----- (004A8BDF) --------------------------------------------------------