Support backspace for resetting various menu values, just like Kart.

This commit is contained in:
toaster 2019-06-18 14:36:06 +01:00
parent 861d0d0b0a
commit 96d6cea569

View file

@ -2668,20 +2668,35 @@ static void M_ChangeCvar(INT32 choice)
{
consvar_t *cv = (consvar_t *)currentMenu->menuitems[itemOn].itemaction;
if (choice == -1)
{
if (cv == &cv_playercolor)
{
SINT8 skinno = R_SkinAvailable(cv_chooseskin.string);
if (skinno != -1)
CV_SetValue(cv,skins[skinno].prefcolor);
return;
}
CV_Set(cv,cv->defaultvalue);
return;
}
choice = (choice<<1) - 1;
if (((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_SLIDER)
||((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_INVISSLIDER)
||((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_NOMOD))
{
CV_SetValue(cv,cv->value+(choice*2-1));
CV_SetValue(cv,cv->value+(choice));
}
else if (cv->flags & CV_FLOAT)
{
char s[20];
sprintf(s,"%f",FIXED_TO_FLOAT(cv->value)+(choice*2-1)*(1.0f/16.0f));
sprintf(s,"%f",FIXED_TO_FLOAT(cv->value)+(choice)*(1.0f/16.0f));
CV_Set(cv,s);
}
else
CV_AddValue(cv,choice*2-1);
CV_AddValue(cv,choice);
}
static boolean M_ChangeStringCvar(INT32 choice)
@ -3117,6 +3132,23 @@ boolean M_Responder(event_t *ev)
S_StartSound(NULL, sfx_shldls);
return true;
}
if (routine && ((currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_ARROWS
|| (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_CVAR))
{
consvar_t *cv = (consvar_t *)currentMenu->menuitems[itemOn].itemaction;
if (cv == &cv_chooseskin
|| cv == &cv_nextmap
|| cv == &cv_newgametype)
return true;
if (currentMenu != &OP_SoundOptionsDef || itemOn > 3)
S_StartSound(NULL, sfx_menu1);
routine(-1);
return true;
}
// Why _does_ backspace go back anyway?
//currentMenu->lastOn = itemOn;
//if (currentMenu->prevMenu)
@ -9557,6 +9589,16 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
S_StartSound(NULL,sfx_menu1); // Tails
setupm_name[l-1] = 0;
}
else if (itemOn == 2)
{
UINT8 col = skins[setupm_fakeskin].prefcolor;
if (setupm_fakecolor != col)
{
S_StartSound(NULL,sfx_menu1); // Tails
setupm_fakecolor = col;
}
}
break;
break;
case KEY_DEL: