about summary refs log tree commit diff
path: root/src/game/client
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-04-06 11:52:00 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-04-06 11:52:00 +0000
commitd15bef7ede6b07dbbc2f6b6a3e23b1ed83e6b6ea (patch)
treef5c299c768a761177065855c25be7506488b95b4 /src/game/client
parent34c3a1c1426e6443ba30b8e2852b73bf92757dff (diff)
downloadzcatch-d15bef7ede6b07dbbc2f6b6a3e23b1ed83e6b6ea.tar.gz
zcatch-d15bef7ede6b07dbbc2f6b6a3e23b1ed83e6b6ea.zip
loads of changes here and there. added flushing of packets when connection is started
Diffstat (limited to 'src/game/client')
-rw-r--r--src/game/client/gc_client.cpp2
-rw-r--r--src/game/client/gc_client.h4
-rw-r--r--src/game/client/gc_hooks.cpp19
-rw-r--r--src/game/client/gc_render_obj.cpp13
4 files changed, 21 insertions, 17 deletions
diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp
index bcacfd17..005e9026 100644
--- a/src/game/client/gc_client.cpp
+++ b/src/game/client/gc_client.cpp
@@ -442,7 +442,7 @@ void send_info(bool start)
 		msg.use_custom_color = config.player_use_custom_color;
 		msg.color_body = config.player_color_body;
 		msg.color_feet = config.player_color_feet;
-		msg.pack(MSGFLAG_VITAL);
+		msg.pack(MSGFLAG_VITAL|MSGFLAG_FLUSH);
 	}
 	else
 	{
diff --git a/src/game/client/gc_client.h b/src/game/client/gc_client.h
index bb684830..2ab558f3 100644
--- a/src/game/client/gc_client.h
+++ b/src/game/client/gc_client.h
@@ -50,9 +50,7 @@ extern player_core predicted_prev_player;
 extern player_core predicted_player;
 
 // input
-extern int picked_up_weapon;
 extern NETOBJ_PLAYER_INPUT input_data;
-extern int input_target_lock;
 
 // debug
 extern int64 debug_firedelay;
@@ -153,6 +151,8 @@ struct client_data
 	tee_render_info skin_info; // this is what the server reports
 	tee_render_info render_info; // this is what we use
 	
+	float angle;
+	
 	void update_render_info();
 };
 
diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp
index 72c94abc..81090ca4 100644
--- a/src/game/client/gc_hooks.cpp
+++ b/src/game/client/gc_hooks.cpp
@@ -386,18 +386,11 @@ extern "C" int modc_snap_input(int *data)
 		return sizeof(input_data);
 	}
 	
-	picked_up_weapon = -1;
-
-	if(!input_target_lock)
-	{
-		input_data.target_x = (int)mouse_pos.x;
-		input_data.target_y = (int)mouse_pos.y;
-		
-		if(!input_data.target_x && !input_data.target_y)
-			input_data.target_y = 1;
-	}
-
-	input_target_lock = 0;
+	input_data.target_x = (int)mouse_pos.x;
+	input_data.target_y = (int)mouse_pos.y;
+	if(!input_data.target_x && !input_data.target_y)
+		input_data.target_y = 1;
+	
 
 	// stress testing
 	if(config.dbg_stress)
@@ -518,6 +511,7 @@ extern "C" void modc_message(int msgtype)
 			
 		// apply new tuning
 		tuning = new_tuning;
+		return;
 	}
 	
 	// normal 
@@ -663,6 +657,7 @@ extern "C" void modc_connected()
 		client_datas[i].name[0] = 0;
 		client_datas[i].skin_id = 0;
 		client_datas[i].team = 0;
+		client_datas[i].angle = 0;
 		client_datas[i].emoticon = 0;
 		client_datas[i].emoticon_start = -1;
 		client_datas[i].skin_info.texture = skin_get(0)->color_texture;
diff --git a/src/game/client/gc_render_obj.cpp b/src/game/client/gc_render_obj.cpp
index 0bfb902c..580ca259 100644
--- a/src/game/client/gc_render_obj.cpp
+++ b/src/game/client/gc_render_obj.cpp
@@ -312,6 +312,17 @@ void render_player(
 	if(player.health < 0) // dont render dead players
 		return;
 
+	//float angle = mix((float)prev.angle, (float)player.angle, intratick)/256.0f;
+	
+	// TODO: fix this good!
+	float mixspeed = 0.05f;
+	if(player.attacktick != prev.attacktick)
+		mixspeed = 0.1f;
+	
+	float angle = mix(client_datas[info.cid].angle, player.angle/256.0f, mixspeed);
+	client_datas[info.cid].angle = angle;
+	vec2 direction = get_direction((int)(angle*256.0f));
+	
 	if(info.local && config.cl_predict)
 	{
 		if(!netobjects.local_character || (netobjects.local_character->health < 0) || (netobjects.gameobj && netobjects.gameobj->game_over))
@@ -326,8 +337,6 @@ void render_player(
 		}
 	}
 
-	vec2 direction = get_direction(player.angle);
-	float angle = player.angle/256.0f;
 	vec2 position = mix(vec2(prev.x, prev.y), vec2(player.x, player.y), intratick);
 	vec2 vel = mix(vec2(prev.vx/256.0f, prev.vy/256.0f), vec2(player.vx/256.0f, player.vy/256.0f), intratick);