about summary refs log tree commit diff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/client/gc_client.cpp2
-rw-r--r--src/game/client/gc_hooks.cpp2
-rw-r--r--src/game/client/gc_menu.cpp12
-rw-r--r--src/game/g_variables.h8
-rw-r--r--src/game/server/gs_server.cpp47
5 files changed, 36 insertions, 35 deletions
diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp
index fec01294..7b191fbf 100644
--- a/src/game/client/gc_client.cpp
+++ b/src/game/client/gc_client.cpp
@@ -851,6 +851,8 @@ void render_game()
 		else
 		{
 			float l = length(mouse_pos);
+			if(l != l) l = 0; // detect division by zero
+			
 			if(l > mouse_max)
 			{
 				mouse_pos = normalize(mouse_pos)*mouse_max;
diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp
index 0074bab7..73dde8f2 100644
--- a/src/game/client/gc_hooks.cpp
+++ b/src/game/client/gc_hooks.cpp
@@ -467,7 +467,7 @@ extern "C" void modc_message(int msg)
 		const char *message = msg_unpack_string();
 
 		/* check for errors and invalid inputs */
-		if(msg_unpack_error() || cid < 0 || cid >= MAX_CLIENTS)
+		if(msg_unpack_error() || cid < -1 || cid >= MAX_CLIENTS)
 			return;
 			
 		dbg_msg("message", "chat cid=%d team=%d msg='%s'", cid, team, message);
diff --git a/src/game/client/gc_menu.cpp b/src/game/client/gc_menu.cpp
index d0789d77..e6a3d6c5 100644
--- a/src/game/client/gc_menu.cpp
+++ b/src/game/client/gc_menu.cpp
@@ -1163,13 +1163,19 @@ static void menu2_render_settings_player(RECT main_view)
 		ui_hsplit_t(&main_view, 20.0f, &button, &main_view);
 		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_followfactor = 0;
+				config.cl_mouse_max_distance = 400;
 				config.cl_mouse_deadzone = 0;
+			}
 			else
-				config.cl_mouse_deadzone = 200;
+			{
+				config.cl_mouse_followfactor = 60;
+				config.cl_mouse_max_distance = 1000;
+				config.cl_mouse_deadzone = 300;
+			}
 		}
 
 		ui_hsplit_t(&main_view, 20.0f, &button, &main_view);
diff --git a/src/game/g_variables.h b/src/game/g_variables.h
index ce544ea1..b7ab3b8e 100644
--- a/src/game/g_variables.h
+++ b/src/game/g_variables.h
@@ -12,7 +12,7 @@ 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_mouse_max_distance, 800, 0, 0)
 
 
 MACRO_CONFIG_INT(cl_flow, 0, 0, 1)
@@ -48,9 +48,3 @@ MACRO_CONFIG_INT(sv_scorelimit, 20, 0, 1000)
 MACRO_CONFIG_INT(sv_timelimit, 0, 0, 1000)
 MACRO_CONFIG_STR(sv_gametype, 32, "dm")
 MACRO_CONFIG_INT(sv_tournament_mode, 0, 0, 1)
-
-
-/* should be removed as they are commands and not variables */
-MACRO_CONFIG_INT(sv_restart, 0, 0, 120)
-MACRO_CONFIG_STR(sv_msg, 512, "")
-MACRO_CONFIG_INT(sv_kick, -1, 0, 0)
diff --git a/src/game/server/gs_server.cpp b/src/game/server/gs_server.cpp
index bb1b40bb..a4e11428 100644
--- a/src/game/server/gs_server.cpp
+++ b/src/game/server/gs_server.cpp
@@ -2016,28 +2016,6 @@ void mods_tick()
 
 	if(world->paused) // make sure that the game object always updates
 		gameobj->tick();
-
-	if(config.sv_restart)
-	{
-		if(config.sv_restart > 1)
-			gameobj->do_warmup(config.sv_restart);
-		else
-			gameobj->startround();
-
-		config.sv_restart = 0;
-	}
-
-	if(config.sv_msg[0] != 0)
-	{
-		send_chat(-1, -1, config.sv_msg);
-		config.sv_msg[0] = 0;
-	}
-	
-	if(config.sv_kick != -1)
-	{
-		server_kick(config.sv_kick, "kicked");
-		config.sv_kick = -1;
-	}
 }
 
 void mods_snap(int client_id)
@@ -2138,8 +2116,8 @@ void mods_connected(int client_id)
 		else
 			players[client_id].team = gameobj->getteam(client_id);
 	}
-	
-	
+
+	// send motd	
 	msg_pack_start(MSG_MOTD, MSGFLAG_VITAL);
 	msg_pack_string(config.sv_motd, 900);
 	msg_pack_end();
@@ -2298,11 +2276,32 @@ static void con_tune_dump(void *result, void *user_data)
 }
 
 
+static void con_restart(void *result, void *user_data)
+{
+	int time = 0;
+	console_result_int(result, 1, &time);
+
+	if(time)
+		gameobj->do_warmup(time);
+	else
+		gameobj->startround();
+}
+
+static void con_broadcast(void *result, void *user_data)
+{
+	const char *message;
+	console_result_string(result, 1, &message);
+	send_chat(-1, -1, message);
+}
+
 void mods_console_init()
 {
 	MACRO_REGISTER_COMMAND("tune", "s?i", con_tune_param, 0);
 	MACRO_REGISTER_COMMAND("tune_reset", "", con_tune_reset, 0);
 	MACRO_REGISTER_COMMAND("tune_dump", "", con_tune_dump, 0);
+
+	MACRO_REGISTER_COMMAND("restart", "?i", con_restart, 0);
+	MACRO_REGISTER_COMMAND("broadcast", "s", con_broadcast, 0);
 }
 
 void mods_init()