From 165aec3d34b8c5521b4941ffe0c4d7bb733dc4c1 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 11 Oct 2015 22:23:40 +0100 Subject: [PATCH] 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. --- src/f_wipe.c | 2 +- src/r_plane.c | 42 +++++++++++++----------------------------- src/r_segs.c | 48 ++++++++++++------------------------------------ src/r_splats.c | 2 +- src/r_things.c | 4 ++-- src/v_video.c | 6 +++--- 6 files changed, 32 insertions(+), 72 deletions(-) diff --git a/src/f_wipe.c b/src/f_wipe.c index 8e7c622c4..0d3061324 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -232,7 +232,7 @@ static void F_DoWipe(fademask_t *fademask) do { // pointer to transtable that this mask would use - transtbl = transtables + ((9 - *mask)<polyobj->translucency >= 10) return; // Don't even draw it - else if (pl->polyobj->translucency == 9) - ds_transmap = ((tr_trans90)<polyobj->translucency == 8) - ds_transmap = ((tr_trans80)<polyobj->translucency == 7) - ds_transmap = ((tr_trans70)<polyobj->translucency == 6) - ds_transmap = ((tr_trans60)<polyobj->translucency == 5) - ds_transmap = ((tr_trans50)<polyobj->translucency == 4) - ds_transmap = ((tr_trans40)<polyobj->translucency == 3) - ds_transmap = ((tr_trans30)<polyobj->translucency == 2) - ds_transmap = ((tr_trans20)<polyobj->translucency == 1) - ds_transmap = ((tr_trans10)<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)<ffloor->alpha < 64) - ds_transmap = ((tr_trans80)<ffloor->alpha < 89) - ds_transmap = ((tr_trans70)<ffloor->alpha < 115) - ds_transmap = ((tr_trans60)<ffloor->alpha < 140) - ds_transmap = ((tr_trans50)<ffloor->alpha < 166) - ds_transmap = ((tr_trans40)<ffloor->alpha < 192) - ds_transmap = ((tr_trans30)<ffloor->alpha < 217) - ds_transmap = ((tr_trans20)<ffloor->alpha < 243) - ds_transmap = ((tr_trans10)<special) { case 900: - dc_transmap = ((tr_trans10)<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)<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)<alpha < 64) - dc_transmap = ((tr_trans80)<alpha < 89) - dc_transmap = ((tr_trans70)<alpha < 115) - dc_transmap = ((tr_trans60)<alpha < 140) - dc_transmap = ((tr_trans50)<alpha < 166) - dc_transmap = ((tr_trans40)<alpha < 192) - dc_transmap = ((tr_trans30)<alpha < 217) - dc_transmap = ((tr_trans20)<alpha < 243) - dc_transmap = ((tr_trans10)<flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility) - vis->transmap = ((tr_trans80-1)<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)) diff --git a/src/v_video.c b/src/v_video.c index 524c15cc7..010c042c3 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -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)<