Classic drawmasks(): if sprite is on other side of maskwall, always draw it first.

This fixes the bug reported here:
http://forums.duke4.net/topic/5340-bug-with-masked-walls/page__view__findpost__p__123233
But I haven't checked the change for any adverse effects.

git-svn-id: https://svn.eduke32.com/eduke32@3701 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-04-21 19:55:45 +00:00
parent 14b16a10eb
commit b6be776079

View file

@ -9209,6 +9209,8 @@ killsprite:
const int32_t w = (getrendermode()==REND_POLYMER) ? const int32_t w = (getrendermode()==REND_POLYMER) ?
maskwall[maskwallcnt] : thewall[maskwall[maskwallcnt]]; maskwall[maskwallcnt] : thewall[maskwall[maskwallcnt]];
const int32_t otherside_spr_first = (getrendermode() == REND_CLASSIC);
dot.x = (float)wall[w].x; dot.x = (float)wall[w].x;
dot.y = (float)wall[w].y; dot.y = (float)wall[w].y;
dot2.x = (float)wall[wall[w].point2].x; dot2.x = (float)wall[wall[w].point2].x;
@ -9216,11 +9218,14 @@ killsprite:
maskeq = equation(dot.x, dot.y, dot2.x, dot2.y); maskeq = equation(dot.x, dot.y, dot2.x, dot2.y);
if (!otherside_spr_first)
{
p1eq = equation(pos.x, pos.y, dot.x, dot.y); p1eq = equation(pos.x, pos.y, dot.x, dot.y);
p2eq = equation(pos.x, pos.y, dot2.x, dot2.y); p2eq = equation(pos.x, pos.y, dot2.x, dot2.y);
middle.x = (dot.x + dot2.x) / 2; middle.x = (dot.x + dot2.x) / 2;
middle.y = (dot.y + dot2.y) / 2; middle.y = (dot.y + dot2.y) / 2;
}
i = spritesortcnt; i = spritesortcnt;
while (i--) while (i--)
@ -9233,9 +9238,9 @@ killsprite:
spr.y = (float)tspriteptr[i]->y; spr.y = (float)tspriteptr[i]->y;
if (!sameside(&maskeq, &spr, &pos) && if (!sameside(&maskeq, &spr, &pos) &&
sameside(&p1eq, &middle, &spr) && (otherside_spr_first ||
sameside(&p2eq, &middle, &spr) (sameside(&p1eq, &middle, &spr) &&
) sameside(&p2eq, &middle, &spr))))
{ {
drawsprite(i); drawsprite(i);
tspriteptr[i] = NULL; tspriteptr[i] = NULL;