mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-28 04:51:42 +00:00
Toggle showing password with tab
This commit is contained in:
parent
180bc0eaee
commit
d711e39518
1 changed files with 30 additions and 12 deletions
42
src/m_menu.c
42
src/m_menu.c
|
|
@ -2384,6 +2384,9 @@ static void M_NextOpt(void)
|
||||||
{
|
{
|
||||||
INT16 oldItemOn = itemOn; // prevent infinite loop
|
INT16 oldItemOn = itemOn; // prevent infinite loop
|
||||||
|
|
||||||
|
if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_PASSWORD)
|
||||||
|
((consvar_t *)currentMenu->menuitems[itemOn].itemaction)->value = 0;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (itemOn + 1 > currentMenu->numitems - 1)
|
if (itemOn + 1 > currentMenu->numitems - 1)
|
||||||
|
|
@ -2397,6 +2400,9 @@ static void M_PrevOpt(void)
|
||||||
{
|
{
|
||||||
INT16 oldItemOn = itemOn; // prevent infinite loop
|
INT16 oldItemOn = itemOn; // prevent infinite loop
|
||||||
|
|
||||||
|
if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_PASSWORD)
|
||||||
|
((consvar_t *)currentMenu->menuitems[itemOn].itemaction)->value = 0;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (!itemOn)
|
if (!itemOn)
|
||||||
|
|
@ -2685,6 +2691,9 @@ boolean M_Responder(event_t *ev)
|
||||||
{
|
{
|
||||||
if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_STRING || (currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_PASSWORD)
|
if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_STRING || (currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_PASSWORD)
|
||||||
{
|
{
|
||||||
|
if (ch == KEY_TAB)
|
||||||
|
((consvar_t *)currentMenu->menuitems[itemOn].itemaction)->value ^= 1;
|
||||||
|
|
||||||
if (shiftdown && ch >= 32 && ch <= 127)
|
if (shiftdown && ch >= 32 && ch <= 127)
|
||||||
ch = shiftxform[ch];
|
ch = shiftxform[ch];
|
||||||
if (M_ChangeStringCvar(ch))
|
if (M_ChangeStringCvar(ch))
|
||||||
|
|
@ -3567,6 +3576,27 @@ static void M_DrawGenericMenu(void)
|
||||||
case IT_CV_NOPRINT: // color use this
|
case IT_CV_NOPRINT: // color use this
|
||||||
case IT_CV_INVISSLIDER: // monitor toggles use this
|
case IT_CV_INVISSLIDER: // monitor toggles use this
|
||||||
break;
|
break;
|
||||||
|
case IT_CV_PASSWORD:
|
||||||
|
if (i == itemOn)
|
||||||
|
{
|
||||||
|
V_DrawRightAlignedThinString(x + MAXSTRINGLENGTH*8 + 10, y, V_ALLOWLOWERCASE, va(M_GetText("Tab: %s password"), cv->value ? "hide" : "show"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cv->value || i != itemOn)
|
||||||
|
{
|
||||||
|
sl = strlen(cv->string);
|
||||||
|
memset(asterisks, '*', sl);
|
||||||
|
memset(asterisks + sl, 0, MAXSTRINGLENGTH+1-sl);
|
||||||
|
|
||||||
|
M_DrawTextBox(x, y + 4, MAXSTRINGLENGTH, 1);
|
||||||
|
V_DrawString(x + 8, y + 12, V_ALLOWLOWERCASE, asterisks);
|
||||||
|
if (skullAnimCounter < 4 && i == itemOn)
|
||||||
|
V_DrawCharacter(x + 8 + V_StringWidth(asterisks, 0), y + 12,
|
||||||
|
'_' | 0x80, false);
|
||||||
|
y += 16;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* fallthru */
|
||||||
case IT_CV_STRING:
|
case IT_CV_STRING:
|
||||||
M_DrawTextBox(x, y + 4, MAXSTRINGLENGTH, 1);
|
M_DrawTextBox(x, y + 4, MAXSTRINGLENGTH, 1);
|
||||||
V_DrawString(x + 8, y + 12, V_ALLOWLOWERCASE, cv->string);
|
V_DrawString(x + 8, y + 12, V_ALLOWLOWERCASE, cv->string);
|
||||||
|
|
@ -3575,18 +3605,6 @@ static void M_DrawGenericMenu(void)
|
||||||
'_' | 0x80, false);
|
'_' | 0x80, false);
|
||||||
y += 16;
|
y += 16;
|
||||||
break;
|
break;
|
||||||
case IT_CV_PASSWORD:
|
|
||||||
sl = strlen(cv->string);
|
|
||||||
memset(asterisks, '*', sl);
|
|
||||||
memset(asterisks + sl, 0, MAXSTRINGLENGTH+1-sl);
|
|
||||||
|
|
||||||
M_DrawTextBox(x, y + 4, MAXSTRINGLENGTH, 1);
|
|
||||||
V_DrawString(x + 8, y + 12, V_ALLOWLOWERCASE, asterisks);
|
|
||||||
if (skullAnimCounter < 4 && i == itemOn)
|
|
||||||
V_DrawCharacter(x + 8 + V_StringWidth(asterisks, 0), y + 12,
|
|
||||||
'_' | 0x80, false);
|
|
||||||
y += 16;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
w = V_StringWidth(cv->string, 0);
|
w = V_StringWidth(cv->string, 0);
|
||||||
V_DrawString(BASEVIDWIDTH - x - w, y,
|
V_DrawString(BASEVIDWIDTH - x - w, y,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue