diff Render.cpp @ 2014:7a2fc95f3b99

Слияние
author Ritor1
date Thu, 07 Nov 2013 09:19:10 +0600
parents bb1e7b0780d8 30c2b575d25c
children f1fd2ed4e9ba
line wrap: on
line diff
--- a/Render.cpp	Thu Nov 07 09:18:58 2013 +0600
+++ b/Render.cpp	Thu Nov 07 09:19:10 2013 +0600
@@ -128,6 +128,35 @@
   return v0;
 }
 
+void Render::sub_4A19B0()
+{
+  char *result; // eax@1
+  signed int v1; // ecx@1
+  /*
+  result = (char *)&this->pBillboardRenderListD3D[0].uOpacity;
+  v1 = 1000;
+  do
+  {
+    *(_DWORD *)result = 0;
+    *((_DWORD *)result + 1) = -1;
+    *((_DWORD *)result + 3) = -1;
+    *((_DWORD *)result - 34) = 4;
+    result += 156;
+    --v1;
+  }
+  while ( v1 );
+  */
+  for( int i = 0; i < 1000; i++ )
+  {
+	this->pBillboardRenderListD3D[i].uOpacity = (RenderBillboardD3D::OpacityType)0;
+	this->pBillboardRenderListD3D[i].field_90 = -1;
+	this->pBillboardRenderListD3D[i].sParentBillboardID = -1;
+	this->pBillboardRenderListD3D[i].uNumVertices = 4;
+  }
+
+  return;
+}
+
 //----- (00440CB8) --------------------------------------------------------
 void Render::DrawBillboardList_BLV()
 {
@@ -135,7 +164,7 @@
   int v5; // eax@11
   RenderBillboardTransform_local0 soft_billboard; // [sp+4h] [bp-50h]@1
 
-  soft_billboard.uParentBillboardID = -1;
+  soft_billboard.sParentBillboardID = -1;
   soft_billboard.pTarget = pBLVRenderParams->pRenderTarget;
   soft_billboard.pTargetZ = pBLVRenderParams->pTargetZBuffer;
   soft_billboard.uTargetPitch = pRenderer->uTargetSurfacePitch;
@@ -150,13 +179,13 @@
     RenderBillboard* p = &pBillboardRenderList[i];
 
       soft_billboard.uScreenSpaceX = p->uScreenSpaceX;
-      soft_billboard.uParentBillboardID = i;
+      soft_billboard.sParentBillboardID = i;
       soft_billboard.uScreenSpaceY = p->uScreenSpaceY;
       soft_billboard._screenspace_x_scaler_packedfloat = p->_screenspace_x_scaler_packedfloat;
       soft_billboard._screenspace_y_scaler_packedfloat = p->_screenspace_y_scaler_packedfloat;
       soft_billboard.sZValue = p->sZValue;
       soft_billboard.uFlags = p->field_1E;
-      soft_billboard.uTintColor = p->uTintColor;
+      soft_billboard.sTintColor = p->sTintColor;
       v2 = p->uHwSpriteID;
       if ( v2 != -1 )
       {
@@ -378,7 +407,7 @@
   //int v17; // [sp+5Ch] [bp-8h]@2
   int v18; // [sp+60h] [bp-4h]@13
 
-  billboard.uParentBillboardID = -1;
+  billboard.sParentBillboardID = -1;
   billboard.pTarget = pRenderer->pTargetSurface;
   billboard.pTargetZ = pRenderer->pActiveZBuffer;
   billboard.uTargetPitch = pRenderer->uTargetSurfacePitch;
@@ -394,9 +423,9 @@
 
     billboard.uScreenSpaceX = pBillboard->uScreenSpaceX;
     billboard.uScreenSpaceY = pBillboard->uScreenSpaceY;
-    billboard.uParentBillboardID = i;
+    billboard.sParentBillboardID = i;
     billboard._screenspace_x_scaler_packedfloat = pBillboard->_screenspace_x_scaler_packedfloat;
-    billboard.uTintColor = pBillboard->uTintColor;
+    billboard.sTintColor = pBillboard->sTintColor;
     billboard._screenspace_y_scaler_packedfloat = pBillboard->_screenspace_y_scaler_packedfloat;
     billboard.sZValue = pBillboard->sZValue;
     billboard.uFlags = pBillboard->field_1E;
@@ -618,7 +647,7 @@
                   v27 = (object->uAttributes & 0x20) == 0;
                   v3->sZValue = v26 + (PID(OBJECT_Item,i));
                   v3->dimming_level = 0;
-                  v3->uTintColor = 0;
+                  v3->sTintColor = 0;
                   if ( !v27 )
                   {
                     if ( !pRenderer->pRenderD3D )
@@ -1120,7 +1149,7 @@
                   v27->sZValue = v30 + v31;
                   v27->dimming_level = 0;
                   v27->pSpriteFrame = v8;
-                  v27->uTintColor = 0;
+                  v27->sTintColor = 0;
                 }
               }
               goto LABEL_38;
@@ -1849,7 +1878,7 @@
   unsigned int v55; // [sp+5Ch] [bp-Ch]@34
   unsigned int v56; // [sp+60h] [bp-8h]@12
   int v57; // [sp+60h] [bp-8h]@34
-  unsigned int a2; // [sp+64h] [bp-4h]@4
+  signed int a2; // [sp+64h] [bp-4h]@4
 
   v5 = this;
   v6 = 0;
@@ -1859,7 +1888,7 @@
     v53 = v7;
     v54 = v7->std__vector_000004_size;
     if ( v7->std__vector_000004_size)
-      a2 = 0xFFFFFFFF;
+      a2 = -1;
     pGame->AlterGamma_ODM(a4, &a2);
     if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01)
     {
@@ -2095,6 +2124,7 @@
 
   hd_water_tile_id = -1;
   hd_water_current_frame = 0;
+  sub_4A19B0();
 }
 
 bool Render::Initialize(bool bWindowed, OSWindow *window, bool bColoredLights, uint32_t uDetailLevel, bool bTinting)
