Skip to content

Commit

Permalink
Fixed|Map Importer: Detecting self-referencing sectors
Browse files Browse the repository at this point in the history
Put more weight on self-referencing line loops when it comes to detecting render hacks.

For example: AV map23 (x=800, y=1500) has a pool of regular shallow water, but a sequence of self-referencing lines cross the room for triggering an event. These self-ref lines should be ignored when detecting render hacks.

IssueID #2370
  • Loading branch information
skyjake committed Jan 1, 2020
1 parent b1f3f06 commit d763a0b
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions doomsday/apps/plugins/importidtech1/src/mapimporter.cpp
Expand Up @@ -1387,22 +1387,27 @@ DENG2_PIMPL(MapImporter)
{
auto &sector = sectors[sectorIndex];

if (sector.lines.empty()) continue;

if (!(sector.hackFlags & (HACK_HAS_AT_LEAST_ONE_SELF_REFERENCING_LINE |
HACK_HAS_SELF_REFERENCING_LOOP)))
{
continue;
}

int numSelfRef = 0;

bool good = true;
for (int lineIndex : sector.lines)
{
auto &line = lines[lineIndex];
auto & line = lines[lineIndex];
const bool isSelfRef = isSelfReferencing(line);

if (isSelfRef) ++numSelfRef;

// Sectors with a loop of self-referencing lines can contain any number
// of other lines, we'll still consider them self-referencing.

if (!isSelfReferencing(line) &&
!(sector.hackFlags & HACK_HAS_SELF_REFERENCING_LOOP))
if (!isSelfRef && !(sector.hackFlags & HACK_HAS_SELF_REFERENCING_LOOP))
{
if (!line.isTwoSided())
{
Expand All @@ -1417,7 +1422,13 @@ DENG2_PIMPL(MapImporter)
good = false;
break;
}
}
}
}
if (!(sector.hackFlags & HACK_HAS_SELF_REFERENCING_LOOP) &&
float(numSelfRef) / float(sector.lines.size()) < 0.25f)
{
// Mostly regular lines and no loops.
good = false;
}
if (good)
{
Expand Down

0 comments on commit d763a0b

Please sign in to comment.