mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 11:10:39 +00:00
Various mapster32 fixes: check wall limits in sector drawing; don't count BACKSPACEing there as a new revision (probably fixes undo-related crashes). Also a patch-fix for a crash I couldn't pin down exactly and a corruption checker for m32script.
git-svn-id: https://svn.eduke32.com/eduke32@1622 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
32a86d8fce
commit
f7154d8c78
2 changed files with 153 additions and 39 deletions
|
@ -517,3 +517,82 @@ defstate resetallws // reset all sprites and walls to default repeat/panning
|
||||||
fixrepeats i
|
fixrepeats i
|
||||||
}
|
}
|
||||||
ends
|
ends
|
||||||
|
|
||||||
|
defstate jumptosec // (tmp)
|
||||||
|
for i allsectors
|
||||||
|
{
|
||||||
|
ife i tmp
|
||||||
|
{
|
||||||
|
set j sector[i].wallptr
|
||||||
|
set posx wall[j].x
|
||||||
|
set posy wall[j].y
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ends
|
||||||
|
|
||||||
|
// Map corruption checker
|
||||||
|
definequote 19 PANIC!!! SECTOR OR WALL LIMIT EXCEEDED!!!
|
||||||
|
definequote 20 SECTOR[%d].WALLPTR=%d out of range: numwalls=%d!!!
|
||||||
|
definequote 21 SECTOR[%d].WALLPTR=%d inconsistent, expected %d!!!
|
||||||
|
definequote 22 SECTOR[%d]: wallptr+wallnum=%d out of range: numwalls=%d!!!
|
||||||
|
definequote 23 WALL[%d].POINT2=%d out of range: sector[%d].wallptr=%d, endwall=%d!!!
|
||||||
|
definequote 24 WALL[%d].NEXTWALL=%d out of range: numwalls=%d!!!
|
||||||
|
definequote 25 WALL[%d].NEXTSECTOR=%d out of range: numsectors=%d!!!
|
||||||
|
|
||||||
|
gamevar ewall 0 0
|
||||||
|
gamevar endwall 0 0
|
||||||
|
|
||||||
|
defstate corruptchk
|
||||||
|
ifle numsectors MAXSECTORS ifle numwalls MAXWALLS nullop else
|
||||||
|
{ quote 19 printmessage16 19 return }
|
||||||
|
set ewall 0 // expected wall index
|
||||||
|
for i allsectors
|
||||||
|
{
|
||||||
|
set k 1
|
||||||
|
ifge sector[i].wallptr 0 ifl sector[i].wallptr numwalls nullop else
|
||||||
|
{
|
||||||
|
qsprintf TQUOTE 20 i sector[i].wallptr numwalls
|
||||||
|
quote TQUOTE printmessage16 TQUOTE
|
||||||
|
set k 0
|
||||||
|
}
|
||||||
|
ifn ewall sector[i].wallptr
|
||||||
|
{
|
||||||
|
qsprintf TQUOTE 21 i sector[i].wallptr ewall
|
||||||
|
quote TQUOTE printmessage16 TQUOTE
|
||||||
|
set ewall sector[i].wallptr
|
||||||
|
}
|
||||||
|
add ewall sector[i].wallnum
|
||||||
|
|
||||||
|
set endwall sector[i].wallptr add endwall sector[i].wallnum
|
||||||
|
ifg endwall numwalls
|
||||||
|
{
|
||||||
|
qsprintf TQUOTE 22 i endwall numwalls
|
||||||
|
quote TQUOTE printmessage16 TQUOTE
|
||||||
|
set k 0
|
||||||
|
}
|
||||||
|
|
||||||
|
ifn k 0
|
||||||
|
{
|
||||||
|
for j wallsofsector i
|
||||||
|
{
|
||||||
|
ifge wall[j].point2 sector[i].wallptr ifl wall[i].point2 endwall nullop else
|
||||||
|
{
|
||||||
|
qsprintf TQUOTE 23 j wall[j].point2 i sector[i].wallptr endwall
|
||||||
|
quote TQUOTE printmessage16 TQUOTE
|
||||||
|
}
|
||||||
|
|
||||||
|
ifge wall[i].nextwall numwalls
|
||||||
|
{
|
||||||
|
qsprintf TQUOTE 24 j wall[j].nextwall numwalls
|
||||||
|
quote TQUOTE printmessage16 TQUOTE
|
||||||
|
}
|
||||||
|
|
||||||
|
ifge wall[i].nextsector numsectors
|
||||||
|
{
|
||||||
|
qsprintf TQUOTE 25 j wall[j].nextsector numsectors
|
||||||
|
quote TQUOTE printmessage16 TQUOTE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ends
|
||||||
|
|
|
@ -1194,6 +1194,8 @@ char changechar(char dachar, int32_t dadir, char smooshyalign, char boundcheck)
|
||||||
return(dachar);
|
return(dachar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t newnumwalls=-1;
|
||||||
|
|
||||||
void overheadeditor(void)
|
void overheadeditor(void)
|
||||||
{
|
{
|
||||||
char buffer[80], *dabuffer, ch;
|
char buffer[80], *dabuffer, ch;
|
||||||
|
@ -1201,7 +1203,7 @@ void overheadeditor(void)
|
||||||
int32_t tempint, tempint1, tempint2, doubvel;
|
int32_t tempint, tempint1, tempint2, doubvel;
|
||||||
int32_t startwall=0, endwall, dax, day, x1, y1, x2, y2, x3, y3, x4, y4;
|
int32_t startwall=0, endwall, dax, day, x1, y1, x2, y2, x3, y3, x4, y4;
|
||||||
int32_t highlightx1, highlighty1, highlightx2, highlighty2, xvect, yvect;
|
int32_t highlightx1, highlighty1, highlightx2, highlighty2, xvect, yvect;
|
||||||
int16_t pag, suckwall=0, sucksect, newnumwalls, newnumsectors, split=0, bad;
|
int16_t pag, suckwall=0, sucksect, /*newnumwalls,*/ newnumsectors, split=0, bad;
|
||||||
int16_t splitsect=0, danumwalls, secondstartwall, joinsector[2], joinsectnum;
|
int16_t splitsect=0, danumwalls, secondstartwall, joinsector[2], joinsectnum;
|
||||||
int16_t splitstartwall=0, splitendwall, loopnum;
|
int16_t splitstartwall=0, splitendwall, loopnum;
|
||||||
int32_t mousx, mousy, bstatus;
|
int32_t mousx, mousy, bstatus;
|
||||||
|
@ -3348,9 +3350,16 @@ SKIP:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bad > 0) //Space
|
if (bad > 0 && (max(numwalls,newnumwalls) > MAXWALLS - (newnumwalls < numwalls)))
|
||||||
{
|
{
|
||||||
if ((newnumwalls < numwalls) && (numwalls < MAXWALLS-1))
|
if (newnumwalls < numwalls)
|
||||||
|
printmessage16("Can't start sector drawing: wall limit reached.");
|
||||||
|
else
|
||||||
|
printmessage16("Inserting another point would exceed wall limit.");
|
||||||
|
}
|
||||||
|
else if (bad > 0) //Space
|
||||||
|
{
|
||||||
|
if ((newnumwalls < numwalls) /*&& (numwalls < MAXWALLS-1)*/)
|
||||||
{
|
{
|
||||||
firstx = mousxplc, firsty = mousyplc; //Make first point
|
firstx = mousxplc, firsty = mousyplc; //Make first point
|
||||||
newnumwalls = numwalls;
|
newnumwalls = numwalls;
|
||||||
|
@ -3581,6 +3590,7 @@ SKIP:
|
||||||
//split sector
|
//split sector
|
||||||
startwall = sector[splitsect].wallptr;
|
startwall = sector[splitsect].wallptr;
|
||||||
endwall = startwall + sector[splitsect].wallnum - 1;
|
endwall = startwall + sector[splitsect].wallnum - 1;
|
||||||
|
// OSD_Printf("numwalls: %d, newnumwalls: %d\n", numwalls, newnumwalls);
|
||||||
for (k=startwall; k<=endwall; k++)
|
for (k=startwall; k<=endwall; k++)
|
||||||
if (wall[k].x == wall[newnumwalls-1].x)
|
if (wall[k].x == wall[newnumwalls-1].x)
|
||||||
if (wall[k].y == wall[newnumwalls-1].y)
|
if (wall[k].y == wall[newnumwalls-1].y)
|
||||||
|
@ -3589,6 +3599,16 @@ SKIP:
|
||||||
if (loopnumofsector(splitsect,splitstartwall) != loopnumofsector(splitsect,(int16_t)k))
|
if (loopnumofsector(splitsect,splitstartwall) != loopnumofsector(splitsect,(int16_t)k))
|
||||||
bad = 1;
|
bad = 1;
|
||||||
|
|
||||||
|
if (numwalls+2*(newnumwalls-numwalls-1) > MAXWALLS)
|
||||||
|
{
|
||||||
|
if (bad==0)
|
||||||
|
printmessage16("Splitting sector would exceed wall limit.");
|
||||||
|
else
|
||||||
|
printmessage16("Joining sector loops would exceed wall limit.");
|
||||||
|
newnumwalls--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (bad == 0)
|
if (bad == 0)
|
||||||
{
|
{
|
||||||
//SPLIT IT!
|
//SPLIT IT!
|
||||||
|
@ -3954,13 +3974,13 @@ SKIP:
|
||||||
if (newnumwalls > numwalls)
|
if (newnumwalls > numwalls)
|
||||||
{
|
{
|
||||||
newnumwalls--;
|
newnumwalls--;
|
||||||
asksave = 1;
|
// asksave = 1;
|
||||||
keystatus[0x0e] = 0;
|
keystatus[0x0e] = 0;
|
||||||
}
|
}
|
||||||
if (newnumwalls == numwalls)
|
if (newnumwalls == numwalls)
|
||||||
{
|
{
|
||||||
newnumwalls = -1;
|
newnumwalls = -1;
|
||||||
asksave = 1;
|
// asksave = 1;
|
||||||
keystatus[0x0e] = 0;
|
keystatus[0x0e] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4105,6 +4125,7 @@ SKIP:
|
||||||
else if (linehighlight >= 0)
|
else if (linehighlight >= 0)
|
||||||
{
|
{
|
||||||
int32_t wallsdrawn = newnumwalls-numwalls;
|
int32_t wallsdrawn = newnumwalls-numwalls;
|
||||||
|
int32_t wallis2sided = (wall[linehighlight].nextwall>=0);
|
||||||
|
|
||||||
if (newnumwalls != -1)
|
if (newnumwalls != -1)
|
||||||
{
|
{
|
||||||
|
@ -4113,6 +4134,10 @@ SKIP:
|
||||||
}
|
}
|
||||||
else wallsdrawn = -1;
|
else wallsdrawn = -1;
|
||||||
|
|
||||||
|
if (max(numwalls,newnumwalls) >= MAXWALLS-wallis2sided)
|
||||||
|
printmessage16("Inserting point would exceed wall limit.");
|
||||||
|
else
|
||||||
|
{
|
||||||
getclosestpointonwall(mousxplc,mousyplc,(int32_t)linehighlight,&dax,&day);
|
getclosestpointonwall(mousxplc,mousyplc,(int32_t)linehighlight,&dax,&day);
|
||||||
adjustmark(&dax,&day,newnumwalls);
|
adjustmark(&dax,&day,newnumwalls);
|
||||||
insertpoint(linehighlight,dax,day);
|
insertpoint(linehighlight,dax,day);
|
||||||
|
@ -4151,6 +4176,7 @@ SKIP:
|
||||||
// printmessage16("Point inserted at midpoint.");
|
// printmessage16("Point inserted at midpoint.");
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
if (wallsdrawn != -1)
|
if (wallsdrawn != -1)
|
||||||
{
|
{
|
||||||
|
@ -5126,6 +5152,15 @@ int32_t checksectorpointer(int16_t i, int16_t sectnum)
|
||||||
{
|
{
|
||||||
int32_t j, k, startwall, endwall, x1, y1, x2, y2;
|
int32_t j, k, startwall, endwall, x1, y1, x2, y2;
|
||||||
|
|
||||||
|
char buf[128];
|
||||||
|
if (i<0 || i>=max(numwalls,newnumwalls))
|
||||||
|
{
|
||||||
|
Bsprintf(buf, "WARN: checksectorpointer called with i=%d but (new)numwalls=%d", i, max(numwalls,newnumwalls));
|
||||||
|
OSD_Printf("%s\n", buf);
|
||||||
|
printmessage16(buf);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
x1 = wall[i].x;
|
x1 = wall[i].x;
|
||||||
y1 = wall[i].y;
|
y1 = wall[i].y;
|
||||||
x2 = wall[wall[i].point2].x;
|
x2 = wall[wall[i].point2].x;
|
||||||
|
|
Loading…
Reference in a new issue