changeset 1044:a85f5cb295b7

Слияние
author Ritor1
date Tue, 21 May 2013 15:17:18 +0600
parents b725a9cdec0c (current diff) c94d6a37d298 (diff)
children d3f4c6584ada
files
diffstat 9 files changed, 28 insertions(+), 145 deletions(-) [+]
line wrap: on
line diff
--- a/CShow.h	Tue May 21 15:17:09 2013 +0600
+++ b/CShow.h	Tue May 21 15:17:18 2013 +0600
@@ -27,7 +27,7 @@
 
   
   //----- (004A952D) --------------------------------------------------------
-  void CShow::PlayMovie(MovieType eVideo, bool bShowMouseAfterPlayback);
+  void PlayMovie(MovieType eVideo, bool bShowMouseAfterPlayback);
 
 
   void (__thiscall ***vdestructor_ptr)(CShow *, bool);
--- a/ParticleEngine.cpp	Tue May 21 15:17:09 2013 +0600
+++ b/ParticleEngine.cpp	Tue May 21 15:17:18 2013 +0600
@@ -237,10 +237,10 @@
   int v42; // ecx@18
   int v43; // eax@18
   unsigned __int64 v44; // qax@18
-  double v45; // st7@18
-  int v46; // ecx@18
-  float v47; // ST18_4@18
-  unsigned __int64 v48; // qax@18
+  //double v45; // st7@18
+  //int v46; // ecx@18
+  //float v47; // ST18_4@18
+  //unsigned __int64 v48; // qax@18
   int y_int_; // [sp+10h] [bp-40h]@2
   int a2; // [sp+18h] [bp-38h]@10
   int x_int; // [sp+20h] [bp-30h]@2
@@ -373,14 +373,9 @@
       pParticle->uScreenSpaceX = v42;
       v44 = v43 * (signed __int64)v24;
       //uParticleID = v44 >> 16;
-      v45 = pParticle->flt_28;
       LODWORD(v44) = (signed int)(v44 >> 16) >> 16;
-      v46 = pBLVRenderParams->uViewportCenterY - v44;
       pParticle->uScreenSpaceY = pBLVRenderParams->uViewportCenterY - v44;
-      v47 = v45;
-      v48 = _48B561_mess_with_scaling_along_z(/*v46, */v47) * (signed __int64)pParticle->_screenspace_scale;
-      //_uParticleID = v48 >> 16;
-      pParticle->_screenspace_scale = v48 >> 16;
+      pParticle->_screenspace_scale = fixpoint_sub0(fixpoint_from_float(pParticle->flt_28), pParticle->_screenspace_scale);
       pParticle->sZValue = z;
       return true;
     }
@@ -405,9 +400,9 @@
   LODWORD(v6) = 0;
   HIDWORD(v6) = floorf(pParticle->flt_5C + 0.5f);
   //v7 = pParticle->flt_28;
-  pParticle->_screenspace_scale = v6 / x;
+  //pParticle->_screenspace_scale = v6 / x;
   //v8 = v7;
-  pParticle->_screenspace_scale = (unsigned __int64)(_48B561_mess_with_scaling_along_z(/*v9, */pParticle->flt_28) * (signed __int64)pParticle->_screenspace_scale) >> 16;
+  pParticle->_screenspace_scale = fixpoint_sub0(fixpoint_from_float(pParticle->flt_28), v6 / x);
   pParticle->sZValue = x;
   return true;
 }
@@ -448,10 +443,10 @@
   signed __int64 v29; // qtt@13
   //int v30; // eax@13
   //int v31; // ST1C_4@13
-  double v32; // st7@13
+  //double v32; // st7@13
   signed int v33; // eax@13
-  int v34; // ecx@13
-  float v35; // ST04_4@13
+  //int v34; // ecx@13
+  //float v35; // ST04_4@13
   int v36; // eax@13
   int v37; // esi@15
   //double v39; // [sp+10h] [bp-40h]@2
@@ -566,12 +561,10 @@
       //v31 = v6->_screenspace_scale;
       v6->uScreenSpaceX = pViewport->uScreenCenterX
                         - ((signed int)((unsigned __int64)(v6->_screenspace_scale * (signed __int64)v16) >> 16) >> 16);
