Browse Source

Implement cl_viewbob cvar for viewmodel bobbing. Same as in http://am.half-lifecreations.com/forums/index.php?topic=288.0

halloween
Night Owl 8 years ago
parent
commit
ea8f2bed77
  1. 2
      cl_dll/hud.cpp
  2. 6
      cl_dll/view.cpp

2
cl_dll/hud.cpp

@ -35,6 +35,7 @@ extern client_sprite_t *GetSpriteList( client_sprite_t *pList, const char *psz, @@ -35,6 +35,7 @@ extern client_sprite_t *GetSpriteList( client_sprite_t *pList, const char *psz,
extern cvar_t *sensitivity;
cvar_t *cl_lw = NULL;
cvar_t *cl_viewbob = NULL;
void ShutdownInput( void );
@ -194,6 +195,7 @@ void CHud::Init( void ) @@ -194,6 +195,7 @@ void CHud::Init( void )
m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE );
m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE );
cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" );
cl_viewbob = CVAR_CREATE( "cl_viewbob", "0", FCVAR_ARCHIVE );
m_pSpriteList = NULL;

6
cl_dll/view.cpp

@ -78,6 +78,7 @@ extern cvar_t *cl_forwardspeed; @@ -78,6 +78,7 @@ extern cvar_t *cl_forwardspeed;
extern cvar_t *chase_active;
extern cvar_t *scr_ofsx, *scr_ofsy, *scr_ofsz;
extern cvar_t *cl_vsmoothing;
extern cvar_t *cl_viewbob;
extern Vector dead_viewangles;
#define CAM_MODE_RELAX 1
@ -527,7 +528,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams ) @@ -527,7 +528,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
V_AddIdle( pparams );
// offsets
if ( pparams->health <= 0 )
if( pparams->health <= 0 )
{
VectorCopy( dead_viewangles, angles );
}
@ -598,6 +599,9 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams ) @@ -598,6 +599,9 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
view->angles[ROLL] -= bob * 1;
view->angles[PITCH] -= bob * 0.3;
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).

Loading…
Cancel
Save