From 35cc746adf7d0bf8d52613d5d49e28dc6ed9f5b3 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 3 Jun 2022 14:53:56 -0400 Subject: [PATCH] Blendmode support for weather --- src/r_things.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 804287fca..05276ea8e 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2188,6 +2188,9 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) //SoM: 3/17/2000 fixed_t gz, gzt; + UINT32 blendmode; + UINT32 trans; + // uncapped/interpolation interpmobjstate_t interp = {0}; @@ -2281,6 +2284,17 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) goto weatherthink; } + // Determine the blendmode and translucency value + { + blendmode = (thing->frame & FF_BLENDMASK) >> FF_BLENDSHIFT; + if (blendmode) + blendmode++; // realign to constants + + trans = (thing->frame & FF_TRANSMASK) >> FF_TRANSSHIFT; + if (trans >= NUMTRANSMAPS) + goto weatherthink; // cap + } + // store information in a vissprite vis = R_NewVisSprite(); vis->scale = vis->sortscale = yscale; //<patch = W_CachePatchNum(sprframe->lumppat[0], PU_SPRITE); - // specific translucency - // (no draw flags) - if (thing->frame & FF_TRANSMASK) - vis->transmap = ((thing->frame & FF_TRANSMASK) - FF_TRANS10) + transtables; - else - vis->transmap = NULL; + vis->transmap = R_GetBlendTable(blendmode, trans); vis->mobj = (mobj_t *)thing; vis->mobjflags = 0;