From 4c26c4fd81d2f9015f1132e6a7cfab1830cf90ae Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Wed, 10 Feb 2021 19:23:07 -0500 Subject: [PATCH 1/2] Shadows use additive/subtractive --- src/r_things.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index e1e38041b..25a33b33f 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1236,7 +1236,8 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale, patch_t *patch; fixed_t xscale, yscale, shadowxscale, shadowyscale, shadowskew, x1, x2; INT32 light = 0; - fixed_t scalemul; UINT8 trans; + UINT8 trans = tr_transsub; + fixed_t scalemul; fixed_t floordiff; fixed_t groundz; pslope_t *groundslope; @@ -1246,14 +1247,15 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale, if (abs(groundz-viewz)/tz > 4) return; // Prevent stretchy shadows and possible crashes + if (thing->whiteshadow == true) + { + trans = tr_transadd; + } + floordiff = abs((isflipped ? thing->height : 0) + thing->z - groundz); - - trans = floordiff / (100*FRACUNIT) + 3; - if (trans >= 9) return; - scalemul = FixedMul(FRACUNIT - floordiff/640, scale); - patch = W_CachePatchName((thing->whiteshadow == true ? "LSHADOW" : "DSHADOW"), PU_CACHE); + patch = W_CachePatchName("DSHADOW", PU_CACHE); xscale = FixedDiv(projection[viewssnum], tz); yscale = FixedDiv(projectiony[viewssnum], tz); shadowxscale = FixedMul(thing->radius*2, scalemul); @@ -1354,16 +1356,9 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale, else shadow->extra_colormap = thing->subsector->sector->extra_colormap; - shadow->transmap = transtables + (trans<transmap = transtables + ((trans-1) << FF_TRANSSHIFT); - if (thing->whiteshadow == true) - { - shadow->colormap = scalelight[LIGHTLEVELS - 1][0]; // full bright! - } - else - { - shadow->colormap = scalelight[0][0]; // full dark! - } + shadow->colormap = colormaps; objectsdrawn++; } From e250c35489b2acfb979f10b9357c58a55cc7a2f6 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Wed, 10 Feb 2021 20:03:29 -0500 Subject: [PATCH 2/2] Remove ground scaling I dun like it, it makes the gameplay purpose of shadows harder to discern --- src/r_things.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 25a33b33f..c4e76303d 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1237,11 +1237,8 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale, fixed_t xscale, yscale, shadowxscale, shadowyscale, shadowskew, x1, x2; INT32 light = 0; UINT8 trans = tr_transsub; - fixed_t scalemul; - fixed_t floordiff; fixed_t groundz; pslope_t *groundslope; - boolean isflipped = thing->eflags & MFE_VERTICALFLIP; groundz = R_GetShadowZ(thing, &groundslope); @@ -1252,14 +1249,11 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale, trans = tr_transadd; } - floordiff = abs((isflipped ? thing->height : 0) + thing->z - groundz); - scalemul = FixedMul(FRACUNIT - floordiff/640, scale); - patch = W_CachePatchName("DSHADOW", PU_CACHE); xscale = FixedDiv(projection[viewssnum], tz); yscale = FixedDiv(projectiony[viewssnum], tz); - shadowxscale = FixedMul(thing->radius*2, scalemul); - shadowyscale = FixedMul(FixedMul(thing->radius*2, scalemul), FixedDiv(abs(groundz - viewz), tz)); + shadowxscale = FixedMul(thing->radius*2, scale); + shadowyscale = FixedMul(FixedMul(thing->radius*2, scale), FixedDiv(abs(groundz - viewz), tz)); shadowyscale = min(shadowyscale, shadowxscale) / SHORT(patch->height); shadowxscale /= SHORT(patch->width); shadowskew = 0; @@ -1276,9 +1270,9 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale, //CONS_Printf("Shadow is sloped by %d %d\n", xslope, zslope); if (viewz < groundz) - shadowyscale += FixedMul(FixedMul(thing->radius*2 / SHORT(patch->height), scalemul), zslope); + shadowyscale += FixedMul(FixedMul(thing->radius*2 / SHORT(patch->height), scale), zslope); else - shadowyscale -= FixedMul(FixedMul(thing->radius*2 / SHORT(patch->height), scalemul), zslope); + shadowyscale -= FixedMul(FixedMul(thing->radius*2 / SHORT(patch->height), scale), zslope); shadowyscale = abs(shadowyscale);