FF_TRANSSHIFT is meant for transmaps linked to states, not anything else!

I'm surprised how the source code flew in the face of this fact for so long and just used it everywhere, that's just silly.

Conflicts:
	src/f_wipe.c
This commit is contained in:
Monster Iestyn 2016-01-14 16:39:31 +00:00
parent 69550e98fe
commit 734419d549
5 changed files with 31 additions and 71 deletions

View file

@ -750,31 +750,15 @@ void R_DrawSinglePlane(visplane_t *pl)
// Hacked up support for alpha value in software mode Tails 09-24-2002 (sidenote: ported to polys 10-15-2014, there was no time travel involved -Red)
if (pl->polyobj->translucency >= 10)
return; // Don't even draw it
else if (pl->polyobj->translucency == 9)
ds_transmap = ((tr_trans90)<<FF_TRANSSHIFT) - 0x10000 + transtables;
else if (pl->polyobj->translucency == 8)
ds_transmap = ((tr_trans80)<<FF_TRANSSHIFT) - 0x10000 + transtables;
else if (pl->polyobj->translucency == 7)
ds_transmap = ((tr_trans70)<<FF_TRANSSHIFT) - 0x10000 + transtables;
else if (pl->polyobj->translucency == 6)
ds_transmap = ((tr_trans60)<<FF_TRANSSHIFT) - 0x10000 + transtables;
else if (pl->polyobj->translucency == 5)
ds_transmap = ((tr_trans50)<<FF_TRANSSHIFT) - 0x10000 + transtables;
else if (pl->polyobj->translucency == 4)
ds_transmap = ((tr_trans40)<<FF_TRANSSHIFT) - 0x10000 + transtables;
else if (pl->polyobj->translucency == 3)
ds_transmap = ((tr_trans30)<<FF_TRANSSHIFT) - 0x10000 + transtables;
else if (pl->polyobj->translucency == 2)
ds_transmap = ((tr_trans20)<<FF_TRANSSHIFT) - 0x10000 + transtables;
else if (pl->polyobj->translucency == 1)
ds_transmap = ((tr_trans10)<<FF_TRANSSHIFT) - 0x10000 + transtables;
else if (pl->polyobj->translucency <= 9 && pl->polyobj->translucency > 0)
ds_transmap = transtables + ((pl->polyobj->translucency-1)<<16);
else // Opaque, but allow transparent flat pixels
spanfunc = splatfunc;
if (pl->extra_colormap && pl->extra_colormap->fog)
light = (pl->lightlevel >> LIGHTSEGSHIFT);
else
light = LIGHTLEVELS-1;
light = LIGHTLEVELS-1;
} else
#endif
@ -805,23 +789,23 @@ void R_DrawSinglePlane(visplane_t *pl)
if (pl->ffloor->alpha < 12)
return; // Don't even draw it
else if (pl->ffloor->alpha < 38)
ds_transmap = ((tr_trans90)<<FF_TRANSSHIFT) - 0x10000 + transtables;
ds_transmap = transtables + ((tr_trans90-1)<<16);
else if (pl->ffloor->alpha < 64)
ds_transmap = ((tr_trans80)<<FF_TRANSSHIFT) - 0x10000 + transtables;
ds_transmap = transtables + ((tr_trans80-1)<<16);
else if (pl->ffloor->alpha < 89)
ds_transmap = ((tr_trans70)<<FF_TRANSSHIFT) - 0x10000 + transtables;
ds_transmap = transtables + ((tr_trans70-1)<<16);
else if (pl->ffloor->alpha < 115)
ds_transmap = ((tr_trans60)<<FF_TRANSSHIFT) - 0x10000 + transtables;
ds_transmap = transtables + ((tr_trans60-1)<<16);
else if (pl->ffloor->alpha < 140)
ds_transmap = ((tr_trans50)<<FF_TRANSSHIFT) - 0x10000 + transtables;
ds_transmap = transtables + ((tr_trans50-1)<<16);
else if (pl->ffloor->alpha < 166)
ds_transmap = ((tr_trans40)<<FF_TRANSSHIFT) - 0x10000 + transtables;
ds_transmap = transtables + ((tr_trans40-1)<<16);
else if (pl->ffloor->alpha < 192)
ds_transmap = ((tr_trans30)<<FF_TRANSSHIFT) - 0x10000 + transtables;
ds_transmap = transtables + ((tr_trans30-1)<<16);
else if (pl->ffloor->alpha < 217)
ds_transmap = ((tr_trans20)<<FF_TRANSSHIFT) - 0x10000 + transtables;
ds_transmap = transtables + ((tr_trans20-1)<<16);
else if (pl->ffloor->alpha < 243)
ds_transmap = ((tr_trans10)<<FF_TRANSSHIFT) - 0x10000 + transtables;
ds_transmap = transtables + ((tr_trans10-1)<<16);
else // Opaque, but allow transparent flat pixels
spanfunc = splatfunc;
@ -1082,7 +1066,7 @@ using the palette colors.
if (spanfunc == R_DrawSpan_8)
{
INT32 i;
ds_transmap = ((tr_trans50)<<FF_TRANSSHIFT) - 0x10000 + transtables;
ds_transmap = transtables + ((tr_trans50-1)<<16);
spanfunc = R_DrawTranslucentSpan_8;
for (i=0; i<4; i++)
{

View file

@ -183,7 +183,7 @@ static void R_DrawWallSplats(void)
colfunc = basecolfunc;
else
{
dc_transmap = ((tr_trans50 - 1)<<FF_TRANSSHIFT) + transtables;
dc_transmap = transtables + ((tr_trans50 - 1)<<16);
colfunc = fuzzcolfunc;
}
@ -304,39 +304,15 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
switch (ldef->special)
{
case 900:
dc_transmap = ((tr_trans10)<<FF_TRANSSHIFT) - 0x10000 + transtables;
colfunc = fuzzcolfunc;
break;
case 901:
dc_transmap = ((tr_trans20)<<FF_TRANSSHIFT) - 0x10000 + transtables;
colfunc = fuzzcolfunc;
break;
case 902:
dc_transmap = ((tr_trans30)<<FF_TRANSSHIFT) - 0x10000 + transtables;
colfunc = fuzzcolfunc;
break;
case 903:
dc_transmap = ((tr_trans40)<<FF_TRANSSHIFT) - 0x10000 + transtables;
colfunc = fuzzcolfunc;
break;
case 904:
dc_transmap = ((tr_trans50)<<FF_TRANSSHIFT) - 0x10000 + transtables;
colfunc = fuzzcolfunc;
break;
case 905:
dc_transmap = ((tr_trans60)<<FF_TRANSSHIFT) - 0x10000 + transtables;
colfunc = fuzzcolfunc;
break;
case 906:
dc_transmap = ((tr_trans70)<<FF_TRANSSHIFT) - 0x10000 + transtables;
colfunc = fuzzcolfunc;
break;
case 907:
dc_transmap = ((tr_trans80)<<FF_TRANSSHIFT) - 0x10000 + transtables;
colfunc = fuzzcolfunc;
break;
case 908:
dc_transmap = ((tr_trans90)<<FF_TRANSSHIFT) - 0x10000 + transtables;
dc_transmap = transtables + ((ldef->special-900)<<16);
colfunc = fuzzcolfunc;
break;
case 909:
@ -354,7 +330,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
if (curline->polyseg->translucency >= NUMTRANSMAPS)
return;
dc_transmap = ((curline->polyseg->translucency)<<FF_TRANSSHIFT) - 0x10000 + transtables;
dc_transmap = transtables + ((curline->polyseg->translucency-1)<<16);
colfunc = fuzzcolfunc;
}
@ -733,23 +709,23 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
if (pfloor->alpha < 12)
return; // Don't even draw it
else if (pfloor->alpha < 38)
dc_transmap = ((tr_trans90)<<FF_TRANSSHIFT) - 0x10000 + transtables;
dc_transmap = transtables + ((tr_trans90-1)<<16);
else if (pfloor->alpha < 64)
dc_transmap = ((tr_trans80)<<FF_TRANSSHIFT) - 0x10000 + transtables;
dc_transmap = transtables + ((tr_trans80-1)<<16);
else if (pfloor->alpha < 89)
dc_transmap = ((tr_trans70)<<FF_TRANSSHIFT) - 0x10000 + transtables;
dc_transmap = transtables + ((tr_trans70-1)<<16);
else if (pfloor->alpha < 115)
dc_transmap = ((tr_trans60)<<FF_TRANSSHIFT) - 0x10000 + transtables;
dc_transmap = transtables + ((tr_trans60-1)<<16);
else if (pfloor->alpha < 140)
dc_transmap = ((tr_trans50)<<FF_TRANSSHIFT) - 0x10000 + transtables;
dc_transmap = transtables + ((tr_trans50-1)<<16);
else if (pfloor->alpha < 166)
dc_transmap = ((tr_trans40)<<FF_TRANSSHIFT) - 0x10000 + transtables;
dc_transmap = transtables + ((tr_trans40-1)<<16);
else if (pfloor->alpha < 192)
dc_transmap = ((tr_trans30)<<FF_TRANSSHIFT) - 0x10000 + transtables;
dc_transmap = transtables + ((tr_trans30-1)<<16);
else if (pfloor->alpha < 217)
dc_transmap = ((tr_trans20)<<FF_TRANSSHIFT) - 0x10000 + transtables;
dc_transmap = transtables + ((tr_trans20-1)<<16);
else if (pfloor->alpha < 243)
dc_transmap = ((tr_trans10)<<FF_TRANSSHIFT) - 0x10000 + transtables;
dc_transmap = transtables + ((tr_trans10-1)<<16);
else
fuzzy = false; // Opaque

View file

@ -503,7 +503,7 @@ static void R_RenderFloorSplat(floorsplat_t *pSplat, vertex_t *verts, UINT8 *pTe
{
ds_x1 = x1;
ds_x2 = x2;
ds_transmap = ((tr_trans50)<<FF_TRANSSHIFT) - 0x10000 + transtables;
ds_transmap = transtables + ((tr_trans50-1)<<16);
splatfunc();
}

View file

@ -1321,9 +1321,9 @@ static void R_ProjectSprite(mobj_t *thing)
if (!cv_translucency.value)
; // no translucency
else if (thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility)
vis->transmap = ((tr_trans80-1)<<FF_TRANSSHIFT) + transtables; // because now the translucency is set through FF_TRANSMASK
vis->transmap = transtables + ((tr_trans80-1)<<16); // because now the translucency is set through FF_TRANSMASK
else if (thing->frame & FF_TRANSMASK)
vis->transmap = (thing->frame & FF_TRANSMASK) - 0x10000 + transtables;
vis->transmap = transtables + ((((thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT)-1)<<16);
if (((thing->frame & FF_FULLBRIGHT) || (thing->flags2 & MF2_SHADOW))
&& (!vis->extra_colormap || !vis->extra_colormap->fog))

View file

@ -366,7 +366,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
}
if (alphalevel)
{
v_translevel = ((alphalevel)<<FF_TRANSSHIFT) - 0x10000 + transtables;
v_translevel = transtables + ((alphalevel-1)<<16);
patchdrawfunc = translucentpdraw;
}
@ -1869,7 +1869,7 @@ void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param)
angle_t disStart = (leveltime * 128) & FINEMASK; // in 0 to FINEANGLE
INT32 newpix;
INT32 sine;
//UINT8 *transme = ((tr_trans50)<<FF_TRANSSHIFT) + transtables;
//UINT8 *transme = transtables + ((tr_trans50-1)<<16);
for (y = yoffset; y < yoffset+height; y++)
{
@ -1926,7 +1926,7 @@ Unoptimized version
INT32 x, y;
// TODO: Add a postimg_param so that we can pick the translucency level...
UINT8 *transme = ((param)<<FF_TRANSSHIFT) - 0x10000 + transtables;
UINT8 *transme = transtables + ((param-1)<<16);
for (y = yoffset; y < yoffset+height; y++)
{