diff options
author | Simon Howard | 2011-10-22 17:09:12 +0000 |
---|---|---|
committer | Simon Howard | 2011-10-22 17:09:12 +0000 |
commit | 4a356b565d08ee48dbe8d920876fd73a72dbc016 (patch) | |
tree | 8cf241b5ba009da77c670532a700002384c6f405 /src/hexen | |
parent | 69be33fe88d0a55dce27214e7543cded8ff51175 (diff) | |
download | chocolate-doom-4a356b565d08ee48dbe8d920876fd73a72dbc016.tar.gz chocolate-doom-4a356b565d08ee48dbe8d920876fd73a72dbc016.tar.bz2 chocolate-doom-4a356b565d08ee48dbe8d920876fd73a72dbc016.zip |
Fix Heretic and Hexen multiplayer chat.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2455
Diffstat (limited to 'src/hexen')
-rw-r--r-- | src/hexen/ct_chat.c | 83 | ||||
-rw-r--r-- | src/hexen/h2_main.c | 18 |
2 files changed, 57 insertions, 44 deletions
diff --git a/src/hexen/ct_chat.c b/src/hexen/ct_chat.c index 74fe96f8..0d0dd49b 100644 --- a/src/hexen/ct_chat.c +++ b/src/hexen/ct_chat.c @@ -28,6 +28,7 @@ #include "h2def.h" #include "s_sound.h" #include "doomkeys.h" +#include "m_controls.h" #include "p_local.h" #include "v_video.h" @@ -51,16 +52,13 @@ enum CT_PLR_ALL }; -#define CT_KEY_BLUE 'b' -#define CT_KEY_RED 'r' -#define CT_KEY_YELLOW 'y' -#define CT_KEY_GREEN 'g' -#define CT_KEY_PLAYER5 'j' // Jade -#define CT_KEY_PLAYER6 'w' // White -#define CT_KEY_PLAYER7 'h' // Hazel -#define CT_KEY_PLAYER8 'p' // Purple -#define CT_KEY_ALL 't' -#define CT_ESCAPE 6 +// KEY_BACKSPACE (ASCII code 0x08) can't be used, because it conflicts with +// CT_PLR_PLAYER8. Investigation reveals that Vanilla Hexen appears to use +// this value for backspace. + +#define CT_BACKSPACE 0x7f + +#define CT_ESCAPE 6 // Public data @@ -159,6 +157,19 @@ void CT_Stop(void) return; } +// These keys are allowed by Vanilla Heretic: + +static boolean ValidChatChar(char c) +{ + return (c >= 'a' && c <= 'z') + || (c >= 'A' && c <= 'Z') + || (c >= '0' && c <= '9') + || c == '!' || c == '?' + || c == ' ' || c == '\'' + || c == ',' || c == '.' + || c == '-' || c == '='; +} + //=========================================================================== // // CT_Responder @@ -192,39 +203,39 @@ boolean CT_Responder(event_t * ev) if (!chatmodeon) { sendto = 0; - if (ev->data1 == CT_KEY_ALL) + if (ev->data1 == key_multi_msg) { sendto = CT_PLR_ALL; } - else if (ev->data1 == CT_KEY_GREEN) + else if (ev->data1 == key_multi_msgplayer[0]) { - sendto = CT_PLR_GREEN; + sendto = CT_PLR_BLUE; } - else if (ev->data1 == CT_KEY_YELLOW) + else if (ev->data1 == key_multi_msgplayer[1]) { - sendto = CT_PLR_YELLOW; + sendto = CT_PLR_RED; } - else if (ev->data1 == CT_KEY_RED) + else if (ev->data1 == key_multi_msgplayer[2]) { - sendto = CT_PLR_RED; + sendto = CT_PLR_YELLOW; } - else if (ev->data1 == CT_KEY_BLUE) + else if (ev->data1 == key_multi_msgplayer[3]) { - sendto = CT_PLR_BLUE; + sendto = CT_PLR_GREEN; } - else if (ev->data1 == CT_KEY_PLAYER5) + else if (ev->data1 == key_multi_msgplayer[4]) { sendto = CT_PLR_PLAYER5; } - else if (ev->data1 == CT_KEY_PLAYER6) + else if (ev->data1 == key_multi_msgplayer[5]) { sendto = CT_PLR_PLAYER6; } - else if (ev->data1 == CT_KEY_PLAYER7) + else if (ev->data1 == key_multi_msgplayer[6]) { sendto = CT_PLR_PLAYER7; } - else if (ev->data1 == CT_KEY_PLAYER8) + else if (ev->data1 == key_multi_msgplayer[7]) { sendto = CT_PLR_PLAYER8; } @@ -272,30 +283,14 @@ boolean CT_Responder(event_t * ev) CT_Stop(); return true; } - else if (ev->data1 >= 'a' && ev->data1 <= 'z') + else if (ev->data1 == KEY_BACKSPACE) { - CT_queueChatChar(ev->data1 - 32); + CT_queueChatChar(CT_BACKSPACE); return true; } - else if (shiftdown) - { - if (ev->data1 == '1') - { - CT_queueChatChar('!'); - return true; - } - else if (ev->data1 == '/') - { - CT_queueChatChar('?'); - return true; - } - } - if (ev->data1 == ' ' || ev->data1 == ',' || ev->data1 == '.' - || (ev->data1 >= '0' && ev->data1 <= '9') || ev->data1 == '\'' - || ev->data1 == KEY_BACKSPACE || ev->data1 == '-' - || ev->data1 == '=') + else if (ValidChatChar(ev->data2)) { - CT_queueChatChar(ev->data1); + CT_queueChatChar(toupper(ev->data2)); return true; } } @@ -369,7 +364,7 @@ void CT_Ticker(void) } CT_ClearChatMessage(i); } - else if (c == KEY_BACKSPACE) + else if (c == CT_BACKSPACE) { CT_BackSpace(i); } diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c index 13e27a22..49d7f21b 100644 --- a/src/hexen/h2_main.c +++ b/src/hexen/h2_main.c @@ -53,6 +53,15 @@ // MACROS ------------------------------------------------------------------ #define MAXWADFILES 20 +#define CT_KEY_BLUE 'b' +#define CT_KEY_RED 'r' +#define CT_KEY_YELLOW 'y' +#define CT_KEY_GREEN 'g' +#define CT_KEY_PLAYER5 'j' // Jade +#define CT_KEY_PLAYER6 'w' // White +#define CT_KEY_PLAYER7 'h' // Hazel +#define CT_KEY_PLAYER8 'p' // Purple +#define CT_KEY_ALL 't' // TYPES ------------------------------------------------------------------- @@ -163,6 +172,15 @@ void D_BindVariables(void) M_BindHereticControls(); M_BindHexenControls(); + key_multi_msgplayer[0] = CT_KEY_BLUE; + key_multi_msgplayer[1] = CT_KEY_RED; + key_multi_msgplayer[2] = CT_KEY_YELLOW; + key_multi_msgplayer[3] = CT_KEY_GREEN; + key_multi_msgplayer[4] = CT_KEY_PLAYER5; + key_multi_msgplayer[5] = CT_KEY_PLAYER6; + key_multi_msgplayer[6] = CT_KEY_PLAYER7; + key_multi_msgplayer[7] = CT_KEY_PLAYER8; + M_BindVariable("graphical_startup", &graphical_startup); M_BindVariable("mouse_sensitivity", &mouseSensitivity); M_BindVariable("sfx_volume", &snd_MaxVolume); |