changeset 2103:2318216e5206

stru_AA1058[i]._494836() continue
author Ritor1
date Tue, 17 Dec 2013 23:11:49 +0600
parents 0db53678ff48
children 9574c5bfb96f
files SaveLoad.cpp mm7_4.cpp
diffstat 2 files changed, 30 insertions(+), 83 deletions(-) [+]
line wrap: on
line diff
--- a/SaveLoad.cpp	Tue Dec 17 21:34:20 2013 +0600
+++ b/SaveLoad.cpp	Tue Dec 17 23:11:49 2013 +0600
@@ -177,7 +177,7 @@
   {
     uchar uQuickspell = pParty->pPlayers[i].uQuickSpell;
     if (uQuickspell)
-      stru_AA1058[i]._494836(uQuickspell, i + 9 - 8);
+      stru_AA1058[i]._494836(uQuickspell, i + 1);
 
     for (uint j = 0; j < 2; ++j)
     {
--- a/mm7_4.cpp	Tue Dec 17 21:34:20 2013 +0600
+++ b/mm7_4.cpp	Tue Dec 17 23:11:49 2013 +0600
@@ -989,36 +989,33 @@
 {
   int v3; // esi@1
   int result; // eax@1
-  stru339_spell_sound *v5; // ebx@1
+  //stru339_spell_sound *v5; // ebx@1
   int *v6; // edi@2
   unsigned int v7; // eax@3
   int v8; // [sp+Ch] [bp-8h]@3
   int v9; // [sp+10h] [bp-4h]@2
   int a2a; // [sp+1Ch] [bp+8h]@1
-  return 0;
+  //return 0;
   v3 = 0;
   result = word_4EE088_sound_ids[uSoundID];
-  v5 = this;
+  //v5 = this;
   a2a = word_4EE088_sound_ids[uSoundID];
-  if ( result )
+  if ( word_4EE088_sound_ids[uSoundID] )
   {
-    v9 = 0;
     v6 = this->pSoundsOffsets;
-    do
+    for ( v9 = 0; v9 < 2; ++v9 )
     {
       v7 = a2a++;
-      result = pSoundList->LoadSound(v7, (char *)v5 + v3, 44744 - v3, &v8, a6);
+      result = pSoundList->LoadSound(v7, (char *)this + v3, 44744 - v3, &v8, a6);
       if ( !result )
         break;
       a6 += 4;
       result = v8 + 256;
-      *v6 = v3;
+      this->pSoundsOffsets[v9] = v3;
       v3 += result;
-      ++v9;
-      *(v6 - 2) = result;
+      this->pSoundsSizes[v9] = v8 + 256;
       ++v6;
     }
-    while ( v9 < 2 );
   }
   return result;
 }
@@ -1027,28 +1024,12 @@
 //----- (00494AED) --------------------------------------------------------
 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression)
 {
-  unsigned int _uNumFrames; // edx@1
-  unsigned int result; // eax@1
-  PlayerFrame *v4; // ecx@2
-
-  _uNumFrames = this->uNumFrames;
-  result = 0;
-  if ( (signed int)this->uNumFrames <= 0 )
+  for ( uint i = 0; i < this->uNumFrames; i++ )
   {
-    result = 0;
+    if ( this->pFrames[i].expression == expression )
+      return i;
   }
-  else
-  {
-    v4 = this->pFrames;
-    while ( v4->expression != expression )
-    {
-      ++result;
-      ++v4;
-      if ( (signed int)result >= (signed int)_uNumFrames )
-        return 0;
-    }
-  }
-  return result;
+  return 0;
 }
 
 //----- (00494B10) --------------------------------------------------------
@@ -1771,64 +1752,30 @@
 //----- (0049B13D) --------------------------------------------------------
 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist)
 {
-  ODMFace *v5; // ebx@1
-  //int v6; // eax@1
-  //unsigned __int16 *v7; // ebx@2
-  //Vec3_int_ *v8; // eax@3
-  Vec3_int_ *v9; // ecx@3
-  //double v10; // st7@3
-  //int v11; // ecx@3
-  Vec3_int_ *v12; // ecx@3
-  //double v13; // st7@3
-  //double v14; // st6@3
-  //double v15; // st5@3
-  //int v16; // ecx@3
-  Vec3_int_ *v17; // eax@3
-  //double v18; // st5@3
   Vec3_float_ *v19; // eax@3
-  //int result; // eax@8
-  //float v21; // ecx@10
-  //double v22; // st7@10
-  //double v23; // st6@10
   Vec3_float_ v2; // [sp+4h] [bp-64h]@3
-  //float v25; // [sp+18h] [bp-50h]@3
   float v26; // [sp+1Ch] [bp-4Ch]@3
   float v27; // [sp+20h] [bp-48h]@3
   float v28; // [sp+24h] [bp-44h]@3
-  //float v29; // [sp+2Ch] [bp-3Ch]@3
-  //float v30; // [sp+30h] [bp-38h]@3
-  //float v31; // [sp+34h] [bp-34h]@3
-  //float v32; // [sp+38h] [bp-30h]@3
-  //float v33; // [sp+3Ch] [bp-2Ch]@3
   Vec3_float_ v1; // [sp+40h] [bp-28h]@1
-  //float v35; // [sp+4Ch] [bp-1Ch]@3
-  //float v36; // [sp+50h] [bp-18h]@3
-  //float v37; // [sp+54h] [bp-14h]@3
   Vec3_float_ v38; // [sp+58h] [bp-10h]@3
-  //int v39; // [sp+64h] [bp-4h]@1
 
-  //v39 = 0;
   v1.x = 0.0;
-  v5 = pFace;
-  //v6 = pFace->uNumVertices;
   v1.y = 0.0;
   v1.z = 0.0;
 
   if (pFace->uNumVertices >= 2)
   {
-    int i = 0;
-    while ( i < pFace->uNumVertices - 2 )
+    for ( int i = 0; i < pFace->uNumVertices - 2; i++ )
     {
-      v9 = &pVertices->pVertices[pFace->pVertexIDs[i]];
-      v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]];
-      v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]];
-	  i++;
-      v1.x = v12->x - v9->x;
-      v26 = v17->x - v12->x;
-      v1.y = v12->y - v9->y;
-      v27 = v17->y - v12->y;
-      v1.z = v12->z - v9->z;
-      v28 = v17->z - v12->z;
+      v1.x = pVertices->pVertices[pFace->pVertexIDs[i + 1]].x - pVertices->pVertices[pFace->pVertexIDs[i]].x;
+      v1.y = pVertices->pVertices[pFace->pVertexIDs[i + 1]].y - pVertices->pVertices[pFace->pVertexIDs[i]].y;
+      v1.z = pVertices->pVertices[pFace->pVertexIDs[i + 1]].z - pVertices->pVertices[pFace->pVertexIDs[i]].z;
+
+      v26 = pVertices->pVertices[pFace->pVertexIDs[i + 2]].x - pVertices->pVertices[pFace->pVertexIDs[i + 1]].x;
+      v27 = pVertices->pVertices[pFace->pVertexIDs[i + 2]].y - pVertices->pVertices[pFace->pVertexIDs[i + 1]].y;
+      v28 = pVertices->pVertices[pFace->pVertexIDs[i + 2]].z - pVertices->pVertices[pFace->pVertexIDs[i + 1]].z;
+
       v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28);
       v38.x = v19->x;
       v38.y = v19->y;
@@ -1841,28 +1788,28 @@
         pOutNormal->y = v38.y;
         pOutNormal->z = v38.z;
 
-        *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z);
+        *pOutDist = -(pVertices->pVertices[pFace->pVertexIDs[i]].x * v38.x
+                    + pVertices->pVertices[pFace->pVertexIDs[i]].y * v38.y
+                    + pVertices->pVertices[pFace->pVertexIDs[i]].z * v38.z);
         return;
       }
     }
   }
 
-  pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16);
-  pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16);
-  pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16);
-  *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16);
+  pOutNormal->x = (double)(pFace->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.vNormal.x >> 16);
+  pOutNormal->y = (double)(pFace->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.vNormal.y >> 16);
+  pOutNormal->z = (double)(pFace->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.vNormal.z >> 16);
+  *pOutDist = (double)(pFace->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.dist >> 16);
 }
 
 //----- (0049D700) --------------------------------------------------------
 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim)
 {
-  unsigned int v1; // eax@1
   int v2; // ecx@1
   unsigned int v3; // eax@1
 
-  v1 = uDim;
   v2 = 0;
-  v3 = v1 - 1;
+  v3 = uDim - 1;
   while ( v3 & 1 )
   {
     v3 >>= 1;