temporarily bump the additional space after wall[] to 1024 walltypes in the editor; display map corruption status in upper left corner in the corrupt case.

git-svn-id: https://svn.eduke32.com/eduke32@1792 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-02-13 15:15:37 +00:00
parent 2428b11152
commit 86eaeaa727
5 changed files with 57 additions and 46 deletions

View File

@ -88,7 +88,7 @@ ifneq (0,$(DEBUGANYWAY))
endif
W_NO_UNUSED_RESULT := $(shell echo '' | $(CC) -E -Wno-unused-result - 2>/dev/null && echo -Wno-unused-result)
W_NO_UNUSED_RESULT := $(findstring -Wno-unused-result,$(WNO_UNUSED_RESULT))
W_NO_UNUSED_RESULT := $(findstring -Wno-unused-result,$(W_NO_UNUSED_RESULT))
BASECFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -D_FORTIFY_SOURCE=2 \

View File

@ -114,7 +114,7 @@ extern const char *SaveBoard(const char *fn, uint32_t flags);
#define CORRUPT_SPRITE (1<<19)
#define CORRUPT_MASK (CORRUPT_SECTOR|CORRUPT_WALL|CORRUPT_SPRITE)
#define MAXCORRUPTTHINGS 64
extern int32_t numcorruptthings, corruptthings[MAXCORRUPTTHINGS];
extern int32_t corruptlevel, numcorruptthings, corruptthings[MAXCORRUPTTHINGS];
extern int32_t autocorruptcheck;
extern int32_t CheckMapCorruption(int32_t printfromlev, int32_t tryfixing);

View File

