summaryrefslogtreecommitdiff
path: root/src/client/cl_keys.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/cl_keys.c')
-rw-r--r--src/client/cl_keys.c55
1 files changed, 53 insertions, 2 deletions
diff --git a/src/client/cl_keys.c b/src/client/cl_keys.c
index 52a5f7a2..08c6c79b 100644
--- a/src/client/cl_keys.c
+++ b/src/client/cl_keys.c
@@ -35,6 +35,9 @@ int historyLine; // the line being displayed from history buffer
// will be <= nextHistoryLine
field_t g_consoleField;
+field_t chatField;
+qboolean chat_team;
+int chat_playerNum;
qboolean key_overstrikeMode;
@@ -706,6 +709,42 @@ void Console_Key (int key) {
}
+/*
+================
+Message_Key
+
+In game talk message
+================
+*/
+void Message_Key( int key ) {
+ char buffer[MAX_STRING_CHARS];
+
+ if ( key == K_ESCAPE ) {
+ Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_MESSAGE );
+ Field_Clear( &chatField );
+ return;
+ }
+
+ if ( key == K_ENTER || key == K_KP_ENTER ) {
+ if ( chatField.buffer[ 0 ] && clc.state == CA_ACTIVE ) {
+ if ( chat_playerNum != -1 ) {
+ Com_sprintf( buffer, sizeof( buffer ), "tell %i \"%s\"\n", chat_playerNum, chatField.buffer );
+ } else if ( chat_team ) {
+ Com_sprintf( buffer, sizeof( buffer ), "say_team \"%s\"\n", chatField.buffer );
+ } else {
+ Com_sprintf( buffer, sizeof( buffer ), "say \"%s\"\n", chatField.buffer );
+ }
+
+ CL_AddReliableCommand( buffer, qfalse );
+ }
+ Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_MESSAGE );
+ Field_Clear( &chatField );
+ return;
+ }
+
+ Field_KeyDownEvent( &chatField, key );
+}
+
//============================================================================
@@ -1190,6 +1229,12 @@ void CL_KeyDownEvent( int key, unsigned time )
// escape is always handled special
if ( key == K_ESCAPE ) {
+ if ( clc.state >= CA_CONNECTING && clc.serverAddress.alternateProtocol == 2 && ( Key_GetCatcher( ) & KEYCATCH_MESSAGE ) ) {
+ // clear message mode
+ Message_Key( key );
+ return;
+ }
+
// escape always gets out of CGAME stuff
if (Key_GetCatcher( ) & KEYCATCH_CGAME) {
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_CGAME );
@@ -1199,12 +1244,12 @@ void CL_KeyDownEvent( int key, unsigned time )
if ( !( Key_GetCatcher( ) & KEYCATCH_UI ) ) {
if ( clc.state == CA_ACTIVE && !clc.demoplaying ) {
- VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_INGAME );
+ VM_Call( uivm, UI_SET_ACTIVE_MENU - ( uiInterface == 2 ? 2 : 0 ), UIMENU_INGAME );
}
else if ( clc.state != CA_DISCONNECTED ) {
CL_Disconnect_f();
S_StopAllSounds();
- VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_MAIN );
+ VM_Call( uivm, UI_SET_ACTIVE_MENU - ( uiInterface == 2 ? 2 : 0 ), UIMENU_MAIN );
}
return;
}
@@ -1227,6 +1272,8 @@ void CL_KeyDownEvent( int key, unsigned time )
if ( cgvm ) {
VM_Call( cgvm, CG_KEY_EVENT, key, qtrue );
}
+ } else if ( clc.state >= CA_CONNECTING && clc.serverAddress.alternateProtocol == 2 && ( Key_GetCatcher( ) & KEYCATCH_MESSAGE ) ) {
+ Message_Key( key );
} else if ( clc.state == CA_DISCONNECTED ) {
Console_Key( key );
}
@@ -1305,6 +1352,10 @@ void CL_CharEvent( int key ) {
{
VM_Call( uivm, UI_KEY_EVENT, key | K_CHAR_FLAG, qtrue );
}
+ else if ( clc.state >= CA_CONNECTING && clc.serverAddress.alternateProtocol == 2 && ( Key_GetCatcher( ) & KEYCATCH_MESSAGE ) )
+ {
+ Field_CharEvent( &chatField, key );
+ }
else if ( clc.state == CA_DISCONNECTED )
{
Field_CharEvent( &g_consoleField, key );