changeset 840:6dd2b94efce7

DrawFan
author Ritor1
date Fri, 29 Mar 2013 10:43:46 +0600
parents d061180f2b42
children 1b88950ff369
files Render.cpp mm7_3.cpp
diffstat 2 files changed, 36 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/Render.cpp	Thu Mar 28 00:37:58 2013 +0400
+++ b/Render.cpp	Fri Mar 29 10:43:46 2013 +0600
@@ -7601,12 +7601,12 @@
 //----- (004A2DA3) --------------------------------------------------------
 void Render::DrawStrip(unsigned int uNumVertices, struct stru148 *a3, IDirect3DTexture2 *pTexture)
 {
-  int v4; // ebx@1
+  //int v4; // ebx@1
   int v7; // eax@7
   float v12; // ST3C_4@8
  int i;
 
-  v4 = (int)this;
+  //v4 = (int)this;
  if (!this->uNumD3DSceneBegins)
    return;
 
@@ -7639,19 +7639,20 @@
    pVertices[i].texcoord.y = array_50AC10[i].v;
   }
   pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture);
-  pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT);
+  pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, 
+    pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT);
  }
 }
 
 //----- (004A2DA3) --------------------------------------------------------
 void Render::DrawFan(unsigned int uNumVertices, stru148 *a3, IDirect3DTexture2 *pTexture)
 {
-  int v4; // ebx@1
+  //int v4; // ebx@1
   int v7; // eax@7
   float v13; // ST3C_4@8
   int i;
 
-  v4 = (int)this;
+  //v4 = (int)this;
   if ( !this->uNumD3DSceneBegins )
     return;
   if ( uNumVertices >= 3 )
@@ -7663,14 +7664,14 @@
       this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE);
       this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO);
     }
-    for (i = 0; i < uNumVertices; ++i)
+    for ( i = 0; i < uNumVertices; ++i )
     {
       pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX;
       pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY;
       pVertices[i].pos.z = 0.99989998;
       pVertices[i].rhw = array_50AC10[i]._rhw;
 
-      pVertices[i].diffuse = GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0);
+      pVertices[i].diffuse = ::GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0);
       v7 = 0;
       if (this->bUsingSpecular)
       {
@@ -7683,7 +7684,7 @@
     }
     pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture);
     pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
-    pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT);
+      pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT);
   }
 }
 
--- a/mm7_3.cpp	Thu Mar 28 00:37:58 2013 +0400
+++ b/mm7_3.cpp	Fri Mar 29 10:43:46 2013 +0600
@@ -6035,12 +6035,12 @@
   array_50AC10[1].vWorldViewProjY = v38;
 
   array_50AC10[2].vWorldViewProjX = pViewport->uViewportBR_X;
-  array_50AC10[2].vWorldViewProjY = pViewport->uViewportTL_Y;
+  array_50AC10[2].vWorldViewProjY = v38;
 
   array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X;
-  array_50AC10[3].vWorldViewProjY = v38;
-
-  /*v36 = (double)(pViewport->uViewportZ - pViewport->uViewportX) * 0.5;
+  array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y;
+
+  v36 = (double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5;
   v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5);
 
   for (int i = 0; i < _this.uNumVertices; ++i)
@@ -6060,10 +6060,10 @@
       v10 = 0;
       v39 = 0;
     }
-    v11 = (signed __int64)array_50AC10[i].vWorldViewProjX;
+    //v11 = (signed __int64)array_50AC10[i].vWorldViewProjX;
     v38 = v10;
     v12 = array_50AC10[i].vWorldViewProjY - 1.0;
-    v13 = v33 * (pViewport->uScreenCenterX - v11);
+    v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX);
     v34 = -_this.field_24;
     v32 = (signed __int64)v12;
     v14 = v33 * (v30 - v32);
@@ -6083,7 +6083,7 @@
       }
       v37 = abs(v34 >> 14);
       v15 = abs(v10);
-      if ( v37 <= v15 || v32 <= pViewport->uViewportY )
+      if ( v37 <= v15 || v32 <= pViewport->uViewportTL_Y )
       {
         if ( v39 <= 0 )
           break;
@@ -6108,38 +6108,28 @@
     v36 += ((unsigned __int64)(_this.ptr_38->field_1C * v13) >> 16);
     v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v37 * v18) >> 16) / 8;
     v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v36 * v18) >> 16) / 8;
-	*/
+
     //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
-    //array_50AC10[i]._rhw = 1;
-    //array_50AC10[i].u = (double)v35 / (65536.0 * pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID].uTextureWidth);
-    //array_50AC10[i].v = (double)v36 / (65536.0 * pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID].uTextureWidth);
-    //}
-    if ( _this.uNumVertices > 0)
-    {
-      float t = (GetTickCount() % 96000) / 96000.0f;
-
-      array_50AC10[0].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
-      array_50AC10[0]._rhw = 1;
-      array_50AC10[0].u = 0;
-      array_50AC10[0].v = 0 + t;
-
-      array_50AC10[1].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
-      array_50AC10[1]._rhw = 1;
-      array_50AC10[1].u = 0;
-      array_50AC10[1].v = 1 + t;
-
-      array_50AC10[2].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
-      array_50AC10[2]._rhw = 1;
-      array_50AC10[2].u = 1;
-      array_50AC10[2].v = 0 + t;
-
-      array_50AC10[3].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
-      array_50AC10[3]._rhw = 1;
-      array_50AC10[3].u = 1;
-      array_50AC10[3].v = 1 + t;
-      pRenderer->DrawStrip(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]);
+    //array_50AC10[i].vWorldPosition.x = v36 / (_this.pTexture->uTextureHeight * 65536.0);
+    //array_50AC10[i].vWorldPosition.y = 1.0 / (pOutdoorCamera->shading_dist_mist >> 16);
+    //array_50AC10[i].vWorldPosition.z = v35 / (_this.pTexture->uTextureWidth * 65536.0);
+    array_50AC10[i]._rhw = 1;
+    //array_50AC10[i].u = (double)v35 / (65536.0 * _this.pTexture->uTextureWidth);
+    //array_50AC10[i].v = (double)v36 / (65536.0 * _this.pTexture->uTextureHeight);
+    //float t = (GetTickCount() % 96000) / 96000.0f;
+    //array_50AC10[i].u += t;
+    if ( i  == _this.uNumVertices - 1 )
+    {
+      pRenderer->DrawFan(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]);
+
+      //array_50AC10[0].vWorldViewProjY = v38;
+      //array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0;
+      //array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0;
+      //array_50AC10[3].vWorldViewProjY = v38;
+
+      pRenderer->DrawFan(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]);
       return;
-    //}
+    }
   }
 }