-      v32 = v6->flt_28;
       v33 = (signed int)((unsigned __int64)(v6->_screenspace_scale * (signed __int64)v40) >> 16) >> 16;
-      v34 = pViewport->uScreenCenterY - v33;
+      //v34 = pViewport->uScreenCenterY - v33;
       v6->uScreenSpaceY = pViewport->uScreenCenterY - v33;
-      v35 = v32;
-      v6->_screenspace_scale = (unsigned __int64)(_48B561_mess_with_scaling_along_z(/*v34, */v35) * (signed __int64)v6->_screenspace_scale) >> 16;
+      v6->_screenspace_scale = fixpoint_sub0(fixpoint_from_float(v6->flt_28), v6->_screenspace_scale);
       v6->sZValue = X_4;
       v36 = v6->uScreenSpaceX;
       if ( v36 >= (signed int)pViewport->uViewportTL_X )
--- a/UiGame.cpp	Tue May 21 15:17:09 2013 +0600
+++ b/UiGame.cpp	Tue May 21 15:17:18 2013 +0600
@@ -790,7 +790,7 @@
         }
         if (PID_TYPE(v18) == OBJECT_BModel)
         {
-          if ( v18 < (signed int)0x2000000u )
+          if ( v18 < (signed int)0x2000000 )
           {
             if ( uCurrentlyLoadedLevelType != LEVEL_Indoor)
             {
--- a/Viewport.cpp	Tue May 21 15:17:09 2013 +0600
+++ b/Viewport.cpp	Tue May 21 15:17:18 2013 +0600
@@ -19,6 +19,7 @@
     br_x = sBR_X;
     if ( sTL_X > sBR_X )
         {
+          __debugbreak(); // check this code
         br_x = sBR_X ^ sTL_X ^ sBR_X;                           // swap x's
         tl_x = br_x ^ sBR_X ^ sTL_X;
         }
@@ -26,6 +27,7 @@
     br_y = sBR_Y;
     if ( sTL_Y > sBR_Y )
         {
+          __debugbreak(); // check this code
         br_y = sBR_Y ^ sTL_Y ^ sBR_Y;                           // swap y's 
         tl_y = br_y ^ sBR_Y ^ sTL_Y;
         }
--- a/Vis.cpp	Tue May 21 15:17:09 2013 +0600
+++ b/Vis.cpp	Tue May 21 15:17:18 2013 +0600
@@ -328,7 +328,7 @@
             if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, &pIndoor->pFaces[pFaceID], 0xFFFFFFFFu) )
             {
               pGame->pIndoorCameraD3D->ViewTransform(&a1, 1);
-              v9 = _48B561_mess_with_scaling_along_z(/*v8, */a1.vWorldViewPosition.x);
+              v9 = fixpoint_from_float(/*v8, */a1.vWorldViewPosition.x);
               LOWORD(v9) = 0;
               v15 = (void *)((PID(OBJECT_BModel,pFaceID)) + v9);
               pNumPointers = &list->uNumPointers;
@@ -379,7 +379,8 @@
         if (Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &intersection, &blv_face, i))
         {
           pGame->pIndoorCameraD3D->ViewTransform(&intersection, 1);
-          int v13 = _48B561_mess_with_scaling_along_z(/*v12, */intersection.vWorldViewPosition.x);
+          int v13 = fixpoint_from_float(/*v12, */intersection.vWorldViewPosition.x);
+          v13 &= 0xFFFF0000;
           v13 += PID(OBJECT_BModel, j | (i << 6));
 
           list->AddObject(face, VisObjectType_Face, v13);
@@ -970,7 +971,7 @@
   pStartR.x = pIndoorCamera->pos.x;
   pStartR.y = pIndoorCamera->pos.y;
   pRotX = pIndoorCamera->sRotationX + UnprojectY((signed __int64)fMouseY);
-  pDepth = _48B561_mess_with_scaling_along_z(/*(int)&fMouseX, */fPickDepth);
+  pDepth = fixpoint_from_float(fPickDepth);
   Vec3_int_::Rotate(pDepth, pRotY, pRotX, pStartR, &outx, &outy, &outz);
 
   v11[0].flt_2C = 0.0;
--- a/mm7_4.cpp	Tue May 21 15:17:09 2013 +0600
+++ b/mm7_4.cpp	Tue May 21 15:17:18 2013 +0600
@@ -1523,80 +1523,6 @@
   
   for (int i = 0; i < 12; ++i)
     v2->pMemBlocks[i] = new stru12_MemoryBlock(640);
-  /*
-  v3 = (stru12_MemoryBlock *)operator new(8u);
-  if ( v3 )
-    v4 = AllocAlignedMem(v3, 640);
-  else
-    v4 = 0;
-  v2->pMemBlocks[0] = v4;
-  /*v5 = (stru12_MemoryBlock *)operator new(8u);
-  if ( v5 )
-    v6 = AllocAlignedMem(v5, 640);
-  else
-    v6 = 0;
-  v2->pMemBlocks[1] = v6;
-  v7 = (stru12_MemoryBlock *)operator new(8u);
-  if ( v7 )
-    v8 = AllocAlignedMem(v7, 640);
-  else
-    v8 = 0;
-  v2->pMemBlocks[2] = v8;
-  v9 = (stru12_MemoryBlock *)operator new(8u);
-  if ( v9 )
-    v10 = AllocAlignedMem(v9, 640);
-  else
-    v10 = 0;
-  v2->pMemBlocks[3] = v10;
-  v11 = (stru12_MemoryBlock *)operator new(8u);
-  if ( v11 )
-    v12 = AllocAlignedMem(v11, 640);
-  else
-    v12 = 0;
-  v2->pMemBlocks[4] = v12;
-  v13 = (stru12_MemoryBlock *)operator new(8u);
-  if ( v13 )
-    v14 = AllocAlignedMem(v13, 640);
-  else
-    v14 = 0;
-  v2->pMemBlocks[5] = v14;
-  v15 = (stru12_MemoryBlock *)operator new(8u);
-  if ( v15 )
-    v16 = AllocAlignedMem(v15, 640);
-  else
-    v16 = 0;
-  v2->pMemBlocks[6] = v16;
-  v17 = (stru12_MemoryBlock *)operator new(8u);
-  if ( v17 )
-    v18 = AllocAlignedMem(v17, 640);
-  else
-    v18 = 0;
-  v2->pMemBlocks[7] = v18;
-  v19 = (stru12_MemoryBlock *)operator new(8u);
-  if ( v19 )
-    v20 = AllocAlignedMem(v19, 640);
-  else
-    v20 = 0;
-  v2->pMemBlocks[8] = v20;
-  v21 = (stru12_MemoryBlock *)operator new(8u);
-  if ( v21 )
-    v22 = AllocAlignedMem(v21, 640);
-  else
-    v22 = 0;
-  v2->pMemBlocks[9] = v22;
-  v23 = (stru12_MemoryBlock *)operator new(8u);
-  if ( v23 )
-    v24 = AllocAlignedMem(v23, 640);
-  else
-    v24 = 0;
-  v2->pMemBlocks[10] = v24;
-  v25 = (stru12_MemoryBlock *)operator new(8u);
-  if ( v25 )
-    v26 = AllocAlignedMem(v25, 640);
-  else
-    v26 = 0;
-  v2->field_8C = 0;
-  v2->pMemBlocks[11] = v26;*/
 }
 
 //----- (00489810) --------------------------------------------------------
@@ -1604,41 +1530,6 @@
 {
   for (int i = 0; i < 12; ++i)
     delete pMemBlocks[i];
-  /*if ( v2 )
-    stru12_MemoryBlock::dtor(v2, 1);
-  v3 = v1->pMemBlocks[1];
-  if ( v3 )
-    stru12_MemoryBlock::dtor(v3, 1);
-  v4 = v1->pMemBlocks[2];
-  if ( v4 )
-    stru12_MemoryBlock::dtor(v4, 1);
-  v5 = v1->pMemBlocks[3];
-  if ( v5 )
-    stru12_MemoryBlock::dtor(v5, 1);
-  v6 = v1->pMemBlocks[4];
-  if ( v6 )
-    stru12_MemoryBlock::dtor(v6, 1);
-  v7 = v1->pMemBlocks[5];
-  if ( v7 )
-    stru12_MemoryBlock::dtor(v7, 1);
-  v8 = v1->pMemBlocks[6];
-  if ( v8 )
-    stru12_MemoryBlock::dtor(v8, 1);
-  v9 = v1->pMemBlocks[7];
-  if ( v9 )
-    stru12_MemoryBlock::dtor(v9, 1);
-  v10 = v1->pMemBlocks[8];
-  if ( v10 )
-    stru12_MemoryBlock::dtor(v10, 1);
-  v11 = v1->pMemBlocks[9];
-  if ( v11 )
-    stru12_MemoryBlock::dtor(v11, 1);
-  v12 = v1->pMemBlocks[10];
-  if ( v12 )
-    stru12_MemoryBlock::dtor(v12, 1);
-  v13 = v1->pMemBlocks[11];
-  if ( v13 )
-    stru12_MemoryBlock::dtor(v13, 1);*/
 }
 
 //----- (004898BF) --------------------------------------------------------
@@ -1787,16 +1678,12 @@
 }
 
 //----- (0048B561) --------------------------------------------------------
