From 586e8a2ab4da35529b19eb3a3c1db05d3469317c Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 21 Jun 2020 11:03:20 +0200 Subject: tried to reconstruct bills cam --- src/core/Cam.cpp | 42 +++++++++++++++++++++++++++++++++++++++--- src/core/Camera.h | 2 +- src/core/Pad.h | 1 + 3 files changed, 41 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 69672272..6ce3bcb9 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -167,7 +167,9 @@ CCam::Process(void) case MODE_MODELVIEW: Process_ModelView(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); break; -// case MODE_BILL: + case MODE_BILL: + Process_Bill(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); + break; case MODE_SYPHON: Process_Syphon(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); break; @@ -1665,6 +1667,8 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient } } +float fBillsBetaOffset; // made up name, actually in CCam + void CCam::Process_BehindCar(const CVector &CameraTarget, float TargetOrientation, float, float) { @@ -1684,6 +1688,15 @@ CCam::Process_BehindCar(const CVector &CameraTarget, float TargetOrientation, fl if(Length < 0.002f) Length = 0.002f; Beta = CGeneral::GetATanOfXY(TargetCoors.x - Source.x, TargetCoors.y - Source.y); +#ifdef TOGGLEABLE_BETA_FEATURES + // This is completely made up but Bill's cam manipulates an angle before calling this + // and otherwise calculating Beta doesn't make much sense. + Beta += fBillsBetaOffset; + fBillsBetaOffset = 0.0f; + Dist.x = -Length*Cos(Beta); + Dist.y = -Length*Sin(Beta); + Source = TargetCoors + Dist; +#endif if(Length > CA_MAX_DISTANCE){ Source.x = TargetCoors.x + Dist.x/Length * CA_MAX_DISTANCE; Source.y = TargetCoors.y + Dist.y/Length * CA_MAX_DISTANCE; @@ -1773,8 +1786,13 @@ CCam::WorkOutCamHeightWeeCar(CVector &TargetCoors, float TargetOrientation) else WellBufferMe(TargetZOffSet, &RoadHeightFix, &RoadHeightFixSpeed, 0.27f, 0.1f, false); - if((colpoint.surfaceB == SURFACE_DEFAULT || colpoint.surfaceB >= SURFACE_CAR) && - colpoint.surfaceB != SURFACE_THICK_METAL_PLATE && colpoint.surfaceB != SURFACE_STEEP_CLIFF && + if(colpoint.surfaceB != SURFACE_TARMAC && + colpoint.surfaceB != SURFACE_GRASS && + colpoint.surfaceB != SURFACE_GRAVEL && + colpoint.surfaceB != SURFACE_MUD_DRY && + colpoint.surfaceB != SURFACE_PAVEMENT && + colpoint.surfaceB != SURFACE_THICK_METAL_PLATE && + colpoint.surfaceB != SURFACE_STEEP_CLIFF && RoadHeightFix > 1.4f) RoadHeightFix = 1.4f; @@ -4421,6 +4439,24 @@ CCam::Process_FollowPed_WithBinding(const CVector &CameraTarget, float TargetOri GetVectorsReadyForRW(); } +void +CCam::Process_Bill(const CVector &CameraTarget, float TargetOrientation, float SpeedVar, float TargetSpeedVar) +{ +#ifdef FIX_BUGS + fBillsBetaOffset += CPad::GetPad(0)->GetRightStickX()/1000.0f; +#else + // just wtf is this? this code must be ancient + if(CPad::GetPad(0)->GetStart()) + fBillsBetaOffset += CPad::GetPad(0)->GetLeftStickX()/1000.0f; +#endif + while(fBillsBetaOffset > TWOPI) fBillsBetaOffset -= TWOPI; + while(fBillsBetaOffset < 0.0f) fBillsBetaOffset += TWOPI; + TargetOrientation += fBillsBetaOffset; + while(TargetOrientation > TWOPI) TargetOrientation -= TWOPI; + while(TargetOrientation < 0.0f) TargetOrientation += TWOPI; + Process_BehindCar(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); +} + void CCam::Process_Im_The_Passenger_Woo_Woo(const CVector &CameraTarget, float TargetOrientation, float, float) { diff --git a/src/core/Camera.h b/src/core/Camera.h index f370bb98..d4e01a8e 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -249,7 +249,7 @@ public: // CCam::Process_Look_At_Cars // CCam::Process_CheesyZoom // CCam::Process_Aiming - // CCam::Process_Bill // same as BehindCar due to unused variables + void Process_Bill(const CVector &CameraTarget, float TargetOrientation, float SpeedVar, float TargetSpeedVar); void Process_Im_The_Passenger_Woo_Woo(const CVector &CameraTarget, float TargetOrientation, float, float); void Process_Blood_On_The_Tracks(const CVector &CameraTarget, float TargetOrientation, float, float); void Process_Cam_Running_Side_Train(const CVector &CameraTarget, float TargetOrientation, float, float); diff --git a/src/core/Pad.h b/src/core/Pad.h index ea771f81..1f29aa60 100644 --- a/src/core/Pad.h +++ b/src/core/Pad.h @@ -444,6 +444,7 @@ public: bool GetLeftShoulder2(void) { return !!NewState.LeftShoulder2; } bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; } bool GetRightShoulder2(void) { return !!NewState.RightShoulder2; } + bool GetStart() { return !!NewState.Start; } int16 GetLeftStickX(void) { return NewState.LeftStickX; } int16 GetLeftStickY(void) { return NewState.LeftStickY; } int16 GetRightStickX(void) { return NewState.RightStickX; } -- cgit v1.2.3