about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/game/client/gc_client.cpp80
-rw-r--r--src/game/client/gc_menu.cpp27
-rw-r--r--src/game/g_variables.h6
3 files changed, 43 insertions, 70 deletions
diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp
index fa4e8ca2..b3ad79f3 100644
--- a/src/game/client/gc_client.cpp
+++ b/src/game/client/gc_client.cpp
@@ -833,6 +833,14 @@ void render_game()
 	if (!menu_active)
 		inp_clear_events();
 
+
+	//
+	float camera_max_distance = 250.0f;
+	float deadzone = config.cl_mouse_deadzone;
+	float follow_factor = config.cl_mouse_followfactor/100.0f;
+	float mouse_max = min(camera_max_distance/follow_factor + deadzone, (float)config.cl_mouse_max_distance);
+	vec2 camera_offset(0, 0);
+
 	// fetch new input
 	if(!menu_active && !emoticon_selector_active)
 	{
@@ -849,8 +857,14 @@ void render_game()
 		else
 		{
 			float l = length(mouse_pos);
-			if(l > 600.0f)
-				mouse_pos = normalize(mouse_pos)*600.0f;
+			if(l > mouse_max)
+			{
+				mouse_pos = normalize(mouse_pos)*mouse_max;
+				l = mouse_max;
+			}
+
+			float offset_amount = max(l-deadzone, 0) * follow_factor;
+			camera_offset = normalize(mouse_pos)*offset_amount;
 		}
 	}
 
@@ -866,70 +880,18 @@ void render_game()
 		snd_set_listener_pos(local_character_pos.x, local_character_pos.y);
 	}
 
-	// update some input
-	if(!menu_active && chat_mode == CHATMODE_NONE)
-	{
-		/*
-		bool do_direct = false;
-		
-		if(!emoticon_selector_active)
-		{
-			if(do_input(&input_data.fire, config.key_fire))
-			{
-				// this is done so that we are sure to send the
-				// target when we actually fired
-				input_data.target_x = (int)mouse_pos.x;
-				input_data.target_y = (int)mouse_pos.y;
-				input_target_lock = 1;
-				
-				if(inp_key_presses(config.key_fire))
-				{
-					if(config.dbg_firedelay)
-					{
-						if(debug_firedelay == 0)
-							debug_firedelay = time_get();
-					}
-					
-					do_direct = true;
-				}
-			}
-		}
-
-		// weapon selection
-		do_input(&input_data.next_weapon, config.key_next_weapon);
-		do_input(&input_data.prev_weapon, config.key_prev_weapon);
-
-		if(inp_key_presses(config.key_next_weapon) || inp_key_presses(config.key_prev_weapon))
-			input_data.wanted_weapon = 0;
-		else if (config.cl_autoswitch_weapons && picked_up_weapon != -1)
-			input_data.wanted_weapon = picked_up_weapon;
-		else
-		{
-			if(inp_key_presses(config.key_weapon1)) input_data.wanted_weapon = 1;
-			if(inp_key_presses(config.key_weapon2)) input_data.wanted_weapon = 2;
-			if(inp_key_presses(config.key_weapon3)) input_data.wanted_weapon = 3;
-			if(inp_key_presses(config.key_weapon4)) input_data.wanted_weapon = 4;
-			if(inp_key_presses(config.key_weapon5)) input_data.wanted_weapon = 5;
-			if(inp_key_presses(config.key_weapon6)) input_data.wanted_weapon = 6;
-		}
-		
-		if(do_direct) // do direct input if wanted
-			client_direct_input((int *)&input_data, sizeof(input_data));*/
-	}
-
-
 	// center at char but can be moved when mouse is far away
+	/*
 	float offx = 0, offy = 0;
 	if (config.cl_dynamic_camera)
 	{
-		int deadzone = 300;
 		if(mouse_pos.x > deadzone) offx = mouse_pos.x-deadzone;
 		if(mouse_pos.x <-deadzone) offx = mouse_pos.x+deadzone;
 		if(mouse_pos.y > deadzone) offy = mouse_pos.y-deadzone;
 		if(mouse_pos.y <-deadzone) offy = mouse_pos.y+deadzone;
 		offx = offx*2/3;
 		offy = offy*2/3;
-	}
+	}*/
 
 	// render the world
 	float zoom = 1.0f;
