ref: 79300a83cb91395d97b33824dcbe39c06ff371da
parent: bb3f64f28173bba0b243957c63679d2ec63dce5c
author: Simon Howard <[email protected]>
date: Sat Jul 10 11:56:18 EDT 2010
Add key bindings for multiplayer messaging. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1940
--- a/setup/configfile.c
+++ b/setup/configfile.c
@@ -337,6 +337,11 @@
{"key_weapon8", &key_weapon8, DEFAULT_KEY, 0, 0},
{"key_message_refresh", &key_message_refresh, DEFAULT_KEY, 0, 0},
{"key_demo_quit", &key_demo_quit, DEFAULT_KEY, 0, 0},
+ {"key_multi_msg", &key_multi_msg, DEFAULT_KEY, 0, 0},
+ {"key_multi_msgplayer1", &key_multi_msgplayer[0], DEFAULT_KEY, 0, 0},
+ {"key_multi_msgplayer2", &key_multi_msgplayer[1], DEFAULT_KEY, 0, 0},
+ {"key_multi_msgplayer3", &key_multi_msgplayer[2], DEFAULT_KEY, 0, 0},
+ {"key_multi_msgplayer4", &key_multi_msgplayer[3], DEFAULT_KEY, 0, 0},
};
static default_collection_t extra_defaults =
--- a/setup/keyboard.c
+++ b/setup/keyboard.c
@@ -93,6 +93,9 @@
int key_message_refresh = KEY_ENTER;
int key_demo_quit = 'q';
+int key_multi_msg = 't';
+int key_multi_msgplayer[] = { 'g', 'i', 'b', 'r' };
+
int vanilla_keyboard_mapping = 1;
static int always_run = 0;
@@ -116,7 +119,9 @@
&key_menu_endgame, &key_menu_messages,
&key_menu_qload, &key_menu_quit, &key_menu_gamma,
&key_menu_incscreen, &key_menu_decscreen,
- &key_message_refresh, NULL };
+ &key_message_refresh, &key_multi_msg,
+ &key_multi_msgplayer[0], &key_multi_msgplayer[1],
+ &key_multi_msgplayer[2], &key_multi_msgplayer[3] };
static int *map_keys[] = { &key_map_north, &key_map_south, &key_map_east,
&key_map_west, &key_map_zoomin, &key_map_zoomout,
@@ -275,6 +280,18 @@
AddKeyControl(table, "Display last message", &key_message_refresh);
AddKeyControl(table, "Finish recording demo", &key_demo_quit);
+
+ TXT_AddWidgets(table, TXT_NewStrut(0, 1),
+ TXT_NewStrut(0, 1),
+ TXT_NewLabel(" - Multiplayer - "),
+ TXT_NewStrut(0, 0),
+ NULL);
+
+ AddKeyControl(table, "Send message", &key_multi_msg);
+ AddKeyControl(table, "- to green", &key_multi_msgplayer[0]);
+ AddKeyControl(table, "- to indigo", &key_multi_msgplayer[1]);
+ AddKeyControl(table, "- to brown", &key_multi_msgplayer[2]);
+ AddKeyControl(table, "- to red", &key_multi_msgplayer[3]);
TXT_AddWidgets(table, TXT_NewStrut(0, 1),
TXT_NewStrut(0, 1),
--- a/setup/keyboard.h
+++ b/setup/keyboard.h
@@ -37,6 +37,11 @@
extern int key_pause;
+// Multiplayer messages:
+
+extern int key_multi_msg;
+extern int key_multi_msgplayer[];
+
// Menu keys:
extern int key_menu_activate;
--- a/src/hu_stuff.c
+++ b/src/hu_stuff.c
@@ -88,6 +88,16 @@
HUSTR_PLRRED
};
+int key_multi_msg = HU_INPUTTOGGLE;
+
+int key_multi_msgplayer[MAXPLAYERS] =
+{
+ HUSTR_KEYGREEN,
+ HUSTR_KEYINDIGO,
+ HUSTR_KEYBROWN,
+ HUSTR_KEYRED
+};
+
int key_message_refresh = KEY_ENTER;
char chat_char; // remove later.
@@ -572,14 +582,6 @@
int i;
int numplayers;
- static char destination_keys[MAXPLAYERS] =
- {
- HUSTR_KEYGREEN,
- HUSTR_KEYINDIGO,
- HUSTR_KEYBROWN,
- HUSTR_KEYRED
- };
-
static int num_nobrainers = 0;
numplayers = 0;
@@ -608,7 +610,7 @@
message_counter = HU_MSGTIMEOUT;
eatkey = true;
}
- else if (netgame && ev->data2 == HU_INPUTTOGGLE)
+ else if (netgame && ev->data2 == key_multi_msg)
{
eatkey = chat_on = true;
HUlib_resetIText(&w_chat);
@@ -618,7 +620,7 @@
{
for (i=0; i<MAXPLAYERS ; i++)
{
- if (ev->data2 == destination_keys[i])
+ if (ev->data2 == key_multi_msgplayer[i])
{
if (playeringame[i] && i!=consoleplayer)
{
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -150,7 +150,10 @@
extern int key_message_refresh;
extern int key_demo_quit;
-
+
+extern int key_multi_msg;
+extern int key_multi_msgplayer[];
+
extern int mousebfire;
extern int mousebstrafe;
extern int mousebforward;
@@ -1048,6 +1051,36 @@
//
CONFIG_VARIABLE_KEY(key_demo_quit, key_demo_quit),
+
+ //!
+ // Key to send a message during multiplayer games.
+ //
+
+ CONFIG_VARIABLE_KEY(key_multi_msg, key_multi_msg),
+
+ //!
+ // Key to send a message to the green player during multiplayer games.
+ //
+
+ CONFIG_VARIABLE_KEY(key_multi_msgplayer1, key_multi_msgplayer[0]),
+
+ //!
+ // Key to send a message to the indigo player during multiplayer games.
+ //
+
+ CONFIG_VARIABLE_KEY(key_multi_msgplayer2, key_multi_msgplayer[1]),
+
+ //!
+ // Key to send a message to the brown player during multiplayer games.
+ //
+
+ CONFIG_VARIABLE_KEY(key_multi_msgplayer3, key_multi_msgplayer[2]),
+
+ //!
+ // Key to send a message to the red player during multiplayer games.
+ //
+
+ CONFIG_VARIABLE_KEY(key_multi_msgplayer4, key_multi_msgplayer[3]),
};
static default_collection_t extra_defaults =