From d93ecf2b1dd32804285769074f02b52fbf86e557 Mon Sep 17 00:00:00 2001 From: cypress Date: Sat, 13 Jan 2024 14:55:23 -0500 Subject: [PATCH] NX/VITA: Idle View Model Bobbing Integration from CSQC --- source/view.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/source/view.c b/source/view.c index 82c5b9d..64d0c6c 100644 --- a/source/view.c +++ b/source/view.c @@ -229,16 +229,33 @@ float V_CalcBob (float speed,float which)//0 = regular, 1 = side bobbing { float bob = 0; float sprint = 1; - - if(cl.stats[STAT_ZOOM] == 3) - sprint = 1.8; //this gets sprinting speed in comparison to walk speed per weapon - if(cl.stats[STAT_ZOOM] == 2) - return 0; - //12.048 -> 4.3 = 100 -> 36ish, so replace 100 with 36 - if(which == 0) - bob = cl_bobup.value * 24 * speed * (sprint * sprint) * sin((cl.time * 12.5 * sprint));//Pitch Bobbing 10 - else if(which == 1) - bob = cl_bobside.value * 24 * speed * (sprint * sprint * sprint) * sin((cl.time * 6.25 * sprint) - (M_PI * 0.25));//Yaw Bobbing 5 + + if (cl.stats[STAT_ZOOM] == 2) + return; + + // Bob idle-y, instead of presenting as if in-motion. + if (speed < 0.1) { + if(cl.stats[STAT_ZOOM] == 1) + speed = 0.05; + else + speed = 0.25; + + if (which == 0) + bob = cl_bobup.value * 10 * speed * (sprint * sprint) * sin(cl.time * 3.25 * sprint); + else + bob = cl_bobside.value * 50 * speed * (sprint * sprint * sprint) * sin((cl.time * sprint) - (M_PI * 0.25)); + } + // Normal walk/sprint bob. + else { + if(cl.stats[STAT_ZOOM] == 3) + sprint = 1.8; //this gets sprinting speed in comparison to walk speed per weapon + + //12.048 -> 4.3 = 100 -> 36ish, so replace 100 with 36 + if(which == 0) + bob = cl_bobup.value * 24 * speed * (sprint * sprint) * sin((cl.time * 12.5 * sprint));//Pitch Bobbing 10 + else if(which == 1) + bob = cl_bobside.value * 24 * speed * (sprint * sprint * sprint) * sin((cl.time * 6.25 * sprint) - (M_PI * 0.25));//Yaw Bobbing 5 + } return bob; }