about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2007-12-12 19:52:57 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2007-12-12 19:52:57 +0000
commitf7ea0b2ba8851e4c0ceaef0a8b2361adfc218443 (patch)
tree123f26bfb4ad7c053dd0ed660eea0c793762c837
parent182c77721e60c6a3b68cc3f1f83e485374d85096 (diff)
downloadzcatch-f7ea0b2ba8851e4c0ceaef0a8b2361adfc218443.tar.gz
zcatch-f7ea0b2ba8851e4c0ceaef0a8b2361adfc218443.zip
loads of minor stuff
-rw-r--r--scripts/make_release.py12
-rw-r--r--src/engine/server/server.c8
-rw-r--r--src/game/game.cpp2
-rw-r--r--src/game/game.h1
-rw-r--r--src/game/server/game_server.cpp22
-rw-r--r--src/game/server/srv_common.h3
6 files changed, 33 insertions, 15 deletions
diff --git a/scripts/make_release.py b/scripts/make_release.py
index 7867413a..0611e210 100644
--- a/scripts/make_release.py
+++ b/scripts/make_release.py
@@ -1,6 +1,6 @@
 import shutil, os, sys, zipfile
 
-valid_platforms = ["win32", "linux86", "linux86_64", "src"]
+#valid_platforms = ["win32", "linux86", "linux86_64", "src"]
 
 if len(sys.argv) != 3:
 	print "wrong number of arguments"
@@ -18,16 +18,16 @@ include_exe = True
 include_src = False
 
 if platform == "src":
-	include_data = False
+	include_data = True
 	include_exe = False
 	include_src = True
 	use_zip = 1
 	use_gz = 1
 
-if not platform in valid_platforms:
-	print "not a valid platform"
-	print valid_platforms
-	sys.exit(-1)
+#if not platform in valid_platforms:
+#	print "not a valid platform"
+#	print valid_platforms
+#	sys.exit(-1)
 
 if platform == 'win32':
 	exe_ext = ".exe"
diff --git a/src/engine/server/server.c b/src/engine/server/server.c
index 33bea042..b723e1b9 100644
--- a/src/engine/server/server.c
+++ b/src/engine/server/server.c
@@ -45,7 +45,7 @@ typedef struct
 {
 	short next;
 	short state; /* 0 = free, 1 = alloced, 2 = timed */
-	int timeout_tick;
+	int timeout;
 } SNAP_ID;
 
 static const int MAX_IDS = 16*1024; /* should be lowered */
@@ -133,10 +133,12 @@ static void snap_remove_first_timeout()
 int snap_new_id()
 {
 	int id;
+	int64 now = time_get();
 	dbg_assert(snap_id_inited == 1, "requesting id too soon");
 	
+	
 	/* process timed ids */
-	while(snap_first_timed_id != -1 && snap_ids[snap_first_timed_id].timeout_tick < server_tick())
+	while(snap_first_timed_id != -1 && snap_ids[snap_first_timed_id].timeout < now)
 		snap_remove_first_timeout();
 	
 	id = snap_first_free_id;
@@ -161,7 +163,7 @@ void snap_free_id(int id)
 
 	snap_id_inusage--;
 	snap_ids[id].state = 2;
-	snap_ids[id].timeout_tick = server_tick() + server_tickspeed()*5;
+	snap_ids[id].timeout = time_get()+time_freq()*5;
 	snap_ids[id].next = -1;
 	
 	if(snap_last_timed_id != -1)
diff --git a/src/game/game.cpp b/src/game/game.cpp
index 2632b64b..cb00ae0e 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -40,7 +40,7 @@ void move_point(vec2 *inout_pos, vec2 *inout_vel, float elasticity, int *bounces
 	}
 }
 
-static bool test_box(vec2 pos, vec2 size)
+bool test_box(vec2 pos, vec2 size)
 {
 	size *= 0.5f;
 	if(col_check_point(pos.x-size.x, pos.y-size.y))
diff --git a/src/game/game.h b/src/game/game.h
index 2c577d3e..c30543d9 100644
--- a/src/game/game.h
+++ b/src/game/game.h
@@ -61,6 +61,7 @@ inline T saturated_add(T min, T max, T current, T modifier)
 
 void move_point(vec2 *inout_pos, vec2 *inout_vel, float elasticity, int *bounces);
 void move_box(vec2 *inout_pos, vec2 *inout_vel, vec2 size, float elasticity);
+bool test_box(vec2 pos, vec2 size);
 
 
 // hooking stuff
diff --git a/src/game/server/game_server.cpp b/src/game/server/game_server.cpp
index 353e4188..7a075039 100644
--- a/src/game/server/game_server.cpp
+++ b/src/game/server/game_server.cpp
@@ -634,7 +634,8 @@ int player::handle_ninja()
 				// hit a player, give him damage and stuffs...
 				create_sound(ents[i]->pos, SOUND_NINJA_HIT);
 				// set his velocity to fast upward (for now)
-				hitobjects[numobjectshit++] = ents[i];
+				if(numobjectshit < 10)
+					hitobjects[numobjectshit++] = ents[i];
 				ents[i]->take_damage(vec2(0,10.0f), data->weapons[WEAPON_NINJA].meleedamage, client_id,WEAPON_NINJA);
 			}
 		}
@@ -898,7 +899,8 @@ int player::handle_weapons()
 			// set his velocity to fast upward (for now)
 			create_smoke(ents[i]->pos);
 			create_sound(pos, SOUND_HAMMER_HIT);
-			hitobjects[numobjectshit++] = ents[i];
+			if(numobjectshit < 10)
+				hitobjects[numobjectshit++] = ents[i];
 			ents[i]->take_damage(vec2(0,-1.0f), data->weapons[active_weapon].meleedamage, client_id, active_weapon);
 			player* target = (player*)ents[i];
 			vec2 dir;
@@ -1006,9 +1008,25 @@ void player::tick_defered()
 {
 	if(!dead)
 	{
+		vec2 start_pos = core.pos;
+		vec2 start_vel = core.vel;
+		bool stuck_before = test_box(core.pos, vec2(28.0f, 28.0f));
+		
 		core.move();
+		bool stuck_after_move = test_box(core.pos, vec2(28.0f, 28.0f));
 		core.quantize();
+		bool stuck_after_quant = test_box(core.pos, vec2(28.0f, 28.0f));
 		pos = core.pos;
+		
+		if(!stuck_before && (stuck_after_move || stuck_after_quant))
+		{
+			dbg_msg("player", "STUCK!!! %f %f %f %f %x %x %x %x", 
+				start_pos.x, start_pos.y,
+				start_vel.x, start_vel.y,
+				start_pos.x, start_pos.y,
+				start_vel.x, start_vel.y);
+		}
+		
 
 		int events = core.triggered_events;
 		int mask = cmask_all_except_one(client_id);
diff --git a/src/game/server/srv_common.h b/src/game/server/srv_common.h
index 209d99e0..901e37af 100644
--- a/src/game/server/srv_common.h
+++ b/src/game/server/srv_common.h
@@ -44,11 +44,8 @@ private:
 
 	entity *prev_type_entity;
 	entity *next_type_entity;
-
-	int index;
 protected:
 	int id;
-	
 public:
 	float proximity_radius;
 	unsigned flags;