diff Engine/Graphics/Render.cpp @ 2575:a76d408c5132 tip

DrawTranslucent -> DrawTextureGrayShade Removed old texture drawing stuff
author a.parshin
date Wed, 09 Mar 2016 01:39:52 +0200
parents dd36326a9994
children
line wrap: on
line diff
--- a/Engine/Graphics/Render.cpp	Mon Mar 07 03:48:40 2016 +0200
+++ b/Engine/Graphics/Render.cpp	Wed Mar 09 01:39:52 2016 +0200
@@ -31,7 +31,6 @@
 #include "Lights.h"
 #include "Level/Decoration.h"
 #include "Vis.h"
-#include "Engine/Registry.h"
 #include "Weather.h"
 #include "Engine/MMT.h"
 
@@ -6370,12 +6369,6 @@
          0xF800 & (r << (6 + 5 + 5 - 8));
 }
 
-void Render::DrawTextureNew(float u, float v, Texture_MM7 *a4)
-{
-  __debugbreak();
-}
-
-
 
 
 void Render::DrawTextureCustomHeight(float u, float v, class Image *img, int custom_height)
@@ -6522,145 +6515,9 @@
 }
 
 //----- (004A6E7E) --------------------------------------------------------
-void Render::DrawTranslucent(unsigned int a2, unsigned int a3, Texture_MM7 *a4)
-{
-  int v5; // edx@4
-  unsigned int v6; // edi@4
-  unsigned int v7; // edx@5
-  unsigned int v8; // edx@6
-  unsigned int v9; // edx@7
-  unsigned int v10; // edx@8
-  unsigned int v11; // ebx@9
-  unsigned int v12; // esi@11
-  unsigned int v13; // edx@12
-  unsigned int v14; // ebx@15
-  unsigned int v15; // esi@17
-  unsigned int v16; // edi@18
-  int v18; // [sp+14h] [bp-Ch]@4
-  int v19; // [sp+18h] [bp-8h]@4
-  unsigned __int8 *v20; // [sp+1Ch] [bp-4h]@4
-
-  if ( this->uNumSceneBegins && a4 && a4->pPalette16 )
-  {
-    //v4 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch];
-    v20 = a4->paletted_pixels;
-    v5 = a4->uTextureWidth;
-    v6 = a4->uTextureHeight;
-    v19 = a4->uTextureWidth;
-    v18 = a4->uTextureWidth;
-    int clipped_out_x = a2;
-    int clipped_out_y = a3;
-    if ( this->bClip )
-    {
-      v7 = this->uClipX;
-      if ( (signed int)a2 < (signed int)v7 )
-      {
-        v8 = v7 - a2;
-        v20 += v8;
-        v19 += a2 - this->uClipX;
-        //v4 += v8;
-        clipped_out_x = uClipX;
-      }
-      v9 = this->uClipY;
-      if ( (signed int)a3 < (signed int)v9 )
-      {
-        v10 = v9 - a3;
-        v20 += v18 * v10;
-        v6 = a3 - this->uClipY + a4->uTextureHeight;
-        //v4 += this->uTargetSurfacePitch * v10;
-        clipped_out_y = uClipY;
-      }
-      v11 = this->uClipX;
-      v5 = v19;
-      if ( (signed int)v11 < (signed int)a2 )
-        v11 = a2;
-      v12 = this->uClipZ;
-      if ( (signed int)(v19 + v11) > (signed int)v12 )
-      {
-        v13 = this->uClipX;
-        if ( (signed int)v13 < (signed int)a2 )
-          v13 = a2;
-        v5 = v12 - v13;
-      }
-      v14 = this->uClipY;
-      if ( (signed int)v14 < (signed int)a3 )
-        v14 = a3;
-      v15 = this->uClipW;
-      if ( (signed int)(v6 + v14) > (signed int)v15 )
-      {
-        v16 = this->uClipY;
-        if ( (signed int)v16 < (signed int)a3 )
-          v16 = a3;
-        v6 = v15 - v16;
-      }
-    }
-
-    for (uint y = 0; y < v6; ++y)
-    {
-      for (int x = 0; x < v5; ++x)
-      {
-        if ( *v20 )
-          WritePixel16(clipped_out_x + x, clipped_out_y + y, ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x7BEF);
-        ++v20;
-      }
-          v20 += v18 - v5;
-    }
-
-    /*if ( pRenderer->uTargetGBits == 5 )
-    {
-      if ( (signed int)v6 > 0 )
-      {
-        v23 = v6;
-        do
-        {
-          if ( v5 > 0 )
-          {
-            v21 = v5;
-            do
-            {
-              if ( *v20 )
-                *v4 = ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x3DEF;
-              ++v4;
-              ++v20;
-              --v21;
-            }
-            while ( v21 );
-          }
-          v20 += v18 - v5;
-          v17 = v23-- == 1;
-          v4 += this->uTargetSurfacePitch - v5;
-        }
-        while ( !v17 );
-      }
-    }
-    else
-    {
-      if ( (signed int)v6 > 0 )
-      {
-        v24 = v6;
-        do
-        {
-          if ( v5 > 0 )
-          {
-            v22 = v5;
-            do
-            {
-              if ( *v20 )
-                *v4 = ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x7BEF;
-              ++v4;
-              ++v20;
-              --v22;
-            }
-            while ( v22 );
-          }
-          v20 += v18 - v5;
-          v17 = v24-- == 1;
-          v4 += this->uTargetSurfacePitch - v5;
-        }
-        while ( !v17 );
-      }
-    }*/
-  }
+void Render::DrawTextureGrayShade(float u, float v, Image *img)
+{
+    DrawMasked(u, v, img, 1, 0x7BEF);
 }
 
 //----- (004A6DF5) --------------------------------------------------------
@@ -6973,18 +6830,18 @@
 //----- (004A68EF) --------------------------------------------------------
 void Render::DrawTransparentGreenShade(float u, float v, Image *pTexture)
 {
-  DrawMasked(u, v, pTexture, 0x07E0);
+  DrawMasked(u, v, pTexture, 0, 0x07E0);
 }
 
 
 //----- (004A6776) --------------------------------------------------------
 void Render::DrawTransparentRedShade(float u, float v, Image *a4)
 {
-  DrawMasked(u, v, a4, 0xF800);
+  DrawMasked(u, v, a4, 0, 0xF800);
 }
 
 //----- (004A68EF) --------------------------------------------------------
-void Render::DrawMasked(float u, float v, Image *pTexture, unsigned __int16 mask)
+void Render::DrawMasked(float u, float v, Image *pTexture, unsigned int color_dimming_level, unsigned __int16 mask)
 {
   unsigned int v5; // ebx@4
   int v10; // edx@8
@@ -7072,7 +6929,7 @@
                 WritePixel16(
                     clipped_out_x + x,
                     clipped_out_y + y,
-                    Color16((*pixels >> 16) & 0xFF, (*pixels >> 8) & 0xFF, *pixels & 0xFF) & mask
+                    (Color16((*pixels >> 16) & 0xFF, (*pixels >> 8) & 0xFF, *pixels & 0xFF) >> color_dimming_level) & mask
                 );
             ++pixels;
         }
@@ -7376,7 +7233,7 @@
 }
 
 
-
+/*
 //----- (004A6274) --------------------------------------------------------
 void Render::DrawTextureIndexedAlpha(unsigned int uX, unsigned int uY, Texture_MM7 *pTexture)
 {
@@ -7453,7 +7310,8 @@
       }
     }
   }
-}
+}*/
+
 
 //----- (004A612A) --------------------------------------------------------
 void Render::ZDrawTextureAlpha(float u, float v, Image *img, int zVal)
@@ -7627,7 +7485,7 @@
 }
 
 
-
+/*
 //----- (004A5EB2) --------------------------------------------------------
 void Render::DrawTextureTransparentColorKey(signed int x, signed int y, Texture_MM7 *tex)
 {
@@ -7714,7 +7572,7 @@
       }
     }
   }
-}
+}*/