From 734419d5495635c6a0d885ad374f5443594bc88b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 14 Jan 2016 16:39:31 +0000 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. Conflicts: src/f_wipe.c --- 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 +++--- 5 files changed, 31 insertions(+), 71 deletions(-) diff --git a/src/r_plane.c b/src/r_plane.c index fa0e0eac..cfc8ea59 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -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)<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 64bf825b..8e05819e 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)<