shithub: choc

Download patch

ref: 18a8a2ced6df890ba67af887c2a64c0611b4d676
parent: 3e82d3d2f14bf12f077beb9603caba84d54b445d
author: Simon Howard <[email protected]>
date: Sun Jul 8 16:53:18 EDT 2007

Make the numeric keypad behave like Vanilla does.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 935

--- a/setup/configfile.c
+++ b/setup/configfile.c
@@ -298,8 +298,8 @@
     'b',    'n',    'm',    ',',    '.',    '/',    KEY_RSHIFT,KEYP_MULTIPLY,
     KEY_RALT,  ' ',  KEY_CAPSLOCK,KEY_F1,  KEY_F2,   KEY_F3,   KEY_F4,   KEY_F5,
     KEY_F6,   KEY_F7,   KEY_F8,   KEY_F9,   KEY_F10,  KEY_PAUSE,KEY_SCRLCK,KEY_HOME,
-    KEYP_UPARROW,KEY_PGUP,KEYP_MINUS,KEYP_LEFTARROW,KEYP_5,KEYP_RIGHTARROW,KEYP_PLUS,KEY_END,
-    KEYP_DOWNARROW,KEY_PGDN,KEY_INS,KEY_DEL,0,   0,      0,      KEY_F11,
+    KEY_UPARROW,KEY_PGUP,KEYP_MINUS,KEY_LEFTARROW,KEYP_5,KEY_RIGHTARROW,KEYP_PLUS,KEY_END,
+    KEY_DOWNARROW,KEY_PGDN,KEY_INS,KEY_DEL,0,   0,      0,      KEY_F11,
     KEY_F12,  0,      0,      0,      0,      0,      0,      0,
     0,      0,      0,      0,      0,      0,      0,      0,
     0,      0,      0,      0,      0,      0,      0,      0,
--- a/src/doomkeys.h
+++ b/src/doomkeys.h
@@ -69,17 +69,6 @@
 #define KEY_CAPSLOCK    (0x80+0x3a)
 #define KEY_SCRLCK      (0x80+0x46)
 
-#define KEYP_0          (0x80+0x52)
-#define KEYP_1          (0x80+0x4F)
-#define KEYP_2          (0x80+0x50)
-#define KEYP_3          (0x80+0x41)
-#define KEYP_4          (0x80+0x4B)
-#define KEYP_5          (0x80+0x4C)
-#define KEYP_6          (0x80+0x4D)
-#define KEYP_7          (0x80+0x47)
-#define KEYP_8          (0x80+0x48)
-#define KEYP_9          (0x80+0x49)
-
 #define KEY_HOME        (0x80+0x47)
 #define KEY_END         (0x80+0x4f)
 #define KEY_PGUP        (0x80+0x49)
@@ -86,17 +75,25 @@
 #define KEY_PGDN        (0x80+0x51)
 #define KEY_INS         (0x80+0x52)
 #define KEY_DEL         (0x80+0x53)
-#define KEYP_UPARROW      KEY_UPARROW
-#define KEYP_DOWNARROW    KEY_DOWNARROW
-#define KEYP_LEFTARROW    KEY_LEFTARROW
-#define KEYP_RIGHTARROW   KEY_RIGHTARROW
-#define KEYP_MULTIPLY     '*'
-#define KEYP_PLUS         '+'
-#define KEYP_MINUS        '-'
-#define KEYP_DIVIDE       '/'
 
+#define KEYP_0          0
+#define KEYP_1          KEY_END
+#define KEYP_2          KEY_DOWNARROW
+#define KEYP_3          KEY_PGDN
+#define KEYP_4          KEY_LEFTARROW
+#define KEYP_5          '5'
+#define KEYP_6          KEY_RIGHTARROW
+#define KEYP_7          KEY_HOME
+#define KEYP_8          KEY_UPARROW
+#define KEYP_9          KEY_PGUP
 
-
+#define KEYP_DIVIDE     '/'
+#define KEYP_PLUS       '+'
+#define KEYP_MINUS      '-'
+#define KEYP_MULTIPLY   '*'
+#define KEYP_PERIOD     0
+#define KEYP_EQUALS     KEY_EQUALS
+#define KEYP_ENTER      KEY_ENTER
 
 #endif          // __DOOMKEYS__
 
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -290,8 +290,7 @@
 
       case SDLK_PAUSE:	return KEY_PAUSE;
 
-      case SDLK_EQUALS:
-      case SDLK_KP_EQUALS:	return KEY_EQUALS;
+      case SDLK_EQUALS: return KEY_EQUALS;
 
       case SDLK_MINUS:          return KEY_MINUS;
 
