From 2244e9162be351030438e1e4203812e6c5936a26 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 17 Aug 2016 19:09:59 +0100 Subject: [PATCH] Some overflow checks. They're not proper like the other overflow checks, but they remove all the situations I've been able to discover without making stuff unnecessarily disappear. --- src/r_things.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/r_things.c b/src/r_things.c index 5dec34d1d..155e3efdc 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1266,6 +1266,7 @@ static void R_ProjectSprite(mobj_t *thing) gyt = -FixedMul(tr_y, viewsin); tz = gxt-gyt; yscale1 = FixedDiv(projectiony, tz); + if (yscale1 < 64) return; // Fix some funky visuals offset += spritecachedinfo[lump].width; tr_x = thing->x + FixedMul(offset, FINECOSINE(thing->angle>>ANGLETOFINESHIFT)) - viewx; @@ -1274,6 +1275,7 @@ static void R_ProjectSprite(mobj_t *thing) gyt = -FixedMul(tr_y, viewsin); tz = gxt-gyt; yscale2 = FixedDiv(projectiony, tz); + if (yscale2 < 64) return; // Fix some funky visuals if (ang >= ANGLE_180) { @@ -1287,8 +1289,8 @@ static void R_ProjectSprite(mobj_t *thing) else range = 1; scalestep = (yscale2 - yscale1)/range; - yscale = yscale1; //this_scale = FixedMul(this_scale, FixedDiv(yscale, yscale1)); + yscale = yscale1; } xscale = FixedMul(xscale, ang_scale);