changeset 1124:dd1cb6a2dba6

Merge
author Grumpy7
date Fri, 31 May 2013 00:41:13 +0200
parents 8a965c8faf05 (current diff) 45a8862d8b6e (diff)
children f87e7d1aa9ec
files mm7_2.cpp
diffstat 15 files changed, 183 insertions(+), 172 deletions(-) [+]
line wrap: on
line diff
--- a/DecalBuilder.cpp	Fri May 31 00:38:25 2013 +0200
+++ b/DecalBuilder.cpp	Fri May 31 00:41:13 2013 +0200
@@ -185,7 +185,6 @@
         memcpy(&static_AE4F90[i], a6, 0x30u);
 		++a6;
       }
-      while ( !v15 );
     v16 = a4;
     if ( pGame->pIndoorCameraD3D->_437376(a4, static_AE4F90, (unsigned int *)&a5) == 1 )
     {
@@ -487,66 +486,38 @@
 //----- (0049BCEB) --------------------------------------------------------
 char DecalBuilder::ApplyDecals_OutdoorFace(ODMFace *pFace)
 {
-  int v2; // edi@1
-  unsigned int v3; // eax@2
-  char *v4; // edx@5
-  double v5; // ST1C_8@12
-  double v6; // ST14_8@12
-  double v7; // ST0C_8@12
-  double v8; // st7@12
-  unsigned int v10; // [sp+20h] [bp-1Ch]@1
+	double v8; // st7@12
+	unsigned int v10; // [sp+20h] [bp-1Ch]@1
+
+	Bloodsplat *pBloodsplat;
 
-  v2 = 0;
-  this->uNumDecals = 0;
-  v10 = pBloodsplatContainer->std__vector_pBloodsplats_size;
-  if ( pBloodsplatContainer->std__vector_pBloodsplats_size )
-  {
-    v3 = pFace->uAttributes;
-    if ( !(v3 & 0x400000) )
-    {
-      if ( !(v3 & 0x10) && (signed int)pBloodsplatContainer->std__vector_pBloodsplats_size > 0 )
-      {
-        v4 = (char *)&pBloodsplatContainer->std__vector_pBloodsplats[0].y;
-        do
-        {
-          if ( (double)pFace->pBoundingBox.x1 - *((float *)v4 + 2) < *((float *)v4 - 1) )
-          {
-            if ( (double)pFace->pBoundingBox.x2 + *((float *)v4 + 2) > *((float *)v4 - 1) )
-            {
-              if ( (double)pFace->pBoundingBox.y1 - *((float *)v4 + 2) < *(float *)v4 )
-              {
-                if ( (double)pFace->pBoundingBox.y2 + *((float *)v4 + 2) > *(float *)v4 )
-                {
-                  if ( (double)pFace->pBoundingBox.z1 - *((float *)v4 + 2) < *((float *)v4 + 1) )
-                  {
-                    if ( (double)pFace->pBoundingBox.z2 + *((float *)v4 + 2) > *((float *)v4 + 1) )
-                    {
-                      v5 = *((float *)v4 - 1) + 6.7553994e15;
-                      v6 = *(float *)v4 + 6.7553994e15;
-                      v7 = *((float *)v4 + 1) + 6.7553994e15;
-                      v8 = (double)((pFace->pFacePlane.dist
-                                   + LODWORD(v5) * pFace->pFacePlane.vNormal.x
-                                   + LODWORD(v6) * pFace->pFacePlane.vNormal.y
-                                   + LODWORD(v7) * pFace->pFacePlane.vNormal.z) >> 16);
-                      if ( v8 <= *((float *)v4 + 2) )
-                      {
-                        *((float *)v4 + 3) = v8;
-                        this->std__vector_30B00C[this->uNumDecals++] = v2;
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          }
-          ++v2;
-          v4 += 40;
-        }
-        while ( v2 < (signed int)v10 );
-      }
-    }
-  }
-  return 1;
+	this->uNumDecals = 0;
+	v10 = pBloodsplatContainer->std__vector_pBloodsplats_size;
+	if ( !(pFace->uAttributes & 0x400000) && !(pFace->uAttributes & 0x10) )
+	{
+		for(int i = 0; i < pBloodsplatContainer->std__vector_pBloodsplats_size; i++ )
+		{
+			pBloodsplat = &pBloodsplatContainer->std__vector_pBloodsplats[i];
+			if ( (double)pFace->pBoundingBox.x1 - pBloodsplat->radius < pBloodsplat->x &&
+				(double)pFace->pBoundingBox.x2 + pBloodsplat->radius > pBloodsplat->x &&
+				(double)pFace->pBoundingBox.y1 - pBloodsplat->radius < pBloodsplat->y &&
+				(double)pFace->pBoundingBox.y2 + pBloodsplat->radius > pBloodsplat->y &&
+				(double)pFace->pBoundingBox.z1 - pBloodsplat->radius < pBloodsplat->z &&
+				(double)pFace->pBoundingBox.z2 + pBloodsplat->radius > pBloodsplat->z )
+			{
+				v8 = (double)((pFace->pFacePlane.dist
+							+ round(pBloodsplat->x) * pFace->pFacePlane.vNormal.x
+							+ round(pBloodsplat->y) * pFace->pFacePlane.vNormal.y
+							+ round(pBloodsplat->z) * pFace->pFacePlane.vNormal.z) >> 16);
+				if ( v8 <= pBloodsplat->radius )
+				{
+					pBloodsplat->dot_dist = v8;
+					this->std__vector_30B00C[this->uNumDecals++] = i;
+				}
+			}
+		}
+	}
+	return 1;
 }
 
 //----- (0049BE8A) --------------------------------------------------------
--- a/GUIWindow.cpp	Fri May 31 00:38:25 2013 +0200
+++ b/GUIWindow.cpp	Fri May 31 00:41:13 2013 +0200
@@ -905,7 +905,7 @@
   }
   //while ( (signed int)v3 < 11 );
 
-  CreateButton(0, 0, 0, 0, 1, 0, UIMSG_33, 0, '\t', "", 0);
+  CreateButton(0, 0, 0, 0, 1, 0, UIMSG_SpellBook_PressTab, 0, '\t', "", 0);
   if ( a2 )
     _41D08F_set_keyboard_control_group(a2, 0, 0, 0);
 
--- a/GUIWindow.h	Fri May 31 00:38:25 2013 +0200
+++ b/GUIWindow.h	Fri May 31 00:41:13 2013 +0200
@@ -30,7 +30,7 @@
 
   UIMSG_31 = 49,
   UIMSG_32 = 50,
-  UIMSG_33 = 51,
+  UIMSG_SpellBook_PressTab = 51,
   UIMSG_34 = 52,
   UIMSG_35 = 53,
   UIMSG_MainMenu_ShowPartyCreationWnd = 54,
--- a/Render.cpp	Fri May 31 00:38:25 2013 +0200
+++ b/Render.cpp	Fri May 31 00:41:13 2013 +0200
@@ -7162,7 +7162,7 @@
 //----- (004A2031) --------------------------------------------------------
 unsigned int Render::GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6)
 {
-  __debugbreak(); // should not fire outside decal builder
+//  __debugbreak(); // should not fire outside decal builder
   return ::GetActorTintColor(tint, a4, a2, a5, a6);
 }
 
--- a/SpriteObject.h	Fri May 31 00:38:25 2013 +0200
+++ b/SpriteObject.h	Fri May 31 00:41:13 2013 +0200
@@ -16,7 +16,7 @@
 
   SpriteObject();
   int Create(int yaw, int pitch, int a4, int a5);
-  void _46BEF1_apply_spells();
+  void _46BEF1_apply_spells_aoe();
   void _438E35();
 
   static void UpdateObject_fn0_BLV(unsigned int uLayingItemID);
--- a/Texture.cpp	Fri May 31 00:38:25 2013 +0200
+++ b/Texture.cpp	Fri May 31 00:41:13 2013 +0200
@@ -52,7 +52,7 @@
 Texture *pTextures_tabs[9][2];
 Texture *pTexture_mapbordr; // idb
 Texture *pTexture_pagemask; // idb
-Texture *pSpellBookPagesTextr[8];
+Texture *pSpellBookPagesTextr[9];
 Texture *pSpellBookPagesTextr_9;
 Texture *pSpellBookPagesTextr_10;
 Texture *pSpellBookPagesTextr_11;
--- a/Texture.h	Fri May 31 00:38:25 2013 +0200
+++ b/Texture.h	Fri May 31 00:41:13 2013 +0200
@@ -155,7 +155,7 @@
 extern Texture *pTextures_tabs[9][2];
 extern Texture *pTexture_mapbordr; // idb
 extern Texture *pTexture_pagemask; // idb
-extern Texture *pSpellBookPagesTextr[8];
+extern Texture *pSpellBookPagesTextr[9];
 extern Texture *pSpellBookPagesTextr_9;
 extern Texture *pSpellBookPagesTextr_10;
 extern Texture *pSpellBookPagesTextr_11;
--- a/UIBooks.cpp	Fri May 31 00:38:25 2013 +0200
+++ b/UIBooks.cpp	Fri May 31 00:41:13 2013 +0200
@@ -320,11 +320,11 @@
   static const char *texNames[9] = // 004E24EC
   {
     "SBFB00", "SBAB00", "SBWB00", "SBEB00",
-    "SBSB00", "SBMB00", "SBBB00", "SBLB00",
+    "SBSB00", "SBMB00", "SBBB00", "SBLB00", "SBDB00"
   };
 
   pTexture_506444 = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE);
-  for (uint i = 0; i < 8; ++i)
+  for (uint i = 0; i < 9; ++i)
   {
     pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE);
 
@@ -432,7 +432,7 @@
   pTexture_pagemask->Release();
   pTexture_506448->Release();
   pTexture_50643C->Release();
-  for (uint i = 0; i < 8; ++i)
+  for (uint i = 0; i < 9; ++i)
       {
       pSpellBookPagesTextr[i]->Release();
       pTextures_tabs[i][0]->Release();
@@ -1712,7 +1712,7 @@
       }
       ++v4;
     }
-    while ( v4 + v1 - 1 < v1 + 11 );
+    while ( v4 - 1 < 11 );
   }
 
 
--- a/mm7_2.cpp	Fri May 31 00:38:25 2013 +0200
+++ b/mm7_2.cpp	Fri May 31 00:41:13 2013 +0200
@@ -11058,7 +11058,7 @@
 }
 
 //----- (0046BEF1) --------------------------------------------------------
-void SpriteObject::_46BEF1_apply_spells()
+void SpriteObject::_46BEF1_apply_spells_aoe()
 {
   SpriteObject *v1; // edi@1
   Actor *v2; // esi@2
@@ -11067,6 +11067,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 )
@@ -11077,7 +11079,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) )
           {
@@ -11338,7 +11412,7 @@
         {
           if ( v6 != 9030 || v2->spell_skill != 4 )
             goto LABEL_246;
-          v2->_46BEF1_apply_spells();
+          v2->_46BEF1_apply_spells_aoe();
 LABEL_233:
           if ( !v138 )
           {
@@ -11447,7 +11521,7 @@
               }
               else
               {
-                v2->_46BEF1_apply_spells();
+                v2->_46BEF1_apply_spells_aoe();
               }
               v2->spell_level = 0;
               v2->spell_skill = 0;
--- a/mm7_3.cpp	Fri May 31 00:38:25 2013 +0200
+++ b/mm7_3.cpp	Fri May 31 00:41:13 2013 +0200
@@ -4384,96 +4384,60 @@
 //----- (0047802A) --------------------------------------------------------
 int stru6_stru1_indoor_sw_billboard::sub_47802A()
 {
-  int v1; // edx@1
-  stru6_stru1_indoor_sw_billboard *v2; // edi@1
-  int v3; // ebx@2
-  char *v4; // esi@3
-  float v5; // eax@4
   double v6; // st7@4
-  double v7; // ST30_8@5
-  double v8; // st6@6
-  double v9; // st5@6
-  char *v10; // ecx@15
-  float v11; // eax@16
   double v12; // st7@16
-  double v13; // st6@16
-  double v14; // st5@16
   signed int v16; // [sp+38h] [bp-Ch]@1
   int a6; // [sp+3Ch] [bp-8h]@5
   int a5; // [sp+40h] [bp-4h]@5
 
   auto a1 = this;
 
-  v1 = 0;
-  v2 = a1;
   v16 = 0;
   if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
   {
-    v3 = 0;
-    if ( a1->field_10 > 0 )
-    {
-      v4 = (char *)&a1->field_14[42];
-      do
-      {
-        LODWORD(v5) = *((int *)v4 - 2);
-        v6 = (double)pBLVRenderParams->field_40 * 0.000015258789 / *((float *)v4 - 2);
-        if ( pRenderer->pRenderD3D )
-        {
-          v7 = v5 + 6.7553994e15;
-          pGame->pIndoorCameraD3D->Project(
-            COERCE_UNSIGNED_INT64(v5 + 6.7553994e15),
-            COERCE_UNSIGNED_INT64(*((float *)v4 - 1) + 6.7553994e15),
-            COERCE_UNSIGNED_INT64(*(float *)v4 + 6.7553994e15),
-            &a5,
-            &a6);
-          *((float *)v4 + 18) = (double)a5;
-          *((float *)v4 + 19) = (double)a6;
-          *((float *)v4 + 20) = (double)SLODWORD(v7);
-        }
-        else
-        {
-          *((float *)v4 + 18) = (double)pBLVRenderParams->uViewportCenterX - v6 * *((float *)v4 - 1);
-          v8 = (double)pBLVRenderParams->uViewportCenterY;
-          v9 = v6 * *(float *)v4;
-          *((int *)v4 + 20) = LODWORD(v5);
-          *((float *)v4 + 19) = v8 - v9;
-        }
-        *((int *)v4 + 21) = *((int *)v4 + 1);
-        if ( (double)(signed int)pViewport->uViewportTL_X <= *((float *)v4 + 18)
-          && (double)(signed int)pViewport->uViewportBR_X > *((float *)v4 + 18)
-          && (double)(signed int)pViewport->uViewportTL_Y <= *((float *)v4 + 19)
-          && (double)(signed int)pViewport->uViewportBR_Y > *((float *)v4 + 19) )
-          v16 = 1;
-        ++v3;
-        v4 += 16;
-      }
-      while ( v3 < v2->field_10 );
-    }
-  }
-  else
-  {
-    if ( a1->field_10 > 0 )
-    {
-      v10 = (char *)&a1->field_14[40];
-      do
-      {
-        LODWORD(v11) = *(int *)v10;
-        v12 = (double)pOutdoorCamera->int_fov_rad / *(float *)v10;
-        *((float *)v10 + 20) = (double)pViewport->uScreenCenterX - v12 * *((float *)v10 + 1);
-        v13 = (double)pViewport->uScreenCenterY;
-        v14 = v12 * *((float *)v10 + 2);
-        *((int *)v10 + 22) = LODWORD(v11);
-        *((int *)v10 + 23) = *((int *)v10 + 3);
-        *((float *)v10 + 21) = v13 - v14;
-        if ( (double)(signed int)pViewport->uViewportTL_X <= *((float *)v10 + 20)
-          && (double)(signed int)pViewport->uViewportBR_X > *((float *)v10 + 20)
-          && (double)(signed int)pViewport->uViewportTL_Y <= *((float *)v10 + 21)
-          && (double)(signed int)pViewport->uViewportBR_Y > *((float *)v10 + 21) )
-          v16 = 1;
-        ++v1;
-        v10 += 16;
-      }
-      while ( v1 < v2->field_10 );
+	for(int i = 0; i < a1->field_10; i++)
+    {
+		v6 = (double)pBLVRenderParams->field_40 * 0.000015258789 / a1->field_B4[i*4];
+		if ( pRenderer->pRenderD3D )
+		{
+			pGame->pIndoorCameraD3D->Project(
+				round(a1->field_B4[i*4]),
+				round(a1->field_B4[i*4+1]),
+				round(a1->field_B4[i*4+2]),
+				&a5,
+				&a6);
+			a1->field_B4[i*4+16] = (double)a5;
+			a1->field_B4[i*4+17] = (double)a6;
+			a1->field_B4[i*4+18] = round(a1->field_B4[i*4]);
+		}
+		else
+		{
+			a1->field_B4[i*4+16] = (double)pBLVRenderParams->uViewportCenterX - v6 * a1->field_B4[i*4+1];
+			a1->field_B4[i*4+17] = (double)pBLVRenderParams->uViewportCenterY - v6 * a1->field_B4[i*4+2];
+			a1->field_B4[i*4+18] = a1->field_B4[i*4];
+		}
+		a1->field_B4[i*4+19] = a1->field_B4[i*4+3];
+		if ( (double)(signed int)pViewport->uViewportTL_X <= a1->field_B4[i*4+16]
+			&& (double)(signed int)pViewport->uViewportBR_X > a1->field_B4[i*4+16]
+			&& (double)(signed int)pViewport->uViewportTL_Y <= a1->field_B4[i*4+17]
+			&& (double)(signed int)pViewport->uViewportBR_Y > a1->field_B4[i*4+17] )
+			v16 = 1;
+    }
+  }
+  else
+  {
+	for(int i = 0; i < a1->field_10; i++)
+    {
+		v12 = (double)pOutdoorCamera->int_fov_rad / a1->field_B4[i*4];
+		a1->field_B4[i*4+20] = (double)pViewport->uScreenCenterX - v12 * a1->field_B4[i*4+1];
+		a1->field_B4[i*4+21] = (double)pViewport->uScreenCenterY - v12 * a1->field_B4[i*4+2];
+		*((int *)&a1->field_B4[i*4+22]) = (int)a1->field_B4[i*4];
+		*((int *)&a1->field_B4[i*4+23]) = a1->field_B4[i*4+3];
+		if ( (double)(signed int)pViewport->uViewportTL_X <= a1->field_B4[i*4+20]
+			&& (double)(signed int)pViewport->uViewportBR_X > a1->field_B4[i*4+20]
+			&& (double)(signed int)pViewport->uViewportTL_Y <= a1->field_B4[i*4+21]
+			&& (double)(signed int)pViewport->uViewportBR_Y > a1->field_B4[i*4+21] )
+			v16 = 1;
     }
   }
   return v16;
@@ -14594,8 +14558,6 @@
 							}
 						}
 					}
-					++v84;
-					++v5;
 				}
 				for(int i = 1; i <= 4; i++)
 				{
--- a/mm7_5.cpp	Fri May 31 00:38:25 2013 +0200
+++ b/mm7_5.cpp	Fri May 31 00:41:13 2013 +0200
@@ -2667,8 +2667,8 @@
             pPlayer10->PlaySound(SPEECH_12, 0);
           byte_506550 = 0;
           continue;
-        case UIMSG_33:
-			__debugbreak();
+        case UIMSG_SpellBook_PressTab:
+			//__debugbreak();
           if ( !uActiveCharacter )
             continue;
           pPlayer3 = pPlayers[uActiveCharacter];
--- a/mm7_6.cpp	Fri May 31 00:38:25 2013 +0200
+++ b/mm7_6.cpp	Fri May 31 00:41:13 2013 +0200
@@ -2599,7 +2599,7 @@
   AwardType *v607; // ecx@1100
   __int16 v608; // ax@1102
   signed int v609; // eax@1104
-  int v610; // edi@1106
+  //int v610; // edi@1106
   unsigned int v611; // eax@1106
   Player *v612; // edi@1106
   DDM_DLV_Header *v613; // eax@1108
@@ -2647,7 +2647,7 @@
   Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286
   Vec3_int_ v704; // [sp+D74h] [bp-110h]@132
   Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127
-  char v710; // [sp+D8Ch] [bp-F8h]@1156
+  int v710; // [sp+D8Ch] [bp-F8h]@1156
   __int64 v712; // [sp+D94h] [bp-F0h]@991
   int v713; // [sp+D9Ch] [bp-E8h]@324
   int n; // [sp+DA0h] [bp-E4h]@1
@@ -6188,7 +6188,7 @@
 			if ( (signed int)pNPCStats->uNumNewNPCs > 0)
 			{
 				pNPCData = pNPCStats->pNewNPCData;
-				__debugbreak(); // data offset
+				//__debugbreak(); // data offset
 				AwardType *_v734 = &achieved_awards[_v733];
 				do
 				{
@@ -6207,7 +6207,8 @@
 			}
 			v608 = pCastSpell->uPlayerID_2;
 			if ( v608 != 4 && v608 != 5
-				|| (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0)
+				//|| (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0)
+				|| (v609 = achieved_awards[v608 + (unsigned __int8)pParty->field_709 - 4], v609 <= 0)
 				|| v609 >= 3 )
 			{
 				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
@@ -6215,13 +6216,14 @@
 				pCastSpell->spellnum = 0;
 				continue;
 			}
-			v610 = 76 * v609;
-			*((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0;
+			//v610 = 76 * v609;
+			//*((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0;
+			pParty->pHirelings[v609-1].evt_B = 0;
 			v611 = pIconsFrameTable->FindIcon("spell96");
 			//*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611);
-			pParty->pHirelings[v609-1].evt_B = pIconsFrameTable->GetIconAnimLength(v611);
+			pParty->pHirelings[v609-1].evt_C = pIconsFrameTable->GetIconAnimLength(v611);
 			//*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1;
-			pParty->pHirelings[v609-1].field_24 = 1;
+			pParty->pHirelings[v609-1].evt_A = 1;
 
 			v612 = pParty->pPlayers;
 			do
@@ -6394,7 +6396,7 @@
 				v643 = rand();
 				v721 = v642 + pParty->vPosition.x;
 				y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048);
-				v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0);
+				v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, &v710, 0);
 				v644 = rand();
 				sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0);
 				--_v726;
