diff mm7_3.cpp @ 724:737d7fec67f0

Слияние
author Ritor1
date Thu, 21 Mar 2013 16:09:59 +0600
parents 256211e8243a af5771589d22
children 9d13d2ec35a6
line wrap: on
line diff
--- a/mm7_3.cpp	Thu Mar 21 16:09:44 2013 +0600
+++ b/mm7_3.cpp	Thu Mar 21 16:09:59 2013 +0600
@@ -11173,19 +11173,19 @@
   char v16; // zf@18
   IndoorCameraD3D **v17; // eax@19
   double v18; // st7@19
-  float v19; // eax@19
+  //float v19; // eax@19
   signed __int64 v20; // qtt@19
   signed __int64 v21; // qtt@20
-  int v22; // edx@21
-  int v23; // eax@21
+  //int v22; // edx@21
+  //int v23; // eax@21
   Particle_sw local_0; // [sp+Ch] [bp-A0h]@3
-  double v25; // [sp+74h] [bp-38h]@19
-  unsigned int v26; // [sp+7Ch] [bp-30h]@1
+  //double v25; // [sp+74h] [bp-38h]@19
+  //unsigned int v26; // [sp+7Ch] [bp-30h]@1
   int a2; // [sp+80h] [bp-2Ch]@5
   int a3; // [sp+84h] [bp-28h]@5
   int a1; // [sp+88h] [bp-24h]@5
   int v30; // [sp+8Ch] [bp-20h]@7
-  float v31; // [sp+90h] [bp-1Ch]@1
+  //float v31; // [sp+90h] [bp-1Ch]@1
   int a5; // [sp+94h] [bp-18h]@17
   int z; // [sp+98h] [bp-14h]@15
   int a6; // [sp+9Ch] [bp-10h]@17
@@ -11193,17 +11193,37 @@
   int x; // [sp+A4h] [bp-8h]@15
   int v37; // [sp+A8h] [bp-4h]@5
 
-  v26 = uDecorationID;
-  LODWORD(v31) = uSectorID;
+  //v26 = uDecorationID;
+  //LODWORD(v31) = uSectorID;
   v2 = &pLevelDecorations[uDecorationID];
