summaryrefslogtreecommitdiff
path: root/src/heretic
diff options
context:
space:
mode:
authorSimon Howard2011-10-22 17:09:12 +0000
committerSimon Howard2011-10-22 17:09:12 +0000
commit4a356b565d08ee48dbe8d920876fd73a72dbc016 (patch)
tree8cf241b5ba009da77c670532a700002384c6f405 /src/heretic
parent69be33fe88d0a55dce27214e7543cded8ff51175 (diff)
downloadchocolate-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/heretic')
-rw-r--r--src/heretic/ct_chat.c67
-rw-r--r--src/heretic/d_main.c10
2 files changed, 41 insertions, 36 deletions
diff --git a/src/heretic/ct_chat.c b/src/heretic/ct_chat.c
index 8059b74d..01e43383 100644
--- a/src/heretic/ct_chat.c
+++ b/src/heretic/ct_chat.c
@@ -27,9 +27,12 @@
#include <string.h>
#include <ctype.h>
+
#include "doomdef.h"
#include "doomkeys.h"
+
#include "deh_str.h"
+#include "m_controls.h"
#include "p_local.h"
#include "s_sound.h"
#include "v_video.h"
@@ -44,12 +47,10 @@
#define CT_PLR_BLUE 4
#define CT_PLR_ALL 5
-#define CT_KEY_GREEN 'g'
-#define CT_KEY_YELLOW 'y'
-#define CT_KEY_RED 'r'
-#define CT_KEY_BLUE 'b'
-#define CT_KEY_ALL 't'
-#define CT_ESCAPE 6
+// Vanilla Heretic seems to use this for KEY_BACKSPACE (tcpdump'ed trace):
+#define CT_BACKSPACE 0x7f
+
+#define CT_ESCAPE 6
// Public data
@@ -132,6 +133,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
@@ -165,23 +179,23 @@ 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;
}
- else if (ev->data1 == CT_KEY_YELLOW)
+ else if (ev->data1 == key_multi_msgplayer[1])
{
sendto = CT_PLR_YELLOW;
}
- else if (ev->data1 == CT_KEY_RED)
+ else if (ev->data1 == key_multi_msgplayer[2])
{
sendto = CT_PLR_RED;
}
- else if (ev->data1 == CT_KEY_BLUE)
+ else if (ev->data1 == key_multi_msgplayer[3])
{
sendto = CT_PLR_BLUE;
}
@@ -228,34 +242,15 @@ 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)
+ else if (ValidChatChar(ev->data2))
{
- if (ev->data1 == '1')
- {
- CT_queueChatChar('!');
- return true;
- }
- else if (ev->data1 == '/')
- {
- CT_queueChatChar('?');
- return true;
- }
- }
- else
- {
- if (ev->data1 == ' ' || ev->data1 == ',' || ev->data1 == '.'
- || (ev->data1 >= '0' && ev->data1 <= '9') || ev->data1 == '\''
- || ev->data1 == KEY_BACKSPACE || ev->data1 == '-'
- || ev->data1 == '=')
- {
- CT_queueChatChar(ev->data1);
- return true;
- }
+ CT_queueChatChar(toupper(ev->data2));
+ return true;
}
}
return false;
@@ -336,7 +331,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/heretic/d_main.c b/src/heretic/d_main.c
index 8bca1db1..a34ef3ac 100644
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -53,6 +53,11 @@
#include "w_main.h"
#include "v_video.h"
+#define CT_KEY_GREEN 'g'
+#define CT_KEY_YELLOW 'y'
+#define CT_KEY_RED 'r'
+#define CT_KEY_BLUE 'b'
+
#define STARTUP_WINDOW_X 17
#define STARTUP_WINDOW_Y 7
@@ -737,6 +742,11 @@ void D_BindVariables(void)
M_BindWeaponControls();
M_BindChatControls(MAXPLAYERS);
+ key_multi_msgplayer[0] = CT_KEY_GREEN;
+ key_multi_msgplayer[1] = CT_KEY_YELLOW;
+ key_multi_msgplayer[2] = CT_KEY_RED;
+ key_multi_msgplayer[3] = CT_KEY_BLUE;
+
M_BindMenuControls();
M_BindMapControls();