diff --git a/src/r_segs.c b/src/r_segs.c index 594024b75..53f12ecc6 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1769,6 +1769,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) while (need > maxopenings); openings = Z_Realloc(openings, maxopenings * sizeof (*openings), PU_STATIC, NULL); lastopening = openings + pos; + + if (oldopenings == NULL) + return; // borrowed fix from *cough* zdoom *cough* // [RH] We also need to adjust the openings pointers that diff --git a/src/r_things.c b/src/r_things.c index 26dad2f0b..b1c4c3851 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -851,6 +851,15 @@ static void R_DrawVisSprite(vissprite_t *vis) if (overflow_test < 0) overflow_test = -overflow_test; 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; + } colfunc = basecolfunc; // hack: this isn't resetting properly somewhere. dc_colormap = vis->colormap; diff --git a/src/r_things.h b/src/r_things.h index ab4688f91..7e38dbf47 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -152,8 +152,6 @@ typedef struct vissprite_s extracolormap_t *extra_colormap; // global colormaps - //fixed_t xscale; - // Precalculated top and bottom screen coords for the sprite. fixed_t thingheight; // The actual height of the thing (for 3D floors) sector_t *sector; // The sector containing the thing.