From 70c72004acb079ff669d2916ba9fc0144f32472a Mon Sep 17 00:00:00 2001
From: StapleButter <thetotalworm@gmail.com>
Date: Sat, 22 Apr 2017 17:15:50 +0200
Subject: behavior for translucent pixels is preserved even when alphablending
 is disabled

---
 src/GPU3D_Soft.cpp | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

(limited to 'src')

diff --git a/src/GPU3D_Soft.cpp b/src/GPU3D_Soft.cpp
index 6dd5676..888b823 100644
--- a/src/GPU3D_Soft.cpp
+++ b/src/GPU3D_Soft.cpp
@@ -924,6 +924,7 @@ void RenderPolygon(Polygon* polygon)
             u8 alpha = color >> 24;
 
             // alpha test
+            // TODO: check alpha test when blending is disabled
             if (DispCnt & (1<<2))
             {
                 if (alpha <= AlphaRef) continue;
@@ -933,11 +934,6 @@ void RenderPolygon(Polygon* polygon)
                 if (alpha == 0) continue;
             }
 
-            // alpha blending disable
-            // TODO: check alpha test when blending is disabled
-            if (!(DispCnt & (1<<3)))
-                alpha = 31;
-
             if (alpha == 31)
             {
                 // edge fill rules for opaque pixels
@@ -967,7 +963,7 @@ void RenderPolygon(Polygon* polygon)
                 u32 dstcolor = ColorBuffer[pixeladdr];
                 u32 dstalpha = dstcolor >> 24;
 
-                if (dstalpha > 0)
+                if ((dstalpha > 0) && (DispCnt & (1<<3)))
                 {
                     u32 srcR = color & 0x3F;
                     u32 srcG = (color >> 8) & 0x3F;
-- 
cgit v1.2.3