changeset 75:6ef241d53522

28.01.13
author Ritor1
date Mon, 28 Jan 2013 14:52:05 +0600
parents 3b4f8bd48e3b
children 5b9ef61560cf
files Game.cpp Render.cpp mm7_3.cpp
diffstat 3 files changed, 32 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/Game.cpp	Fri Jan 25 16:48:21 2013 +0600
+++ b/Game.cpp	Mon Jan 28 14:52:05 2013 +0600
@@ -78,10 +78,10 @@
 		| pParty->sRotationX != pParty->sPrevRotationX | pParty->vPosition.z != pParty->vPrevPosition.z | pParty->sEyelevel != pParty->sPrevEyelevel )
       pParty->uFlags |= 2u;
     pParty->vPrevPosition = pParty->vPosition;
-    //pParty->vPrevPosition.y = pParty->vPosition.y;
+    pParty->vPrevPosition.y = pParty->vPosition.y;
     //v0 = &pRenderer;
     pParty->sPrevRotationY = pParty->sRotationY;
-    //pParty->vPrevPosition.z = pParty->vPosition.y;
+    pParty->vPrevPosition.z = pParty->vPosition.y;
     pParty->sPrevRotationX = pParty->sRotationX;
     pParty->sPrevEyelevel = pParty->sEyelevel;
     pRenderer->BeginSceneD3D();
--- a/Render.cpp	Fri Jan 25 16:48:21 2013 +0600
+++ b/Render.cpp	Mon Jan 28 14:52:05 2013 +0600
@@ -7131,7 +7131,7 @@
 void Render::DrawTerrainPolygon(unsigned int uNumVertices, stru148 *a4, IDirect3DTexture2 *a5, int a6, int a7)
 {
   RenderVertexSoft *pVertices; // esi@0
-  Render *v7; // edi@1
+  int v7; // edi@1
   unsigned int v8; // ebx@1
   LightmapBuilder *v9; // esi@3
   unsigned int v10; // edx@3
@@ -7193,42 +7193,47 @@
   unsigned int v66; // [sp+88h] [bp-4h]@40
   unsigned int a6a; // [sp+A0h] [bp+14h]@11
 
-  v7 = this;
+  v7 = (int)this;
   v8 = 0;
-  if ( this->uNumD3DSceneBegins && (signed int)uNumVertices >= 3 )
-  {
-    v61 = pVertices;
-    v9 = pGame->pLightmapBuilder;
+  if ( !this->uNumD3DSceneBegins )
+     return;
+  if ( uNumVertices < 3)
+     return;
+
+  v61 = pVertices;
+  /*  v9 = pGame->pLightmapBuilder;
     v65 = v9;
-    v10 = v9->std__vector_000004_size;
+    v10 = v9->std__vector_000004_size;*/
     if ( byte_4D864C && pGame->uFlags & 1 )
     {
       v11 = GetActorTintColor(a4->field_58, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0);
-      v9->_45D74F_MessWithLight(v11, 0);
+      pGame->pLightmapBuilder->_45D74F_MessWithLight(v11, 0);
     }
     else
     {
-      if ( a6 || !v10 || byte_4D864C && pGame->uFlags & 2 )
-      {
-        if ( (char)a7 )
+      if ( a6 || !pGame->pLightmapBuilder->std__vector_000004_size || 
+          byte_4D864C && pGame->uFlags & 2 )
+      {
+        if ( (_BYTE)a7 )
           v60 = 3;
         else
           v60 = 1;
-        ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, v60));
-        if ( a6 || v7->bUsingSpecular )
-        {
-          ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u));
-          //v49 = v7->pRenderD3D->pDevice;
+        this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, v60);
+        if ( a6 || this->bUsingSpecular )
+        {
+          this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1);
+          v49 = this->pRenderD3D->pDevice;
           //v50 = v49->lpVtbl;
           if ( a6 )
           {
-            ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 5));
-            ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 6));
+            this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 5);
+            //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 6);
           }
           else
           {
-            ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2));
-            ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1));
+            this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2);
+            //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1);
+            __debugbreak;//it's error
           }
 
         }
@@ -7250,7 +7255,7 @@
             v56 = a7;
             v57 = *(float *)v52;
             *(int *)(a7 + 12) = v55;
-            if ( v7->bUsingSpecular )
+            if ( this->bUsingSpecular )
             {
               v58 = v57;
               v59 = sub_47C3D7_get_fog_related_stuff(0, 0, v58);
@@ -7305,7 +7310,7 @@
             v17 = a7;
             v18 = *(float *)v13;
             *(int *)(a7 + 12) = v16;
-            if ( v7->bUsingSpecular )
+            if ( this->bUsingSpecular )
             {
               v19 = v18;
               v20 = sub_47C3D7_get_fog_related_stuff(0, 0, v19);
@@ -7387,7 +7392,7 @@
             }
             while ( v37 );
           }
-          ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0));
+          ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0));//problem
           ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 6u));
           ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 5u));
           ErrD3D(pRenderD3D->pDevice->DrawPrimitive(
@@ -7411,7 +7416,7 @@
     if ( pIndoorCamera->field_4C & 2 || pBLVRenderParams->uFlags & 2 )
       pGame->pIndoorCameraD3D->debug_outline_d3d(arary_77E5C8, uNumVertices, 0xFFFFFFu, 0.0);
   }
-}
+
 // 4A26BC: could not find valid save-restore pair for esi
 // 4D864C: using guessed type char byte_4D864C;
 
--- a/mm7_3.cpp	Fri Jan 25 16:48:21 2013 +0600
+++ b/mm7_3.cpp	Mon Jan 28 14:52:05 2013 +0600
@@ -7852,7 +7852,7 @@
  array_50AC10[3].u = 1;
  array_50AC10[3].v = 1 + t;
  pRenderer->DrawStrip(_this.uNumVertices, &_this,
-          pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]);//problem
+          pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]);
         return;
 }