From 51489e44d4189de0f1302ea96d44cc40a111e9fc Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 14 Nov 2015 17:21:11 +0000 Subject: [PATCH] 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 --- polymer/eduke32/build/include/editor.h | 1 + polymer/eduke32/build/src/config.c | 8 +++++++- polymer/eduke32/source/astub.c | 9 +++++++++ polymer/eduke32/source/m32common.c | 25 +++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/build/include/editor.h b/polymer/eduke32/build/include/editor.h index 1f427ee72..7582dfcb2 100644 --- a/polymer/eduke32/build/include/editor.h +++ b/polymer/eduke32/build/include/editor.h @@ -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); diff --git a/polymer/eduke32/build/src/config.c b/polymer/eduke32/build/src/config.c index 91c0c7253..0a64fe59d 100644 --- a/polymer/eduke32/build/src/config.c +++ b/polymer/eduke32/build/src/config.c @@ -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, diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 88146eee1..f785a04af 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -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); diff --git a/polymer/eduke32/source/m32common.c b/polymer/eduke32/source/m32common.c index 2f5de4047..66f9bbd3b 100644 --- a/polymer/eduke32/source/m32common.c +++ b/polymer/eduke32/source/m32common.c @@ -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<= 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;