shithub: choc

Download patch

ref: cb0892800052958253795d8ac9399f71b4848a53
parent: 1658ae111ec89bc32d63dcb12848337a968a0400
author: Simon Howard <[email protected]>
date: Fri Mar 16 18:26:06 EDT 2007

Add back shiftxform table so that the shift key works in multiplayer
chat when vanilla_keyboard_mapping is enabled.

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

--- a/src/hu_stuff.c
+++ b/src/hu_stuff.c
@@ -32,6 +32,7 @@
 
 #include "deh_main.h"
 #include "i_swap.h"
+#include "i_video.h"
 
 #include "hu_stuff.h"
 #include "hu_lib.h"
@@ -284,7 +285,49 @@
     THUSTR_32
 };
 
+static const char shiftxform[] =
+{
 
+    0,
+    1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+    11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+    21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+    31,
+    ' ', '!', '"', '#', '$', '%', '&',
+    '"', // shift-'
+    '(', ')', '*', '+',
+    '<', // shift-,
+    '_', // shift--
+    '>', // shift-.
+    '?', // shift-/
+    ')', // shift-0
+    '!', // shift-1
+    '@', // shift-2
+    '#', // shift-3
+    '$', // shift-4
+    '%', // shift-5
+    '^', // shift-6
+    '&', // shift-7
+    '*', // shift-8
+    '(', // shift-9
+    ':',
+    ':', // shift-;
+    '<',
+    '+', // shift-=
+    '>', '?', '@',
+    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
+    'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+    '[', // shift-[
+    '!', // shift-backslash - OH MY GOD DOES WATCOM SUCK
+    ']', // shift-]
+    '"', '_',
+    '\'', // shift-`
+    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
+    'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+    '{', '|', '}', '~', 127
+};
+
+
 void HU_Init(void)
 {
 
@@ -616,6 +659,14 @@
 	}
 	else
 	{
+            if (vanilla_keyboard_mapping)
+            {
+                if (shiftdown || (c >= 'a' && c <= 'z'))
+                {
+                    c = shiftxform[c];
+                }
+            }
+
 	    eatkey = HUlib_keyInIText(&w_chat, c);
 	    if (eatkey)
 	    {
--- a/src/i_video.h
+++ b/src/i_video.h
@@ -70,5 +70,6 @@
 extern float mouse_acceleration;
 extern int mouse_threshold;
 extern int startup_delay;
+extern int vanilla_keyboard_mapping;
 
 #endif
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -280,7 +280,6 @@
 extern int      show_endoom;
 extern int      vanilla_savegame_limit;
 extern int      vanilla_demo_limit;
-extern int      vanilla_keyboard_mapping;
 
 extern int snd_musicdevice;
 extern int snd_sfxdevice;