diff Render.cpp @ 1638:ccde94f02b75

class IndoorCamera split into BLVRenderParams and ODMRenderParams
author Nomad
date Tue, 17 Sep 2013 15:40:09 +0200
parents 2c71fa8913d2
children afc1c3514dd5
line wrap: on
line diff
--- a/Render.cpp	Tue Sep 17 14:10:41 2013 +0200
+++ b/Render.cpp	Tue Sep 17 15:40:09 2013 +0200
@@ -12,7 +12,6 @@
 #include "DecalBuilder.h"
 #include "ParticleEngine.h"
 #include "Render.h"
-#include "IndoorCamera.h"
 #include "Outdoor.h"
 #include "Party.h"
 #include "LOD.h"
@@ -517,7 +516,7 @@
       //v28 = v4;
       v36 = v4->uFlags;
       a6 = v4->uGlowRadius * object->field_22_glow_radius_multiplier;
-      v6 = stru_5C6E00->Atan2(object->vPosition.x - pIndoorCamera->pos.x, object->vPosition.y - pIndoorCamera->pos.y);
+      v6 = stru_5C6E00->Atan2(object->vPosition.x - pODMRenderParams->vPartyPos.x, object->vPosition.y - pODMRenderParams->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;
@@ -543,15 +542,15 @@
               //LOBYTE(v11) = byte_4E94D3;
               pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3);
             }
-            v12 = (x - pIndoorCamera->pos.x) << 16;
-            if ( pIndoorCamera->sRotationX )
+            v12 = (x - pODMRenderParams->vPartyPos.x) << 16;
+            if (pODMRenderParams->rotation_x)
             {
-              v13 = (y - pIndoorCamera->pos.y) << 16;
+              v13 = (y - pODMRenderParams->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 - pIndoorCamera->pos.z) << 16;
+              v33 = (z - pODMRenderParams->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;
@@ -567,17 +566,17 @@
             }
             else
             {
-              v34 = (y - pIndoorCamera->pos.y) << 16;
+              v34 = (y - pODMRenderParams->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 - pIndoorCamera->pos.x) << 16) * (signed __int64)pODMRenderParams->camera_rotation_y_int_sine) >> 16;
+                v21 = (unsigned __int64)(((x - pODMRenderParams->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 - pIndoorCamera->pos.z) << 16;
+                v18 = (z - pODMRenderParams->vPartyPos.z) << 16;
 LABEL_29:
                 v31 = v18;
                 v22 = abs(v17);
@@ -636,8 +635,6 @@
     //while ( v41 < (signed int)uNumSpriteObjects );
   }
 }
-// 4E94D3: using guessed type char byte_4E94D3;
-// 5187E4: using guessed type int uNumSpritesDrawnThisFrame;
 
 //----- (0049D9BC) --------------------------------------------------------
 signed int __stdcall RenderD3D__DeviceEnumerator(GUID *lpGUID, const char *lpDevDesc, const char *lpDriverName, RenderD3D__DevInfo *pOut)
@@ -999,8 +996,8 @@
           //v9 = v8;
           v42 = v8->uFlags;
           a5 = v8->uGlowRadius;
-          v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pIndoorCamera->pos.x,
-                                                       decor->vPosition.y - pIndoorCamera->pos.y);
+          v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pODMRenderParams->vPartyPos.x,
+                                                       decor->vPosition.y - pODMRenderParams->vPartyPos.y);
           v11 = *((int *)v0 + 2);
           v37 = v10;
           v12 = v42;
@@ -1043,16 +1040,16 @@
               v16,
               byte_4E94D0);
           }
-          v17 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16;
-          if ( pIndoorCamera->sRotationX )
+          v17 = (decor->vPosition.x - pODMRenderParams->vPartyPos.x) << 16;
+          if (pODMRenderParams->rotation_x)
           {
-            v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16;
+            v40 = (decor->vPosition.y - pODMRenderParams->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 - pIndoorCamera->pos.z) << 16;
+            v40 = (decor->vPosition.z - pODMRenderParams->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);
@@ -1128,8 +1125,8 @@
           }
           else
           {
-            v42 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16;
-            v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16;
+            v42 = (decor->vPosition.x - pODMRenderParams->vPartyPos.x) << 16;
+            v40 = (decor->vPosition.y - pODMRenderParams->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);
@@ -1140,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 - pIndoorCamera->pos.z) << 16;
+              v22 = (decor->vPosition.z - pODMRenderParams->vPartyPos.z) << 16;
               goto LABEL_30;
             }
           }
@@ -1171,8 +1168,6 @@
   }
     //while ( v35 < (signed int)uNumLevelDecorations );
 }
-// 4E94D0: using guessed type char byte_4E94D0;
-// 5187EC: using guessed type int uNumDecorationsDrawnThisFrame;
 
 //----- (0049D717) --------------------------------------------------------
 HRESULT __stdcall D3DZBufferFormatEnumerator(DDPIXELFORMAT *Src, DDPIXELFORMAT *Dst)
@@ -4920,7 +4915,8 @@
       }
     }
 
-    if (pIndoorCamera->flags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES || pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES)
+    //if (pIndoorCamera->flags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES || pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES)
+    if (pODMRenderParams->flags & ODM_RENDER_DRAW_TERRAIN_OUTLINES)
       pGame->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, uNumVertices, 0x00FFFFFF, 0.0);
   }
 // 4A26BC: could not find valid save-restore pair for esi
@@ -5125,14 +5121,14 @@
     pRenderer->DrawIndoorPolygon(v3, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], v58, v57, -1, 0);
     return;
   }
-  HIDWORD(v69) = pIndoorCamera->sRotationX;
-  HIDWORD(v68) = pIndoorCamera->pos.z;
+  HIDWORD(v69) = pBLVRenderParams->sPartyRotX;
+  HIDWORD(v68) = pBLVRenderParams->vPartyPos.z;
   *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY;
   v70 = (signed __int64)((double)(pBLVRenderParams->field_40 * pBLVRenderParams->vPartyPos.z)
                        / (((double)pBLVRenderParams->field_40 + 16192.0)
                         * 65536.0)
                        + *(float *)&v74);
-  v5 = (double)pIndoorCamera->sRotationX * 0.0030664064;
+  v5 = (double)pBLVRenderParams->sPartyRotX * 0.0030664064;
   *(float *)&v75 = v5;
   v80 = cos(v5) * 16192.0;
   v6 = (signed __int64)(*(float *)&v74