From fbff05bd17b8b636a93363f8c2ee5bf147645901 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 19 Aug 2016 12:26:26 +0100 Subject: [PATCH] Fixed the between-objects sorting problem previously mentioned in the merge request. Now they're sorted by whichever sprite has an end closest to the camera, instead of the middle point previously used. http://i.imgur.com/UyOKX5u.png <-- this common glitch with crawlas given MF_PAPER (THEY'RE NOT GOOD AT TURNING NEAR EDGES) used to show the behind-crawlas in front of the front-crawlas. Unfortunately, I've just discovered this issue (which happens with the old version of the sorting code too): http://i.imgur.com/QNjbATB.png but to be fair these crawlas have gotten stuck inside the edges of this platform, so I'm not sure I can do anything about this without cutting off Sonic's feet when he stands on the ground? shrug --- src/r_things.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 97c1b5d7b..970c59b3d 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1152,7 +1152,7 @@ static void R_ProjectSprite(mobj_t *thing) // aspect ratio stuff xscale = FixedDiv(projection, tz); - sortscale = FixedDiv(projectiony, tz); + yscale = FixedDiv(projectiony, tz); // decide which patch to use for sprite relative to player #ifdef RANGECHECK @@ -1292,11 +1292,13 @@ static void R_ProjectSprite(mobj_t *thing) range = 1; scalestep = (yscale2 - yscale)/range; + + sortscale = max(yscale, yscale2); } else { - yscale = sortscale; scalestep = 0; + sortscale = yscale; } xscale = FixedMul(xscale, ang_scale);