From 32b18b93983c83da15df794ae4e21323159cc2a5 Mon Sep 17 00:00:00 2001 From: divverent Date: Fri, 16 Jul 2010 22:24:54 +0000 Subject: [PATCH] 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 --- client.h | 3 ++- view.c | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) 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!!! -- 2.39.2