diff options
author | Simon Howard | 2010-07-10 15:56:18 +0000 |
---|---|---|
committer | Simon Howard | 2010-07-10 15:56:18 +0000 |
commit | 79300a83cb91395d97b33824dcbe39c06ff371da (patch) | |
tree | 76df767323df8d6fed2b20d6a80dc84b113b8c45 | |
parent | bb3f64f28173bba0b243957c63679d2ec63dce5c (diff) | |
download | chocolate-doom-79300a83cb91395d97b33824dcbe39c06ff371da.tar.gz chocolate-doom-79300a83cb91395d97b33824dcbe39c06ff371da.tar.bz2 chocolate-doom-79300a83cb91395d97b33824dcbe39c06ff371da.zip |
Add key bindings for multiplayer messaging.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1940
-rw-r--r-- | setup/configfile.c | 5 | ||||
-rw-r--r-- | setup/keyboard.c | 19 | ||||
-rw-r--r-- | setup/keyboard.h | 5 | ||||
-rw-r--r-- | src/hu_stuff.c | 22 | ||||
-rw-r--r-- | src/m_config.c | 35 |
5 files changed, 74 insertions, 12 deletions
diff --git a/setup/configfile.c b/setup/configfile.c index 9f0e5de5..97d87aaf 100644 --- a/setup/configfile.c +++ b/setup/configfile.c @@ -337,6 +337,11 @@ static default_t extra_defaults_list[] = {"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 = diff --git a/setup/keyboard.c b/setup/keyboard.c index b402d10c..f16c0940 100644 --- a/setup/keyboard.c +++ b/setup/keyboard.c @@ -93,6 +93,9 @@ int key_weapon8 = '8'; 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 @@ static int *shortcuts[] = { &key_menu_help, &key_menu_save, &key_menu_load, &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, @@ -278,6 +283,18 @@ static void OtherKeysDialog(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) 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), TXT_NewLabel(" - Map - "), TXT_NewStrut(0, 0), NULL); diff --git a/setup/keyboard.h b/setup/keyboard.h index 62addc8f..feeb9cf8 100644 --- a/setup/keyboard.h +++ b/setup/keyboard.h @@ -37,6 +37,11 @@ extern int vanilla_keyboard_mapping; extern int key_pause; +// Multiplayer messages: + +extern int key_multi_msg; +extern int key_multi_msgplayer[]; + // Menu keys: extern int key_menu_activate; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 1381532d..afe3974c 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -88,6 +88,16 @@ char* player_names[] = 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 @@ boolean HU_Responder(event_t *ev) 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 @@ boolean HU_Responder(event_t *ev) 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 @@ boolean HU_Responder(event_t *ev) { for (i=0; i<MAXPLAYERS ; i++) { - if (ev->data2 == destination_keys[i]) + if (ev->data2 == key_multi_msgplayer[i]) { if (playeringame[i] && i!=consoleplayer) { diff --git a/src/m_config.c b/src/m_config.c index d0fe6808..ef9c97e8 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -150,7 +150,10 @@ extern int key_weapon8; 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 @@ static default_t extra_defaults_list[] = // 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 = |