From 920346b7aebcb8d4312987e3bb4185be13c53c91 Mon Sep 17 00:00:00 2001 From: divverent Date: Fri, 16 Jul 2010 22:25:00 +0000 Subject: [PATCH] The code works as intended! Change some names and comments in the meantime. From: MirceaKitsune git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10343 d7cf8633-e32d-0410-b094-e92efae38249 --- client.h | 5 ++--- view.c | 24 +++++++++--------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/client.h b/client.h index a50f2277..0666a096 100644 --- a/client.h +++ b/client.h @@ -978,9 +978,8 @@ typedef struct client_state_s double lastongroundtime; double hitgroundtime; float bob2_smooth; - - float ground_hit_speed; - float ground_hit_counter; + float bobfall_speed; + float bobfall_swing; // don't change view angle, full screen, etc int intermission; diff --git a/view.c b/view.c index 279f445f..fe3e8130 100644 --- a/view.c +++ b/view.c @@ -712,31 +712,25 @@ void V_CalcRefdef (void) gunorg[0] += bob2vel[0]; gunorg[1] += bob2vel[1]; } - - - // TEST!!! - // get the speed while in the air, apply it while we're not + // fall bobbing code + // causes the view to swing down and back up when touching the ground if (!cl.onground) { - cl.ground_hit_speed = cl.velocity[2] * 0.1; // replace 0.1 with cvar - cl.ground_hit_counter = 1; + cl.bobfall_speed = cl.velocity[2] * 0.1; // replace 0.1 with cvar + cl.bobfall_swing = 1; } else { - if(cl.ground_hit_counter > 0) - cl.ground_hit_counter -= 0.1; // replace 0.1 with cvar + if(cl.bobfall_swing > 0) + cl.bobfall_swing -= 0.01; // replace 0.1 with cvar else - cl.ground_hit_counter = 0; + cl.bobfall_swing = 0; - 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; + vieworg[2] += sin(M_PI + M_PI * cl.bobfall_swing) * -cl.bobfall_speed; + gunorg[2] += sin(M_PI + M_PI * cl.bobfall_swing) * -cl.bobfall_speed; } - // End of TEST!!! - - - // gun model bobbing code if (cl_bob.value || cl_bob2.value) if (cl_bobmodel.value) -- 2.39.2