diff Render.cpp @ 1640:afc1c3514dd5

Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
author Nomad
date Tue, 17 Sep 2013 17:40:59 +0200
parents ccde94f02b75
children 466c5e15f524
line wrap: on
line diff
--- a/Render.cpp	Tue Sep 17 15:40:36 2013 +0200
+++ b/Render.cpp	Tue Sep 17 17:40:59 2013 +0200
@@ -516,7 +516,7 @@
       //v28 = v4;
       v36 = v4->uFlags;
       a6 = v4->uGlowRadius * object->field_22_glow_radius_multiplier;
-      v6 = stru_5C6E00->Atan2(object->vPosition.x - pODMRenderParams->vPartyPos.x, object->vPosition.y - pODMRenderParams->vPartyPos.y);
+      v6 = stru_5C6E00->Atan2(object->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, object->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
       //LOWORD(v7) = object->uFacing;
       //v8 = v36;
             v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7;
@@ -542,15 +542,15 @@
               //LOBYTE(v11) = byte_4E94D3;
               pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3);
             }
-            v12 = (x - pODMRenderParams->vPartyPos.x) << 16;
-            if (pODMRenderParams->rotation_x)
+            v12 = (x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16;
+            if (pGame->pIndoorCameraD3D->sRotationX)
             {
-              v13 = (y - pODMRenderParams->vPartyPos.y) << 16;
+              v13 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16;
               v30 = ((unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16)
                   + ((unsigned __int64)(v13 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16);
               v37 = (unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16;
               a6a = (unsigned __int64)(v13 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16;
-              v33 = (z - pODMRenderParams->vPartyPos.z) << 16;
+              v33 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16;
               v14 = (unsigned __int64)(v30 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16;
               v15 = (unsigned __int64)(v33 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16;
               v16 = v15 + v14;
@@ -566,17 +566,17 @@
             }
             else
             {
-              v34 = (y - pODMRenderParams->vPartyPos.y) << 16;
+              v34 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16;
               v19 = (unsigned __int64)(v12 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16;
               v20 = (unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16;
               v16 = v20 + v19;
               v42 = v20 + v19;
               if ( v20 + v19 >= 262144 && v16 <= pODMRenderParams->shading_dist_mist << 16 )
               {
-                v21 = (unsigned __int64)(((x - pODMRenderParams->vPartyPos.x) << 16) * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16;
+                v21 = (unsigned __int64)(((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16) * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16;
                 v17 = ((unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v21;
                 v40 = ((unsigned __int64)(v34 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - v21;
-                v18 = (z - pODMRenderParams->vPartyPos.z) << 16;
+                v18 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16;
 LABEL_29:
                 v31 = v18;
                 v22 = abs(v17);
@@ -996,8 +996,8 @@
           //v9 = v8;
           v42 = v8->uFlags;
           a5 = v8->uGlowRadius;
-          v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pODMRenderParams->vPartyPos.x,
-                                                       decor->vPosition.y - pODMRenderParams->vPartyPos.y);
+          v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x,
+                                                       decor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
           v11 = *((int *)v0 + 2);
           v37 = v10;
           v12 = v42;
@@ -1040,16 +1040,16 @@
               v16,
               byte_4E94D0);
           }
-          v17 = (decor->vPosition.x - pODMRenderParams->vPartyPos.x) << 16;
-          if (pODMRenderParams->rotation_x)
+          v17 = (decor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16;
+          if (pGame->pIndoorCameraD3D->sRotationX)
           {
-            v40 = (decor->vPosition.y - pODMRenderParams->vPartyPos.y) << 16;
+            v40 = (decor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16;
             v18 = ((unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16)
                 + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16);
             v42 = v18;
             b = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16;
             a5 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16;
-            v40 = (decor->vPosition.z - pODMRenderParams->vPartyPos.z) << 16;
+            v40 = (decor->vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16;
             v41 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16;
             v19 = (unsigned __int64)(v18 * (signed __int64)pODMRenderParams->camera_rotation_x_int_cosine) >> 16;
             v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_x_int_sine) >> 16);
@@ -1125,8 +1125,8 @@
           }
           else
           {
-            v42 = (decor->vPosition.x - pODMRenderParams->vPartyPos.x) << 16;
-            v40 = (decor->vPosition.y - pODMRenderParams->vPartyPos.y) << 16;
+            v42 = (decor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16;
+            v40 = (decor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16;
             b = (unsigned __int64)(v17 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16;
             a5 = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16;
             v20 = b + ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16);
@@ -1137,7 +1137,7 @@
               b = (unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16;
               v21 = ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - a5;
               v41 = ((unsigned __int64)(v40 * (signed __int64)pODMRenderParams->camera_rotation_y_int_cosine) >> 16) - a5;
-              v22 = (decor->vPosition.z - pODMRenderParams->vPartyPos.z) << 16;
+              v22 = (decor->vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16;
               goto LABEL_30;
             }
           }
@@ -5102,13 +5102,13 @@
       LODWORD(v80) = uNumVertices;
       do
       {
-        v69 = (GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x;
+        v69 = (GetTickCount() >> 5) - pGame->pIndoorCameraD3D->vPartyPos.x;
         *(float *)v54 = (double)v69 + *(float *)v54;
         *(float *)v54 = *(float *)v54 * 0.25;
         v55 = GetTickCount();
         v54 += 48;
         v44 = LODWORD(v80)-- == 1;
-        v68 = pBLVRenderParams->vPartyPos.y + (v55 >> 5);
+        v68 = pGame->pIndoorCameraD3D->vPartyPos.y + (v55 >> 5);
         *((float *)v54 - 11) = ((double)v68 + *((float *)v54 - 11)) * 0.25;
       }
       while ( !v44 );
@@ -5121,14 +5121,14 @@
     pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0);
     return;
   }
-  HIDWORD(v69) = pBLVRenderParams->sPartyRotX;
-  HIDWORD(v68) = pBLVRenderParams->vPartyPos.z;
+  HIDWORD(v69) = pGame->pIndoorCameraD3D->sRotationX;
+  HIDWORD(v68) = pGame->pIndoorCameraD3D->vPartyPos.z;
   *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY;
-  v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pBLVRenderParams->vPartyPos.z)
+  v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pGame->pIndoorCameraD3D->vPartyPos.z)
                        / (((double)pBLVRenderParams->field_40 + 16192.0)
                         * 65536.0)
                        + *(float *)&v74);
-  v5 = (double)pBLVRenderParams->sPartyRotX * 0.0030664064;
+  v5 = (double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064;
   *(float *)&v75 = v5;
   v80 = cos(v5) * 16192.0;
   v6 = (signed __int64)(*(float *)&v74
@@ -5145,10 +5145,10 @@
   v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0);
   if ( !v62.pTexture )
     return;
-  v8 = pBLVRenderParams->sPartyRotX;
+  v8 = pGame->pIndoorCameraD3D->sRotationX;
   v62.dimming_level = 0;
   v62.uNumVertices = v3;
-  v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX + 16);
+  v9 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);
   v62.v_18.y = 0;
   v62.v_18.x = -v9;
   v62.v_18.z = -stru_5C6E00->Cos(v8 + 16);