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/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
4 files changed, 22 insertions, 6 deletions
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;