-  if ( !(v2->field_2 & 0x20) )
-  {
+  if (v2->field_2 & 0x20)
+    return;
+
     v3 = &pDecorationList->pDecorations[v2->uDecorationDescID];
     v4 = v3->uFlags;
-    if ( (char)v4 >= 0 )
-    {
-      if ( !(v4 & DECORATION_DONT_DRAW) )
-      {
+    if (v3->uFlags & DECORATION_EMITS_FIRE)
+    {
+      memset(&local_0, 0, 0x68u);               // fire,  like at the Pit's tavern
+      v5 = (double)v2->vPosition.x;
+      local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
+      local_0.uDiffuse = 0xFF3C1E;
+      local_0.x = v5;
+      local_0.y = (double)v2->vPosition.y;
+      local_0.z = (double)v2->vPosition.z;
+      local_0.flt_10 = 0.0;
+      local_0.flt_14 = 0.0;
+      local_0.flt_18 = 0.0;
+      local_0.flt_28 = 1.0;
+      local_0.timeToLive = (rand() & 0x80) + 128;
+      local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01");
+      pGame->pParticleEngine->AddParticle(&local_0);
+      return;
+    }
+
+
+      if (v4 & DECORATION_DONT_DRAW)
+        return;
+
         v6 = v2->vPosition.x;
         v7 = v2->vPosition.z;
         a2 = v2->vPosition.y;
@@ -11214,7 +11234,7 @@
            - stru_5C6E00->Atan2(v6 - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y);
         v37 = pBLVRenderParams->field_0_timer_;
         v9 = ((signed int)(stru_5C6E00->uIntegerPi + v8) >> 8) & 7;
-        if ( pParty->bTurnBasedModeOn == 1 )
+        if (pParty->bTurnBasedModeOn)
           v37 = pMiscTimer->uTotalGameTimeElapsed;
         v10 = abs(v2->vPosition.x + v2->vPosition.y);
         v11 = pSpriteFrameTable->GetFrame(v3->uSpriteID, v37 + v10);
@@ -11235,23 +11255,24 @@
           if ( v14 >= abs(y) )
           {
             pGame->pIndoorCameraD3D->Project(x, y, z, &a5, &a6);
+
             v15 = &pBillboardRenderList[uNumBillboardsToDraw];
-            if ( (signed int)uNumBillboardsToDraw < 500 )
-            {
+            assert(uNumBillboardsToDraw < 500);
+
               ++uNumBillboardsToDraw;
               ++uNumDecorationsDrawnThisFrame;
               v16 = pRenderer->pRenderD3D == 0;
               v15->uHwSpriteID = v12->pHwSpriteIDs[v9];
               v15->uPalette = v12->uPaletteIndex;
-              v15->uIndoorSectorID = LOWORD(v31);
+              v15->uIndoorSectorID = uSectorID;
               if ( v16 )
               {
                 LODWORD(v21) = pBLVRenderParams->field_40 << 16;
                 HIDWORD(v21) = pBLVRenderParams->field_40 >> 16;
                 v37 = v21 / x;
-                LODWORD(v31) = v12->scale;
+                //LODWORD(v31) = v12->scale;
                 v37 = v21 / x;
-                v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(SLODWORD(v31) * v21 / x) >> 16;
+                v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v12->scale * v21 / x) >> 16;
                 v37 = (unsigned __int64)(v12->scale * (signed __int64)v37) >> 16;
               }
               else
@@ -11259,24 +11280,27 @@
                 v17 = &pGame->pIndoorCameraD3D;
                 v15->fov_x = pGame->pIndoorCameraD3D->fov_x;
                 v18 = (*v17)->fov_y;
-                v19 = v15->fov_x;
+                //v19 = v15->fov_x;
                 v15->fov_y = v18;
-                v31 = v19;
-                v25 = v19 + 6.7553994e15;
+                //v31 = v19;
+                //v25 = v19 + 6.7553994e15;
+                //v25 = floorf(v15->fov_x + 0.5f);
                 LODWORD(v20) = 0;
-                HIDWORD(v20) = SLOWORD(v25);
+                HIDWORD(v20) = floorf(v15->fov_x + 0.5f);
                 v37 = v20 / x;
-                LODWORD(v31) = v12->scale;
-                v37 = (unsigned __int64)(SLODWORD(v31) * v20 / x) >> 16;
-                v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(SLODWORD(v31) * v20 / x) >> 16;
-                v31 = v15->fov_y;
-                v25 = v31 + 6.7553994e15;
+                //LODWORD(v31) = v12->scale;
+                v37 = (unsigned __int64)(v12->scale * v20 / x) >> 16;
+                v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v12->scale * v20 / x) >> 16;
+                //v31 = v15->fov_y;
+                //v25 = v31 + 6.7553994e15;
+                //v25 = floorf(v15->fov_y + 0.5f);
                 LODWORD(v20) = 0;
-                HIDWORD(v20) = SLOWORD(v25);
+                HIDWORD(v20) = floorf(v15->fov_y + 0.5f);
                 v37 = v20 / x;
                 v37 = (unsigned __int64)(v12->scale * v20 / x) >> 16;
               }
-              HIWORD(v22) = HIWORD(x);
+              //HIWORD(v22) = HIWORD(x);
+              //LOWORD(v22) = 0;
               v15->_screenspace_y_scaler_packedfloat = v37;
               v15->field_1E = v30;
               v15->world_x = a1;
@@ -11284,39 +11308,17 @@
               v15->world_z = a3;
               v15->uScreenSpaceX = a5;
               v15->uScreenSpaceY = a6;
-              v23 = 8 * v26;
-              LOBYTE(v23) = 8 * v26 | OBJECT_Decoration;
-              LOWORD(v22) = 0;
+              //v23 = 8 * uDecorationID;
+              //LOBYTE(v23) = 8 * uDecorationID | OBJECT_Decoration;
 
               //v15->sZValue = v22 + v23;
               v15->actual_z = HIWORD(x);
-              v15->object_pid = 8 * v26 | OBJECT_Decoration;
+              v15->object_pid = 8 * uDecorationID | OBJECT_Decoration;
 
               v15->uTintColor = 0;
               v15->pSpriteFrame = v12;
-            }
-          }
-        }
-      }
-    }
-    else
-    {
-      memset(&local_0, 0, 0x68u);               // fire,  like at the Pit's tavern
-      v5 = (double)v2->vPosition.x;
-      local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
-      local_0.uDiffuse = 0xFF3C1E;
-      local_0.x = v5;
-      local_0.y = (double)v2->vPosition.y;
-      local_0.z = (double)v2->vPosition.z;
-      local_0.flt_10 = 0.0;
-      local_0.flt_14 = 0.0;
-      local_0.flt_18 = 0.0;
-      local_0.flt_28 = 1.0;
-      local_0.timeToLive = (rand() & 0x80) + 128;
-      local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01");
-      pGame->pParticleEngine->AddParticle(&local_0);
-    }
-  }
+          }
+        }
 }
 
 
@@ -11334,15 +11336,15 @@
   int v9; // ecx@12
   unsigned __int16 v10; // ax@12
   int *v11; // eax@20
-  char v12; // zf@26
-  int v18; // ST5C_4@27
+  //char v12; // zf@26
+  __int64 v18; // ST5C_4@27
   signed __int64 v19; // qtt@28
   int v20; // ST5C_4@28
