Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ================
- idPlayer::UpdateViewAngles
- ================
- */
- void idPlayer::UpdateViewAngles( void ) {
- if ( gameLocal.GameIsPaused() || gameLocal.IsSpectatingWinner() ) {
- return;
- }
- if ( !noclip && ( IsInCinematic() || privateCameraView || gameLocal.GetCamera() || influenceActive == INFLUENCE_LEVEL2 ) ) {
- // no view changes at all, but we still want to update the deltas or else when
- // we get out of this mode, our view will snap to a kind of random angle
- UpdateDeltaViewAngles( viewAngles ); //winnerCam ||
- return;
- }
- int i;
- idAngles delta;
- // if dead
- if ( health <= 0 ) {
- if ( pm_thirdPersonDeath.GetBool() ) {
- viewAngles.roll = 0.0f;
- viewAngles.pitch = 30.0f;
- } else {
- viewAngles.roll = 40.0f;
- viewAngles.pitch = -15.0f;
- }
- return;
- }
- if ( !IsGuidingProjectile() ) {
- for ( i = 0; i < 3; i++ ) {
- cmdAngles[i] = SHORT2ANGLE( usercmd.angles[i] );
- if ( influenceActive == INFLUENCE_LEVEL3 ) {
- viewAngles[i] += idMath::ClampFloat( -1.0f, 1.0f, idMath::AngleDelta( idMath::AngleNormalize180( SHORT2ANGLE( usercmd.angles[i]) + deltaViewAngles[i] ) , viewAngles[i] ) );
- } else {
- viewAngles[i] = idMath::AngleNormalize180( SHORT2ANGLE( usercmd.angles[i] ) + deltaViewAngles[i] );
- }
- }
- if ( !centerView.IsDone( gameLocal.time ) ) {
- viewAngles.pitch = centerView.GetCurrentValue( gameLocal.time );
- }
- // clamp the pitch
- if ( noclip ) {
- if ( viewAngles.pitch > 89.0f ) {
- // don't let the player look down more than 89 degrees while noclipping
- viewAngles.pitch = 89.0f;
- } else if ( viewAngles.pitch < -89.0f ) {
- // don't let the player look up more than 89 degrees while noclipping
- viewAngles.pitch = -89.0f;
- }
- } else {
- if ( viewAngles.pitch > pm_maxviewpitch.GetFloat() ) {
- // don't let the player look down enough to see the shadow of his (non-existant) feet
- viewAngles.pitch = pm_maxviewpitch.GetFloat();
- } else if ( viewAngles.pitch < pm_minviewpitch.GetFloat() ) {
- // don't let the player look up more than 89 degrees
- viewAngles.pitch = pm_minviewpitch.GetFloat();
- }
- }
- // orient the model towards the direction we're looking
- SetAngles( idAngles( 0, viewAngles.yaw, 0 ) );
- // save in the log for analyzing weapon angle offsets
- loggedViewAngles[ gameLocal.framenum & (NUM_LOGGED_VIEW_ANGLES-1) ] = viewAngles;
- UpdateDeltaViewAngles( viewAngles );
- } else if ( IsGuidingProjectile() ) {
- for ( i = 0; i < 3; i++ ) {
- cmdAngles[i] = SHORT2ANGLE( usercmd.angles[i] );
- if ( influenceActive == INFLUENCE_LEVEL3 ) {
- guideAngles[i] += idMath::ClampFloat( -1.0f, 1.0f, idMath::AngleDelta( idMath::AngleNormalize180( SHORT2ANGLE( usercmd.angles[i]) + deltaViewAngles[i] ) , guideAngles[i] ) );
- } else {
- guideAngles[i] = idMath::AngleNormalize180( SHORT2ANGLE( usercmd.angles[i] ) + deltaViewAngles[i] );
- }
- }
- UpdateDeltaViewAngles( guideAngles );
- }
- }
- //militia_add
- /*
- ==============
- idPlayer::CameraViews
- ==============
- */
- void idPlayer::CameraViews( void ) {
- pfl.thirdpersonView = false;
- rvVehicle * vehicle = NULL;
- if ( IsInVehicle ( ) ) {
- vehicle = vehicleController.GetVehicle();
- }
- renderView->vieworg = firstPersonViewOrigin;
- renderView->viewaxis = firstPersonViewAxis;
- SmoothenRenderView( true );
- if ( gameLocal.IsMPGameState( GAMEREVIEW ) ) {
- SpectateWinner();
- } else if ( IsGuidingProjectile() ) {
- GuidingProjectile();
- } else if ( AttackerDeathViewCheck() ) {
- AttackerDeathView();
- } else if ( !atl.vehicleDeath && vehicle && !IsZoomed() && !pfl.dead && ( pm_thirdPerson.GetBool() || vehicle->thirdpersonVehicle ) ) {
- /*
- if ( !vehicle->thirdpersonCrossHair ) {
- HideCrosshair();
- } else {
- ShowCrosshair();
- }
- */
- ThirdPersonView( pm_thirdPersonAngle.GetFloat(), (camera_zoom.GetCurrentValue( gameLocal.time )), vehicle->thirdpersonHeight, true, false, IsInVehicle() );
- } else if ( !vehicle && !IsZoomed() && !pfl.dead && !atl.vehicleDeath && pm_thirdPerson.GetBool() ) {
- /*
- if ( !pm_thirdpersonCrosshair.GetBool() ) {
- HideCrosshair();
- } else {
- ShowCrosshair();
- }
- */
- ThirdPersonView( pm_thirdPersonAngle.GetFloat(), (camera_zoom.GetCurrentValue( gameLocal.time )), pm_thirdPersonHeight.GetFloat(), true, false, IsInVehicle() );
- } else if ( ( pfl.dead || atl.vehicleDeath ) && pm_thirdPersonDeath.GetBool() ) {
- if ( !pfl.thirdpersonDeath ) {
- pfl.thirdpersonDeath = true;
- deathAngle = GetLimitRandomInt( 1, 1079 );
- deathRange = GetLimitRandomInt( 130, 750 );
- deathHeight = GetLimitRandomInt( 30, 140 );
- }
- //HideCrosshair();
- ThirdPersonView( deathAngle, deathRange, deathHeight, true, true, false );
- } else {
- //ShowCrosshair();
- renderView->vieworg = firstPersonViewOrigin;
- renderView->viewaxis = firstPersonViewAxis;
- renderView->viewID = entityNumber + 1;
- }
- // field of view
- gameLocal.CalcFov( CalcFov( IsZoomed() ), renderView->fov_x, renderView->fov_y );
- pfl.cameraIsSet = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement