From 0d11ead1b25081ef2e86f43e422b0d1569768c92 Mon Sep 17 00:00:00 2001 From: Jaklyy <102590697+Jaklyy@users.noreply.github.com> Date: Wed, 29 May 2024 13:16:58 -0400 Subject: [PATCH] interpolated colors are rounded up if >= .5 --- src/GPU3D_Soft.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/GPU3D_Soft.cpp b/src/GPU3D_Soft.cpp index 13ebd9da..28536d1b 100644 --- a/src/GPU3D_Soft.cpp +++ b/src/GPU3D_Soft.cpp @@ -317,9 +317,9 @@ void SoftRenderer::TextureLookup(const GPU& gpu, u32 texparam, u32 texpal, s16 s u32 g1 = color1 & 0x03E0; u32 b1 = color1 & 0x7C00; - *tr = (r0 + r1) & 0x3E; - *tg = ((g0 + g1) >> 5) & 0x3E; - *tb = ((b0 + b1) >> 10) & 0x3E; + *tr = (r0 + r1) + 1 & 0x3E; + *tg = ((g0 + g1) >> 5) + 1 & 0x3E; + *tb = ((b0 + b1) >> 10) + 1 & 0x3E; } else if ((palinfo >> 14) == 3) { @@ -333,9 +333,9 @@ void SoftRenderer::TextureLookup(const GPU& gpu, u32 texparam, u32 texpal, s16 s u32 g1 = color1 & 0x03E0; u32 b1 = color1 & 0x7C00; - *tr = ((r0*5 + r1*3) >> 2) & 0x3E; - *tg = ((g0*5 + g1*3) >> 7) & 0x3E; - *tb = ((b0*5 + b1*3) >> 12) & 0x3E; + *tr = ((r0*5 + r1*3) >> 2) + 1 & 0x3E; + *tg = ((g0*5 + g1*3) >> 7) + 1 & 0x3E; + *tb = ((b0*5 + b1*3) >> 12) + 1 & 0x3E; } else { @@ -364,9 +364,9 @@ void SoftRenderer::TextureLookup(const GPU& gpu, u32 texparam, u32 texpal, s16 s u32 g1 = color1 & 0x03E0; u32 b1 = color1 & 0x7C00; - *tr = ((r0*3 + r1*5) >> 2) & 0x3E; - *tg = ((g0*3 + g1*5) >> 7) & 0x3E; - *tb = ((b0*3 + b1*5) >> 12) & 0x3E; + *tr = ((r0*3 + r1*5) >> 2) + 1 & 0x3E; + *tg = ((g0*3 + g1*5) >> 7) + 1 & 0x3E; + *tb = ((b0*3 + b1*5) >> 12) + 1 & 0x3E; *alpha = 31; }