2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-22 01:47:45 +01:00

Update weapon bobbing code.

This commit is contained in:
Andrey Akhmichin 2024-02-13 05:30:42 +05:00
parent 955f7ad436
commit 7bbc2cf4d7

View File

@ -295,9 +295,12 @@ void V_CalcGunAngle( struct ref_params_s *pparams )
viewent->angles[PITCH] -= v_idlescale * sin( pparams->time * v_ipitch_cycle.value ) * ( v_ipitch_level.value * 0.5f );
viewent->angles[YAW] -= v_idlescale * sin( pparams->time * v_iyaw_cycle.value ) * v_iyaw_level.value;
if( !( cl_viewbob && cl_viewbob->value ))
{
VectorCopy( viewent->angles, viewent->curstate.angles );
VectorCopy( viewent->angles, viewent->latched.prevangles );
}
}
/*
==============
@ -575,6 +578,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
{
VectorCopy( pparams->cl_viewangles, view->angles );
}
// set up gun position
V_CalcGunAngle( pparams );
@ -597,9 +601,6 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
view->angles[ROLL] -= bob * 1.0f;
view->angles[PITCH] -= bob * 0.3f;
if( cl_viewbob && cl_viewbob->value )
VectorCopy( view->angles, view->curstate.angles );
// pushing the view origin down off of the same X/Z plane as the ent's origin will give the
// gun a very nice 'shifting' effect when the player looks up/down. If there is a problem
// with view model distortion, this may be a cause. (SJB).
@ -768,6 +769,14 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
}
}
if( cl_viewbob && cl_viewbob->value )
{
VectorCopy( view->origin, view->curstate.origin );
VectorCopy( view->origin, view->latched.prevorigin );
VectorCopy( view->angles, view->curstate.angles );
VectorCopy( view->angles, view->latched.prevangles );
}
lasttime = pparams->time;
v_origin = pparams->vieworg;