From 822f0bd40b637839c4d8832a791e3a12f102b198 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 9 Jan 2021 12:11:52 +0100 Subject: cam sector fix --- src/core/Cam.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/core/Cam.cpp') diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 1d73a272..a11cd6a4 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -3829,11 +3829,11 @@ CCam::Process_Debug(const CVector&, float, float, float) } // stay inside sectors - while(CWorld::GetSectorX(Source.x) > 95.0f) + while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f) Source.x -= 1.0f; while(CWorld::GetSectorX(Source.x) < 5.0f) Source.x += 1.0f; - while(CWorld::GetSectorY(Source.y) > 95.0f) + while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f) Source.y -= 1.0f; while(CWorld::GetSectorY(Source.y) < 5.0f) Source.y += 1.0f; @@ -3900,11 +3900,11 @@ CCam::Process_Debug(const CVector&, float, float, float) } // stay inside sectors - while(CWorld::GetSectorX(Source.x) > 95.0f) + while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f) Source.x -= 1.0f; while(CWorld::GetSectorX(Source.x) < 5.0f) Source.x += 1.0f; - while(CWorld::GetSectorY(Source.y) > 95.0f) + while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f) Source.y -= 1.0f; while(CWorld::GetSectorY(Source.y) < 5.0f) Source.y += 1.0f; @@ -3981,11 +3981,11 @@ CCam::Process_Editor(const CVector&, float, float, float) } // stay inside sectors - while(CWorld::GetSectorX(Source.x) > 95.0f) + while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f) Source.x -= 1.0f; while(CWorld::GetSectorX(Source.x) < 5.0f) Source.x += 1.0f; - while(CWorld::GetSectorY(Source.y) > 95.0f) + while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f) Source.y -= 1.0f; while(CWorld::GetSectorY(Source.y) < 5.0f) Source.y += 1.0f; -- cgit v1.2.3 From ac0f759b274368b9424222a392d9f28b73980eb0 Mon Sep 17 00:00:00 2001 From: withmorten Date: Tue, 19 Jan 2021 13:35:48 +0100 Subject: make building with Codewarrior 7 possible --- src/core/Cam.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/Cam.cpp') diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index a11cd6a4..74de0ab7 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -946,7 +946,7 @@ CVector CCam::DoAverageOnVector(const CVector &vec) { int i; - CVector Average = { 0.0f, 0.0f, 0.0f }; + CVector Average(0.0f, 0.0f, 0.0f); if(ResetStatics){ m_iRunningVectorArrayPos = 0; -- cgit v1.2.3 From a511d79bf056a8ff65d4687822dcba6185d9c7ef Mon Sep 17 00:00:00 2001 From: withmorten Date: Thu, 21 Jan 2021 23:21:03 +0100 Subject: free cam fixes --- src/core/Cam.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/core/Cam.cpp') diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 74de0ab7..f43ff57a 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -193,7 +193,7 @@ CCam::Process(void) break; case MODE_CAM_ON_A_STRING: #ifdef FREE_CAM - if(CCamera::bFreeCam) + if(CCamera::bFreeCam && !CVehicle::bCheat5) Process_FollowCar_SA(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); else #endif @@ -5039,11 +5039,15 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, // Using GetCarGun(LR/UD) will give us same unprocessed RightStick value as SA 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. // if (CCamera::m_bUseMouse3rdPerson) // stickY = 0.0f; +#ifdef INVERT_LOOK_FOR_PAD + if (CPad::bInvertLook4Pad) + stickY = -stickY; +#endif float xMovement = Abs(stickX) * (FOV / 80.0f * 5.f / 70.f) * stickX * 0.007f * 0.007f; float yMovement = Abs(stickY) * (FOV / 80.0f * 3.f / 70.f) * stickY * 0.007f * 0.007f; -- cgit v1.2.3 From 0f623c23543166a67c7fd1881cc05995dd274bba Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Tue, 26 Jan 2021 19:35:40 +0200 Subject: Use original animation names from VCS --- src/core/Cam.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core/Cam.cpp') diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index f43ff57a..2a32ed1f 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -1644,10 +1644,10 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient if(CamTargetEntity->m_rwObject){ // what's going on here? - if(RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_WEAPON_PUMP) || - RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_WEAPON_THROW) || - RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_WEAPON_THROWU) || - RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_WEAPON_START_THROW)){ + if(RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_STD_WEAPON_PUMP) || + RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_STD_WEAPON_THROW) || + RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_STD_THROW_UNDER) || + RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_STD_START_THROW)){ CPed *player = FindPlayerPed(); float PlayerDist = (Source - player->GetPosition()).Magnitude(); if(PlayerDist < 2.75f) -- cgit v1.2.3 From 2bd8be587277af6a1239a19d0235888c85388f93 Mon Sep 17 00:00:00 2001 From: withmorten Date: Fri, 5 Feb 2021 12:08:14 +0100 Subject: Fix inverted vertical camera --- src/core/Cam.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/Cam.cpp') diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 2a32ed1f..e0497fe2 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -4631,7 +4631,7 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient */ { LookLeftRight = -CPad::GetPad(0)->LookAroundLeftRight(); - LookUpDown = -CPad::GetPad(0)->LookAroundUpDown(); + LookUpDown = CPad::GetPad(0)->LookAroundUpDown(); } float AlphaOffset, BetaOffset; if(UseMouse){ -- cgit v1.2.3 From a11bf19b9341a77ce57ba8bd00eb0bf5d2dcc7a8 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 27 May 2021 16:53:50 +0300 Subject: Fix sin & cos calls --- src/core/Cam.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/core/Cam.cpp') diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index e0497fe2..b6e4f967 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -4933,9 +4933,9 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, AlphaSpeed = 0.0; Distance = 1000.0; - Front.x = -(cos(Beta) * cos(Alpha)); - Front.y = -(sin(Beta) * cos(Alpha)); - Front.z = sin(Alpha); + Front.x = -(Cos(Beta) * Cos(Alpha)); + Front.y = -(Sin(Beta) * Cos(Alpha)); + Front.z = Sin(Alpha); m_aTargetHistoryPosOne = TargetCoors - nextDistance * Front; @@ -5210,9 +5210,9 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, lastBeta = Beta; - Front.x = -(cos(Beta) * cos(Alpha)); - Front.y = -(sin(Beta) * cos(Alpha)); - Front.z = sin(Alpha); + Front.x = -(Cos(Beta) * Cos(Alpha)); + Front.y = -(Sin(Beta) * Cos(Alpha)); + Front.z = Sin(Alpha); GetVectorsReadyForRW(); TheCamera.m_bCamDirectlyBehind = false; TheCamera.m_bCamDirectlyInFront = false; @@ -5222,9 +5222,9 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, m_cvecTargetCoorsForFudgeInter = TargetCoors; m_aTargetHistoryPosThree = m_aTargetHistoryPosOne; float nextAlpha = alphaWithSpeedAccounted + zoomModeAlphaOffset; - float nextFrontX = -(cos(Beta) * cos(nextAlpha)); - float nextFrontY = -(sin(Beta) * cos(nextAlpha)); - float nextFrontZ = sin(nextAlpha); + float nextFrontX = -(Cos(Beta) * Cos(nextAlpha)); + float nextFrontY = -(Sin(Beta) * Cos(nextAlpha)); + float nextFrontZ = Sin(nextAlpha); m_aTargetHistoryPosOne.x = TargetCoors.x - nextFrontX * nextDistance; m_aTargetHistoryPosOne.y = TargetCoors.y - nextFrontY * nextDistance; -- cgit v1.2.3 From cb3b3855b844c14c0e943c1a7614fc29820cf666 Mon Sep 17 00:00:00 2001 From: withmorten Date: Mon, 28 Jun 2021 13:31:35 +0200 Subject: rename clamp macro to Clamp to fix compilation with g++11 --- src/core/Cam.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core/Cam.cpp') diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index b6e4f967..ecfade74 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -3482,7 +3482,7 @@ FindSplinePathPositionFloat(float *out, float *spline, uint32 time, uint32 &mark } } float a = ((float)time - (float)MS(spline[marker-4])) / (float)MS(spline[marker] - spline[marker-4]); - a = clamp(a, 0.0f, 1.0f); + a = Clamp(a, 0.0f, 1.0f); float b = 1.0f - a; *out = b*b*b * spline[marker-3] + 3.0f*a*b*b * spline[marker-1] + @@ -3520,7 +3520,7 @@ FindSplinePathPositionVector(CVector *out, float *spline, uint32 time, uint32 &m } float a = ((float)time - (float)MS(spline[marker-10])) / (float)MS(spline[marker] - spline[marker-10]); - a = clamp(a, 0.0f, 1.0f); + a = Clamp(a, 0.0f, 1.0f); float b = 1.0f - a; out->x = b*b*b * spline[marker-9] + @@ -4899,7 +4899,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, // 0.98f: CAR_FOV_FADE_MULT FOV = Pow(0.98f, CTimer::GetTimeStep()) * (FOV - DefaultFOV) + DefaultFOV; - FOV = clamp(FOV, DefaultFOV, DefaultFOV + 30.0f); + FOV = Clamp(FOV, DefaultFOV, DefaultFOV + 30.0f); } // WORKAROUND: I still don't know how looking behind works (m_bCamDirectlyInFront is unused in III, they seem to use m_bUseTransitionBeta) @@ -5021,7 +5021,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, } } - float targetAlpha = Asin(clamp(Front.z, -1.0f, 1.0f)) - zoomModeAlphaOffset; + float targetAlpha = Asin(Clamp(Front.z, -1.0f, 1.0f)) - zoomModeAlphaOffset; if (targetAlpha <= maxAlphaAllowed) { if (targetAlpha < -CARCAM_SET[camSetArrPos][14]) targetAlpha = -CARCAM_SET[camSetArrPos][14]; -- cgit v1.2.3