Mapster32: add config variable 'corruptcheck_heinum'.

With 3 modes:
 0: auto-correction and warning disabled
 1: auto-correction enabled (default, current behavior)
 2: auto-correction and warning enabled

git-svn-id: https://svn.eduke32.com/eduke32@5320 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2015-08-08 07:04:14 +00:00
parent 212343b390
commit e8623165a7
4 changed files with 30 additions and 11 deletions

View file

@ -251,7 +251,7 @@ static inline int32_t get_nextloopstart(int32_t loopstart)
#define MAXCORRUPTTHINGS 64
extern int32_t corruptlevel, numcorruptthings, corruptthings[MAXCORRUPTTHINGS];
extern int32_t autocorruptcheck;
extern int32_t corruptcheck_noalreadyrefd;
extern int32_t corruptcheck_noalreadyrefd, corruptcheck_heinum;
extern int32_t corrupt_tryfix_alt;
extern int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing);

View file

@ -209,6 +209,8 @@ int32_t loadsetup(const char *fn)
if (readconfig(fp, "autocorruptchecksec", val, VL) > 0) autocorruptcheck = max(0, atoi_safe(val));
if (readconfig(fp, "corruptcheck_noalreadyrefd", val, VL) > 0)
corruptcheck_noalreadyrefd = !!atoi_safe(val);
if (readconfig(fp, "corruptcheck_heinum", val, VL) > 0)
corruptcheck_heinum = clamp(atoi_safe(val), 0, 2);
if (readconfig(fp, "fixmaponsave_sprites", val, VL) > 0)
fixmaponsave_sprites = !!atoi_safe(val);
if (readconfig(fp, "keeptexturestretch", val, VL) > 0)
@ -488,6 +490,10 @@ int32_t writesetup(const char *fn)
"; Ignore 'already referenced wall' warnings\n"
"corruptcheck_noalreadyrefd = %d\n"
"\n"
"; Auto-correct inconsistent ceilingstat/floorstat bit 2 and .heinum?\n"
"; Set to 2, also warn on 'corruptcheck'.\n"
"corruptcheck_heinum = %d\n"
"\n"
"; Fix sprite sectnums when saving a map or entering 3D mode\n"
"fixmaponsave_sprites = %d\n"
"\n"
@ -620,7 +626,7 @@ int32_t writesetup(const char *fn)
msens, unrealedlook, pk_uedaccel, quickmapcycling,
sideview_reversehrot,
revertCTRL,scrollamount,pk_turnaccel,pk_turndecel,autosave,autocorruptcheck,
corruptcheck_noalreadyrefd, fixmaponsave_sprites, keeptexturestretch,
corruptcheck_noalreadyrefd, corruptcheck_heinum, fixmaponsave_sprites, keeptexturestretch,
showheightindicators,showambiencesounds,pathsearchmode,
m32_2d3dmode,m32_2d3dsize,m32_2d3d.x, m32_2d3d.y,
autogray, //showinnergray,

View file

@ -8547,11 +8547,7 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm)
return OSDCMD_SHOWHELP;
if (setval)
{
pk_uedaccel = atoi_safe(parm->parms[0]);
pk_uedaccel = pk_uedaccel<0 ? 0:pk_uedaccel;
pk_uedaccel = pk_uedaccel>5 ? 5:pk_uedaccel;
}
pk_uedaccel = clamp(atoi_safe(parm->parms[0]), 0, 5);
OSD_Printf("UnrealEd mouse navigation acceleration is %d\n", pk_uedaccel);
return OSDCMD_OK;
@ -8624,6 +8620,22 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
if (!Bstrcasecmp(parm->name, "corruptcheck_heinum"))
{
if (parm->numparms > 1)
return OSDCMD_SHOWHELP;
static const char *mode[3] = {"disabled", "auto-correct only", "auto-correct and warn"};
if (setval)
corruptcheck_heinum = clamp(atoi_safe(parm->parms[0]), 0, 2);
OSD_Printf("Check inconsistent ceilingstat/floorstat bit 2 and .heinum: %s\n",
mode[corruptcheck_heinum]);
return OSDCMD_OK;
}
if (!Bstrcasecmp(parm->name, "keeptexturestretch"))
{
keeptexturestretch = !keeptexturestretch;
@ -9058,6 +9070,7 @@ static int32_t registerosdcommands(void)
OSD_RegisterFunction("show_heightindicators", "show_heightindicators {0, 1 or 2}: sets display of height indicators in 2D mode", osdcmd_vars_pk);
OSD_RegisterFunction("show_ambiencesounds", "show_ambiencesounds {0, 1 or 2}>: sets display of MUSICANDSFX circles in 2D mode", osdcmd_vars_pk);
OSD_RegisterFunction("corruptcheck_noalreadyrefd", "corruptcheck_noalreadyrefd: toggles ignoring of one-to-many red wall connections", osdcmd_vars_pk);
OSD_RegisterFunction("corruptcheck_heinum", "corruptcheck_heinum: toggles auto-correcting inconsistent c/fstat bit 2 and heinum (2: also warn)", osdcmd_vars_pk);
OSD_RegisterFunction("keeptexturestretch", "toggles keeping texture stretching when dragging wall vertices", osdcmd_vars_pk);
OSD_RegisterFunction("corruptcheck", "corruptcheck {<seconds>|now|tryfix}: sets auto corruption check interval if <seconds> given, otherwise as indicated", osdcmd_vars_pk);

View file

@ -44,7 +44,7 @@ int32_t showambiencesounds=2;
int32_t autosave=180;
int32_t autocorruptcheck;
int32_t corruptcheck_noalreadyrefd;
int32_t corruptcheck_noalreadyrefd, corruptcheck_heinum=1;
int32_t corrupt_tryfix_alt;
int32_t corruptlevel, numcorruptthings, corruptthings[MAXCORRUPTTHINGS];
@ -941,6 +941,7 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing)
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
if (corruptcheck_heinum)
{
const char *cflabel[2] = {"ceiling", "floor"};
@ -959,13 +960,12 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing)
i, cflabel[j]);
heinumcheckstat = 1;
}
/*
else if (heinumcheckstat==0)
else if (corruptcheck_heinum==2 && heinumcheckstat==0)
{
CORRUPTCHK_PRINT(1, CORRUPT_SECTOR|i,
"SECTOR[%d]: inconsistent %sstat&2 and heinum", i, cflabel[j]);
}
*/
if (heinumcheckstat != 1)
heinumcheckstat = 2;
}