From 980e4885f0db3f56b5ec31359393741dd8a27672 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Thu, 20 Mar 2008 00:52:23 +0000 Subject: getting too tired, to many misstakes. more fixes for hook --- src/game/g_game.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/game/g_game.cpp b/src/game/g_game.cpp index 8b3719b5..fb0c5ee9 100644 --- a/src/game/g_game.cpp +++ b/src/game/g_game.cpp @@ -240,7 +240,7 @@ void player_core::tick() if(hook_state == HOOK_IDLE) { hook_state = HOOK_FLYING; - hook_pos = pos+direction*phys_size*0.75f; + hook_pos = pos+direction*phys_size*1.5f; hook_dir = direction; hooked_player = -1; hook_tick = 0; @@ -257,7 +257,7 @@ void player_core::tick() if(distance(pos, new_pos) > world->tuning.hook_length) { hook_state = HOOK_GOING_TO_RETRACT; - new_pos = pos + normalize(pos-new_pos) * world->tuning.hook_length; + new_pos = pos + normalize(new_pos-pos) * world->tuning.hook_length; } // make sure that the hook doesn't go though the ground @@ -273,8 +273,15 @@ void player_core::tick() continue; vec2 closest_point = closest_point_on_line(hook_pos, new_pos, p->pos); - if(distance(p->pos, closest_point) < phys_size+4.0f) + if(distance(p->pos, closest_point) < phys_size+2.0f) { + dbg_msg("", "state=%d p0=%f,%f p1=%f,%f t=%f,%f c=%f,%f", + hook_state, + hook_pos.x, hook_pos.y, + new_pos.x, new_pos.y, + p->pos.x, p->pos.y, + closest_point.x, closest_point.y + ); triggered_events |= COREEVENT_HOOK_ATTACH_PLAYER; hook_state = HOOK_GRABBED; hooked_player = i; -- cgit 1.4.1