-int _48B561_mess_with_scaling_along_z(/*int a1, */float a2)
+int fixpoint_from_float(float val)
 {
-  //v2 = a2 - 0.5;
-  //v3 = v2 + 6.7553994e15;
-  int v4 = floorf((a2 - 0.5f) + 0.5f);
-  //v7 = (a2 - (double)SLODWORD(v3)) * 65536.0;
-  //v5 = v7 + 6.7553994e15;
-  //return LODWORD(v5) | (v4 << 16);
-  int v5 = floorf((a2 - v4) * 65536.0f + 0.5f);
-  return v5 | (v4 << 16);
+  //  float X.Yf -> int XXXX YYYY
+  int left = floorf((val - 0.5f) + 0.5f);
+  int right = floorf((val - left) * 65536.0f);
+  return (left << 16) | right;
 }
 
 //----- (00491E3A) --------------------------------------------------------
--- a/mm7_5.cpp	Tue May 21 15:17:09 2013 +0600
+++ b/mm7_5.cpp	Tue May 21 15:17:18 2013 +0600
@@ -5371,7 +5371,7 @@
        sinf_x = sinf(3.14159265f * sRotX / 1024.0f),
        cosf_y = cosf(3.14159265f * sRotY / 1024.0f),
        sinf_y = sinf(3.14159265f * sRotY / 1024.0f);