@@ -941,7 +903,7 @@ void render_game()
 		render_world(mouse_pos.x, mouse_pos.y, zoom);
 	else
 	{
-		render_world(local_character_pos.x+offx, local_character_pos.y+offy, zoom);
+		render_world(local_character_pos.x+camera_offset.x, local_character_pos.y+camera_offset.y, zoom);
 
 		// draw screen box
 		if(0)
@@ -949,8 +911,8 @@ void render_game()
 			gfx_texture_set(-1);
 			gfx_blend_normal();
 			gfx_lines_begin();
-				float cx = local_character_pos.x+offx;
-				float cy = local_character_pos.y+offy;
+				float cx = local_character_pos.x+camera_offset.x;
+				float cy = local_character_pos.y+camera_offset.y;
 				float w = 400*3/2;
 				float h = 300*3/2;
 				gfx_lines_draw(cx-w,cy-h,cx+w,cy-h);
diff --git a/src/game/client/gc_menu.cpp b/src/game/client/gc_menu.cpp
index fe2d1c73..d4b45eff 100644
--- a/src/game/client/gc_menu.cpp
+++ b/src/game/client/gc_menu.cpp
@@ -1142,10 +1142,19 @@ static void menu2_render_settings_player(RECT main_view)
 		ui_vsplit_l(&button, 180.0f, &button, 0);
 		ui_do_edit_box(config.player_name, &button, config.player_name, sizeof(config.player_name), 14.0f);
 
+		static int dynamic_camera_button = 0;
 		ui_hsplit_t(&main_view, 20.0f, &button, &main_view);
-		if (ui_do_button(&config.cl_dynamic_camera, "Dynamic camera", config.cl_dynamic_camera, &button, ui_draw_checkbox, 0))
-			config.cl_dynamic_camera ^= 1;
+		if(ui_do_button(&dynamic_camera_button, "Dynamic Camera", config.cl_mouse_deadzone != 0, &button, ui_draw_checkbox, 0))
+		{
+			config.cl_mouse_followfactor = 60;
+			config.cl_mouse_max_distance = 400;
 			
+			if(config.cl_mouse_deadzone)
+				config.cl_mouse_deadzone = 0;
+			else
+				config.cl_mouse_deadzone = 200;
+		}
+
 		ui_hsplit_t(&main_view, 20.0f, &button, &main_view);
 		if (ui_do_button(&config.cl_autoswitch_weapons, "Switch weapon on pickup", config.cl_autoswitch_weapons, &button, ui_draw_checkbox, 0))
 			config.cl_autoswitch_weapons ^= 1;
@@ -1154,7 +1163,7 @@ static void menu2_render_settings_player(RECT main_view)
 		if (ui_do_button(&config.cl_nameplates, "Show name plates", config.cl_nameplates, &button, ui_draw_checkbox, 0))
 			config.cl_nameplates ^= 1;
 
-		if(config.cl_nameplates)
+		//if(config.cl_nameplates)
 		{
 			ui_hsplit_t(&main_view, 20.0f, &button, &main_view);
 			ui_vsplit_l(&button, 15.0f, 0, &button);
@@ -1573,9 +1582,9 @@ static void menu2_render_settings_sound(RECT main_view)
 }
 
 
+	/*
 static void menu2_render_settings_network(RECT main_view)
 {
-	/*
 	RECT button;
 	ui_vsplit_l(&main_view, 300.0f, &main_view, 0);
 	
@@ -1585,8 +1594,8 @@ static void menu2_render_settings_network(RECT main_view)
 		ui_vsplit_l(&button, 110.0f, 0, &button);
 		ui_vsplit_l(&button, 180.0f, &button, 0);
 		ui_do_edit_box(&config.rcon_password, &button, config.rcon_password, sizeof(config.rcon_password), true);
-	}*/
-}
+	}
+}*/
 
 static void menu2_render_settings(RECT main_view)
 {
@@ -1603,7 +1612,7 @@ static void menu2_render_settings(RECT main_view)
 	
 	RECT button;
 	
-	const char *tabs[] = {"Player", "Controls", "Network", "Graphics", "Sound"};
+	const char *tabs[] = {"Player", "Controls", "Graphics", "Sound"};
 	int num_tabs = (int)(sizeof(tabs)/sizeof(*tabs));
 
 	for(int i = 0; i < num_tabs; i++)
@@ -1621,10 +1630,8 @@ static void menu2_render_settings(RECT main_view)
 	else if(settings_page == 1)
 		menu2_render_settings_controls(main_view);
 	else if(settings_page == 2)
-		menu2_render_settings_network(main_view);
-	else if(settings_page == 3)
 		menu2_render_settings_graphics(main_view);
-	else if(settings_page == 4)
+	else if(settings_page == 3)
 		menu2_render_settings_sound(main_view);
 
 	if(need_restart)
diff --git a/src/game/g_variables.h b/src/game/g_variables.h
index c1f32d11..aa004016 100644
--- a/src/game/g_variables.h
+++ b/src/game/g_variables.h
@@ -2,7 +2,6 @@
 MACRO_CONFIG_INT(cl_predict, 1, 0, 1)
 MACRO_CONFIG_INT(cl_nameplates, 0, 0, 1)
 MACRO_CONFIG_INT(cl_nameplates_always, 0, 0, 1)
-MACRO_CONFIG_INT(cl_dynamic_camera, 1, 0, 1)
 MACRO_CONFIG_INT(cl_autoswitch_weapons, 0, 0, 1)
 MACRO_CONFIG_INT(cl_show_player_ids, 0, 0, 1)
 
@@ -10,6 +9,11 @@ MACRO_CONFIG_INT(cl_show_player_ids, 0, 0, 1)
 MACRO_CONFIG_INT(cl_warning_tuning, 1, 0, 1)
 
 
+MACRO_CONFIG_INT(cl_mouse_deadzone, 200, 0, 0)
+MACRO_CONFIG_INT(cl_mouse_followfactor, 60, 0, 200)
+MACRO_CONFIG_INT(cl_mouse_max_distance, 400, 0, 0)
+
+
 MACRO_CONFIG_INT(cl_flow, 0, 0, 1)
 
 MACRO_CONFIG_INT(cl_show_welcome, 1, 0, 1)