about summary refs log tree commit diff
path: root/src/game/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/client')
-rw-r--r--src/game/client/gc_client.cpp24
-rw-r--r--src/game/client/gc_console.cpp25
2 files changed, 28 insertions, 21 deletions
diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp
index 6bb6f582..80e7bd40 100644
--- a/src/game/client/gc_client.cpp
+++ b/src/game/client/gc_client.cpp
@@ -741,6 +741,9 @@ void chat_enable_mode(int team)
 			
 		mem_zero(chat_input, sizeof(chat_input));
 		chat_input_len = 0;
+		
+		// make sure that we don't trigger something weird
+		inp_clear_events();
 	}
 }
 
@@ -779,7 +782,7 @@ void render_game()
 	anim_eval(&data->animations[ANIM_BASE], 0, &idlestate);
 	anim_eval_add(&idlestate, &data->animations[ANIM_IDLE], 0, 1.0f);
 
-	if (inp_key_down(KEY_ESC))
+	if(inp_key_down(KEY_ESC))
 	{
 		if (chat_mode)
 			chat_mode = CHATMODE_NONE;
@@ -806,15 +809,6 @@ void render_game()
 	{
 		if(chat_mode != CHATMODE_NONE)
 		{
-			if(inp_key_down(KEY_ENTER) || inp_key_down(KEY_KP_ENTER))
-			{
-				// send message
-				if(chat_input_len)
-					chat_say(chat_mode == CHATMODE_ALL ? 0 : 1, chat_input);
-
-				chat_mode = CHATMODE_NONE;
-			}
-
 			for(int i = 0; i < inp_num_events(); i++)
 			{
 				INPUT_EVENT e = inp_get_event(i);
@@ -829,6 +823,16 @@ void render_game()
 					}
 				}
 
+				if((e.key == KEY_ENTER || e.key == KEY_KP_ENTER) && (e.flags&INPFLAG_PRESS))
+				{
+					// send message
+					if(chat_input_len)
+						chat_say(chat_mode == CHATMODE_ALL ? 0 : 1, chat_input);
+
+					chat_mode = CHATMODE_NONE;
+					break;					
+				}
+				
 				if(e.key == KEY_BACKSPACE && (e.flags&INPFLAG_PRESS))
 				{
 					if(chat_input_len > 0)
diff --git a/src/game/client/gc_console.cpp b/src/game/client/gc_console.cpp
index 37e50948..ca1e20cb 100644
--- a/src/game/client/gc_console.cpp
+++ b/src/game/client/gc_console.cpp
@@ -215,6 +215,20 @@ static void con_sayteam(void *result, void *user_data)
 	chat_say(1, console_arg_string(result, 0));
 }
 
+
+
+static void con_chat(void *result, void *user_data)
+{
+	const char *mode = console_arg_string(result, 0);
+	if(strcmp(mode, "all") == 0)
+		chat_enable_mode(0);
+	else if(strcmp(mode, "team") == 0)
+		chat_enable_mode(1);
+	else
+		dbg_msg("console", "expected all or team as mode");
+}
+
+
 void send_kill(int client_id);
 
 static void con_kill(void *result, void *user_data)
@@ -330,17 +344,6 @@ static void con_key_input_weapon(void *result, void *user_data)
 		input_data.wanted_weapon = w;
 }
 
-static void con_chat(void *result, void *user_data)
-{
-	const char *mode = console_arg_string(result, 0);
-	if(strcmp(mode, "all") == 0)
-		chat_enable_mode(0);
-	else if(strcmp(mode, "team") == 0)
-		chat_enable_mode(1);
-	else
-		dbg_msg("console", "expected all or team as mode");
-}
-
 static void con_toggle_local_console(void *result, void *user_data)
 {
 	console_toggle(0);