changeset 121:3471df3713e2

Teal line at game's viewport bottom fix
author Nomad
date Mon, 11 Feb 2013 17:29:51 +0200
parents fe0e317c0de0
children 48bea61a12a5 fa3b930d0ccf
files Game.cpp Outdoor.cpp Render.cpp mm7_4.cpp
diffstat 4 files changed, 20 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/Game.cpp	Sun Feb 10 23:43:28 2013 +0200
+++ b/Game.cpp	Mon Feb 11 17:29:51 2013 +0200
@@ -1,3 +1,5 @@
+#include <assert.h>
+
 #include "Game.h"
 #include "Party.h"
 #include "IndoorCamera.h"
@@ -104,6 +106,7 @@
         pIndoor->Draw();
       else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
         pOutdoor->Draw();
+      else assert(false);
 
       if (pRenderer->pRenderD3D)
       {
--- a/Outdoor.cpp	Sun Feb 10 23:43:28 2013 +0200
+++ b/Outdoor.cpp	Mon Feb 11 17:29:51 2013 +0200
@@ -47,13 +47,13 @@
 void OutdoorLocation::ExecDraw(unsigned int bRedraw)
 {
   int v1; // edi@1
-  unsigned int v2; // ebx@1
+  //unsigned int v2; // ebx@1
   int v3; // ST18_4@3
   int v4; // ST04_4@19
   int v5; // eax@19
 
   v1 = 0;
-  v2 = bRedraw;
+  //v2 = bRedraw;
   if ( viewparams->field_54 )
     v1 = 2;
   pIndoorCamera->sRotationX = pParty->sRotationX;
@@ -65,7 +65,7 @@
   pIndoorCamera->field_4C = v1;
   pIndoorCamera->pos.y = pParty->vPosition.y - pParty->y_rotation_granularity * ((stru_5C6E00->SinCos(pParty->sRotationY)) >> 16);
   pIndoorCamera->pos.z = pParty->vPosition.z + pParty->sEyelevel;
-  if ( v2 || pRenderer->pRenderD3D )
+  if (bRedraw || pRenderer->pRenderD3D)
   {
     ResetStru148s();
     pOutdoorCamera->RotationToInts();
@@ -73,7 +73,7 @@
   }
   pIndoorCamera->uMapGridCellX = WorldPosToGridCellX(pParty->vPosition.x);
   pIndoorCamera->uMapGridCellZ = WorldPosToGridCellZ(pParty->vPosition.y);
-  if ( v2 )
+  if (bRedraw)
   {
     Software_ResetNewEdges();
     sub_487DA9();
@@ -84,7 +84,7 @@
     pOutdoor->UpdateSunlightVectors();
   pOutdoor->UpdateFog();
   pGame->pIndoorCameraD3D->Reset_list_0037C();
-  if ( !v2 )
+  if (!bRedraw)
   {
     if ( !pRenderer->pRenderD3D )
     {
@@ -97,7 +97,7 @@
 		pRenderer->RenderTerrainD3D();//pRenderer->DrawBezierTerrain();// Ritor1: temporarily lag
 	}
   }
-  else if ( pRenderer->pRenderD3D )
+  else if (pRenderer->pRenderD3D)
   {
     pRenderer->DrawSkyD3D();
     pRenderer->DrawBuildingsD3D();
@@ -119,7 +119,7 @@
   }
   pGame->PushStationaryLights(-1);
   pGame->PrepareBloodsplats();
-  if ( v2 )
+  if (bRedraw)
   {
     v4 = WorldPosToGridCellZ(pParty->vPosition.y);
     v5 = WorldPosToGridCellX(pParty->vPosition.x);
@@ -147,12 +147,11 @@
 //----- (00441CFF) --------------------------------------------------------
 void OutdoorLocation::Draw()
 {
-  unsigned int v0; // ecx@1
+  bool redrawWorld = true;
+  if ( !(pParty->uFlags & 2) && !(pGame->uFlags2 & 1) )
+    redrawWorld = false;
+  pOutdoor->ExecDraw(redrawWorld);
 
-  v0 = 1;
-  if ( !(pParty->uFlags & 2) && !(pGame->uFlags2 & 1) )
-    v0 = 0;
-  pOutdoor->ExecDraw(v0);
   pGame->DrawParticles();
   pWeather->Draw();
   array_5118E8._440F07();
--- a/Render.cpp	Sun Feb 10 23:43:28 2013 +0200
+++ b/Render.cpp	Mon Feb 11 17:29:51 2013 +0200
@@ -1735,7 +1735,7 @@
   int v63; // [sp+50h] [bp-8h]@3
   int v64; // [sp+57h] [bp-1h]@2
   int v62;
-  struct IndoorCameraD3D *pIndoorCameraD3D;
+  //struct IndoorCameraD3D *pIndoorCameraD3D;
 
   v63 = 0;
   // basic optimizations
@@ -1771,9 +1771,9 @@
       pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * 512;
       pTerrainVertices[z * 128 + x].vWorldPosition.y = (64 - (signed)z) * 512;
       pTerrainVertices[z * 128 + x].vWorldPosition.z = 32 * pOutdoor->pTerrain.pHeightmap[z * 128 + x];
-      pIndoorCameraD3D = pGame->pIndoorCameraD3D;
-      pIndoorCameraD3D->ViewTransform(&pTerrainVertices[z * 128 + x], 1);
-      pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0);
+      //pIndoorCameraD3D = pGame->pIndoorCameraD3D;
+      pGame->pIndoorCameraD3D->ViewTransform(&pTerrainVertices[z * 128 + x], 1);
+      pGame->pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0);
     }
   }
   for (unsigned int z = uStartZ; z < uEndZ - 1; ++z)
--- a/mm7_4.cpp	Sun Feb 10 23:43:28 2013 +0200
+++ b/mm7_4.cpp	Mon Feb 11 17:29:51 2013 +0200
@@ -6827,7 +6827,7 @@
                  pSrc + 8 + 460/*462*/ + y * 640, 174/*172*/ * sizeof(__int16));
         }
 
-        for (uint y = 351/*352*/; y < 480; ++y)
+        for (uint y = 352; y < 480; ++y)
           memcpy(pDst + y * Dst.lPitch / 2,
                  pSrc + y * 640, 640 * sizeof(__int16));
 
@@ -6841,7 +6841,7 @@
         v22 = 4 * ((Dst.lPitch / 4) + v9);
         v21 = 4 * v9 + 1280;
 
-        auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1;
+        //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1;
         //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1);
         v10 = (int)pSrc_x1y1;
         v11 = (int)pDst_x1y1;