diff mm7_2.cpp @ 1119:aa706cde7fda

* dark spells working * found aoe apply buff function * round() moved * some global variable fixes * DecalBuilder::ApplyDecals_OutdoorFace() clean
author zipi
date Wed, 29 May 2013 22:51:00 +0100
parents 39eaa6b00141
children dd1cb6a2dba6
line wrap: on
line diff
--- a/mm7_2.cpp	Wed May 29 20:12:22 2013 +0100
+++ b/mm7_2.cpp	Wed May 29 22:51:00 2013 +0100
@@ -11068,7 +11068,7 @@
 }
 
 //----- (0046BEF1) --------------------------------------------------------
-void SpriteObject::_46BEF1_apply_spells()
+void SpriteObject::_46BEF1_apply_spells_aoe()
 {
   SpriteObject *v1; // edi@1
   Actor *v2; // esi@2
@@ -11077,6 +11077,8 @@
   unsigned __int8 v5; // c3@4
   signed int v6; // [sp+8h] [bp-4h]@1
 
+  int v7,v8,v9,v10,v11;
+
   v6 = 0;
   v1 = this;
   if ( (signed int)uNumActors > 0 )
@@ -11087,7 +11089,79 @@
       if ( v2->CanAct() )
       {
         //UNDEF(v3);
-        if ( !(v4 | v5) )
+		//.text:0046BF26                 movsx   eax, word ptr [esi-2]
+		//.text:0046BF2A                 sub     eax, [edi+4]
+		//.text:0046BF31                 mov     [ebp+var_8], eax
+		//.text:0046BF37                 fild    [ebp+var_8]
+		// v7 pushed to stack
+		v7 = v2->vPosition.x - this->vPosition.x;
+
+		//.text:0046BF2D                 movsx   ecx, word ptr [esi+2]
+		v8 = v2->vPosition.z;
+
+		//.text:0046BF34                 movsx   eax, word ptr [esi]
+		//.text:0046BF3A                 sub     eax, [edi+8]
+		//.text:0046BF3D                 mov     [ebp+var_8], eax
+		//.text:0046BF44                 fild    [ebp+var_8]
+		// v9 pushed to stack
+		v9 = v2->vPosition.y - this->vPosition.y;
+
+		//.text:0046BF40                 movsx   eax, word ptr [esi-6]
+		//.text:0046BF47                 sar     eax, 1
+		//.text:0046BF49                 add     eax, ecx
+		//.text:0046BF4B                 sub     eax, [edi+0Ch]
+		//.text:0046BF4E                 mov     [ebp+var_8], eax
+		//.text:0046BF51                 fild    [ebp+var_8]
+		//.text:0046BF58                 fld     st
+		// v10 pushed to stack, two times
+		v10 = v2->uActorHeight / 2 + v8 - this->vVelocity.y;
+
+		//.text:0046BF54                 movsx   eax, word ptr [esi-8]
+		//.text:0046BF5A                 add     eax, 100h
+		//.text:0046BF63                 mov     ecx, eax
+		v11 = this->vVelocity.x;
+
+		//.text:0046BF5F                 fmul    st, st(1)
+		// stack: v10*v10, v10, v9, v7
+		//.text:0046BF61                 fld     st(2)
+		// stack: v7, v10*v10, v10, v9, v7
+		
+
+		//.text:0046BF65                 fmul    st, st(3)
+		// stack: v7*v9, v10*v10, v10, v9, v7
+		
+		//.text:0046BF67                 imul    ecx, eax
+		v11 = v11 * v11;
+
+		//.text:0046BF6A                 faddp   st(1), st
+		// stack: v10*v10+v7*v9, v10, v9, v7
+		//.text:0046BF6C                 fld     st(3)
+		// stack: v7, v10*v10+v7*v9, v10, v9, v7
+		//.text:0046BF6E                 fmul    st, st(4)
+		// stack: v7*v7, v10*v10+v7*v9, v10, v9, v7
+		//.text:0046BF70                 faddp   st(1), st
+		// stack: v10*v10+v7*v9+v7*v7, v10, v9, v7
+		
+		//.text:0046BF72                 mov     [ebp+var_8], ecx
+		//.text:0046BF75                 fild    [ebp+var_8]
+		// v11 pushed to stack
+
+		//.text:0046BF78                 fcompp
+		// if ( v11 > v10*v10+v7*v9+v7*v7 )
+		// stack: v10, v9, v7
+
+		//.text:0046BF7A                 fstp    st
+		// stack: v9, v7
+
+		//.text:0046BF7C                 fnstsw  ax
+		//.text:0046BF7E                 fstp    st
+		// stack: v7
+
+		//.text:0046BF80                 test    ah, 41h
+		//.text:0046BF83                 fstp    st
+		//.text:0046BF85                 jnz     short loc_46BFDD
+
+		if ( v11 >= v10*v10+v7*v9+v7*v7 )
         {
           if ( stru_50C198.GetMagicalResistance(v2, 0xAu) )
           {
@@ -11348,7 +11422,7 @@
         {
           if ( v6 != 9030 || v2->spell_skill != 4 )
             goto LABEL_246;
-          v2->_46BEF1_apply_spells();
+          v2->_46BEF1_apply_spells_aoe();
 LABEL_233:
           if ( !v138 )
           {
@@ -11457,7 +11531,7 @@
               }
               else
               {
-                v2->_46BEF1_apply_spells();
+                v2->_46BEF1_apply_spells_aoe();
               }
               v2->spell_level = 0;
               v2->spell_skill = 0;