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.cpp77
-rw-r--r--src/game/client/gc_client.h1
-rw-r--r--src/game/client/gc_console.cpp26
-rw-r--r--src/game/client/gc_hooks.cpp11
4 files changed, 84 insertions, 31 deletions
diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp
index 27021c1f..c092ca73 100644
--- a/src/game/client/gc_client.cpp
+++ b/src/game/client/gc_client.cpp
@@ -35,6 +35,7 @@ bool menu_active = false;
 bool menu_game_active = false;
 static bool emoticon_selector_active = false;
 
+tuning_params tuning;
 
 vec2 mouse_pos;
 vec2 local_character_pos;
@@ -1439,14 +1440,6 @@ void render_game()
 		}
 	}
 	
-	if(client_connection_problems())
-	{
-		gfx_mapscreen(0, 0, 300*gfx_screenaspect(), 300);
-		const char *text = "Connection Problems...";
-		float w = gfx_text_width(0, 24, text, -1);
-		gfx_text(0, 150*gfx_screenaspect()-w/2, 50, 24, text, -1);
-	}
-	
 	if(config.debug && local_character && local_prev_character)
 	{
 		gfx_mapscreen(0, 0, 300*gfx_screenaspect(), 300);
@@ -1496,5 +1489,73 @@ void render_game()
 		render_goals(width/2-w/2, 150+750+25, w);
 		render_spectators(width/2-w/2, 150+750+25+50+25, w);
 	}
+	
+	
+	
+	{
+		gfx_mapscreen(0, 0, 300*gfx_screenaspect(), 300);
+
+		if(client_connection_problems())
+		{
+			const char *text = "Connection Problems...";
+			float w = gfx_text_width(0, 24, text, -1);
+			gfx_text(0, 150*gfx_screenaspect()-w/2, 50, 24, text, -1);
+		}
+		
+		tuning_params standard_tuning;
+
+		// render warning about non standard tuning
+		bool flash = time_get()/(time_freq()/2)%2 == 0;
+		if(config.cl_warning_tuning && memcmp(&standard_tuning, &tuning, sizeof(tuning_params)) != 0)
+		{
+			const char *text = "Warning! Server is running non-standard tuning.";
+			if(flash)
+				gfx_text_color(1,0.4f,0.4f,1.0f);
+			else
+				gfx_text_color(0.75f,0.2f,0.2f,1.0f);
+			gfx_text(0x0, 5, 40, 6, text, -1);
+			gfx_text_color(1,1,1,1);
+		}
+		
+		// render tuning debugging
+		if(config.dbg_tuning)
+		{
+			float y = 50.0f;
+			int count = 0;
+			for(int i = 0; i < tuning.num(); i++)
+			{
+				char buf[128];
+				float current, standard;
+				tuning.get(i, &current);
+				standard_tuning.get(i, &standard);
+				
+				if(standard == current)
+					gfx_text_color(1,1,1,1.0f);
+				else
+					gfx_text_color(1,0.25f,0.25f,1.0f);
+		
+				float w;
+				float x = 5.0f;
+				
+				sprintf(buf, "%.2f", standard);
+				x += 20.0f;
+				w = gfx_text_width(0, 5, buf, -1);
+				gfx_text(0x0, x-w, y+count*6, 5, buf, -1);
+
+				sprintf(buf, "%.2f", current);
+				x += 20.0f;
+				w = gfx_text_width(0, 5, buf, -1);
+				gfx_text(0x0, x-w, y+count*6, 5, buf, -1);
+
+				x += 5.0f;
+				gfx_text(0x0, x, y+count*6, 5, tuning.names[i], -1);
+				
+				count++;
+			}
+		}
+		
+		gfx_text_color(1,1,1,1);
+	}
+	
 }
 
diff --git a/src/game/client/gc_client.h b/src/game/client/gc_client.h
index def3cad8..63c74d77 100644
--- a/src/game/client/gc_client.h
+++ b/src/game/client/gc_client.h
@@ -25,6 +25,7 @@ extern const obj_player_character *local_prev_character;
 extern const obj_player_info *local_info;
 extern const obj_flag *flags[2];
 extern const obj_game *gameobj;
+extern tuning_params tuning;
 
 // predicted players
 extern player_core predicted_prev_player;
diff --git a/src/game/client/gc_console.cpp b/src/game/client/gc_console.cpp
index b8f090ea..d462156b 100644
--- a/src/game/client/gc_console.cpp
+++ b/src/game/client/gc_console.cpp
@@ -39,6 +39,8 @@ static float time_now()
 	return float(time_get()-time_start)/float(time_freq());
 }
 
+
+
 static void client_console_print(const char *str)
 {
 	int len = strlen(str);
@@ -66,39 +68,21 @@ static void client_console_print(const char *str)
 	//dbg_msg("console", "FROM CLIENT!! %s", str);
 }
 
-static void connect_command(struct lexer_result *result, void *user_data)
-{
-	const char *address;
-	extract_result_string(result, 1, &address);
-	client_connect(address);
-}
 
-static void disconnect_command(struct lexer_result *result, void *user_data)
-{
-	client_disconnect();
-}
-
-static void quit_command(struct lexer_result *result, void *user_data)
-{
-	client_quit();
-}
-
-static void con_team(struct lexer_result *result, void *user_data)
+static void con_team(void *result, void *user_data)
 {
 	int new_team;
-	extract_result_int(result, 1, &new_team);
+	console_result_int(result, 1, &new_team);
 	send_switch_team(new_team);
 }
 
 void client_console_init()
 {
 	console_register_print_callback(client_console_print);
-	MACRO_REGISTER_COMMAND("quit", "", quit_command, 0x0);
-	MACRO_REGISTER_COMMAND("connect", "s", connect_command, 0x0);
-	MACRO_REGISTER_COMMAND("disconnect", "", disconnect_command, 0x0);
 	MACRO_REGISTER_COMMAND("team", "i", con_team, 0x0);
 }
 
+
 void console_handle_input()
 {
 	int was_active = console_active();
diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp
index 3c8d801d..0acd1c41 100644
--- a/src/game/client/gc_hooks.cpp
+++ b/src/game/client/gc_hooks.cpp
@@ -5,6 +5,7 @@
 extern "C" {
 	#include <engine/e_config.h>
 	#include <engine/client/ec_font.h>
+	#include <engine/e_console.h>
 };
 
 #include <game/generated/gc_data.h>
@@ -25,7 +26,7 @@ extern void menu_init();
 extern bool menu_active;
 extern bool menu_game_active;
 
-extern "C" void modc_preinit()
+extern "C" void modc_console_init()
 {
 	client_console_init();
 }
@@ -109,6 +110,7 @@ extern "C" void modc_predict()
 
 	// repredict player
 	world_core world;
+	world.tuning = tuning;
 	int local_cid = -1;
 
 	// search for players
@@ -437,10 +439,15 @@ extern "C" void modc_message(int msg)
 		
 		client_datas[cid].update_render_info();
 	}
+	else if(msg == MSG_TUNE_PARAMS)
+	{
+		int *params = (int *)&tuning;
+		for(unsigned i = 0; i < sizeof(tuning_params)/sizeof(int); i++)
+			params[i] = msg_unpack_int();
+	}
     else if(msg == MSG_WEAPON_PICKUP)
     {
         int weapon = msg_unpack_int();
-
         picked_up_weapon = weapon+1;
     }
 	else if(msg == MSG_READY_TO_ENTER)