@@ -4508,7 +4538,7 @@
 //----- (004A1EA3) --------------------------------------------------------
 unsigned int Render::GetParentBillboardID(unsigned int uBillboardID)
 {
-  return pRenderer->pBillboardRenderListD3D[uBillboardID].uParentBillboardID;
+  return pRenderer->pBillboardRenderListD3D[uBillboardID].sParentBillboardID;
 }
 
 //----- (004A1EB6) --------------------------------------------------------
@@ -5367,18 +5397,18 @@
     //v59 = pGame->pLightmapBuilder;
     //v9 = v59->std__vector_000004_size;
 
-  uint uCorrectedColor = uColor;
+  int sCorrectedColor = uColor;
   if (pGame->pLightmapBuilder->std__vector_000004_size)
-    uCorrectedColor = 0xFFFFFFFF;
-  pGame->AlterGamma_BLV(pFace, &uCorrectedColor);
+    sCorrectedColor = -1;
+  pGame->AlterGamma_BLV(pFace, &sCorrectedColor);
 
 
   if (pFace->uAttributes & FACE_OUTLINED)
   {
     int color;
     if (GetTickCount() % 300 >= 150)
-      uColor = uCorrectedColor = 0xFF20FF20;
-    else uColor = uCorrectedColor = 0xFF109010;
+      uColor = sCorrectedColor = 0xFF20FF20;
+    else uColor = sCorrectedColor = 0xFF109010;
   }
 
   if (byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01)
@@ -5392,7 +5422,7 @@
 		d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY;
 		d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894);
 		d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x;
-		d3d_vertex_buffer[i].diffuse = uCorrectedColor;
+		d3d_vertex_buffer[i].diffuse = sCorrectedColor;
 		d3d_vertex_buffer[i].specular = 0;
 		d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth;
 		d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight;
