From e0758875d4cb94f40243557e12f928fe435fd309 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Sun, 3 Sep 2023 16:31:08 -0500 Subject: [PATCH] Actually fix papersprites near camera crash --- src/r_things.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 26a430a94..8e3ef4079 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -890,6 +890,15 @@ static void R_DrawVisSprite(vissprite_t *vis) if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) return; // ditto } + // TODO This check should not be necessary. But Papersprites near to the camera will sometimes create invalid values + // for the vissprite's startfrac. This happens because they are not depth culled like other sprites. + // Someone who is more familiar with papersprites pls check and try to fix <3 + if (vis->startfrac < 0 || vis->startfrac > (patch->width << FRACBITS)) + { + // never draw vissprites with startfrac out of patch range + return; + } + // Prevent an out of bounds error if (bmpatch && (bmpatch->width != patch->width || bmpatch->height != patch->height)) @@ -2408,7 +2417,7 @@ static void R_ProjectSprite(mobj_t *thing) vis->xscale = FixedMul(spritexscale, xscale); //SoM: 4/17/2000 vis->scale = FixedMul(spriteyscale, yscale); //<thingscale = this_scale; + vis->thingscale = interp.scale; vis->spritexscale = spritexscale; vis->spriteyscale = spriteyscale; @@ -2649,7 +2658,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) vis = R_NewVisSprite(); vis->scale = FixedMul(yscale, this_scale); vis->sortscale = yscale; //<thingscale = this_scale; + vis->thingscale = interp.scale; vis->dispoffset = 0; // Monster Iestyn: 23/11/15 vis->gx = interp.x; vis->gy = interp.y;