void CBaseViewModel::CalcViewModelView( CBasePlayer *owner, const Vector& eyePosition, const QAngle& eyeAngles ) { // UNDONE: Calc this on the server? Disabled for now as it seems unnecessary to have this info on the server #if defined( CLIENT_DLL ) QAngle vmangoriginal = eyeAngles; QAngle vmangles = eyeAngles; Vector vmorigin = eyePosition; Vector vecRight; Vector vecUp; Vector vecForward; AngleVectors( vmangoriginal, &vecForward, &vecRight, &vecUp ); //Vector vecOffset = Vector( viewmodel_offset_x.GetFloat(), viewmodel_offset_y.GetFloat(), viewmodel_offset_z.GetFloat() ); vmorigin += (vecForward * viewmodel_offset_y.GetFloat()) + (vecUp * viewmodel_offset_z.GetFloat()) + (vecRight * viewmodel_offset_x.GetFloat()); // TrackIR if ( IsHeadTrackingEnabled() ) { vmorigin = owner->EyePosition(); VectorAngles( owner->GetAutoaimVector( AUTOAIM_5DEGREES ), vmangoriginal ); vmangles = vmangoriginal; } // TrackIR CBaseCombatWeapon *pWeapon = m_hWeapon.Get(); //Allow weapon lagging if ( pWeapon != NULL ) { #if defined( CLIENT_DLL ) if ( !prediction->InPrediction() ) #endif { // add weapon-specific bob pWeapon->AddViewmodelBob( this, vmorigin, vmangles ); } } // Add model-specific bob even if no weapon associated (for head bob for off hand models) AddViewModelBob( owner, vmorigin, vmangles ); // Add lag CalcViewModelLag( vmorigin, vmangles, vmangoriginal ); #if defined( CLIENT_DLL ) if ( !prediction->InPrediction() ) { // Let the viewmodel shake at about 10% of the amplitude of the player's view ACTIVE_SPLITSCREEN_PLAYER_GUARD_ENT( GetOwner() ); GetViewEffects()->ApplyShake( vmorigin, vmangles, 0.1 ); } #endif CalcIronsights( vmorigin, vmangles ); SetLocalOrigin( vmorigin ); SetLocalAngles( vmangles ); #endif }
void CBaseViewModel::CalcViewModelView( CBasePlayer *owner, const Vector& eyePosition, const QAngle& eyeAngles ) { // UNDONE: Calc this on the server? Disabled for now as it seems unnecessary to have this info on the server #if defined( CLIENT_DLL ) QAngle vmangoriginal = eyeAngles; QAngle vmangles = eyeAngles; Vector vmorigin = eyePosition; //We are using the weapon model's animation to make view bobbing CBaseCombatWeapon *pWeapon = m_hWeapon.Get(); //Allow weapon lagging if ( pWeapon != NULL ) { #if defined( CLIENT_DLL ) if ( !prediction->InPrediction() ) #endif { // add weapon-specific bob // pWeapon->AddViewmodelBob( this, vmorigin, vmangles ); } } // Add model-specific bob even if no weapon associated (for head bob for off hand models) // AddViewModelBob( owner, vmorigin, vmangles ); // Add lag // CalcViewModelLag( vmorigin, vmangles, vmangoriginal ); #if defined( CLIENT_DLL ) if ( !prediction->InPrediction() ) { // Let the viewmodel shake at about 10% of the amplitude of the player's view vieweffects->ApplyShake( vmorigin, vmangles, 0.1 ); } #endif CalcIronsights( vmorigin, vmangles ); CalcLeg( vmorigin, vmangles ); // CalcLimitAim( vmorigin, vmangles ); SetLocalOrigin( vmorigin ); SetLocalAngles( vmangles ); #endif }
void CBaseViewModel::CalcViewModelView( CBasePlayer *owner, const Vector& eyePosition, const QAngle& eyeAngles ) { // UNDONE: Calc this on the server? Disabled for now as it seems unnecessary to have this info on the server #if defined( CLIENT_DLL ) QAngle vmangoriginal = eyeAngles; QAngle vmangles = eyeAngles; Vector vmorigin = eyePosition; CBaseCombatWeapon *pWeapon = m_hWeapon.Get(); //Allow weapon lagging //if ( pWeapon != NULL ) if( pWeapon != NULL && !pWeapon->IsIronsighted() ) // { #if defined( CLIENT_DLL ) if ( !prediction->InPrediction() ) #endif { // add weapon-specific bob pWeapon->AddViewmodelBob( this, vmorigin, vmangles ); } } // Add model-specific bob even if no weapon associated (for head bob for off hand models) AddViewModelBob( owner, vmorigin, vmangles ); //So this is the function that does the model movement when you move around. // Add lag CalcViewModelLag( vmorigin, vmangles, vmangoriginal ); #if defined( CLIENT_DLL ) if ( !prediction->InPrediction() ) { // Let the viewmodel shake at about 10% of the amplitude of the player's view vieweffects->ApplyShake( vmorigin, vmangles, 0.1 ); } #endif CalcIronsights( vmorigin, vmangles ); //BG2 -Added for Iron Sights Testing. Credits to Jorg for the code. -HairyPotter SetLocalOrigin( Vector( vmorigin.x, vmorigin.y, vmorigin.z ) ); SetLocalAngles( vmangles ); #endif }
void CBaseViewModel::CalcViewModelView(CBasePlayer *owner, const Vector& eyePosition, const QAngle& eyeAngles) { // UNDONE: Calc this on the server? Disabled for now as it seems unnecessary to have this info on the server #if defined( CLIENT_DLL ) QAngle vmangoriginal = eyeAngles; QAngle vmangles = eyeAngles; Vector vmorigin = eyePosition; //CBaseCombatWeapon *pWeapon = m_hWeapon.Get(); CBaseCombatWeapon *pWeapon = GetOwningWeapon(); //Allow weapon lagging if (pWeapon != NULL) { #if defined( CLIENT_DLL ) if (!prediction->InPrediction()) #endif { // add weapon-specific bob pWeapon->AddViewmodelBob(this, vmorigin, vmangles); //#if defined ( CSTRIKE_DLL ) //CalcViewModelLag( vmorigin, vmangles, vmangoriginal ); //#endif } } // Add model-specific bob even if no weapon associated (for head bob for off hand models) AddViewModelBob(owner, vmorigin, vmangles); //#if !defined ( CSTRIKE_DLL ) // This was causing weapon jitter when rotating in updated CS:S; original Source had this in above InPrediction block 07/14/10 // Add lag //CalcViewModelLag(vmorigin, vmangles, vmangoriginal); //#endif #if defined( CLIENT_DLL ) if (!prediction->InPrediction()) { // Let the viewmodel shake at about 10% of the amplitude of the player's view vieweffects->ApplyShake(vmorigin, vmangles, 0.1); } #endif if( UseVR() ) { g_ClientVirtualReality.OverrideViewModelTransform( vmorigin, vmangles, pWeapon && pWeapon->ShouldUseLargeViewModelVROverride() ); } CalcIronsights(vmorigin, vmangles); CalcAdjustedView(vmorigin, vmangles); SetLocalOrigin(vmorigin); SetLocalAngles(vmangles); #ifdef SIXENSE if( g_pSixenseInput->IsEnabled() && (owner->GetObserverMode()==OBS_MODE_NONE) && !UseVR() ) { const float max_gun_pitch = 20.0f; float viewmodel_fov_ratio = g_pClientMode->GetViewModelFOV(); QAngle gun_angles = g_pSixenseInput->GetViewAngleOffset() * -viewmodel_fov_ratio; // Clamp pitch a bit to minimize seeing back of viewmodel if( gun_angles[PITCH] < -max_gun_pitch ) { gun_angles[PITCH] = -max_gun_pitch; } #ifdef WIN32 // ShouldFlipViewModel comes up unresolved on osx? Mabye because it's defined inline? fixme if( ShouldFlipViewModel() ) { gun_angles[YAW] *= -1.0f; } #endif vmangles = EyeAngles() + gun_angles; SetLocalAngles(vmangles); } #endif #endif }