@@ -5419,7 +5449,7 @@
         d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY;
         d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894);
         d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x;
-        d3d_vertex_buffer[i].diffuse = uCorrectedColor;
+        d3d_vertex_buffer[i].diffuse = sCorrectedColor;
         d3d_vertex_buffer[i].specular = 0;
         d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth;
         d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight;
@@ -5489,7 +5519,7 @@
         pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/);
 
         for (uint i = 0; i < uNumVertices; ++i)
-          d3d_vertex_buffer[i].diffuse = uCorrectedColor;
+          d3d_vertex_buffer[i].diffuse = sCorrectedColor;
         /*v33 = uNumVertices;
         if ( (signed int)uNumVertices > 0 )
         {
@@ -5573,7 +5603,7 @@
     //v10 = a3;
     pBillboardRenderListD3D[v7].field_90 = pSoftBillboard->field_44;
     pBillboardRenderListD3D[v7].sZValue = pSoftBillboard->sZValue;
-    pBillboardRenderListD3D[v7].uParentBillboardID = pSoftBillboard->uParentBillboardID;
+    pBillboardRenderListD3D[v7].sParentBillboardID = pSoftBillboard->sParentBillboardID;
     //v25 = pSoftBillboard->uScreenSpaceX;
     //v24 = pSoftBillboard->uScreenSpaceY;
     a1 = (pSoftBillboard->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(pSoftBillboard->_screenspace_x_scaler_packedfloat);
@@ -5582,10 +5612,10 @@
     v27 = (double)(pSprite->uBufferHeight - pSprite->uAreaY);
     if ( pSoftBillboard->uFlags & 4 )
       v31 = v31 * -1.0;
-    if ( pSoftBillboard->uTintColor && this->bTinting )
+    if ( pSoftBillboard->sTintColor && this->bTinting )
     {
       v11 = ::GetActorTintColor(dimming_level, 0, pSoftBillboard->zbuffer_depth, 0, 0);
-      v12 = BlendColors(pSoftBillboard->uTintColor, v11);
+      v12 = BlendColors(pSoftBillboard->sTintColor, v11);
       if ( v28 )
         v12 = (unsigned int)((char *)&array_77EC08[1852].pEdgeList1[17] + 3) & ((unsigned int)v12 >> 1);
     }
@@ -5706,7 +5736,7 @@
       pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_1;
       pBillboardRenderListD3D[v8].field_90 = a2->field_44;
       pBillboardRenderListD3D[v8].sZValue = a2->sZValue;
-      pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID;
+      pBillboardRenderListD3D[v8].sParentBillboardID = a2->sParentBillboardID;
       //v9 = a2->uScreenSpaceX;
       //v10 = a2->uScreenSpaceY;
       v11 = (a2->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(a2->_screenspace_x_scaler_packedfloat);
@@ -5879,7 +5909,7 @@
     pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_1;
     pBillboardRenderListD3D[v8].field_90 = a2->field_44;
     pBillboardRenderListD3D[v8].sZValue = a2->sZValue;
-    pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID;
+    pBillboardRenderListD3D[v8].sParentBillboardID = a2->sParentBillboardID;
     v9 = a2->uScreenSpaceX;
     v10 = a2->uScreenSpaceY;
     v11 = (a2->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(a2->_screenspace_x_scaler_packedfloat);
@@ -6025,10 +6055,10 @@
   v29 = (a2->_screenspace_y_scaler_packedfloat & 0xFFFF) / 65530.0 + HIWORD(a2->_screenspace_y_scaler_packedfloat);
 
   unsigned int diffuse = ::GetActorTintColor(dimming_level, 0, a2->zbuffer_depth, 0, pBillboard);
-  if (a2->uTintColor & 0x00FFFFFF && bTinting)
-  {
-    diffuse = BlendColors(a2->uTintColor, diffuse);
-    if (a2->uTintColor & 0xFF000000)
+  if (a2->sTintColor & 0x00FFFFFF && bTinting)
+  {
+    diffuse = BlendColors(a2->sTintColor, diffuse);
+    if (a2->sTintColor & 0xFF000000)
       diffuse = 0x007F7F7F & ((unsigned int)diffuse >> 1);
   }
 
@@ -6093,9 +6123,9 @@
   pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth;
   pBillboardRenderListD3D[v8].field_90 = a2->field_44;
   pBillboardRenderListD3D[v8].sZValue = a2->sZValue;
-  pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID;
-
-  if (a2->uTintColor & 0xFF000000)
+  pBillboardRenderListD3D[v8].sParentBillboardID = a2->sParentBillboardID;
+
+  if (a2->sTintColor & 0xFF000000)
     pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_3;
   else
     pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Transparent;
@@ -6282,7 +6312,7 @@
 
   v5 = Billboard_ProbablyAddToListAndSortByZOrder(depth);
   pBillboardRenderListD3D[v5].field_90 = 0;
-  pBillboardRenderListD3D[v5].uParentBillboardID = -1;
+  pBillboardRenderListD3D[v5].sParentBillboardID = -1;
   pBillboardRenderListD3D[v5].uOpacity = RenderBillboardD3D::Opaque_2;
   pBillboardRenderListD3D[v5].pTexture = 0;
   pBillboardRenderListD3D[v5].uNumVertices = a1->uNumVertices;
@@ -8280,14 +8310,14 @@
       SetUserInterface(pParty->alignment, true);
       if ( pVideoPlayer->pVideoFrame.pPixels )
         pVideoPlayer->pVideoFrame.Load(pVideoPlayer->pVideoFrameTextureFilename, 1);
-      if ( uCurrentMenuID != MENU_CREATEPARTY )
-      {
-        if ( uCurrentMenuID == MENU_CREDITSPROC )
+      if ( sCurrentMenuID != MENU_CREATEPARTY )
+      {
+        if ( sCurrentMenuID == MENU_CREDITSPROC )
           dword_A74C88 = 1; 
       }
       else
       {
-        if ( uCurrentMenuID )
+        if ( sCurrentMenuID )
         {
           v6 = &pTexture_PCX;
           pTexture_PCX.Release();
@@ -8298,7 +8328,7 @@
           v6 = &pTexture_PCX;
           pTexture_PCX.Release();
           v8 = "title.pcx";
-          if ( uCurrentMenuID )
+          if ( sCurrentMenuID )
             v8 = "lsave640.pcx";
         }
         v6->Load(v8, 0);
@@ -8578,6 +8608,7 @@
     if (p->uOpacity != RenderBillboardD3D::NoBlend)
       SetBillboardBlendOptions(p->uOpacity);
     
+	//if((int)p->pTexture!=0xcdcdcdcd)
     pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture);
     ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
                                                          D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
@@ -9000,8 +9031,8 @@
                         - (double)pGame->pIndoorCameraD3D->vPartyPos.z));
   pSkyPolygon.Create_48607B(&stru_8019C8);// ptr_38
   pSkyPolygon.ptr_38->_48694B_frustum_sky();
-  pSkyPolygon.uTileBitmapID = pOutdoor->uSky_TextureID;//179(original 166)
-  pSkyPolygon.pTexture = (Texture *)(SLOWORD(pOutdoor->uSky_TextureID) != -1 ? (int)&pBitmaps_LOD->pTextures[SLOWORD(pOutdoor->uSky_TextureID)] : 0);
+  pSkyPolygon.uTileBitmapID = pOutdoor->sSky_TextureID;//179(original 166)
+  pSkyPolygon.pTexture = (Texture *)(SLOWORD(pOutdoor->sSky_TextureID) != -1 ? (int)&pBitmaps_LOD->pTextures[SLOWORD(pOutdoor->sSky_TextureID)] : 0);
   if ( pSkyPolygon.pTexture )
   {
     pSkyPolygon.dimming_level = 0;