mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- Check for maps with bad setup of their wall lists.
Lo Wang In Time's map 11 does not include wall 0 into its sector, which caused crashes when trying to triangulate this sector.
This commit is contained in:
parent
64fc0b66b2
commit
62a5a720e8
2 changed files with 18 additions and 10 deletions
|
@ -55,6 +55,23 @@ TArray<int> splits;
|
||||||
|
|
||||||
void hw_BuildSections()
|
void hw_BuildSections()
|
||||||
{
|
{
|
||||||
|
for (int i = 0; i < numsectors; i++)
|
||||||
|
{
|
||||||
|
// Fix maps which do not set their wallptr to the first wall. Lo Wang In Time's map 11 is such a case.
|
||||||
|
int wp = sector[i].wallptr;
|
||||||
|
while (wp > 0 && wall[wp - 1].nextwall >= 0 && wall[wall[wp - 1].nextwall].nextsector == i)
|
||||||
|
{
|
||||||
|
sector[i].wallptr--;
|
||||||
|
sector[i].wallnum++;
|
||||||
|
wp--;
|
||||||
|
}
|
||||||
|
sections[i].sector = i;
|
||||||
|
sections[i].lines.Resize(sector[i].wallnum);
|
||||||
|
for (int j = 0; j < sector[i].wallnum; j++) sections[i].lines[j] = sector[i].wallptr + j;
|
||||||
|
sectionspersector[i].Resize(1);
|
||||||
|
sectionspersector[i][0] = i;
|
||||||
|
}
|
||||||
|
|
||||||
// Initial setup just creates a 1:1 mapping of walls to section lines and sectors to sections.
|
// Initial setup just creates a 1:1 mapping of walls to section lines and sectors to sections.
|
||||||
numsectionlines = numwalls;
|
numsectionlines = numwalls;
|
||||||
numsections = numsectors;
|
numsections = numsectors;
|
||||||
|
@ -68,15 +85,6 @@ void hw_BuildSections()
|
||||||
sectionLines[i].point2index = wall[i].point2 - sector[wall[i].sector].wallptr;
|
sectionLines[i].point2index = wall[i].point2 - sector[wall[i].sector].wallptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < numsectors; i++)
|
|
||||||
{
|
|
||||||
sections[i].sector = i;
|
|
||||||
sections[i].lines.Resize(sector[i].wallnum);
|
|
||||||
for (int j = 0; j < sector[i].wallnum; j++) sections[i].lines[j] = sector[i].wallptr + j;
|
|
||||||
sectionspersector[i].Resize(1);
|
|
||||||
sectionspersector[i][0] = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < splits.Size(); i += 3)
|
for (unsigned i = 0; i < splits.Size(); i += 3)
|
||||||
hw_SplitSector(splits[i], splits[i + 1], splits[i + 2]);
|
hw_SplitSector(splits[i], splits[i + 1], splits[i + 2]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,7 +243,7 @@ bool SectorGeometry::MakeVertices(unsigned int secnum, int plane, const FVector2
|
||||||
int s = start;
|
int s = start;
|
||||||
if (start >= 0 && start < numvertices)
|
if (start >= 0 && start < numvertices)
|
||||||
{
|
{
|
||||||
while (!done[start])
|
while (start >= 0 && start < numvertices && !done[start])
|
||||||
{
|
{
|
||||||
auto sline = §ionLines[sec->lines[start]];
|
auto sline = §ionLines[sec->lines[start]];
|
||||||
auto wallp = &wall[sline->startpoint];
|
auto wallp = &wall[sline->startpoint];
|
||||||
|
|
Loading…
Reference in a new issue