Fixed some of the worst of it, but still has inconsistencies with the lookup tables we generated for main.kart - will provide evidence on Discord.

(side note, it's weird as hell that code we inherited from vanilla next - and i checked, it wasn't mangled in the merge - has bugs that straight up prevent it from functioning properly...)
This commit is contained in:
toaster 2021-04-01 00:05:05 +01:00
parent 40cbc30bff
commit cf59809852
4 changed files with 6 additions and 14 deletions

View file

@ -9162,7 +9162,7 @@ void P_SceneryThinker(mobj_t *mobj)
static void P_DefaultMobjShadowScale(mobj_t *thing)
{
thing->shadowscale = 0;
thing->whiteshadow = (thing->frame & FF_FULLBRIGHT);
thing->whiteshadow = ((thing->frame & FF_BRIGHTMASK) == FF_FULLBRIGHT);
switch (thing->type)
{

View file

@ -98,7 +98,7 @@ UINT32 ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alph
#define clamp(c) max(min(c, 0xFF), 0x00);
else
{
float falpha = ((float)alpha / 256.0f);
float falpha = ((float)alpha / 255.0f);
float fr = ((float)foreground.s.red * falpha);
float fg = ((float)foreground.s.green * falpha);
float fb = ((float)foreground.s.blue * falpha);

View file

@ -152,7 +152,7 @@ UINT8 skincolor_modified[MAXSKINCOLORS];
CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1];
CV_PossibleValue_t Followercolor_cons_t[MAXSKINCOLORS+3]; // +3 to account for "Match", "Opposite" & NULL
#define TRANSTAB_AMTMUL10 (256.0f / 10.0f)
#define TRANSTAB_AMTMUL10 (255.0f / 10.0f)
/** \brief Initializes the translucency tables used by the Software renderer.
*/
@ -191,7 +191,7 @@ void R_GenerateBlendTables(void)
for (i = 0; i <= 9; i++)
{
const size_t offs = (0x10000 * i);
const UINT8 alpha = TRANSTAB_AMTMUL10 * i;
const UINT8 alpha = TRANSTAB_AMTMUL10 * (10-i);
R_GenerateTranslucencyTable(blendtables[blendtab_add] + offs, AST_ADD, alpha);
R_GenerateTranslucencyTable(blendtables[blendtab_subtract] + offs, AST_SUBTRACT, alpha);
@ -203,8 +203,6 @@ void R_GenerateBlendTables(void)
R_GenerateTranslucencyTable(blendtables[blendtab_modulate], AST_MODULATE, 0);
}
static colorlookup_t transtab_lut;
void R_GenerateTranslucencyTable(UINT8 *table, int style, UINT8 blendamt)
{
INT16 bg, fg;
@ -212,8 +210,6 @@ void R_GenerateTranslucencyTable(UINT8 *table, int style, UINT8 blendamt)
if (table == NULL)
I_Error("R_GenerateTranslucencyTable: input table was NULL!");
InitColorLUT(&transtab_lut, pMasterPalette, false);
for (bg = 0; bg < 0xFF; bg++)
{
for (fg = 0; fg < 0xFF; fg++)
@ -223,7 +219,7 @@ void R_GenerateTranslucencyTable(UINT8 *table, int style, UINT8 blendamt)
RGBA_t result;
result.rgba = ASTBlendPixel(backrgba, frontrgba, style, blendamt);
table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut, result.s.red, result.s.green, result.s.blue);
table[((fg * 0x100) + bg)] = NearestPaletteColor(result.s.red, result.s.green, result.s.blue, pMasterPalette);
}
}
}

View file

@ -1251,7 +1251,6 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
patch_t *patch;
fixed_t xscale, yscale, shadowxscale, shadowyscale, shadowskew, x1, x2;
INT32 light = 0;
boolean additive = false;
fixed_t groundz;
pslope_t *groundslope;
@ -1259,9 +1258,6 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
if (abs(groundz-viewz)/tz > 4) return; // Prevent stretchy shadows and possible crashes
if (thing->whiteshadow == true)
additive = true;
patch = W_CachePatchName("DSHADOW", PU_SPRITE);
xscale = FixedDiv(projection[viewssnum], tz);
yscale = FixedDiv(projectiony[viewssnum], tz);
@ -1349,7 +1345,7 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
shadow->extra_colormap = thing->subsector->sector->extra_colormap;
}
shadow->transmap = R_GetBlendTable(additive ? AST_ADD : AST_SUBTRACT, 0);
shadow->transmap = R_GetBlendTable(thing->whiteshadow ? AST_ADD : AST_SUBTRACT, 0);
shadow->colormap = colormaps;
objectsdrawn++;