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,24 +750,8 @@ 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) // 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) if (pl->polyobj->translucency >= 10)
return; // Don't even draw it return; // Don't even draw it
else if (pl->polyobj->translucency == 9) else if (pl->polyobj->translucency <= 9 && pl->polyobj->translucency > 0)
ds_transmap = ((tr_trans90)<<FF_TRANSSHIFT) - 0x10000 + transtables; ds_transmap = transtables + ((pl->polyobj->translucency-1)<<16);
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 // Opaque, but allow transparent flat pixels else // Opaque, but allow transparent flat pixels
spanfunc = splatfunc; spanfunc = splatfunc;
@ -805,23 +789,23 @@ void R_DrawSinglePlane(visplane_t *pl)
if (pl->ffloor->alpha < 12) if (pl->ffloor->alpha < 12)
return; // Don't even draw it return; // Don't even draw it
else if (pl->ffloor->alpha < 38) 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) 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) 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) 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) 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) 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) 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) 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) 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 else // Opaque, but allow transparent flat pixels
spanfunc = splatfunc; spanfunc = splatfunc;
@ -1082,7 +1066,7 @@ using the palette colors.
if (spanfunc == R_DrawSpan_8) if (spanfunc == R_DrawSpan_8)
{ {
INT32 i; INT32 i;
ds_transmap = ((tr_trans50)<<FF_TRANSSHIFT) - 0x10000 + transtables; ds_transmap = transtables + ((tr_trans50-1)<<16);
spanfunc = R_DrawTranslucentSpan_8; spanfunc = R_DrawTranslucentSpan_8;
for (i=0; i<4; i++) for (i=0; i<4; i++)
{ {

View file

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

View file

@ -1321,9 +1321,9 @@ static void R_ProjectSprite(mobj_t *thing)
if (!cv_translucency.value) if (!cv_translucency.value)
; // no translucency ; // no translucency
else if (thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility) 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) 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)) if (((thing->frame & FF_FULLBRIGHT) || (thing->flags2 & MF2_SHADOW))
&& (!vis->extra_colormap || !vis->extra_colormap->fog)) && (!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) if (alphalevel)
{ {
v_translevel = ((alphalevel)<<FF_TRANSSHIFT) - 0x10000 + transtables; v_translevel = transtables + ((alphalevel-1)<<16);
patchdrawfunc = translucentpdraw; 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 angle_t disStart = (leveltime * 128) & FINEMASK; // in 0 to FINEANGLE
INT32 newpix; INT32 newpix;
INT32 sine; INT32 sine;
//UINT8 *transme = ((tr_trans50)<<FF_TRANSSHIFT) + transtables; //UINT8 *transme = transtables + ((tr_trans50-1)<<16);
for (y = yoffset; y < yoffset+height; y++) for (y = yoffset; y < yoffset+height; y++)
{ {
@ -1926,7 +1926,7 @@ Unoptimized version
INT32 x, y; INT32 x, y;
// TODO: Add a postimg_param so that we can pick the translucency level... // 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++) for (y = yoffset; y < yoffset+height; y++)
{ {