From: divverent Date: Fri, 16 Jul 2010 22:24:54 +0000 (+0000) Subject: Very close to getting the correct maths done. It now works as intended, just need... X-Git-Tag: xonotic-v0.1.0preview~230^2~136 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=32b18b93983c83da15df794ae4e21323159cc2a5;p=xonotic%2Fdarkplaces.git Very close to getting the correct maths done. It now works as intended, just need to separate the swing's length and speed. From: MirceaKitsune git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10342 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/client.h b/client.h index 8b9298df..a50f2277 100644 --- a/client.h +++ b/client.h @@ -978,8 +978,9 @@ typedef struct client_state_s double lastongroundtime; double hitgroundtime; float bob2_smooth; - + float ground_hit_speed; + float ground_hit_counter; // don't change view angle, full screen, etc int intermission; diff --git a/view.c b/view.c index f35fb255..279f445f 100644 --- a/view.c +++ b/view.c @@ -720,16 +720,17 @@ void V_CalcRefdef (void) if (!cl.onground) { cl.ground_hit_speed = cl.velocity[2] * 0.1; // replace 0.1 with cvar + cl.ground_hit_counter = 1; } else { - if(cl.ground_hit_speed < 0) - cl.ground_hit_speed += 0.1; // replace 0.1 with cvar + if(cl.ground_hit_counter > 0) + cl.ground_hit_counter -= 0.1; // replace 0.1 with cvar else - cl.ground_hit_speed = 0; + cl.ground_hit_counter = 0; - vieworg[2] += sin(M_PI + M_PI * cl.ground_hit_speed * 1); - gunorg[2] += sin(M_PI + M_PI * cl.ground_hit_speed * 1); + vieworg[2] += sin(M_PI + M_PI * cl.ground_hit_counter) * -cl.ground_hit_speed; + gunorg[2] += sin(M_PI + M_PI * cl.ground_hit_counter) * -cl.ground_hit_speed; } // End of TEST!!!