ref: 5139df0e33ac840518c5cfd34d898e644de723e6
parent: 544320206de9f54893aa77d2e4e75976e6fa84cb
author: Simon Howard <[email protected]>
date: Tue Sep 3 22:41:24 EDT 2013
Extend "emulation" of menu pause key behavior to caps/num/scroll lock keys, which cause the same behavior. Subversion-branch: /branches/v2-branch Subversion-revision: 2632
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -1403,7 +1403,14 @@
}
}
+// These keys evaluate to a "null" key in Vanilla Doom that allows weird
+// jumping in the menus. Preserve this behavior for accuracy.
+static boolean IsNullKey(int key)
+{
+ return key == KEY_PAUSE || key == KEY_CAPSLOCK
+ || key == KEY_SCRLCK || key == KEY_NUMLOCK;
+}
//
// CONTROL PANEL
@@ -1745,7 +1752,6 @@
return false;
}
-
// Keys usable within menu
if (key == key_menu_down)
@@ -1846,9 +1852,9 @@
// Keyboard shortcut?
// Vanilla Doom has a weird behavior where it jumps to the scroll bars
- // when the pause key is pressed, so emulate this.
+ // when the certain keys are pressed, so emulate this.
- else if (ch != 0 || key == KEY_PAUSE)
+ else if (ch != 0 || IsNullKey(key))
{
for (i = itemOn+1;i < currentMenu->numitems;i++)
{
--- a/src/doomkeys.h
+++ b/src/doomkeys.h
@@ -67,6 +67,7 @@
// new keys:
#define KEY_CAPSLOCK (0x80+0x3a)
+#define KEY_NUMLOCK (0x80+0x45)
#define KEY_SCRLCK (0x80+0x46)
#define KEY_HOME (0x80+0x47)
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -506,6 +506,7 @@
case SDLK_CAPSLOCK: return KEY_CAPSLOCK;
case SDLK_SCROLLOCK: return KEY_SCRLCK;
+ case SDLK_NUMLOCK: return KEY_NUMLOCK;
case SDLK_KP0: return KEYP_0;
case SDLK_KP1: return KEYP_1;
--- a/src/strife/m_menu.c
+++ b/src/strife/m_menu.c
@@ -1669,7 +1669,15 @@
while((bl = toupper(message[++i])) != 0); // step to the next character
}
+// These keys evaluate to a "null" key in Vanilla Doom that allows weird
+// jumping in the menus. Preserve this behavior for accuracy.
+static boolean IsNullKey(int key)
+{
+ return key == KEY_PAUSE || key == KEY_CAPSLOCK
+ || key == KEY_SCRLCK || key == KEY_NUMLOCK;
+}
+
//
// CONTROL PANEL
//
@@ -2183,9 +2191,9 @@
// Keyboard shortcut?
// Vanilla Strife has a weird behavior where it jumps to the scroll bars
- // when the pause key is pressed, so emulate this.
+ // when certain keys are pressed, so emulate this.
- else if (ch != 0 || key == KEY_PAUSE)
+ else if (ch != 0 || IsNullKey(key))
{
// Keyboard shortcut?