--- a/mm7_data.cpp	Fri May 31 00:38:25 2013 +0200
+++ b/mm7_data.cpp	Fri May 31 00:41:13 2013 +0200
@@ -390,8 +390,8 @@
 char aIcons[777]; // idb
 char aPending[777]; // idb
 char aCanTFindS[777]; // idb
-char *spellbook_texture_filename_suffices[8] = {"f", "a", "w", "e", "s", "m", "b", "l"}; // weak
-__int16 word_4E1D3A[777]; // weak
+char *spellbook_texture_filename_suffices[9] = {"f", "a", "w", "e", "s", "m", "b", "l", "d"}; // weak
+//__int16 word_4E1D3A[777]; // weak
 __int16 pTownPortalBook_xs[6] = {260, 324, 147, 385, 390,  19};
 __int16 pTownPortalBook_ys[6] = {206,  84, 182, 239,  17, 283};
 __int16 pTownPortalBook_ws[6] = { 80,  66,  68,  72,  67,  74};
@@ -1063,9 +1063,9 @@
 int dword_50BAE8[777]; // weak
 int stru_50B700._xs2[3 + 45]; // weak
 int stru_50B700._xs3[48]; // weak*/
-int dword_50BC10[777]; // weak
-int dword_50BDA0[777]; // weak
-int dword_50BF30[777]; // weak
+int dword_50BC10[100]; // weak
+int dword_50BDA0[100]; // weak
+int dword_50BF30[100]; // weak
 char town_portal_caster_id; // weak
 int some_active_character; // weak
 //_UNKNOWN unk_50C190; // weak
--- a/mm7_data.h	Fri May 31 00:38:25 2013 +0200
+++ b/mm7_data.h	Fri May 31 00:41:13 2013 +0200
@@ -1382,6 +1382,7 @@
 int __fastcall MakeColorMaskFromBitDepth(int a1);
 void __fastcall fill_pixels_fast(unsigned int a1, unsigned __int16 *pPixels, unsigned int uNumPixels);
 int __fastcall GetDiceResult(unsigned int uNumDice, unsigned int uDiceSides); // idb
+inline int round(float x) { return (floor(x + 0.5)); }
 inline void __fastcall memset32(void *ptr, unsigned __int32 value, int count)
 {
   auto p = (unsigned __int32 *)ptr;
--- a/stru6.h	Fri May 31 00:38:25 2013 +0200
+++ b/stru6.h	Fri May 31 00:41:13 2013 +0200
@@ -33,7 +33,8 @@
   unsigned int uNumVec3sInArray2;
   struct stru160 *pArray2;
   int field_10;
-  int field_14[80];
+  int field_14[40];
+  float field_B4[40];
 };
 #pragma pack(pop)