From 899e67272284191648049cb4492cc9cca98f00be Mon Sep 17 00:00:00 2001 From: TimeServ Date: Mon, 30 Aug 2004 01:17:57 +0000 Subject: [PATCH] 32-bpp fix git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@72 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/sw/d_polyse.c | 12 ++++++------ engine/sw/r_surf.c | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/engine/sw/d_polyse.c b/engine/sw/d_polyse.c index 221f58a1e..3243aa06d 100644 --- a/engine/sw/d_polyse.c +++ b/engine/sw/d_polyse.c @@ -584,9 +584,9 @@ void D_PolysetDrawSpans32Trans (spanpackage_t *pspanpackage) lpdest[1] = ((qbyte *)acolormap)[lptex[1] + (llight & 0xFF00)]; lpdest[2] = ((qbyte *)acolormap)[lptex[2] + (llight & 0xFF00)]; #else - lpdest[0] = (lpdest[0]*transbackfac + gammatable[(lptex[0]*(llight>>8))/(256)]*transfactor)/255; - lpdest[1] = (lpdest[1]*transbackfac + gammatable[(lptex[1]*(llight>>8))/(256)]*transfactor)/255; - lpdest[2] = (lpdest[2]*transbackfac + gammatable[(lptex[2]*(llight>>8))/(256)]*transfactor)/255; + lpdest[0] = (lpdest[0]*transbackfac + gammatable[(lptex[0]*(llight&0x3FFF))/(0x3FFF)]*transfactor)/255; + lpdest[1] = (lpdest[1]*transbackfac + gammatable[(lptex[1]*(llight&0x3FFF))/(0x3FFF)]*transfactor)/255; + lpdest[2] = (lpdest[2]*transbackfac + gammatable[(lptex[2]*(llight&0x3FFF))/(0x3FFF)]*transfactor)/255; #endif *lpz = lzi >> 16; } @@ -658,9 +658,9 @@ void D_PolysetDrawSpans32 (spanpackage_t *pspanpackage) lpdest[1] = ((qbyte *)acolormap)[lptex[1] + (llight & 0xFF00)]; lpdest[2] = ((qbyte *)acolormap)[lptex[2] + (llight & 0xFF00)]; #else - lpdest[0] = gammatable[(lptex[0]*(llight>>8))/(256)]; - lpdest[1] = gammatable[(lptex[1]*(llight>>8))/(256)]; - lpdest[2] = gammatable[(lptex[2]*(llight>>8))/(256)]; + lpdest[0] = gammatable[(lptex[0]*(llight&0x3FFF))/(0x3FFF)]; + lpdest[1] = gammatable[(lptex[1]*(llight&0x3FFF))/(0x3FFF)]; + lpdest[2] = gammatable[(lptex[2]*(llight&0x3FFF))/(0x3FFF)]; #endif *lpz = lzi >> 16; } diff --git a/engine/sw/r_surf.c b/engine/sw/r_surf.c index 452c0a65c..2212e1240 100644 --- a/engine/sw/r_surf.c +++ b/engine/sw/r_surf.c @@ -1486,9 +1486,9 @@ void R_DrawSurfaceBlock32From32Lit (void) pix = psource[b+0]; prowdest[b+2] = pix; - prowdest[b+0] = gammatable[((int)psource[b+2]*(256-((lightb&0xff00)>>6))) / 256]; - prowdest[b+1] = gammatable[((int)psource[b+1]*(256-((lightg&0xff00)>>6))) / 256]; - prowdest[b+2] = gammatable[((int)psource[b+0]*(256-((lightr&0xff00)>>6))) / 256]; + prowdest[b+0] = gammatable[((int)psource[b+2]*(0x3FFF-(lightb & 0x3FFF))) / 0x3FFF]; + prowdest[b+1] = gammatable[((int)psource[b+1]*(0x3FFF-(lightg & 0x3FFF))) / 0x3FFF]; + prowdest[b+2] = gammatable[((int)psource[b+0]*(0x3FFF-(lightr & 0x3FFF))) / 0x3FFF]; prowdest[b+3] = psource[b+3]; lightr += lightstepr;