@ -1259,16 +1259,25 @@ static inline void drawline16base(int32_t bx, int32_t by, int32_t x1, int32_t y1
drawline16(bx+x1, by+y1, bx+x2, by+y2, col);
}
static void drawsmalllabel(const char *text, char col, char backcol,
int32_t x1, int32_t y1, int32_t x2, int32_t y2)
static void drawsmalllabel(const char *text, char col, char backcol, int32_t dax, int32_t day)
{
printext16(x1,y1, col,backcol, text,1);
drawline16(x1-1,y1-1, x2-3,y1-1, backcol);
drawline16(x1-1,y2+1, x2-3,y2+1, backcol);
int32_t x1, y1, x2, y2;
drawline16(x1-2,y1, x1-2,y2, backcol);
drawline16(x2-2,y1, x2-2,y2, backcol);
drawline16(x2-3,y1, x2-3,y2, backcol);
x1 = halfxdim16+dax-(Bstrlen(text)<<1);
y1 = midydim16+day-4;
x2 = x1 + (Bstrlen(text)<<2)+2;
y2 = y1 + 7;
if ((x1 > 3) && (x2 < xdim) && (y1 > 1) && (y2 < ydim16))
{
printext16(x1,y1, col,backcol, text,1);
drawline16(x1-1,y1-1, x2-3,y1-1, backcol);
drawline16(x1-1,y2+1, x2-3,y2+1, backcol);
drawline16(x1-2,y1, x1-2,y2, backcol);
drawline16(x2-2,y1, x2-2,y2, backcol);
drawline16(x2-3,y1, x2-3,y2, backcol);
}
}
// backup highlighted sectors with sprites as mapinfo for later restoration
@ -1944,13 +1953,7 @@ void overheadeditor(void)
if (m32_sideview)
day += vdisp;
x1 = halfxdim16+dax-(Bstrlen(dabuffer)<<1);
y1 = midydim16+day-4;
x2 = x1 + (Bstrlen(dabuffer)<<2)+2;
y2 = y1 + 7;
if ((x1 > 3) && (x2 < xdim) && (y1 > 1) && (y2 < ydim16))
drawsmalllabel(dabuffer, editorcolors[0], editorcolors[7],
x1,y1, x2,y2);
drawsmalllabel(dabuffer, editorcolors[0], editorcolors[7], dax, day);
}
}
}
@ -1985,14 +1988,7 @@ void overheadeditor(void)
if (m32_sideview)
day += getscreenvdisp(getflorzofslope(sectorofwall(i), dax,day)-pos.z, zoom);
x1 = halfxdim16+dax-(Bstrlen(dabuffer)<<1);
y1 = midydim16+day-4;
x2 = x1 + (Bstrlen(dabuffer)<<2)+2;
y2 = y1 + 7;
if ((x1 > 3) && (x2 < xdim) && (y1 > 1) && (y2 < ydim16))
drawsmalllabel(dabuffer, editorcolors[0], editorcolors[31],
x1,y1, x2,y2);
drawsmalllabel(dabuffer, editorcolors[0], editorcolors[31], dax, day);
}
}
}
@ -2022,12 +2018,6 @@ void overheadeditor(void)
if (m32_sideview)
day += getscreenvdisp(sprite[i].z-pos.z, zoom);
x1 = halfxdim16+dax-(Bstrlen(dabuffer)<<1);
y1 = midydim16+day-4;
x2 = x1 + (Bstrlen(dabuffer)<<2)+2;
y2 = y1 + 7;
if ((x1 > 3) && (x2 < xdim) && (y1 > 1) && (y2 < ydim16))
{
int32_t blocking = (sprite[i].cstat&1);
@ -2038,8 +2028,7 @@ void overheadeditor(void)
if ((i == pointhighlight-16384) && (totalclock & 32))
col += (2<<2);
drawsmalllabel(dabuffer, editorcolors[0], editorcolors[col],
x1,y1, x2,y2);
drawsmalllabel(dabuffer, editorcolors[0], editorcolors[col], dax, day);
}
}
j--;
@ -2084,16 +2073,24 @@ void overheadeditor(void)
if (joinsector[0] >= 0)
col = editorcolors[11];
if (numcorruptthings>0 && (pointhighlight&16384)==0)
if (numcorruptthings>0)
{
for (i=0; i<numcorruptthings; i++)
if ((corruptthings[i]&CORRUPT_MASK)==CORRUPT_WALL &&
static char cbuf[64];
if ((pointhighlight&16384)==0)
{
for (i=0; i<numcorruptthings; i++)
if ((corruptthings[i]&CORRUPT_MASK)==CORRUPT_WALL &&
(corruptthings[i]&(MAXWALLS-1))==pointhighlight)
{
col = editorcolors[13];
printext16(searchx+6,searchy-6-8,editorcolors[13],editorcolors[0],"corrupt wall",0);
break;
}
{
col = editorcolors[13];
printext16(searchx+6,searchy-6-8,editorcolors[13],editorcolors[0],"corrupt wall",0);
break;
}
}
Bsprintf(cbuf, "map corrupt (level %d): %d errors", corruptlevel, numcorruptthings);
printext16(8,8, editorcolors[13],editorcolors[0],cbuf,0);
}
if ((keystatus[0x36] || keystatus[0xb8]) && !eitherCTRL) // RSHIFT || RALT

View File

@ -6186,7 +6186,7 @@ int32_t preinitengine(void)
dynarray[] =
{
{ (void **) &sector, sizeof(sectortype) *MAXSECTORS },
{ (void **) &wall, sizeof(walltype) *(MAXWALLS+4) }, // +4: editor quirks
{ (void **) &wall, sizeof(walltype) *MAXWALLS }, // +1024: editor quirks. FIXME!
{ (void **) &sprite, sizeof(spritetype) *MAXSPRITES },
{ (void **) &tsprite, sizeof(spritetype) *MAXSPRITESONSCREEN },
{ (void **) &spriteext, sizeof(spriteext_t) *(MAXSPRITES+MAXUNIQHUDID) },
@ -6195,6 +6195,12 @@ int32_t preinitengine(void)
{ (void **) &state_decompress, sizeof(qlz_state_decompress) }
};
if (editstatus)
{
dynarray[1].size += 1024*sizeof(walltype);
Bprintf("FIXME: Allocating additional space beyong wall[] for editor bugs.\n");
}
for (i=0; i<(signed)(sizeof(dynarray)/sizeof(dynarray[0])); i++)
size += dynarray[i].size;

View File

@ -103,7 +103,7 @@ int32_t autocorruptcheck = 0;
static int32_t corruptchecktimer;
static int32_t curcorruptthing=-1;
int32_t numcorruptthings=0, corruptthings[MAXCORRUPTTHINGS];
int32_t corruptlevel=0, numcorruptthings=0, corruptthings[MAXCORRUPTTHINGS];
static uint32_t templenrepquot;
static void fixxrepeat(int16_t i, uint32_t lenrepquot)
@ -7884,11 +7884,14 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm)
{
if (!Bstrcasecmp(parm->parms[0], "now"))
{
CheckMapCorruption(1, 0);
if (CheckMapCorruption(1, 0)==0)
OSD_Printf("All OK.\n");
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->parms[0], "tryfix"))
{
CheckMapCorruption(3, 1);
return OSDCMD_OK;
}
else if (isdigit(parm->parms[0][0]))
{
@ -9987,8 +9990,8 @@ void ExtCheckKeys(void)
if (autocorruptcheck>0 && totalclock > corruptchecktimer)
{
if (CheckMapCorruption(3, 0)>=4)
message("Corruption detected. See OSD for details.");
if (CheckMapCorruption(3, 0)>=3)
printmessage16("Corruption detected. See OSD for details.");
corruptchecktimer = totalclock + 120*autocorruptcheck;
}
}
@ -10084,7 +10087,10 @@ int32_t CheckMapCorruption(int32_t printfromlev, int32_t tryfixing)
CORRUPTCHK_PRINT(5, 0, CCHK_PANIC "WALL LIMIT EXCEEDED (MAXWALLS=%d)!!!", MAXWALLS);
if (numsectors>MAXSECTORS || numwalls>MAXWALLS)
{
corruptlevel = bad;
return bad;
}
seen_nextwalls = Bcalloc((numwalls+7)>>3,1);
if (!seen_nextwalls) return 5;
@ -10253,6 +10259,8 @@ int32_t CheckMapCorruption(int32_t printfromlev, int32_t tryfixing)
Bfree(seen_nextwalls);
Bfree(lastnextwallsource);
corruptlevel = errlevel;
return errlevel;
}
////