Polymer: fix external view.

Some of the ROR code was operating under the assumption that drawasks
always correspond to one call of polymer_displarooms(), but that's not
necessarily the case; external view draws all sectors from the top
polymer_drawrooms(), which was causing crashes. Just ignore the sector
mask queues in external view mode, we already don't draw masked walls.

git-svn-id: https://svn.eduke32.com/eduke32@1982 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2011-08-20 21:06:00 +00:00
parent 0423ff8184
commit 8e5bf7a89c

View file

@ -1075,13 +1075,15 @@ void polymer_drawmasks(void)
// polymer_drawsprite(spritesortcnt); // polymer_drawsprite(spritesortcnt);
// } // }
if (cursectormaskcount) {
// We (kind of) queue sector masks near to far, so drawing them in reverse // We (kind of) queue sector masks near to far, so drawing them in reverse
// order is the sane approach here. Of course impossible cases will arise. // order is the sane approach here. Of course impossible cases will arise.
while (*cursectormaskcount) { while (*cursectormaskcount) {
polymer_drawsector(cursectormasks[--(*cursectormaskcount)], TRUE); polymer_drawsector(cursectormasks[--(*cursectormaskcount)], TRUE);
} }
// This should _always_ be called after a corresponding pr_displayrooms(). // This should _always_ be called after a corresponding pr_displayrooms()
// unless we're in "external view" mode, which was checked above.
// Both the top-level game drawrooms and the recursive internal passes // Both the top-level game drawrooms and the recursive internal passes
// should be accounted for here. If these free cause corruption, there's // should be accounted for here. If these free cause corruption, there's
// an accounting bug somewhere. // an accounting bug somewhere.
@ -1089,6 +1091,7 @@ void polymer_drawmasks(void)
cursectormaskcount = NULL; cursectormaskcount = NULL;
Bfree(cursectormasks); Bfree(cursectormasks);
cursectormasks = NULL; cursectormasks = NULL;
}
// bglDisable(GL_POLYGON_OFFSET_FILL); // bglDisable(GL_POLYGON_OFFSET_FILL);
bglDisable(GL_BLEND); bglDisable(GL_BLEND);
@ -2529,7 +2532,7 @@ static void polymer_drawsector(int16_t sectnum, int32_t domasks)
if (searchit == 2) if (searchit == 2)
memcpy(s->floor.material.diffusemodulation, oldcolor, sizeof(GLubyte) * 4); memcpy(s->floor.material.diffusemodulation, oldcolor, sizeof(GLubyte) * 4);
} else if (!domasks && sec->floorstat & 384) { } else if (!domasks && cursectormaskcount && sec->floorstat & 384) {
// If we just skipped a mask, queue it for later // If we just skipped a mask, queue it for later
cursectormasks[(*cursectormaskcount)++] = sectnum; cursectormasks[(*cursectormaskcount)++] = sectnum;
// Don't queue it twice if the ceiling is also a mask, though. // Don't queue it twice if the ceiling is also a mask, though.
@ -2566,7 +2569,8 @@ static void polymer_drawsector(int16_t sectnum, int32_t domasks)
if (searchit == 2) if (searchit == 2)
memcpy(s->ceil.material.diffusemodulation, oldcolor, sizeof(GLubyte) * 4); memcpy(s->ceil.material.diffusemodulation, oldcolor, sizeof(GLubyte) * 4);
} else if (!domasks && !queuedmask && (sec->ceilingstat & 384)) { } else if (!domasks && !queuedmask && cursectormaskcount &&
(sec->ceilingstat & 384)) {
// If we just skipped a mask, queue it for later // If we just skipped a mask, queue it for later
cursectormasks[(*cursectormaskcount)++] = sectnum; cursectormasks[(*cursectormaskcount)++] = sectnum;
} }