From e8623165a748282211d818a9e934153dad302d43 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 8 Aug 2015 07:04:14 +0000 Subject: [PATCH] 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 --- polymer/eduke32/build/include/editor.h | 2 +- polymer/eduke32/build/src/config.c | 8 +++++++- polymer/eduke32/source/astub.c | 23 ++++++++++++++++++----- polymer/eduke32/source/m32common.c | 8 ++++---- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/polymer/eduke32/build/include/editor.h b/polymer/eduke32/build/include/editor.h index 12ce1b235..ab9b1e50d 100644 --- a/polymer/eduke32/build/include/editor.h +++ b/polymer/eduke32/build/include/editor.h @@ -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); diff --git a/polymer/eduke32/build/src/config.c b/polymer/eduke32/build/src/config.c index 369332202..91c0c7253 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_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, diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 92931002d..995550c37 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -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 {|now|tryfix}: sets auto corruption check interval if given, otherwise as indicated", osdcmd_vars_pk); diff --git a/polymer/eduke32/source/m32common.c b/polymer/eduke32/source/m32common.c index f8f7b0da7..cb011a3d0 100644 --- a/polymer/eduke32/source/m32common.c +++ b/polymer/eduke32/source/m32common.c @@ -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; }