From 14ed02e08dffc05549ac5c63e65ad17cd158020f Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Tue, 7 May 2024 09:54:49 +0200 Subject: [PATCH] limit max distance for vissprites to 8192 map units as before But don't rely on an integer overflow this time. This increases FPS from 9 to 28 in the opening scene of comatose.wad --- src/r_things.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/r_things.c b/src/r_things.c index ee929684..bc363392 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -47,6 +47,7 @@ #include "z_zone.h" #define MINZ (FRACUNIT*4) +#define MAXZ (FRACUNIT*8192) #define BASEYCENTER 100 typedef struct { @@ -539,7 +540,7 @@ void R_ProjectSprite (mobj_t* thing) tz = gxt-gyt; // thing is behind view plane? - if (tz < MINZ) + if (tz < MINZ || tz > MAXZ) return; xscale = FixedDiv(projection, tz);