//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPropServerVehicleManhack::GetVehicleViewPosition( int nRole, Vector *pAbsOrigin, QAngle *pAbsAngles, float *pFOV ) { Assert( nRole == VEHICLE_ROLE_DRIVER ); CBasePlayer *pPlayer = ToBasePlayer( GetDrivableVehicle()->GetDriver() ); Assert( pPlayer );//*/ //commented out because this really should be setting the manhack angle, not the vehicle angle *pAbsAngles = pPlayer->EyeAngles(); // yuck. this is an in/out parameter. //*pAbsOrigin = pPlayer->EyePosition(); CNPC_Manhack *pManhack=NULL; if (GetManhack()) pManhack=GetManhack()->GetManhack(); if (pManhack != NULL) { Vector m_vecManhackEye = GetManhack()->GetManhackEyePosition(); //pManhack->GetManhackView(); QAngle m_angManhackEye = pManhack->GetAbsAngles(); matrix3x4_t vehicleEyePosToWorld; AngleMatrix( m_angManhackEye, vehicleEyePosToWorld ); // Dampen the eye positional change as we drive around. //*pAbsAngles = pPlayer->EyeAngles(); CPropVehicleManhack *pDriveable = assert_cast<CPropVehicleManhack*>(GetDrivableVehicle()); if (pDriveable) pDriveable->DampenEyePosition( m_vecManhackEye, m_angManhackEye ); // Compute the relative rotation between the unperturbed eye attachment + the eye angles matrix3x4_t cameraToWorld; AngleMatrix( *pAbsAngles, cameraToWorld ); matrix3x4_t worldToEyePos; MatrixInvert( vehicleEyePosToWorld, worldToEyePos ); matrix3x4_t vehicleCameraToEyePos; ConcatTransforms( worldToEyePos, cameraToWorld, vehicleCameraToEyePos ); AngleMatrix( m_angManhackEye, m_vecManhackEye, vehicleEyePosToWorld ); // Now treat the relative eye angles as being relative to this new, perturbed view position... matrix3x4_t newCameraToWorld; ConcatTransforms( vehicleEyePosToWorld, vehicleCameraToEyePos, newCameraToWorld ); // output new view abs angles MatrixAngles( newCameraToWorld, *pAbsAngles ); // UNDONE: *pOrigin would already be correct in single player if the HandleView() on the server ran after vphysics MatrixGetColumn( newCameraToWorld, 3, *pAbsOrigin ); } else DevMsg("fail\n"); }
void CHLCServerVehicle::HandlePassengerEntry( CBasePlayer *pPlayer, bool bAllowEntryOutsideZone ) { // Check to see if this vehicle can be controlled or if it's locked if ( GetDrivableVehicle()->CanEnterVehicle(pPlayer) ) { pPlayer->GetInVehicle( this, VEHICLE_ROLE_DRIVER); } }
//----------------------------------------------------------------------------- // Purpose: // Input : pPlayer - //----------------------------------------------------------------------------- void CChoreoGenericServerVehicle::ItemPostFrame( CBasePlayer *player ) { Assert( player == GetDriver() ); GetDrivableVehicle()->ItemPostFrame( player ); if (( player->m_afButtonPressed & IN_USE ) || GetVehicle()->ShouldForceExit() ) { GetVehicle()->ClearForcedExit(); if ( GetDrivableVehicle()->CanExitVehicle(player) ) { // Let the vehicle try to play the exit animation if ( !HandlePassengerExit( player ) && ( player != NULL ) ) { player->PlayUseDenySound(); } } } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CChoreoGenericServerVehicle::GetVehicleViewPosition( int nRole, Vector *pAbsOrigin, QAngle *pAbsAngles, float *pFOV /*= NULL*/ ) { // FIXME: This needs to be reconciled with the other versions of this function! Assert( nRole == VEHICLE_ROLE_DRIVER ); CBasePlayer *pPlayer = ToBasePlayer( GetDrivableVehicle()->GetDriver() ); Assert( pPlayer ); // Use the player's eyes instead of the attachment point if ( GetVehicle()->m_bForcePlayerEyePoint ) { // Call to BaseClass because CBasePlayer::EyePosition calls this function. *pAbsOrigin = pPlayer->CBaseCombatCharacter::EyePosition(); *pAbsAngles = pPlayer->CBaseCombatCharacter::EyeAngles(); return; } *pAbsAngles = pPlayer->EyeAngles(); // yuck. this is an in/out parameter. float flPitchFactor = 1.0; matrix3x4_t vehicleEyePosToWorld; Vector vehicleEyeOrigin; QAngle vehicleEyeAngles; GetVehicle()->GetAttachment( "vehicle_driver_eyes", vehicleEyeOrigin, vehicleEyeAngles ); AngleMatrix( vehicleEyeAngles, vehicleEyePosToWorld ); // Compute the relative rotation between the unperterbed eye attachment + the eye angles matrix3x4_t cameraToWorld; AngleMatrix( *pAbsAngles, cameraToWorld ); matrix3x4_t worldToEyePos; MatrixInvert( vehicleEyePosToWorld, worldToEyePos ); matrix3x4_t vehicleCameraToEyePos; ConcatTransforms( worldToEyePos, cameraToWorld, vehicleCameraToEyePos ); // Now perterb the attachment point vehicleEyeAngles.x = RemapAngleRange( PITCH_CURVE_ZERO * flPitchFactor, PITCH_CURVE_LINEAR, vehicleEyeAngles.x ); vehicleEyeAngles.z = RemapAngleRange( ROLL_CURVE_ZERO * flPitchFactor, ROLL_CURVE_LINEAR, vehicleEyeAngles.z ); AngleMatrix( vehicleEyeAngles, vehicleEyeOrigin, vehicleEyePosToWorld ); // Now treat the relative eye angles as being relative to this new, perterbed view position... matrix3x4_t newCameraToWorld; ConcatTransforms( vehicleEyePosToWorld, vehicleCameraToEyePos, newCameraToWorld ); // output new view abs angles MatrixAngles( newCameraToWorld, *pAbsAngles ); // UNDONE: *pOrigin would already be correct in single player if the HandleView() on the server ran after vphysics MatrixGetColumn( newCameraToWorld, 3, *pAbsOrigin ); }
//======================================================================================================================================== // CRANE VEHICLE SERVER VEHICLE //======================================================================================================================================== CPropCrane *CCraneServerVehicle::GetCrane( void ) { return (CPropCrane*)GetDrivableVehicle(); }
//======================================================================================================================================== // CRANE VEHICLE SERVER VEHICLE //======================================================================================================================================== CPropCannon *CCannonServerVehicle::GetCannon( void ) { return (CPropCannon*)GetDrivableVehicle(); }
//======================================================================================================================================== // CRANE VEHICLE SERVER VEHICLE //======================================================================================================================================== CPropVehicleChoreoGeneric *CChoreoGenericServerVehicle::GetVehicle( void ) { return (CPropVehicleChoreoGeneric *)GetDrivableVehicle(); }
//======================================================================================================================================== // CRANE VEHICLE SERVER VEHICLE //======================================================================================================================================== CPropVehicleManhack *CPropServerVehicleManhack::GetManhack( void ) { return (CPropVehicleManhack *)GetDrivableVehicle(); }
QUA_helicopter *CHLCServerVehicle::Gethelicopter( void ) { return (QUA_helicopter*)GetDrivableVehicle(); }
//======================================================================================================================================== // CRANE VEHICLE SERVER VEHICLE //======================================================================================================================================== CPropVehiclePrisonerPod *CPrisonerPodServerVehicle::GetPod( void ) { return (CPropVehiclePrisonerPod *)GetDrivableVehicle(); }
CPropAPC2 *CAPC2FourWheelServerVehicle::GetAPC( void ) { return (CPropAPC2*)GetDrivableVehicle(); }