This commit is contained in:
Night Owl 2016-07-31 19:33:34 +05:00
commit 3728c6c7c2
3 changed files with 84 additions and 41 deletions

View File

@ -54,6 +54,8 @@ float rel_pitch;
#define IMPULSE_DOWN 2
#define IMPULSE_UP 4
bool CL_IsDead();
Vector dead_viewangles(0, 0, 0);
void IN_ToggleButtons( float forwardmove, float sidemove )
{
@ -152,10 +154,17 @@ void IN_ClientLookEvent( float relyaw, float relpitch )
void IN_Move( float frametime, usercmd_t *cmd )
{
Vector viewangles;
gEngfuncs.GetViewAngles( viewangles );
bool fLadder = false;
if( gHUD.m_iIntermission )
return; // we can't move during intermission
if( cl_laddermode->value != 2 )
fLadder = gEngfuncs.GetLocalPlayer()->curstate.movetype == MOVETYPE_FLY;
{
cl_entity_t *pplayer = gEngfuncs.GetLocalPlayer();
if( pplayer )
fLadder = pplayer->curstate.movetype == MOVETYPE_FLY;
}
//if(ac_forwardmove || ac_sidemove)
//gEngfuncs.Con_Printf("Move: %f %f %f %f\n", ac_forwardmove, ac_sidemove, rel_pitch, rel_yaw);
#if 0
@ -164,8 +173,14 @@ void IN_Move( float frametime, usercmd_t *cmd )
V_StopPitchDrift();
}
#endif
if( !gHUD.m_iIntermission )
if( CL_IsDead() )
{
viewangles = dead_viewangles; // HACKHACK: see below
}
else
{
gEngfuncs.GetViewAngles( viewangles );
}
if( gHUD.GetSensitivity() != 0 )
{
rel_yaw *= gHUD.GetSensitivity();
@ -176,7 +191,6 @@ void IN_Move( float frametime, usercmd_t *cmd )
rel_yaw *= sensitivity->value;
rel_pitch *= sensitivity->value;
}
viewangles[YAW] += rel_yaw;
if( fLadder )
{
@ -188,15 +202,20 @@ void IN_Move( float frametime, usercmd_t *cmd )
gHUD.m_MOTD.scroll += rel_pitch;
else
viewangles[PITCH] += rel_pitch;
if( viewangles[PITCH] > cl_pitchdown->value )
viewangles[PITCH] = cl_pitchdown->value;
if( viewangles[PITCH] < -cl_pitchup->value )
viewangles[PITCH] = -cl_pitchup->value;
}
float rgfl[3];
viewangles.CopyToArray( rgfl );
gEngfuncs.SetViewAngles( rgfl );
// HACKHACK: change viewangles directly in viewcode,
// so viewangles when player is dead will not be changed on server
if( !CL_IsDead() )
{
gEngfuncs.SetViewAngles( viewangles );
}
dead_viewangles = viewangles; // keep them actual
if( ac_movecount )
{
IN_ToggleButtons( ac_forwardmove / ac_movecount, ac_sidemove / ac_movecount );

View File

@ -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 Vector dead_viewangles;
#define CAM_MODE_RELAX 1
#define CAM_MODE_FOCUS 2
@ -441,7 +442,14 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
pparams->vieworg[2] += bob ;
VectorAdd( pparams->vieworg, pparams->viewheight, pparams->vieworg );
if( pparams->health <= 0 )
{
VectorCopy( dead_viewangles, pparams->viewangles );
}
else
{
VectorCopy( pparams->cl_viewangles, pparams->viewangles );
}
gEngfuncs.V_CalcShake();
gEngfuncs.V_ApplyShake( pparams->vieworg, pparams->viewangles, 1.0 );
@ -519,7 +527,14 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
V_AddIdle( pparams );
// offsets
if ( pparams->health <= 0 )
{
VectorCopy( dead_viewangles, angles );
}
else
{
VectorCopy( pparams->cl_viewangles, angles );
}
AngleVectors( angles, pparams->forward, pparams->right, pparams->up );
@ -553,8 +568,14 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
}
// Give gun our viewangles
if( pparams->health <= 0 )
{
VectorCopy( dead_viewangles, view->angles );
}
else
{
VectorCopy( pparams->cl_viewangles, view->angles );
}
// set up gun position
V_CalcGunAngle( pparams );
@ -616,6 +637,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
float steptime;
steptime = pparams->time - lasttime;
if( steptime < 0 )
//FIXME I_Error( "steptime < 0" );
steptime = 0;

View File

@ -579,7 +579,9 @@ void CGauss::WeaponIdle( void )
iAnim = GAUSS_FIDGET;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3;
}
#ifndef CLIENT_DLL
SendWeaponAnim( iAnim );
#endif
}
}