engine.cpp: fix sprite sorting/adjustment issue introduced in r7612 that caused sprites with the same y value at the end of the sorted array to not be adjusted properly

git-svn-id: https://svn.eduke32.com/eduke32@7627 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
pogokeen 2019-05-06 21:53:46 +00:00 committed by Christoph Oelckers
parent fc636b53ca
commit 78d08b3ac2

View file

@ -8533,7 +8533,7 @@ killsprite:
spritesxyz[i].y = yp; spritesxyz[i].y = yp;
} }
int32_t gap, ys; int32_t gap, y, ys;
gap = 1; while (gap < spritesortcnt) gap = (gap<<1)+1; gap = 1; while (gap < spritesortcnt) gap = (gap<<1)+1;
for (gap>>=1; gap>0; gap>>=1) //Sort sprite list for (gap>>=1; gap>0; gap>>=1) //Sort sprite list
@ -8549,11 +8549,11 @@ killsprite:
ys = spritesxyz[0].y; i = 0; ys = spritesxyz[0].y; i = 0;
for (bssize_t j=1; j<=spritesortcnt; j++) for (bssize_t j=1; j<=spritesortcnt; j++)
{ {
if (j == spritesortcnt || y = spritesxyz[j].y^(j == spritesortcnt);
spritesxyz[j].y == ys) if (y == ys)
continue; continue;
ys = spritesxyz[j].y; ys = y;
if (j > i+1) if (j > i+1)
{ {