From 9231a4653c400a77bfc47ad132bf6841f5b00d15 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 17 Aug 2016 22:19:28 +0100 Subject: [PATCH] SORTED, THANKS MI http://gfycat.com/SimpleShallowDeviltasmanian now to put this behind some sort of flag and optimise it --- src/r_things.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index ee441b7d5..7892dbb7b 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1238,10 +1238,10 @@ static void R_ProjectSprite(mobj_t *thing) // calculate edges of the shape if (flip) - offset = spritecachedinfo[lump].width-spritecachedinfo[lump].offset; + offset = spritecachedinfo[lump].offset - spritecachedinfo[lump].width; else - offset = spritecachedinfo[lump].offset; - tx -= FixedMul(offset, FixedMul(this_scale, ang_scale)); + offset = -spritecachedinfo[lump].offset; + tx += FixedMul(offset, FixedMul(this_scale, ang_scale)); x1 = (centerxfrac + FixedMul (tx,xscale)) >>FRACBITS; // off the right side? @@ -1257,17 +1257,16 @@ static void R_ProjectSprite(mobj_t *thing) if (1) // (flatsprite) { - fixed_t yscale1; fixed_t yscale2; INT32 range; - tr_x = thing->x + FixedMul(-offset, FINECOSINE(thing->angle>>ANGLETOFINESHIFT)) - viewx; - tr_y = thing->y + FixedMul(-offset, FINESINE(thing->angle>>ANGLETOFINESHIFT)) - viewy; + tr_x = thing->x + FixedMul(offset, FINECOSINE(thing->angle>>ANGLETOFINESHIFT)) - viewx; + tr_y = thing->y + FixedMul(offset, FINESINE(thing->angle>>ANGLETOFINESHIFT)) - viewy; gxt = FixedMul(tr_x, viewcos); gyt = -FixedMul(tr_y, viewsin); tz = gxt-gyt; - yscale1 = FixedDiv(projectiony, tz); - if (yscale1 < 64) return; // Fix some funky visuals + yscale = FixedDiv(projectiony, tz); + if (yscale < 64) return; // Fix some funky visuals offset += spritecachedinfo[lump].width; tr_x = thing->x + FixedMul(offset, FINECOSINE(thing->angle>>ANGLETOFINESHIFT)) - viewx; @@ -1281,17 +1280,15 @@ static void R_ProjectSprite(mobj_t *thing) if (ang >= ANGLE_180) { fixed_t temp = yscale2; - yscale2 = yscale1; - yscale1 = temp; + yscale2 = yscale; + yscale = temp; } if (x2 > x1) range = (x2 - x1); else range = 1; - scalestep = (yscale2 - yscale1)/range; - //this_scale = FixedMul(this_scale, FixedDiv(yscale, yscale1)); - yscale = yscale1; + scalestep = (yscale2 - yscale)/range; } xscale = FixedMul(xscale, ang_scale);