about summary refs log tree commit diff
path: root/src/game/server
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2007-07-22 09:15:34 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2007-07-22 09:15:34 +0000
commit3b1871499c52a41c6fe1e017d6da858b7e70a396 (patch)
tree410cca70987d8789088e25c8a8b5b24eb46a8c06 /src/game/server
parent1950995bb5137e084b5706275cce1d9d7398fc34 (diff)
downloadzcatch-3b1871499c52a41c6fe1e017d6da858b7e70a396.tar.gz
zcatch-3b1871499c52a41c6fe1e017d6da858b7e70a396.zip
laggometer, smaller gfx fixes
Diffstat (limited to 'src/game/server')
-rw-r--r--src/game/server/game_server.cpp50
1 files changed, 32 insertions, 18 deletions
diff --git a/src/game/server/game_server.cpp b/src/game/server/game_server.cpp
index ecb57716..af705e19 100644
--- a/src/game/server/game_server.cpp
+++ b/src/game/server/game_server.cpp
@@ -343,7 +343,7 @@ game_world world;
 gameobject::gameobject()
 : entity(OBJTYPE_GAME)
 {
-	gametype = GAMETYPE_TDM;
+	gametype = GAMETYPE_DM;
 	game_over_tick = -1;
 	sudden_death = 0;
 	round_start_tick = server_tick();
@@ -1032,6 +1032,9 @@ void player::tick()
 		
 	if(hook_state == HOOK_GRABBED)
 	{
+		if(hooked_player)
+			hook_pos = hooked_player->pos;
+			
 		/*if(hooked_player)
 			hook_pos = hooked_player->pos;
 
@@ -1043,24 +1046,29 @@ void player::tick()
 			vel.x = saturated_add(-hook_drag_speed, hook_drag_speed, vel.x, -accel*dir.x*0.75f);
 			vel.y = saturated_add(-hook_drag_speed, hook_drag_speed, vel.y, -accel*dir.y);
 		}*/
-		// Old version feels much better (to me atleast)
-		vec2 hookvel = normalize(hook_pos-pos)*hook_drag_accel;
-		// the hook as more power to drag you up then down.
-		// this makes it easier to get on top of an platform
-		if(hookvel.y > 0)
-			hookvel.y *= 0.3f;
-		
-		// the hook will boost it's power if the player wants to move
-		// in that direction. otherwise it will dampen everything abit
-		if((hookvel.x < 0 && input.left) || (hookvel.x > 0 && input.right)) 
-			hookvel.x *= 0.95f;
-		else
-			hookvel.x *= 0.75f;
-		vec2 new_vel = vel+hookvel;
 		
-		// check if we are under the legal limit for the hook
-		if(length(new_vel) < hook_drag_speed || length(new_vel) < length(vel))
-			vel = new_vel; // no problem. apply
+		// Old version feels much better (to me atleast)
+		if(distance(hook_pos, pos) > 46.0f)
+		{
+			vec2 hookvel = normalize(hook_pos-pos)*hook_drag_accel;
+			// the hook as more power to drag you up then down.
+			// this makes it easier to get on top of an platform
+			if(hookvel.y > 0)
+				hookvel.y *= 0.3f;
+			
+			// the hook will boost it's power if the player wants to move
+			// in that direction. otherwise it will dampen everything abit
+			if((hookvel.x < 0 && input.left) || (hookvel.x > 0 && input.right)) 
+				hookvel.x *= 0.95f;
+			else
+				hookvel.x *= 0.75f;
+			
+			vec2 new_vel = vel+hookvel;
+			
+			// check if we are under the legal limit for the hook
+			if(length(new_vel) < hook_drag_speed || length(new_vel) < length(vel))
+				vel = new_vel; // no problem. apply
+		}
 	}
 		
 	// fix influence of other players, collision + hook
@@ -1205,6 +1213,12 @@ void player::snap(int snaping_client)
 	player->vy = (int)vel.y;
 	player->emote = EMOTE_NORMAL;
 
+	player->latency = 0;
+	client_info info;
+	if(server_getclientinfo(client_id, &info))
+		player->latency = info.latency;
+	
+
 	player->ammocount = weapons[active_weapon].ammo;
 	player->health = 0;
 	player->armor = 0;