From eacd9527a3f852b963a5a9cd88f39c54f5e00561 Mon Sep 17 00:00:00 2001 From: terminx Date: Fri, 15 Jan 2016 07:58:57 +0000 Subject: [PATCH] Mapster32: configurable point and line highlight/selection distances git-svn-id: https://svn.eduke32.com/eduke32@5568 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/editor.h | 1 + polymer/eduke32/build/src/build.c | 7 +++++-- polymer/eduke32/build/src/config.c | 11 ++++++++++ polymer/eduke32/source/astub.c | 28 ++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/build/include/editor.h b/polymer/eduke32/build/include/editor.h index 9b9bc1ad5..cde4d5ce7 100644 --- a/polymer/eduke32/build/include/editor.h +++ b/polymer/eduke32/build/include/editor.h @@ -176,6 +176,7 @@ extern int32_t getscreenvdisp(int32_t bz, int32_t zoome); extern void setup_sideview_sincos(void); extern int8_t keeptexturestretch; +extern int16_t pointhighlightdist, linehighlightdist; extern int32_t wallength(int16_t i); extern void fixrepeats(int16_t i); diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 4b8c19a58..15ece08dd 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -218,6 +218,9 @@ int32_t pk_uedaccel=3; int8_t keeptexturestretch = 1; int8_t sideview_reversehrot = 0; +int16_t pointhighlightdist = 512; +int16_t linehighlightdist = 1024; + char lastpm16buf[156]; //static int32_t checksectorpointer_warn = 0; @@ -8531,7 +8534,7 @@ static int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line, int8_t if (!ignore_pointhighlight && (pointhighlight&0xc000) == 16384) return -1; - dist = 1024; + dist = linehighlightdist; if (m32_sideview) { daxplc = searchx; @@ -8593,7 +8596,7 @@ static int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line, int8_t int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point) { - int32_t i, j, dst, dist = 512, closest = -1; + int32_t i, j, dst, dist = pointhighlightdist, closest = -1; int32_t dax,day; int32_t alwaysshowgray = get_alwaysshowgray(); diff --git a/polymer/eduke32/build/src/config.c b/polymer/eduke32/build/src/config.c index 0a64fe59d..b3be46e87 100644 --- a/polymer/eduke32/build/src/config.c +++ b/polymer/eduke32/build/src/config.c @@ -226,6 +226,12 @@ int32_t loadsetup(const char *fn) if (readconfig(fp, "pathsearchmode", val, VL) > 0) pathsearchmode = clamp(atoi_safe(val), 0, 1); + if (readconfig(fp, "pointhighlightdist", val, VL) > 0) + pointhighlightdist = atoi_safe(val); + + if (readconfig(fp, "linehighlightdist", val, VL) > 0) + linehighlightdist = atoi_safe(val); + if (readconfig(fp, "2d3dmode", val, VL) > 0) m32_2d3dmode = clamp(atoi_safe(val), 0, 1); @@ -520,6 +526,10 @@ int32_t writesetup(const char *fn) "2d3d_x = %d\n" "2d3d_y = %d\n" "\n" + "; Point and line highlight/selection distances\n" + "pointhighlightdist = %d\n" + "linehighlightdist = %d\n" + "\n" "; TROR: Automatic grayout of plain (non-extended) sectors,\n" "; toggled with Ctrl-A:\n" "autogray = %d\n" @@ -635,6 +645,7 @@ int32_t writesetup(const char *fn) corruptcheck_heinum, fixmaponsave_sprites, keeptexturestretch, showheightindicators,showambiencesounds,pathsearchmode, m32_2d3dmode,m32_2d3dsize,m32_2d3d.x, m32_2d3d.y, + pointhighlightdist, linehighlightdist, autogray, //showinnergray, graphicsmode, MixRate,AmbienceToggle,ParentalLock, !!m32_osd_tryscript, diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 82bd3e712..cb07757f2 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -8698,6 +8698,32 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm) return OSDCMD_OK; } + if (!Bstrcasecmp(parm->name, "pointhighlightdist")) + { + if (parm->numparms > 1) + return OSDCMD_SHOWHELP; + + if (setval) + pointhighlightdist = atoi_safe(parm->parms[0]); + + OSD_Printf("Point highlight distance: %d\n", pointhighlightdist); + + return OSDCMD_OK; + } + + if (!Bstrcasecmp(parm->name, "linehighlightdist")) + { + if (parm->numparms > 1) + return OSDCMD_SHOWHELP; + + if (setval) + linehighlightdist = atoi_safe(parm->parms[0]); + + OSD_Printf("Line highlight distance: %d\n", linehighlightdist); + + return OSDCMD_OK; + } + if (!Bstrcasecmp(parm->name, "corruptcheck")) { if (parm->numparms >= 1) @@ -9101,6 +9127,8 @@ static int32_t registerosdcommands(void) //PK OSD_RegisterFunction("m32_2d3dmode", "2d3dmode: experimental 2d/3d hybrid mode", osdcmd_vars_pk); + OSD_RegisterFunction("pointhighlightdist", "pointhighlightdist: distance at which points are selected", osdcmd_vars_pk); + OSD_RegisterFunction("linehighlightdist", "linehighlightdist: distance at which lines are selected", osdcmd_vars_pk); OSD_RegisterFunction("pk_turnaccel", "pk_turnaccel : sets turning acceleration+deceleration", osdcmd_vars_pk); OSD_RegisterFunction("pk_turndecel", "pk_turndecel : sets turning deceleration", osdcmd_vars_pk); OSD_RegisterFunction("pk_uedaccel", "pk_uedaccel : sets UnrealEd movement speed factor (0-5, exponentially)", osdcmd_vars_pk);