@@ -323,15 +322,19 @@
       case SDLK_KP8: return KEYP_8;
       case SDLK_KP9: return KEYP_9;
 
+      case SDLK_KP_PERIOD:   return KEYP_PERIOD;
+      case SDLK_KP_MULTIPLY: return KEYP_MULTIPLY;
+      case SDLK_KP_PLUS:     return KEYP_PLUS;
+      case SDLK_KP_MINUS:    return KEYP_MINUS;
+      case SDLK_KP_DIVIDE:   return KEYP_DIVIDE;
+      case SDLK_KP_EQUALS:   return KEYP_EQUALS;
+      case SDLK_KP_ENTER:    return KEYP_ENTER;
+
       case SDLK_HOME: return KEY_HOME;
       case SDLK_INSERT: return KEY_INS;
       case SDLK_END: return KEY_END;
       case SDLK_PAGEUP: return KEY_PGUP;
       case SDLK_PAGEDOWN: return KEY_PGDN;
-      case SDLK_KP_MULTIPLY: return KEYP_MULTIPLY;
-      case SDLK_KP_PLUS: return KEYP_PLUS;
-      case SDLK_KP_MINUS: return KEYP_MINUS;
-      case SDLK_KP_DIVIDE: return KEYP_DIVIDE;
 
       default:
         return tolower(sym->sym);
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -459,8 +459,8 @@
     'b',    'n',    'm',    ',',    '.',    '/',    KEY_RSHIFT,KEYP_MULTIPLY,
     KEY_RALT,  ' ',  KEY_CAPSLOCK,KEY_F1,  KEY_F2,   KEY_F3,   KEY_F4,   KEY_F5,
     KEY_F6,   KEY_F7,   KEY_F8,   KEY_F9,   KEY_F10,  KEY_PAUSE,KEY_SCRLCK,KEY_HOME,
-    KEYP_UPARROW,KEY_PGUP,KEYP_MINUS,KEYP_LEFTARROW,KEYP_5,KEYP_RIGHTARROW,KEYP_PLUS,KEY_END,
-    KEYP_DOWNARROW,KEY_PGDN,KEY_INS,KEY_DEL,0,   0,      0,      KEY_F11,
+    KEY_UPARROW,KEY_PGUP,KEY_MINUS,KEY_LEFTARROW,KEYP_5,KEY_RIGHTARROW,KEYP_PLUS,KEY_END,
+    KEY_DOWNARROW,KEY_PGDN,KEY_INS,KEY_DEL,0,   0,      0,      KEY_F11,
     KEY_F12,  0,      0,      0,      0,      0,      0,      0,
     0,      0,      0,      0,      0,      0,      0,      0,
     0,      0,      0,      0,      0,      0,      0,      0,
--- a/textscreen/txt_sdl.c
+++ b/textscreen/txt_sdl.c
@@ -259,7 +259,7 @@
 
         case SDLK_PAUSE:       return KEY_PAUSE;
 
-        case SDLK_KP_EQUALS:   return KEY_EQUALS;
+        case SDLK_EQUALS:      return KEY_EQUALS;
 
         case SDLK_LSHIFT:
         case SDLK_RSHIFT:
@@ -289,15 +289,19 @@
         case SDLK_KP8:         return KEYP_8;
         case SDLK_KP9:         return KEYP_9;
 
+        case SDLK_KP_PERIOD:   return KEYP_PERIOD;
+        case SDLK_KP_MULTIPLY: return KEYP_MULTIPLY;
+        case SDLK_KP_PLUS:     return KEYP_PLUS;
+        case SDLK_KP_MINUS:    return KEYP_MINUS;
+        case SDLK_KP_DIVIDE:   return KEYP_DIVIDE;
+        case SDLK_KP_EQUALS:   return KEYP_EQUALS;
+        case SDLK_KP_ENTER:    return KEYP_ENTER;
+
         case SDLK_HOME:        return KEY_HOME;
         case SDLK_INSERT:      return KEY_INS;
         case SDLK_END:         return KEY_END;
         case SDLK_PAGEUP:      return KEY_PGUP;
         case SDLK_PAGEDOWN:    return KEY_PGDN;
-        case SDLK_KP_MULTIPLY: return KEYP_MULTIPLY;
-        case SDLK_KP_PLUS:     return KEYP_PLUS;
-        case SDLK_KP_MINUS:    return KEYP_MINUS;
-        case SDLK_KP_DIVIDE:   return KEYP_DIVIDE;
 
         default:               break;
     }