Engine: fix sprite sorting issue that caused broken voxel rendering in polymost

This commit is contained in:
nukeykt 2020-05-27 18:46:38 +09:00 committed by Christoph Oelckers
parent 8a812cc329
commit 714ed1ecdd

View file

@ -2629,20 +2629,20 @@ killsprite:
if (spritesortcnt < numSprites) if (spritesortcnt < numSprites)
{ {
int32_t py = spritesxyz[spritesortcnt].y;
int32_t pcstat = tspriteptr[spritesortcnt]->cstat & 48;
int32_t pangle = tspriteptr[spritesortcnt]->ang;
i = spritesortcnt; i = spritesortcnt;
for (bssize_t j = spritesortcnt + 1; j <= numSprites; j++) for (bssize_t i = spritesortcnt; i < numSprites;)
{ {
if (j < numSprites) int32_t py = spritesxyz[i].y;
int32_t pcstat = tspriteptr[i]->cstat & 48;
int32_t pangle = tspriteptr[i]->ang;
int j = i + 1;
if (!polymost_spriteIsModelOrVoxel(tspriteptr[i]))
{ {
if (py == spritesxyz[j].y && pcstat == (tspriteptr[j]->cstat & 48) && (pcstat != 16 || pangle == tspriteptr[j]->ang) while (j < numSprites && py == spritesxyz[j].y && pcstat == (tspriteptr[j]->cstat & 48) && (pcstat != 16 || pangle == tspriteptr[j]->ang)
&& !polymost_spriteIsModelOrVoxel(tspriteptr[j])) && !polymost_spriteIsModelOrVoxel(tspriteptr[j]))
continue; {
py = spritesxyz[j].y; j++;
pcstat = (tspriteptr[j]->cstat & 48); }
pangle = tspriteptr[j]->ang;
} }
if (j - i == 1) if (j - i == 1)
{ {