diff options
author | aap <aap@papnet.eu> | 2019-07-10 17:18:26 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2019-07-10 17:18:26 +0200 |
commit | 4a36d64f15f898854bb8a76be86ac9a8c536b291 (patch) | |
tree | 2ff1344fb2f1e9859ba15cd56c461d40683359f9 /src/core/Camera.cpp | |
parent | Merge pull request #128 from erorcun/erorcun (diff) | |
download | re3-4a36d64f15f898854bb8a76be86ac9a8c536b291.tar re3-4a36d64f15f898854bb8a76be86ac9a8c536b291.tar.gz re3-4a36d64f15f898854bb8a76be86ac9a8c536b291.tar.bz2 re3-4a36d64f15f898854bb8a76be86ac9a8c536b291.tar.lz re3-4a36d64f15f898854bb8a76be86ac9a8c536b291.tar.xz re3-4a36d64f15f898854bb8a76be86ac9a8c536b291.tar.zst re3-4a36d64f15f898854bb8a76be86ac9a8c536b291.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/Camera.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 4f565897..4e988c15 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -170,9 +170,9 @@ WellBufferMe(float Target, float *CurrentValue, float *CurrentSpeed, float MaxSp float TargetSpeed = Delta * MaxSpeed; // Add or subtract absolute depending on sign, genius! // if(TargetSpeed - *CurrentSpeed > 0.0f) -// *CurrentSpeed += Acceleration * fabs(TargetSpeed - *CurrentSpeed) * CTimer::GetTimeStep(); +// *CurrentSpeed += Acceleration * Abs(TargetSpeed - *CurrentSpeed) * CTimer::GetTimeStep(); // else -// *CurrentSpeed -= Acceleration * fabs(TargetSpeed - *CurrentSpeed) * CTimer::GetTimeStep(); +// *CurrentSpeed -= Acceleration * Abs(TargetSpeed - *CurrentSpeed) * CTimer::GetTimeStep(); // this is simpler: *CurrentSpeed += Acceleration * (TargetSpeed - *CurrentSpeed) * CTimer::GetTimeStep(); @@ -249,14 +249,14 @@ CCam::GetPedBetaAngleForClearView(const CVector &Target, float Dist, float BetaO for(a = 0.0f; a <= PI; a += DEGTORAD(5.0f)){ if(BetaOffset <= 0.0f){ - ToSource = CVector(cos(Beta + BetaOffset + a), sin(Beta + BetaOffset + a), 0.0f)*Dist; + ToSource = CVector(Cos(Beta + BetaOffset + a), Sin(Beta + BetaOffset + a), 0.0f)*Dist; if(!CWorld::ProcessLineOfSight(Target, Target + ToSource, point, ent, checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, true, true)) return a; } if(BetaOffset >= 0.0f){ - ToSource = CVector(cos(Beta + BetaOffset - a), sin(Beta + BetaOffset - a), 0.0f)*Dist; + ToSource = CVector(Cos(Beta + BetaOffset - a), Sin(Beta + BetaOffset - a), 0.0f)*Dist; if(!CWorld::ProcessLineOfSight(Target, Target + ToSource, point, ent, checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, true, true)) @@ -500,7 +500,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl CVector PlayerPos = FindPlayerPed()->GetPosition(); float RotationDist = (AngleToGoTo == Center ? CenterDist : LateralDist) * RealGroundDist; // What's going on here? - AngleToGoTo? - CVector RotatedSource = PlayerPos + CVector(cos(Beta - AngleToGoTo), sin(Beta - AngleToGoTo), 0.0f) * RotationDist; + CVector RotatedSource = PlayerPos + CVector(Cos(Beta - AngleToGoTo), Sin(Beta - AngleToGoTo), 0.0f) * RotationDist; CColPoint colpoint; CEntity *entity; @@ -584,9 +584,9 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl float ReqSpeed = DeltaBeta * MaxSpeed; // Add or subtract absolute depending on sign, genius! if(ReqSpeed - BetaSpeed > 0.0f) - BetaSpeed += SpeedStep * fabs(ReqSpeed - BetaSpeed) * CTimer::GetTimeStep(); + BetaSpeed += SpeedStep * Abs(ReqSpeed - BetaSpeed) * CTimer::GetTimeStep(); else - BetaSpeed -= SpeedStep * fabs(ReqSpeed - BetaSpeed) * CTimer::GetTimeStep(); + BetaSpeed -= SpeedStep * Abs(ReqSpeed - BetaSpeed) * CTimer::GetTimeStep(); // this would be simpler: // BetaSpeed += SpeedStep * (ReqSpeed - BetaSpeed) * CTimer::ms_fTimeStep; @@ -604,14 +604,14 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl BetaSpeed = 0.0f; } - Source.x = TargetCoors.x + Distance * cos(Beta); - Source.y = TargetCoors.y + Distance * sin(Beta); + Source.x = TargetCoors.x + Distance * Cos(Beta); + Source.y = TargetCoors.y + Distance * Sin(Beta); // Check if we can stop rotating DeltaBeta = FixedTargetOrientation - Beta; while(DeltaBeta >= PI) DeltaBeta -= 2*PI; while(DeltaBeta < -PI) DeltaBeta += 2*PI; - if(fabs(DeltaBeta) < DEGTORAD(1.0f) && !bBehindPlayerDesired){ + if(Abs(DeltaBeta) < DEGTORAD(1.0f) && !bBehindPlayerDesired){ // Stop rotation PickedASide = false; Rotating = false; @@ -624,18 +624,18 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl HackPlayerOnStoppingTrain || Rotating){ if(TheCamera.m_bCamDirectlyBehind){ Beta = TargetOrientation + PI; - Source.x = TargetCoors.x + Distance * cos(Beta); - Source.y = TargetCoors.y + Distance * sin(Beta); + Source.x = TargetCoors.x + Distance * Cos(Beta); + Source.y = TargetCoors.y + Distance * Sin(Beta); } if(TheCamera.m_bCamDirectlyInFront){ Beta = TargetOrientation; - Source.x = TargetCoors.x + Distance * cos(Beta); - Source.y = TargetCoors.y + Distance * sin(Beta); + Source.x = TargetCoors.x + Distance * Cos(Beta); + Source.y = TargetCoors.y + Distance * Sin(Beta); } if(HackPlayerOnStoppingTrain){ Beta = TargetOrientation + PI; - Source.x = TargetCoors.x + Distance * cos(Beta); - Source.y = TargetCoors.y + Distance * sin(Beta); + Source.x = TargetCoors.x + Distance * Cos(Beta); + Source.y = TargetCoors.y + Distance * Sin(Beta); m_fDimensionOfHighestNearCar = 0.0f; m_fCamBufferedHeight = 0.0f; m_fCamBufferedHeightSpeed = 0.0f; @@ -904,7 +904,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa while(deltaBeta >= PI) deltaBeta -= 2*PI; while(deltaBeta < -PI) deltaBeta += 2*PI; - float BehindCarNess = cos(deltaBeta); // 1 if behind car, 0 if side, -1 if in front + float BehindCarNess = Cos(deltaBeta); // 1 if behind car, 0 if side, -1 if in front CarAlpha = -CarAlpha * BehindCarNess; if(CarAlpha < -0.01f) CarAlpha = -0.01f; @@ -939,8 +939,8 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa Forward = CamTargetEntity->GetForward(); // we actually still have that... Forward.Normalise(); // shouldn't be necessary float CarSideAngle = CGeneral::GetATanOfXY(Forward.x, Forward.y) + PI/2.0f; - float SideX = 2.5f * cos(CarSideAngle); - float SideY = 2.5f * sin(CarSideAngle); + float SideX = 2.5f * Cos(CarSideAngle); + float SideY = 2.5f * Sin(CarSideAngle); CWorld::FindRoofZFor3DCoord(TargetCoors.x + SideX, TargetCoors.y + SideY, CarBottom, &FoundRoofSide1); CWorld::FindRoofZFor3DCoord(TargetCoors.x - SideX, TargetCoors.y - SideY, CarBottom, &FoundRoofSide2); @@ -1042,7 +1042,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa WellBufferMe(LastTargetAlphaWithCollisionOn, &Alpha, &AlphaSpeed, LastTopAlphaSpeed, LastAlphaSpeedStep, true); - Source.z = TargetCoors.z + sin(Alpha + ModeAlpha)*Length + m_fCloseInCarHeightOffset; + Source.z = TargetCoors.z + Sin(Alpha + ModeAlpha)*Length + m_fCloseInCarHeightOffset; } // Rotate cam behind the car when the car is moving forward @@ -1062,7 +1062,7 @@ CCam::RotCamIfInFrontCar(CVector &TargetCoors, float TargetOrientation) while(DeltaBeta >= PI) DeltaBeta -= 2*PI; while(DeltaBeta < -PI) DeltaBeta += 2*PI; - if(fabs(DeltaBeta) > DEGTORAD(20.0f) && MovingForward && TheCamera.m_uiTransitionState == 0) + if(Abs(DeltaBeta) > DEGTORAD(20.0f) && MovingForward && TheCamera.m_uiTransitionState == 0) m_bFixingBeta = true; CPad *pad = CPad::GetPad(0); @@ -1088,14 +1088,14 @@ CCam::RotCamIfInFrontCar(CVector &TargetCoors, float TargetOrientation) if(TheCamera.m_bUseTransitionBeta && &TheCamera.Cams[TheCamera.ActiveCam] == this) Beta = m_fTransitionBeta; - Source.x = TargetCoors.x - cos(Beta)*Dist; - Source.y = TargetCoors.y - sin(Beta)*Dist; + Source.x = TargetCoors.x - Cos(Beta)*Dist; + Source.y = TargetCoors.y - Sin(Beta)*Dist; // Check if we're done DeltaBeta = TargetOrientation - Beta; while(DeltaBeta >= PI) DeltaBeta -= 2*PI; while(DeltaBeta < -PI) DeltaBeta += 2*PI; - if(fabs(DeltaBeta) < DEGTORAD(2.0f)) + if(Abs(DeltaBeta) < DEGTORAD(2.0f)) m_bFixingBeta = false; } TheCamera.m_bCamDirectlyBehind = false; @@ -1157,14 +1157,14 @@ CCam::FixCamIfObscured(CVector &TargetCoors, float TargetHeight, float TargetOri return false; if(Fix1){ - Source.x = Target.x - cos(Beta)*Dist1; - Source.y = Target.y - sin(Beta)*Dist1; + Source.x = Target.x - Cos(Beta)*Dist1; + Source.y = Target.y - Sin(Beta)*Dist1; if(Mode == MODE_BEHINDCAR) Source = colPoint.point; }else{ WellBufferMe(Dist2, &m_fDistanceBeforeChanges, &DistanceSpeed, 0.2f, 0.025f, false); - Source.x = Target.x - cos(Beta)*m_fDistanceBeforeChanges; - Source.y = Target.y - sin(Beta)*m_fDistanceBeforeChanges; + Source.x = Target.x - Cos(Beta)*m_fDistanceBeforeChanges; + Source.y = Target.y - Sin(Beta)*m_fDistanceBeforeChanges; } if(ResetStatics){ |