From 10a8682620c547f5b187633e12ea282b2eae76c6 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 16 Aug 2016 23:38:59 +0100 Subject: [PATCH] resolved issue where the sides had the opposite scales over ANGLE_180. also, i've sussed out WHAT'S going wrong here - the topleft pixel of the sprite will always be rendered at the height on the screen it would be rendered otherwise, which is causing the waving. now to figure out what to change to get that to move appropriately... --- src/r_things.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index f17b4ec52..6cb5bac6a 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1256,6 +1256,7 @@ static void R_ProjectSprite(mobj_t *thing) if (1) // (flatsprite) { + fixed_t yscale1; fixed_t yscale2; INT32 range; @@ -1264,7 +1265,7 @@ static void R_ProjectSprite(mobj_t *thing) gxt = FixedMul(tr_x, viewcos); gyt = -FixedMul(tr_y, viewsin); tz = gxt-gyt; - yscale = FixedDiv(projectiony, tz); + yscale1 = FixedDiv(projectiony, tz); leftoffset += spritecachedinfo[lump].width; tr_x = thing->x + FixedMul(leftoffset, FINECOSINE(ang>>ANGLETOFINESHIFT)) - viewx; @@ -1274,11 +1275,20 @@ static void R_ProjectSprite(mobj_t *thing) tz = gxt-gyt; yscale2 = FixedDiv(projectiony, tz); + if (ang >= ANGLE_180) + { + fixed_t temp = yscale2; + yscale2 = yscale1; + yscale1 = temp; + } + if (x2 > x1) range = (x2 - x1); else range = 1; - scalestep = (yscale2 - yscale)/range; + scalestep = (yscale2 - yscale1)/range; + yscale = yscale1; + //this_scale = FixedMul(this_scale, FixedDiv(yscale, yscale1)); } xscale = FixedMul(xscale, ang_scale);