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,20 +1075,23 @@ void polymer_drawmasks(void)
// polymer_drawsprite(spritesortcnt); // polymer_drawsprite(spritesortcnt);
// } // }
// We (kind of) queue sector masks near to far, so drawing them in reverse if (cursectormaskcount) {
// order is the sane approach here. Of course impossible cases will arise. // We (kind of) queue sector masks near to far, so drawing them in reverse
while (*cursectormaskcount) { // order is the sane approach here. Of course impossible cases will arise.
polymer_drawsector(cursectormasks[--(*cursectormaskcount)], TRUE); while (*cursectormaskcount) {
} 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()
// Both the top-level game drawrooms and the recursive internal passes // unless we're in "external view" mode, which was checked above.
// should be accounted for here. If these free cause corruption, there's // Both the top-level game drawrooms and the recursive internal passes
// an accounting bug somewhere. // should be accounted for here. If these free cause corruption, there's
Bfree(cursectormaskcount); // an accounting bug somewhere.
cursectormaskcount = NULL; Bfree(cursectormaskcount);
Bfree(cursectormasks); cursectormaskcount = NULL;
cursectormasks = NULL; Bfree(cursectormasks);
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;
} }