-  int v21; // edx@29
+  //int v21; // edx@29
   __int16 v22; // ax@29
-  int v23; // eax@29
+  //int v23; // eax@29
   SpriteFrame *v24; // [sp+1Ch] [bp-40h]@12
-  __int16 a5; // [sp+28h] [bp-34h]@12
+  //__int16 a5; // [sp+28h] [bp-34h]@12
   int a6; // [sp+2Ch] [bp-30h]@12
   int a2; // [sp+30h] [bp-2Ch]@12
   int a1; // [sp+34h] [bp-28h]@12
@@ -11369,7 +11371,7 @@
             && (v2 < 811 || v2 >= 815)
             || pGame->pStru6Instance->_4A81CA(p))
           {
-            a5 = p->uSectorID;
+            //a5 = p->uSectorID;
             a1 = p->vPosition.x;
             a2 = p->vPosition.y;
             a3 = p->vPosition.z;
@@ -11389,8 +11391,7 @@
             if ( v30 & 0x20 )
             {
               v8 = v30;
-              a3 -= (signed int)((unsigned __int64)(v5->scale
-                                                  * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1;
+              a3 -= (signed int)((unsigned __int64)(v5->scale * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1;
             }
             v34 = 0;
             if ( v8 & 2 )
@@ -11409,7 +11410,7 @@
                 a1,
                 a2,
                 a3,
-                a5,
+                p->uSectorID,
                 a6,
                 v1->uParticleTrailColorR,
                 v1->uParticleTrailColorG,
@@ -11426,15 +11427,27 @@
                    1) )
             {
               pGame->pIndoorCameraD3D->Project(x, y, z, &v36, &v35);
-              if ( (signed int)uNumBillboardsToDraw >= 500 )
-                return;
+
+              assert(uNumBillboardsToDraw < 500);
+              //if ( (signed int)uNumBillboardsToDraw >= 500 )
+              //  return;
               ++uNumBillboardsToDraw;
               ++uNumSpritesDrawnThisFrame;
               p->uAttributes |= 1u;
-              v12 = pRenderer->pRenderD3D == 0;
+              //v12 = pRenderer->pRenderD3D == 0;
               v3->uPalette = v24->uPaletteIndex;
-              v3->uIndoorSectorID = a5;
-              if ( v12 )
+              v3->uIndoorSectorID = p->uSectorID;
+              if ( pRenderer->pRenderD3D )
+              {
+                v3->fov_x = pGame->pIndoorCameraD3D->fov_x;
+                v3->fov_y = pGame->pIndoorCameraD3D->fov_y;
+                LODWORD(v18) = 0;
+                HIDWORD(v18) = (int)floorf(v3->fov_x + 0.5f);
+                v18 = v18 / x;
+                v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v18) >> 16;
+                v31 = (unsigned __int64)(v24->scale * v18) >> 16;
+              }
+              else
               {
                 LODWORD(v19) = pBLVRenderParams->field_40 << 16;
                 HIDWORD(v19) = pBLVRenderParams->field_40 >> 16;
@@ -11442,15 +11455,8 @@
                 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v19 / x) >> 16;
                 v31 = (unsigned __int64)(v24->scale * (signed __int64)v20) >> 16;
               }
-              else
-              {
-                v3->fov_x = pGame->pIndoorCameraD3D->fov_x;
-                v3->fov_y = pGame->pIndoorCameraD3D->fov_y;
-                v18 = (int)floorf(v3->fov_x + 0.5f) / x;
-                v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * (__int64)v18) >> 16;
-                v31 = (unsigned __int64)(v24->scale * (__int64)v18) >> 16;
-              }
-              HIWORD(v21) = HIWORD(x);
+              //HIWORD(v21) = HIWORD(x);
+              //LOWORD(v21) = 0;
               v3->_screenspace_y_scaler_packedfloat = v31;
               v3->field_1E = v34;
               v3->world_x = a1;
@@ -11460,13 +11466,14 @@
               v22 = v35;
               v3->uTintColor = 0;
               v3->uScreenSpaceY = v22;
-              LOWORD(v21) = 0;
-              v23 = 8 * i;
-              LOBYTE(v23) = 8 * i | OBJECT_Item;
+              //v23 = 8 * i;
+              //LOBYTE(v23) = 8 * i | OBJECT_Item;
               v3->pSpriteFrame = v24;
-              v12 = (p->uAttributes & 0x20) == 0;
-              v3->sZValue = v21 + v23;
-              if ( !v12 )
+              //v12 = (p->uAttributes & 0x20) == 0;
+              //v3->sZValue = v21 + v23;
+              v3->actual_z = HIWORD(x);
+              v3->object_pid = 8 * i | OBJECT_Item;
+              if (p->uAttributes & 0x20)
               {
                 if ( !pRenderer->pRenderD3D )
                   v3->sZValue = 0;