- sDepth = 14000000;
+ //sDepth = 14000000;
  *outx = v.x + ((unsigned __int64)(sinf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16)));
  *outy = v.y + ((unsigned __int64)(cosf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16)));
  *outz = v.z + ((unsigned __int64)(sinf_x * (signed __int64)sDepth) >> 16);
--- a/mm7_data.h	Tue May 21 15:17:09 2013 +0600
+++ b/mm7_data.h	Tue May 21 15:17:18 2013 +0600
@@ -1905,7 +1905,6 @@
 bool __fastcall HSV2RGB(float *a1, float *a2, float *a3, float a4, float a5, float a6);
 void __fastcall RGB2HSV(float *a1, float *a2, float a3, float a4, float a5, float *a6);
 unsigned int ReplaceHSV(unsigned int uColor, float a2, float gamma, float a4);
-int _48B561_mess_with_scaling_along_z(/*int a1, */float a2);
 signed int __cdecl PlayerCreation_Chose4Skills();
 signed int __cdecl PlayerCreation_ComputeAttributeBonus();
 void LoadPlayerPortraintsAndVoices();
@@ -2021,6 +2020,7 @@
 int fixpoint_sub0(int, int);
 int fixpoint_div(int, int);
 int fixpoint_mul(int, int);
+int fixpoint_from_float(float value);
 
 
 #define ErrD3D(hr) do {extern void ErrHR(HRESULT, const char *, const char *, const char *, int); ErrHR(hr, "Direct3D", __FUNCTION__, __FILE__, __LINE__);} while(0)
--- a/stru6.cpp	Tue May 21 15:17:09 2013 +0600
+++ b/stru6.cpp	Tue May 21 15:17:18 2013 +0600
@@ -711,7 +711,7 @@
     v4 = (double)v2 * 0.0001953125 + 0.2;
   }
   v5 = v4;
-  return _48B561_mess_with_scaling_along_z(/*v2, */v5);
+  return fixpoint_from_float(v5);
 }
 
 //----- (004A80DC) --------------------------------------------------------