From c6f0c467e374efb2e92eef9994c055e8ab2f13ac Mon Sep 17 00:00:00 2001 From: helixhorned Date: Fri, 22 May 2015 12:43:26 +0000 Subject: [PATCH] Polymer: fix rendering of middle part of 1-way masked wall. It does not depend on the "swap bottom wall parts" bit being set. The fix is by matching up the related code with Polymost. git-svn-id: https://svn.eduke32.com/eduke32@5230 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/polymer.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 9d6a7c88a..39e962944 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -3149,18 +3149,23 @@ static void polymer_updatewall(int16_t wallnum) if ((wal->cstat & 16) || (wal->cstat & 32)) { - // mask wall pass - if (wal->cstat & 4) - yref = min(sec->floorz, nsec->floorz); - else - yref = max(sec->ceilingz, nsec->ceilingz); + const int botSwap = (wal->cstat & 4); if (wal->cstat & 32) { - if ((!(wal->cstat & 2) && (wal->cstat & 4)) || ((wal->cstat & 2) && (wall[nwallnum].cstat & 4))) - yref = sec->ceilingz; + // 1-sided wall + if (nsec) + yref = botSwap ? sec->ceilingz : nsec->ceilingz; else - yref = nsec->ceilingz; + yref = botSwap ? sec->floorz : sec->ceilingz; + } + else + { + // masked wall + if (botSwap) + yref = min(sec->floorz, nsec->floorz); + else + yref = max(sec->ceilingz, nsec->ceilingz); } curpicnum = walloverpicnum;