mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Mapster32 corruptcheck: on nextsector/nextwall oob, suggest making wall white.
... in the auto-correction. Also, - make two similar corruptions level 5 (wallptr oob, wallptr+wallnum oob). - in drawscreen_drawwall(), do a more strict bound check, not only >=0. git-svn-id: https://svn.eduke32.com/eduke32@3745 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
c86bf550a5
commit
789e26b42f
2 changed files with 44 additions and 18 deletions
|
@ -15665,7 +15665,7 @@ void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum,
|
|||
static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t posze, int32_t zoome, int32_t grayp)
|
||||
{
|
||||
const walltype *wal = &wall[i];
|
||||
int32_t sect=0, j, x1, y1, x2, y2, dz = 0, dz2 = 0;
|
||||
int32_t j, x1, y1, x2, y2, dz = 0, dz2 = 0;
|
||||
int32_t fz=0,fzn=0;
|
||||
// intptr_t tempint;
|
||||
char col;
|
||||
|
@ -15701,7 +15701,7 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t
|
|||
col = 33;
|
||||
if ((wal->cstat&1) != 0)
|
||||
col = 5;
|
||||
if (wal->nextwall >= 0 && ((wal->cstat^wall[j].cstat)&1))
|
||||
if ((unsigned)wal->nextwall < MAXWALLS && ((wal->cstat^wall[j].cstat)&1))
|
||||
col = 2;
|
||||
if ((i == linehighlight) || ((linehighlight >= 0) && (i == wall[linehighlight].nextwall)))
|
||||
if (totalclock & 16)
|
||||
|
@ -15734,7 +15734,7 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t
|
|||
{
|
||||
// draw vertical line to neighboring wall
|
||||
int32_t fz2;
|
||||
sect = sectorofwall(i);
|
||||
int32_t sect = sectorofwall(i);
|
||||
|
||||
fz = getflorzofslope(sect, wal->x,wal->y);
|
||||
fz2 = getflorzofslope(sect, wall[wal->point2].x,wall[wal->point2].y);
|
||||
|
|
|
@ -11573,6 +11573,9 @@ static int32_t check_spritelist_consistency()
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define TRYFIX_NONE() (tryfixing == 0ull)
|
||||
#define TRYFIX_CNUM(onumct) (onumct < MAXCORRUPTTHINGS && (tryfixing & (1ull<<onumct)))
|
||||
|
||||
int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing)
|
||||
{
|
||||
int32_t i, j, w0, numw, endwall, ns, nw;
|
||||
|
@ -11627,7 +11630,7 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing)
|
|||
if (w0 < 0 || w0 >= MAXWALLS)
|
||||
CORRUPTCHK_PRINT(5, CORRUPT_SECTOR|i, "SECTOR[%d].WALLPTR=%d INVALID!!!", i, w0);
|
||||
else
|
||||
CORRUPTCHK_PRINT(4, CORRUPT_SECTOR|i, "SECTOR[%d].WALLPTR=%d out of range (numwalls=%d)", i, w0, numw);
|
||||
CORRUPTCHK_PRINT(5, CORRUPT_SECTOR|i, "SECTOR[%d].WALLPTR=%d out of range (numwalls=%d)", i, w0, numw);
|
||||
}
|
||||
|
||||
if (w0 != ewall)
|
||||
|
@ -11642,7 +11645,7 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing)
|
|||
|
||||
endwall = w0 + numw;
|
||||
if (endwall > numwalls)
|
||||
CORRUPTCHK_PRINT(4, CORRUPT_SECTOR|i, "SECTOR[%d]: wallptr+wallnum=%d out of range: numwalls=%d", i, endwall, numwalls);
|
||||
CORRUPTCHK_PRINT(5, CORRUPT_SECTOR|i, "SECTOR[%d]: wallptr+wallnum=%d out of range: numwalls=%d", i, endwall, numwalls);
|
||||
|
||||
// inconsistent cstat&2 and heinum checker
|
||||
{
|
||||
|
@ -11697,9 +11700,12 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing)
|
|||
}
|
||||
|
||||
nw = wall[j].nextwall;
|
||||
ns = wall[j].nextsector;
|
||||
|
||||
if (nw >= numwalls)
|
||||
{
|
||||
int32_t onumct = numcorruptthings;
|
||||
|
||||
if (TRYFIX_NONE())
|
||||
{
|
||||
if (nw >= MAXWALLS)
|
||||
CORRUPTCHK_PRINT(5, CORRUPT_WALL|j, "WALL[%d].NEXTWALL=%d INVALID!!!",
|
||||
|
@ -11707,9 +11713,22 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing)
|
|||
else
|
||||
CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTWALL=%d out of range: numwalls=%d",
|
||||
j, nw, numwalls);
|
||||
OSD_Printf(" will make wall %d white on tryfix\n", j);
|
||||
}
|
||||
else if (TRYFIX_CNUM(onumct)) // CODEDUP MAKE_WALL_WHITE
|
||||
{
|
||||
wall[j].nextwall = wall[j].nextsector = -1;
|
||||
OSD_Printf(CCHK_CORRECTED "auto-correction: made wall %d white\n", j);
|
||||
}
|
||||
}
|
||||
|
||||
ns = wall[j].nextsector;
|
||||
|
||||
if (ns >= numsectors)
|
||||
{
|
||||
int32_t onumct = numcorruptthings;
|
||||
|
||||
if (TRYFIX_NONE())
|
||||
{
|
||||
if (ns >= MAXSECTORS)
|
||||
CORRUPTCHK_PRINT(5, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR=%d INVALID!!!",
|
||||
|
@ -11717,6 +11736,13 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing)
|
|||
else
|
||||
CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR=%d out of range: numsectors=%d",
|
||||
j, ns, numsectors);
|
||||
OSD_Printf(" will make wall %d white on tryfix\n", j);
|
||||
}
|
||||
else if (TRYFIX_CNUM(onumct)) // CODEDUP MAKE_WALL_WHITE
|
||||
{
|
||||
wall[j].nextwall = wall[j].nextsector = -1;
|
||||
OSD_Printf(CCHK_CORRECTED "auto-correction: made wall %d white\n", j);
|
||||
}
|
||||
}
|
||||
|
||||
if (nw>=w0 && nw<=endwall)
|
||||
|
|
Loading…
Reference in a new issue