mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-11 04:51:13 +00:00
- Fixed crash on maps with out of range sidedef and sector numbers, adapted from PRBoom.
# Conflicts: # src/p_setup.cpp
This commit is contained in:
parent
98de1423ea
commit
a05df40a6e
1 changed files with 18 additions and 9 deletions
|
@ -1742,13 +1742,6 @@ void P_LoadLineDefs (MapData * map)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// patch missing first sides instead of crashing out.
|
|
||||||
// Visual glitches are better than not being able to play.
|
|
||||||
if (LittleShort(mld->sidenum[0]) == NO_INDEX)
|
|
||||||
{
|
|
||||||
Printf("Line %d has no first side.\n", i);
|
|
||||||
mld->sidenum[0] = 0;
|
|
||||||
}
|
|
||||||
sidecount++;
|
sidecount++;
|
||||||
if (LittleShort(mld->sidenum[1]) != NO_INDEX)
|
if (LittleShort(mld->sidenum[1]) != NO_INDEX)
|
||||||
sidecount++;
|
sidecount++;
|
||||||
|
@ -1787,6 +1780,22 @@ void P_LoadLineDefs (MapData * map)
|
||||||
ProcessEDLinedef(ld, mld->tag);
|
ProcessEDLinedef(ld, mld->tag);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
// cph 2006/09/30 - fix sidedef errors right away.
|
||||||
|
for (int j=0; j < 2; j++)
|
||||||
|
{
|
||||||
|
if (LittleShort(mld->sidenum[j]) != NO_INDEX && mld->sidenum[j] >= level.sides.Size())
|
||||||
|
{
|
||||||
|
mld->sidenum[j] = 0; // dummy sidedef
|
||||||
|
Printf("Linedef %d has a bad sidedef\n", i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// patch missing first sides instead of crashing out.
|
||||||
|
// Visual glitches are better than not being able to play.
|
||||||
|
if (LittleShort(mld->sidenum[0]) == NO_INDEX)
|
||||||
|
{
|
||||||
|
Printf("Line %d has no first side.\n", i);
|
||||||
|
mld->sidenum[0] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
ld->v1 = &level.vertexes[LittleShort(mld->v1)];
|
ld->v1 = &level.vertexes[LittleShort(mld->v1)];
|
||||||
ld->v2 = &level.vertexes[LittleShort(mld->v2)];
|
ld->v2 = &level.vertexes[LittleShort(mld->v2)];
|
||||||
|
@ -2259,11 +2268,11 @@ void P_LoadSideDefs2 (MapData *map, FMissingTextureTracker &missingtex)
|
||||||
// killough 4/4/98: allow sidedef texture names to be overloaded
|
// killough 4/4/98: allow sidedef texture names to be overloaded
|
||||||
// killough 4/11/98: refined to allow colormaps to work as wall
|
// killough 4/11/98: refined to allow colormaps to work as wall
|
||||||
// textures if invalid as colormaps but valid as textures.
|
// textures if invalid as colormaps but valid as textures.
|
||||||
|
// cph 2006/09/30 - catch out-of-range sector numbers; use sector 0 instead
|
||||||
if ((unsigned)LittleShort(msd->sector)>=level.sectors.Size())
|
if ((unsigned)LittleShort(msd->sector)>=level.sectors.Size())
|
||||||
{
|
{
|
||||||
Printf (PRINT_HIGH, "Sidedef %d has a bad sector\n", i);
|
Printf (PRINT_HIGH, "Sidedef %d has a bad sector\n", i);
|
||||||
sd->sector = sec = NULL;
|
sd->sector = sec = &level.sectors[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue