- Fixed: I forgot to reimplement the number keys for Strife's dialogues when I redid the

menus to work with controllers.

SVN r2103 (trunk)
This commit is contained in:
Randy Heit 2010-01-08 02:10:05 +00:00
parent 870628dda5
commit 1e5b84ea14
2 changed files with 52 additions and 57 deletions

View file

@ -2966,40 +2966,47 @@ bool M_Responder (event_t *ev)
{
mkey = MKEY_Clear;
}
else if (!keyup && !OptionsActive)
else if (!keyup)
{
ch = tolower (ch);
if (messageToPrint)
if (OptionsActive)
{
// Take care of any messages that need input
ch = tolower (ch);
assert(messageRoutine != NULL);
if (ch != ' ' && ch != 'n' && ch != 'y')
{
return false;
}
D_RemoveNextCharEvent();
M_EndMessage(ch);
return true;
M_OptResponder(ev);
}
else
{
// Search for a menu item associated with the pressed key.
for (i = (itemOn + 1) % currentMenu->numitems;
i != itemOn;
i = (i + 1) % currentMenu->numitems)
ch = tolower (ch);
if (messageToPrint)
{
// Take care of any messages that need input
ch = tolower (ch);
assert(messageRoutine != NULL);
if (ch != ' ' && ch != 'n' && ch != 'y')
{
return false;
}
D_RemoveNextCharEvent();
M_EndMessage(ch);
return true;
}
else
{
// Search for a menu item associated with the pressed key.
for (i = (itemOn + 1) % currentMenu->numitems;
i != itemOn;
i = (i + 1) % currentMenu->numitems)
{
if (currentMenu->menuitems[i].alphaKey == ch)
{
break;
}
}
if (currentMenu->menuitems[i].alphaKey == ch)
{
break;
itemOn = i;
S_Sound(CHAN_VOICE | CHAN_UI, "menu/cursor", 1, ATTN_NONE);
return true;
}
}
if (currentMenu->menuitems[i].alphaKey == ch)
{
itemOn = i;
S_Sound(CHAN_VOICE | CHAN_UI, "menu/cursor", 1, ATTN_NONE);
return true;
}
}
}
break;

View file

@ -2141,11 +2141,10 @@ void M_OptResponder(event_t *ev)
CurrentMenu->items[0].label = OldMessage;
CurrentMenu->items[0].type = OldType;
}
else if (ev->type == EV_GUI_Event && ev->subtype == EV_GUI_KeyDown && tolower(ev->data1) == 't')
else if (ev->type == EV_GUI_Event && ev->subtype == EV_GUI_KeyDown)
{
// Test selected resolution
if (CurrentMenu == &ModesMenu)
{
if (CurrentMenu == &ModesMenu && (ev->data1 == 't' || ev->data1 == 'T'))
{ // Test selected resolution
if (!(item->type == screenres &&
GetSelectedSize (CurrentItem, &NewWidth, &NewHeight)))
{
@ -2161,6 +2160,23 @@ void M_OptResponder(event_t *ev)
S_Sound (CHAN_VOICE | CHAN_UI, "menu/choose", 1, ATTN_NONE);
SetModesMenu (NewWidth, NewHeight, NewBits);
}
else if (ev->data1 >= '0' && ev->data1 <= '9')
{ // Activate an item of type numberedmore
int i;
int num = ev->data1 == '0' ? 10 : ev->data1 - '0';
for (i = 0; i < CurrentMenu->numitems; ++i)
{
menuitem_t *item = CurrentMenu->items + i;
if (item->type == numberedmore && item->b.position == num)
{
CurrentItem = i;
M_OptButtonHandler(MKEY_Enter, false);
break;
}
}
}
}
}
@ -2769,35 +2785,7 @@ void M_OptButtonHandler(EMenuKey key, bool repeat)
item->b.key1 = item->c.key2 = 0;
}
break;
/*
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
{
int lookfor = ch == '0' ? 10 : ch - '0', i;
for (i = 0; i < CurrentMenu->numitems; ++i)
{
if (CurrentMenu->items[i].b.position == lookfor)
{
CurrentItem = i;
item = &CurrentMenu->items[i];
break;
}
}
if (i == CurrentMenu->numitems)
{
break;
}
// Otherwise, fall through to '\r' below
}
*/
case MKEY_Enter:
if (CurrentMenu == &ModesMenu && item->type == screenres)
{