From b6be77607953d966a7007be4592881137e0a5a8b Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 21 Apr 2013 19:55:45 +0000 Subject: [PATCH] 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 --- polymer/eduke32/build/src/engine.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index a465a70bc..30c0ba1f3 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -9209,6 +9209,8 @@ killsprite: const int32_t w = (getrendermode()==REND_POLYMER) ? maskwall[maskwallcnt] : thewall[maskwall[maskwallcnt]]; + const int32_t otherside_spr_first = (getrendermode() == REND_CLASSIC); + dot.x = (float)wall[w].x; dot.y = (float)wall[w].y; dot2.x = (float)wall[wall[w].point2].x; @@ -9216,11 +9218,14 @@ killsprite: maskeq = equation(dot.x, dot.y, dot2.x, dot2.y); - p1eq = equation(pos.x, pos.y, dot.x, dot.y); - p2eq = equation(pos.x, pos.y, dot2.x, dot2.y); + if (!otherside_spr_first) + { + p1eq = equation(pos.x, pos.y, dot.x, dot.y); + p2eq = equation(pos.x, pos.y, dot2.x, dot2.y); - middle.x = (dot.x + dot2.x) / 2; - middle.y = (dot.y + dot2.y) / 2; + middle.x = (dot.x + dot2.x) / 2; + middle.y = (dot.y + dot2.y) / 2; + } i = spritesortcnt; while (i--) @@ -9233,9 +9238,9 @@ killsprite: spr.y = (float)tspriteptr[i]->y; if (!sameside(&maskeq, &spr, &pos) && - sameside(&p1eq, &middle, &spr) && - sameside(&p2eq, &middle, &spr) - ) + (otherside_spr_first || + (sameside(&p1eq, &middle, &spr) && + sameside(&p2eq, &middle, &spr)))) { drawsprite(i); tspriteptr[i] = NULL;