diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4d5b136cf..9d0dc91b0 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1466,11 +1466,14 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom blendmode = PF_Translucent; break; default: - if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT) - blendmode = HWR_TranstableToAlpha(R_GetLinedefTransTable(gl_linedef->alpha), &Surf); + { + transnum_t transtable = R_GetLinedefTransTable(gl_linedef); + if (transtable != NUMTRANSMAPS) + blendmode = HWR_TranstableToAlpha(transtable, &Surf); else blendmode = PF_Masked; break; + } } if (gl_curline->polyseg && gl_curline->polyseg->translucency > 0) diff --git a/src/r_segs.c b/src/r_segs.c index a848dd884..a646ff440 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -270,9 +270,23 @@ static void R_Render2sidedMultiPatchColumn(column_t *column) } } -transnum_t R_GetLinedefTransTable(fixed_t alpha) +transnum_t R_GetLinedefTransTable(line_t *ldef) { - return (20*(FRACUNIT - alpha - 1) + FRACUNIT) >> (FRACBITS+1); + transnum_t transnum = NUMTRANSMAPS; // Send back NUMTRANSMAPS for none + fixed_t alpha = ldef->alpha; + if (alpha > 0 && alpha < FRACUNIT) + transnum = (20*(FRACUNIT - alpha - 1) + FRACUNIT) >> (FRACBITS+1); + else + { + switch (ldef->special) + { + case 910: transnum = tr_transadd; break; + case 911: transnum = tr_transsub; break; + default: transnum = NUMTRANSMAPS; break; + } + } + + return transnum; } void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) @@ -289,6 +303,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) INT32 times, repeats; INT64 overflow_test; INT32 range; + transnum_t transtable = NUMTRANSMAPS; // Calculate light table. // Use different light tables @@ -305,9 +320,10 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) if (!ldef->alpha) return; - if (ldef->alpha > 0 && ldef->alpha < FRACUNIT) + transtable = R_GetLinedefTransTable(ldef); + if (transtable != NUMTRANSMAPS) { - dc_transmap = transtables + ((R_GetLinedefTransTable(ldef->alpha) - 1) << FF_TRANSSHIFT); + dc_transmap = transtables + ((transtable - 1) << FF_TRANSSHIFT); colfunc = colfuncs[COLDRAWFUNC_FUZZY]; } diff --git a/src/r_segs.h b/src/r_segs.h index ace5711d4..6a79047e0 100644 --- a/src/r_segs.h +++ b/src/r_segs.h @@ -18,7 +18,7 @@ #pragma interface #endif -transnum_t R_GetLinedefTransTable(fixed_t alpha); +transnum_t R_GetLinedefTransTable(line_t *line); void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2); void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pffloor); void R_StoreWallRange(INT32 start, INT32 stop);