NX/VITA: Idle View Model Bobbing Integration from CSQC

This commit is contained in:
cypress 2024-01-13 14:55:23 -05:00 committed by GitHub
parent b5150a81e6
commit d93ecf2b1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 10 deletions

View File

@ -230,15 +230,32 @@ float V_CalcBob (float speed,float which)//0 = regular, 1 = side bobbing
float bob = 0; float bob = 0;
float sprint = 1; float sprint = 1;
if(cl.stats[STAT_ZOOM] == 3) if (cl.stats[STAT_ZOOM] == 2)
sprint = 1.8; //this gets sprinting speed in comparison to walk speed per weapon return;
if(cl.stats[STAT_ZOOM] == 2)
return 0; // Bob idle-y, instead of presenting as if in-motion.
//12.048 -> 4.3 = 100 -> 36ish, so replace 100 with 36 if (speed < 0.1) {
if(which == 0) if(cl.stats[STAT_ZOOM] == 1)
bob = cl_bobup.value * 24 * speed * (sprint * sprint) * sin((cl.time * 12.5 * sprint));//Pitch Bobbing 10 speed = 0.05;
else if(which == 1) else
bob = cl_bobside.value * 24 * speed * (sprint * sprint * sprint) * sin((cl.time * 6.25 * sprint) - (M_PI * 0.25));//Yaw Bobbing 5 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; return bob;
} }