Alpha value for fade colormaps

This commit is contained in:
Sally Coolatta 2021-12-06 20:38:30 -05:00
parent be34cd699b
commit 8484ba9294

View file

@ -615,6 +615,7 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
{ {
double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb, cdestbright; double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb, cdestbright;
double maskamt = 0, othermask = 0; double maskamt = 0, othermask = 0;
double fmaskamt = 0, fothermask = 0;
UINT8 cr = R_GetRgbaR(extra_colormap->rgba), UINT8 cr = R_GetRgbaR(extra_colormap->rgba),
cg = R_GetRgbaG(extra_colormap->rgba), cg = R_GetRgbaG(extra_colormap->rgba),
@ -622,8 +623,8 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
ca = R_GetRgbaA(extra_colormap->rgba), ca = R_GetRgbaA(extra_colormap->rgba),
cfr = R_GetRgbaR(extra_colormap->fadergba), cfr = R_GetRgbaR(extra_colormap->fadergba),
cfg = R_GetRgbaG(extra_colormap->fadergba), cfg = R_GetRgbaG(extra_colormap->fadergba),
cfb = R_GetRgbaB(extra_colormap->fadergba); cfb = R_GetRgbaB(extra_colormap->fadergba),
// cfa = R_GetRgbaA(extra_colormap->fadergba); // unused in software cfa = R_GetRgbaA(extra_colormap->fadergba);
UINT8 fadestart = extra_colormap->fadestart, UINT8 fadestart = extra_colormap->fadestart,
fadedist = extra_colormap->fadeend - extra_colormap->fadestart; fadedist = extra_colormap->fadeend - extra_colormap->fadestart;
@ -654,14 +655,11 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
cdestb = cfb; cdestb = cfb;
cdestbright = sqrt((cfr*cfr) + (cfg*cfg) + (cfb*cfb)); cdestbright = sqrt((cfr*cfr) + (cfg*cfg) + (cfb*cfb));
// fade alpha unused in software fmaskamt = (double)(cfa/24.0l);
// maskamt = (double)(cfa/24.0l); fothermask = 1 - fmaskamt;
// othermask = 1 - maskamt; //fmaskamt /= 0xff;
// maskamt /= 0xff;
// cdestr *= maskamt; (void)fothermask; // unused, but don't feel like commenting it out
// cdestg *= maskamt;
// cdestb *= maskamt;
///////////////////// /////////////////////
// This code creates the colormap array used by software renderer // This code creates the colormap array used by software renderer
@ -710,7 +708,7 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
} }
// Add/subtract this value during fading. // Add/subtract this value during fading.
brightChange[i] = fabs(cbest - cdist) / (double)fadedist; brightChange[i] = (fabs(cbest - cdist) / (double)fadedist) * fmaskamt;
} }
// Now allocate memory for the actual colormap array itself! // Now allocate memory for the actual colormap array itself!