Mapster32: add var 'corruptcheck_game_duke3d' and enable by default.

Currently, this checks for effector sprites that are not face-aligned.
See
https://forums.duke4.net/topic/8324-icestation-colossus-map-broken

git-svn-id: https://svn.eduke32.com/eduke32@5420 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2015-11-14 17:21:11 +00:00
parent 72039e80ee
commit 51489e44d4
4 changed files with 42 additions and 1 deletions

View File

@ -253,6 +253,7 @@ static inline int32_t get_nextloopstart(int32_t loopstart)
extern int32_t corruptlevel, numcorruptthings, corruptthings[MAXCORRUPTTHINGS];
extern int32_t autocorruptcheck;
extern int32_t corruptcheck_noalreadyrefd, corruptcheck_heinum;
extern int32_t corruptcheck_game_duke3d;
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_game_duke3d", val, VL) > 0)
corruptcheck_game_duke3d = !!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)
@ -490,6 +492,9 @@ int32_t writesetup(const char *fn)
"; Ignore 'already referenced wall' warnings\n"
"corruptcheck_noalreadyrefd = %d\n"
"\n"
"; Flag Duke3D issues\n"
"corruptcheck_game_duke3d = %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"
@ -626,7 +631,8 @@ int32_t writesetup(const char *fn)
msens, unrealedlook, pk_uedaccel, quickmapcycling,
sideview_reversehrot,
revertCTRL,scrollamount,pk_turnaccel,pk_turndecel,autosave,autocorruptcheck,
corruptcheck_noalreadyrefd, corruptcheck_heinum, fixmaponsave_sprites, keeptexturestretch,
corruptcheck_noalreadyrefd, corruptcheck_game_duke3d,
corruptcheck_heinum, fixmaponsave_sprites, keeptexturestretch,
showheightindicators,showambiencesounds,pathsearchmode,
m32_2d3dmode,m32_2d3dsize,m32_2d3d.x, m32_2d3d.y,
autogray, //showinnergray,

View File

@ -8634,6 +8634,14 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
if (!Bstrcasecmp(parm->name, "corruptcheck_game_duke3d"))
{
corruptcheck_game_duke3d = !corruptcheck_game_duke3d;
OSD_Printf("%s Duke3D issues\n",
!corruptcheck_game_duke3d?"Ignore":"Regard");
return OSDCMD_OK;
}
if (!Bstrcasecmp(parm->name, "corruptcheck_heinum"))
{
if (parm->numparms > 1)
@ -9083,6 +9091,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_game_duke3d", "corruptcheck_game_duke3d: toggles ignoring of Duke3D issues", 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", "keeptexturestretch: toggles keeping texture stretching when dragging wall vertices", osdcmd_vars_pk);

View File

@ -45,6 +45,7 @@ int32_t autosave=180;
int32_t autocorruptcheck;
int32_t corruptcheck_noalreadyrefd, corruptcheck_heinum=1;
int32_t corruptcheck_game_duke3d=1; // TODO: at startup, make conditional on which game we are editing for?
int32_t corrupt_tryfix_alt;
int32_t corruptlevel, numcorruptthings, corruptthings[MAXCORRUPTTHINGS];
@ -1302,6 +1303,30 @@ end_wall_loop_checks:
CORRUPTCHK_PRINT(0, CORRUPT_SPRITE|i, "SPRITE[%d].PICNUM=%d out of range, resetting to 0", i, TrackerCast(sprite[i].picnum));
}
if (corruptcheck_game_duke3d)
{
const int32_t tilenum = sprite[i].picnum;
if (tilenum >= 1 && tilenum <= 9 && (sprite[i].cstat&48))
{
const int32_t onumct = numcorruptthings;
CORRUPTCHK_PRINT(1, CORRUPT_SPRITE|i, "%s sprite %d is not face-aligned",
names[tilenum], i);
if (onumct < MAXCORRUPTTHINGS)
{
if (tryfixing & (1ull<<onumct))
{
sprite[i].cstat &= ~(32+16);
OSD_Printf(CCHK_CORRECTED "auto-correction: cleared sprite[%d].cstat bits 16 and 32\n", i);
}
else if (1 >= printfromlev)
OSD_Printf(" suggest clearing sprite[%d].cstat bits 16 and 32\n", i);
}
}
}
if (klabs(sprite[i].x) > BXY_MAX || klabs(sprite[i].y) > BXY_MAX)
{
const int32_t onumct = numcorruptthings;