some free cam fixes for controller

This commit is contained in:
withmorten 2021-01-18 17:25:31 +01:00
parent 4babb11e2f
commit df4e22e3d0
5 changed files with 36 additions and 3 deletions

View File

@ -5062,6 +5062,13 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
float stickX = -(pad->GetCarGunLeftRight());
float stickY = pad->GetCarGunUpDown();
// In SA this checks for m_bUseMouse3rdPerson so num2 / num8 do not move camera
// when Keyboard & Mouse controls are used. To make it work better with III/VC, check for actual pad state instead
if (!CPad::IsAffectedByController && !isCar)
stickY = 0.0f;
else if (CPad::bInvertLook4Pad)
stickY = -stickY;
if (CCamera::m_bUseMouse3rdPerson)
stickY = 0.0f;

View File

@ -1424,7 +1424,12 @@ CAutomobile::ProcessControl(void)
if (GetModelIndex() == MI_RCRAIDER || GetModelIndex() == MI_RCGOBLIN)
FlyingControl(FLIGHT_MODEL_RCHELI);
else if (m_nWheelsOnGround < 4 && !(GetModelIndex() == MI_SEASPAR && bTouchingWater) ||
CPad::GetPad(0)->GetAccelerate() != 0 || CPad::GetPad(0)->GetCarGunUpDown() > 1.0f ||
CPad::GetPad(0)->GetAccelerate() != 0 ||
#ifndef FREE_CAM
CPad::GetPad(0)->GetCarGunUpDown() > 1.0f ||
#else
((!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController)) && CPad::GetPad(0)->GetCarGunUpDown() > 1.0f) ||
#endif
Abs(m_vecMoveSpeed.x) > 0.02f ||
Abs(m_vecMoveSpeed.y) > 0.02f ||
Abs(m_vecMoveSpeed.z) > 0.02f)

View File

@ -1844,7 +1844,12 @@ CBike::ProcessControlInputs(uint8 pad)
m_fSteerInput = clamp(m_fSteerInput, -1.0f, 1.0f);
// Lean forward/backward
float updown = -CPad::GetPad(pad)->GetSteeringUpDown()/128.0f + CPad::GetPad(pad)->GetCarGunUpDown()/128.0f;
float updown;
#ifdef FREE_CAM
if (CCamera::bFreeCam) updown = CPad::IsAffectedByController ? -CPad::GetPad(pad)->GetSteeringUpDown()/128.0f : CPad::GetPad(pad)->GetCarGunUpDown()/128.0f;
else
#endif
updown = -CPad::GetPad(pad)->GetSteeringUpDown()/128.0f + CPad::GetPad(pad)->GetCarGunUpDown()/128.0f;
m_fLeanInput += (updown - m_fLeanInput)*0.2f*CTimer::GetTimeStep();
m_fLeanInput = clamp(m_fLeanInput, -1.0f, 1.0f);

View File

@ -964,7 +964,14 @@ CBoat::PreRender(void)
// FIX: Planes can also be controlled with GetCarGunUpDown
#ifdef FIX_BUGS
static float steeringUpDown = 0.0f;
steeringUpDown += ((Abs(CPad::GetPad(0)->GetCarGunUpDown()) > 1.0f ? (-CPad::GetPad(0)->GetCarGunUpDown() / 128.0f) : (-CPad::GetPad(0)->GetSteeringUpDown() / 128.0f)) - steeringUpDown) * Min(1.f, CTimer::GetTimeStep() / 5.f);
#ifdef FREE_CAM
if(!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController))
#endif
steeringUpDown += ((Abs(CPad::GetPad(0)->GetCarGunUpDown()) > 1.0f ? (-CPad::GetPad(0)->GetCarGunUpDown()/128.0f) : (-CPad::GetPad(0)->GetSteeringUpDown()/128.0f)) - steeringUpDown) * Min(1.f, CTimer::GetTimeStep()/5.f);
#ifdef FREE_CAM
else
steeringUpDown = -CPad::GetPad(0)->GetSteeringUpDown()/128.0f;
#endif
#else
float steeringUpDown = -CPad::GetPad(0)->GetSteeringUpDown()/128.0f;
#endif

View File

@ -334,6 +334,9 @@ CVehicle::FlyingControl(eFlightModel flightModel)
float fSteerLR = CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f;
float fSteerUD = -CPad::GetPad(0)->GetSteeringUpDown() / 128.0f;
float fGunUD = Abs(CPad::GetPad(0)->GetCarGunUpDown());
#ifdef FREE_CAM
if(!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController))
#endif
if(fGunUD > 1.0f)
fSteerUD = -CPad::GetPad(0)->GetCarGunUpDown() / 128.0f;
@ -507,9 +510,15 @@ CVehicle::FlyingControl(eFlightModel flightModel)
fYaw = CPad::GetPad(0)->GetLookRight();
if (CPad::GetPad(0)->GetLookLeft())
fYaw = -1.0f;
#ifdef FREE_CAM
if (!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController))
#endif
if(Abs(CPad::GetPad(0)->GetCarGunLeftRight()) > 1.0f)
fYaw = CPad::GetPad(0)->GetCarGunLeftRight() / 128.0f;
}
#ifdef FREE_CAM
if(!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController))
#endif
if(Abs(CPad::GetPad(0)->GetCarGunUpDown()) > 1.0f)
fPitch = -CPad::GetPad(0)->GetCarGunUpDown() / 128.0f;
if (CPad::GetPad(0)->GetHorn()) {