|
|
@ -4878,6 +4878,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float nextDistance = Max(newDistance, minDistForVehType);
|
|
|
|
float nextDistance = Max(newDistance, minDistForVehType);
|
|
|
|
|
|
|
|
static float frameTime = CTimer::GetTimeStepFix();
|
|
|
|
|
|
|
|
|
|
|
|
CA_MAX_DISTANCE = newDistance;
|
|
|
|
CA_MAX_DISTANCE = newDistance;
|
|
|
|
CA_MIN_DISTANCE = 3.5f;
|
|
|
|
CA_MIN_DISTANCE = 3.5f;
|
|
|
@ -4892,12 +4893,12 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|
|
|
if (isCar || isBike) {
|
|
|
|
if (isCar || isBike) {
|
|
|
|
// 0.4f: CAR_FOV_START_SPEED
|
|
|
|
// 0.4f: CAR_FOV_START_SPEED
|
|
|
|
if (DotProduct(car->GetForward(), car->m_vecMoveSpeed) > 0.4f)
|
|
|
|
if (DotProduct(car->GetForward(), car->m_vecMoveSpeed) > 0.4f)
|
|
|
|
FOV += (DotProduct(car->GetForward(), car->m_vecMoveSpeed) - 0.4f) * CTimer::GetTimeStep();
|
|
|
|
FOV += (DotProduct(car->GetForward(), car->m_vecMoveSpeed) - 0.4f) * (CTimer::GetTimeStep() / frameTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (FOV > DefaultFOV)
|
|
|
|
if (FOV > DefaultFOV)
|
|
|
|
// 0.98f: CAR_FOV_FADE_MULT
|
|
|
|
// 0.98f: CAR_FOV_FADE_MULT
|
|
|
|
FOV = Pow(0.98f, CTimer::GetTimeStep()) * (FOV - DefaultFOV) + DefaultFOV;
|
|
|
|
FOV = Pow(0.98f, CTimer::GetTimeStep() / frameTime) * (FOV - DefaultFOV) + DefaultFOV;
|
|
|
|
|
|
|
|
|
|
|
|
FOV = Clamp(FOV, DefaultFOV, DefaultFOV + 30.0f);
|
|
|
|
FOV = Clamp(FOV, DefaultFOV, DefaultFOV + 30.0f);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4965,8 +4966,8 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|
|
|
else if (velocityRightHeading > camRightHeading + PI)
|
|
|
|
else if (velocityRightHeading > camRightHeading + PI)
|
|
|
|
velocityRightHeading = velocityRightHeading - TWOPI;
|
|
|
|
velocityRightHeading = velocityRightHeading - TWOPI;
|
|
|
|
|
|
|
|
|
|
|
|
float betaChangeMult1 = CTimer::GetTimeStep() * CARCAM_SET[camSetArrPos][10];
|
|
|
|
float betaChangeMult1 = (CTimer::GetTimeStep() / frameTime) * CARCAM_SET[camSetArrPos][10];
|
|
|
|
float betaChangeLimit = CTimer::GetTimeStep() * CARCAM_SET[camSetArrPos][11];
|
|
|
|
float betaChangeLimit = (CTimer::GetTimeStep() / frameTime) * CARCAM_SET[camSetArrPos][11];
|
|
|
|
|
|
|
|
|
|
|
|
float betaChangeMult2 = (car->m_vecMoveSpeed - DotProduct(car->m_vecMoveSpeed, Front) * Front).Magnitude();
|
|
|
|
float betaChangeMult2 = (car->m_vecMoveSpeed - DotProduct(car->m_vecMoveSpeed, Front) * Front).Magnitude();
|
|
|
|
|
|
|
|
|
|
|
@ -5028,8 +5029,8 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
targetAlpha = maxAlphaAllowed;
|
|
|
|
targetAlpha = maxAlphaAllowed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
float maxAlphaBlendAmount = CTimer::GetTimeStep() * CARCAM_SET[camSetArrPos][6];
|
|
|
|
float maxAlphaBlendAmount = (CTimer::GetTimeStep() / frameTime) * CARCAM_SET[camSetArrPos][6];
|
|
|
|
float targetAlphaBlendAmount = (1.0f - Pow(CARCAM_SET[camSetArrPos][5], CTimer::GetTimeStep())) * (targetAlpha - Alpha);
|
|
|
|
float targetAlphaBlendAmount = (1.0f - Pow(CARCAM_SET[camSetArrPos][5], (CTimer::GetTimeStep() / frameTime))) * (targetAlpha - Alpha);
|
|
|
|
if (targetAlphaBlendAmount <= maxAlphaBlendAmount) {
|
|
|
|
if (targetAlphaBlendAmount <= maxAlphaBlendAmount) {
|
|
|
|
if (targetAlphaBlendAmount < -maxAlphaBlendAmount)
|
|
|
|
if (targetAlphaBlendAmount < -maxAlphaBlendAmount)
|
|
|
|
targetAlphaBlendAmount = -maxAlphaBlendAmount;
|
|
|
|
targetAlphaBlendAmount = -maxAlphaBlendAmount;
|
|
|
@ -5038,7 +5039,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Using GetCarGun(LR/UD) will give us same unprocessed RightStick value as SA
|
|
|
|
// Using GetCarGun(LR/UD) will give us same unprocessed RightStick value as SA
|
|
|
|
float stickX = -(pad->GetCarGunLeftRight());
|
|
|
|
float stickX = -pad->GetCarGunLeftRight();
|
|
|
|
float stickY = -pad->GetCarGunUpDown();
|
|
|
|
float stickY = -pad->GetCarGunUpDown();
|
|
|
|
|
|
|
|
|
|
|
|
// In SA this is for not let num2/num8 move camera when Keyboard & Mouse controls are used.
|
|
|
|
// In SA this is for not let num2/num8 move camera when Keyboard & Mouse controls are used.
|
|
|
@ -5125,7 +5126,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|
|
|
float betaSpeedFromStickX = xMovement * CARCAM_SET[camSetArrPos][12];
|
|
|
|
float betaSpeedFromStickX = xMovement * CARCAM_SET[camSetArrPos][12];
|
|
|
|
|
|
|
|
|
|
|
|
float newAngleSpeedMaxBlendAmount = CARCAM_SET[camSetArrPos][9];
|
|
|
|
float newAngleSpeedMaxBlendAmount = CARCAM_SET[camSetArrPos][9];
|
|
|
|
float angleChangeStep = Pow(CARCAM_SET[camSetArrPos][8], CTimer::GetTimeStep());
|
|
|
|
float angleChangeStep = Pow(CARCAM_SET[camSetArrPos][8], frameTime);
|
|
|
|
float targetBetaWithStickBlendAmount = betaSpeedFromStickX + (targetBeta - Beta) / Max(CTimer::GetTimeStep(), 1.0f);
|
|
|
|
float targetBetaWithStickBlendAmount = betaSpeedFromStickX + (targetBeta - Beta) / Max(CTimer::GetTimeStep(), 1.0f);
|
|
|
|
|
|
|
|
|
|
|
|
if (targetBetaWithStickBlendAmount < -newAngleSpeedMaxBlendAmount)
|
|
|
|
if (targetBetaWithStickBlendAmount < -newAngleSpeedMaxBlendAmount)
|
|
|
@ -5135,7 +5136,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|
|
|
|
|
|
|
|
|
|
|
float angleChangeStepLeft = 1.0f - angleChangeStep;
|
|
|
|
float angleChangeStepLeft = 1.0f - angleChangeStep;
|
|
|
|
BetaSpeed = targetBetaWithStickBlendAmount * angleChangeStepLeft + angleChangeStep * BetaSpeed;
|
|
|
|
BetaSpeed = targetBetaWithStickBlendAmount * angleChangeStepLeft + angleChangeStep * BetaSpeed;
|
|
|
|
if (Abs(BetaSpeed) < 0.0001f)
|
|
|
|
if (Abs(BetaSpeed) < 0.0001f * frameTime)
|
|
|
|
BetaSpeed = 0.0f;
|
|
|
|
BetaSpeed = 0.0f;
|
|
|
|
|
|
|
|
|
|
|
|
float betaChangePerFrame;
|
|
|
|
float betaChangePerFrame;
|
|
|
@ -5176,7 +5177,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|
|
|
AlphaSpeed = maxAlphaSpeed;
|
|
|
|
AlphaSpeed = maxAlphaSpeed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (Abs(AlphaSpeed) < 0.0001f)
|
|
|
|
if (Abs(AlphaSpeed) < 0.0001f * frameTime)
|
|
|
|
AlphaSpeed = 0.0f;
|
|
|
|
AlphaSpeed = 0.0f;
|
|
|
|
|
|
|
|
|
|
|
|
float alphaWithSpeedAccounted;
|
|
|
|
float alphaWithSpeedAccounted;
|
|
|
@ -5200,12 +5201,12 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Prevent unsignificant angle changes
|
|
|
|
// Prevent unsignificant angle changes
|
|
|
|
if (Abs(lastAlpha - Alpha) < 0.0001f)
|
|
|
|
if (Abs(lastAlpha - Alpha) < 0.0001f * frameTime)
|
|
|
|
Alpha = lastAlpha;
|
|
|
|
Alpha = lastAlpha;
|
|
|
|
|
|
|
|
|
|
|
|
lastAlpha = Alpha;
|
|
|
|
lastAlpha = Alpha;
|
|
|
|
|
|
|
|
|
|
|
|
if (Abs(lastBeta - Beta) < 0.0001f)
|
|
|
|
if (Abs(lastBeta - Beta) < 0.0001f * frameTime)
|
|
|
|
Beta = lastBeta;
|
|
|
|
Beta = lastBeta;
|
|
|
|
|
|
|
|
|
|
|
|
lastBeta = Beta;
|
|
|
|
lastBeta = Beta;
|
|
|
|