Mapster32: configurable point and line highlight/selection distances

git-svn-id: https://svn.eduke32.com/eduke32@5568 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-01-15 07:58:57 +00:00
parent ba54de3ab3
commit eacd9527a3
4 changed files with 45 additions and 2 deletions

View file

@ -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);

View file

@ -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();

View file

@ -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,

View file

@ -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 <value>: sets turning acceleration+deceleration", osdcmd_vars_pk);
OSD_RegisterFunction("pk_turndecel", "pk_turndecel <value>: sets turning deceleration", osdcmd_vars_pk);
OSD_RegisterFunction("pk_uedaccel", "pk_uedaccel <value>: sets UnrealEd movement speed factor (0-5, exponentially)", osdcmd_vars_pk);