foxygit / doom Log in
commit cb0892800052958253795d8ac9399f71b4848a53
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Fri Mar 16 22:26:06 2007 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Fri Mar 16 22:26:06 2007 +0000

    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
---
 src/hu_stuff.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 src/i_video.h  |  1 +
 src/m_misc.c   |  1 -
 3 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/src/hu_stuff.c b/src/hu_stuff.c
index 32ca1fc3..e6699438 100644
--- 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,6 +285,48 @@ char *mapnamest[] =	// TNT WAD map names.
     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 @@ boolean HU_Responder(event_t *ev)
 	}
 	else
 	{
+            if (vanilla_keyboard_mapping)
+            {
+                if (shiftdown || (c >= 'a' && c <= 'z'))
+                {
+                    c = shiftxform[c];
+                }
+            }
+
 	    eatkey = HUlib_keyInIText(&w_chat, c);
 	    if (eatkey)
 	    {
diff --git a/src/i_video.h b/src/i_video.h
index a9d7faa1..2eeb8343 100644
--- a/src/i_video.h
+++ b/src/i_video.h
@@ -70,5 +70,6 @@ extern boolean grabmouse;
 extern float mouse_acceleration;
 extern int mouse_threshold;
 extern int startup_delay;
+extern int vanilla_keyboard_mapping;

 #endif
diff --git a/src/m_misc.c b/src/m_misc.c
index 84a2e3fa..6e0af575 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -280,7 +280,6 @@ extern char*	chat_macros[];
 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;