1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-22 23:20:00 +00:00

a few cam fixes

This commit is contained in:
aap 2020-06-13 23:39:24 +02:00
parent 39177cb3e3
commit 3fe282fbe4
3 changed files with 49 additions and 45 deletions

View file

@ -52,8 +52,8 @@ CCam::Init(void)
f_max_role_angle = DEGTORAD(5.0f);
Distance = 30.0f;
DistanceSpeed = 0.0f;
m_pLastCarEntered = 0;
m_pLastPedLookedAt = 0;
m_pLastCarEntered = nil;
m_pLastPedLookedAt = nil;
ResetStatics = true;
Beta = 0.0f;
m_bFixingBeta = false;
@ -1001,8 +1001,8 @@ CCam::GetPedBetaAngleForClearView(const CVector &Target, float Dist, float BetaO
return 0.0f;
}
static float DefaultAcceleration = 0.045f;
static float DefaultMaxStep = 0.15f;
float DefaultAcceleration = 0.045f;
float DefaultMaxStep = 0.15f;
void
CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, float, float)
@ -1473,14 +1473,14 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
ResetStatics = false;
}
static float fBaseDist = 1.7f;
static float fAngleDist = 2.0f;
static float fFalloff = 3.0f;
static float fStickSens = 0.01f;
static float fTweakFOV = 1.05f;
static float fTranslateCamUp = 0.8f;
static int16 nFadeControlThreshhold = 45;
static float fDefaultAlphaOrient = -0.22f;
float fBaseDist = 1.7f;
float fAngleDist = 2.0f;
float fFalloff = 3.0f;
float fStickSens = 0.01f;
float fTweakFOV = 1.05f;
float fTranslateCamUp = 0.8f;
int16 nFadeControlThreshhold = 45;
float fDefaultAlphaOrient = -0.22f;
void
CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrientation, float, float)
@ -1522,8 +1522,8 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
BetaOffset = LookLeftRight * TheCamera.m_fMouseAccelHorzntl * FOV/80.0f;
AlphaOffset = LookUpDown * TheCamera.m_fMouseAccelVertical * FOV/80.0f;
}else{
BetaOffset = LookLeftRight * fStickSens * (0.5f/7.0f) * FOV/80.0f * CTimer::GetTimeStep();
AlphaOffset = LookUpDown * fStickSens * (0.3f/7.0f) * FOV/80.0f * CTimer::GetTimeStep();
BetaOffset = LookLeftRight * fStickSens * (1.0f/14.0f) * FOV/80.0f * CTimer::GetTimeStep();
AlphaOffset = LookUpDown * fStickSens * (0.6f/14.0f) * FOV/80.0f * CTimer::GetTimeStep();
}
if(TheCamera.GetFading() && TheCamera.GetFadingDirection() == FADE_IN && nFadeControlThreshhold < CDraw::FadeValue ||
@ -1545,7 +1545,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(45.0f)) Alpha = DEGTORAD(45.0f);
if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors = CameraTarget;
TargetCoors.z += fTranslateCamUp;
@ -1583,7 +1583,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, true, true, true, true, false, false, true)){
float PedColDist = (TargetCoors - colPoint.point).Magnitude();
float ColCamDist = CamDist - PedColDist;
if(entity->IsPed() && ColCamDist > 1.0f){
if(entity->IsPed() && ColCamDist > DEFAULT_NEAR + 0.1f){
// Ped in the way but not clipping through
if(CWorld::ProcessLineOfSight(colPoint.point, Source, colPoint, entity, true, true, true, true, false, false, true)){
PedColDist = (TargetCoors - colPoint.point).Magnitude();
@ -1621,9 +1621,12 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
if(dist == 0.1f)
Source += (TargetCoors - Source)*0.3f;
Near = RwCameraGetNearClipPlane(Scene.camera);
#ifndef FIX_BUGS
// this is totally wrong...
radius = Tan(FOV / 2.0f) * Near;
#else
radius = ViewPlaneWidth*Near;
#endif
// Keep testing
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);
@ -2693,7 +2696,7 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x;
TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y;
@ -2740,7 +2743,7 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(CamTargetEntity->GetModelIndex());
CVector CamPos = mi->GetFrontSeatPosn();
CamPos.x = 0.0f;
CamPos.y += -0.08f;
CamPos.y += 0.08f;
CamPos.z += 0.62f;
FOV = 60.0f;
Source = Multiply3x3(CamTargetEntity->GetMatrix(), CamPos);
@ -4581,8 +4584,8 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
BetaOffset = LookLeftRight * TheCamera.m_fMouseAccelHorzntl * FOV/80.0f;
AlphaOffset = LookUpDown * TheCamera.m_fMouseAccelVertical * FOV/80.0f;
}else{
BetaOffset = LookLeftRight * fStickSens * (0.5f/10.0f) * FOV/80.0f * CTimer::GetTimeStep();
AlphaOffset = LookUpDown * fStickSens * (0.3f/10.0f) * FOV/80.0f * CTimer::GetTimeStep();
BetaOffset = LookLeftRight * fStickSens * (1.0f/20.0f) * FOV/80.0f * CTimer::GetTimeStep();
AlphaOffset = LookUpDown * fStickSens * (0.6f/20.0f) * FOV/80.0f * CTimer::GetTimeStep();
}
// Stop centering once stick has been touched
@ -4654,7 +4657,7 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, true, true, true, true, false, false, true)){
float PedColDist = (TargetCoors - colPoint.point).Magnitude();
float ColCamDist = CamDist - PedColDist;
if(entity->IsPed() && ColCamDist > 1.0f){
if(entity->IsPed() && ColCamDist > DEFAULT_NEAR + 0.1f){
// Ped in the way but not clipping through
if(CWorld::ProcessLineOfSight(colPoint.point, Source, colPoint, entity, true, true, true, true, false, false, true)){
PedColDist = (TargetCoors - colPoint.point).Magnitude();
@ -4693,6 +4696,8 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
Source += (TargetCoors - Source)*0.3f;
// Keep testing
Near = RwCameraGetNearClipPlane(Scene.camera);
radius = ViewPlaneWidth*Near;
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);
i++;

View file

@ -129,8 +129,8 @@ CCamera::Init(void)
Cams[1].m_fPlayerVelocity = 0.0f;
Cams[2].m_fPlayerVelocity = 0.0f;
m_bHeadBob = false;
m_fFractionInterToStopMovingTarget = 0.25f;
m_fFractionInterToStopCatchUpTarget = 0.75f;
m_fFractionInterToStopMoving = 0.25f;
m_fFractionInterToStopCatchUp = 0.75f;
m_fGaitSwayBuffer = 0.85f;
m_bScriptParametersSetForInterPol = false;
m_uiCamShakeStart = 0;
@ -329,12 +329,12 @@ CCamera::Process(void)
currentTime = m_uiTransitionDuration;
float fractionInter = (float) currentTime / m_uiTransitionDuration;
if(fractionInter <= m_fFractionInterToStopMovingTarget){
if(fractionInter <= m_fFractionInterToStopMoving){
float inter;
if(m_fFractionInterToStopMovingTarget == 0.0f)
if(m_fFractionInterToStopMoving == 0.0f)
inter = 0.0f;
else
inter = (m_fFractionInterToStopMovingTarget - fractionInter)/m_fFractionInterToStopMovingTarget;
inter = (m_fFractionInterToStopMoving - fractionInter)/m_fFractionInterToStopMoving;
inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
m_vecSourceWhenInterPol = m_cvecStartingSourceForInterPol + inter*m_cvecSourceSpeedAtStartInter;
@ -388,12 +388,12 @@ CCamera::Process(void)
}
CamUp.Normalise();
FOV = m_fFOVWhenInterPol;
}else if(fractionInter > m_fFractionInterToStopMovingTarget && fractionInter <= 1.0f){
}else if(fractionInter > m_fFractionInterToStopMoving && fractionInter <= 1.0f){
float inter;
if(m_fFractionInterToStopCatchUpTarget == 0.0f)
if(m_fFractionInterToStopCatchUp == 0.0f)
inter = 0.0f;
else
inter = (fractionInter - m_fFractionInterToStopMovingTarget)/m_fFractionInterToStopCatchUpTarget;
inter = (fractionInter - m_fFractionInterToStopMoving)/m_fFractionInterToStopCatchUp;
inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
CamSource = m_vecSourceWhenInterPol + inter*(Cams[ActiveCam].Source - m_vecSourceWhenInterPol);
@ -1846,10 +1846,9 @@ CCamera::SetCamPositionForFixedMode(const CVector &Source, const CVector &UpOffS
void
CCamera::StartTransition(int16 newMode)
{
bool foo = false;
bool switchSyphonMode = false;
bool switchPedToCar = false;
bool switchPedMode = false;
bool switchFromFight = false;
bool switchFromFixed = false;
bool switch1stPersonToVehicle = false;
float betaOffset, targetBeta, camBeta, deltaBeta;
@ -1858,8 +1857,8 @@ CCamera::StartTransition(int16 newMode)
// missing on PS2
m_bItsOkToLookJustAtThePlayer = false;
m_fFractionInterToStopMovingTarget = 0.25f;
m_fFractionInterToStopCatchUpTarget = 0.75f;
m_fFractionInterToStopMoving = 0.25f;
m_fFractionInterToStopCatchUp = 0.75f;
if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT ||
Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED ||
@ -1878,7 +1877,7 @@ CCamera::StartTransition(int16 newMode)
if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT && newMode == CCam::MODE_SYPHON)
switchSyphonMode = true;
if(Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM && newMode == CCam::MODE_FOLLOWPED)
switchPedMode = true;
switchFromFight = true;
if(Cams[ActiveCam].Mode == CCam::MODE_FIXED)
switchFromFixed = true;
@ -2097,19 +2096,19 @@ CCamera::StartTransition(int16 newMode)
m_uiTransitionDuration = 1350;
if(switchSyphonMode)
m_uiTransitionDuration = 1800;
else if(switchPedMode)
else if(switchFromFight)
m_uiTransitionDuration = 750;
// not on PS2
else if(switchPedToCar){
m_fFractionInterToStopMovingTarget = 0.2f;
m_fFractionInterToStopCatchUpTarget = 0.8f;
m_fFractionInterToStopMoving = 0.2f;
m_fFractionInterToStopCatchUp = 0.8f;
m_uiTransitionDuration = 950;
}else if(switchFromFixed){
m_fFractionInterToStopMovingTarget = 0.05f;
m_fFractionInterToStopCatchUpTarget = 0.95f;
m_fFractionInterToStopMoving = 0.05f;
m_fFractionInterToStopCatchUp = 0.95f;
}else if(switch1stPersonToVehicle){
m_fFractionInterToStopMovingTarget = 0.0f;
m_fFractionInterToStopCatchUpTarget = 1.0f;
m_fFractionInterToStopMoving = 0.0f;
m_fFractionInterToStopCatchUp = 1.0f;
m_uiTransitionDuration = 1;
}else
m_uiTransitionDuration = 1350; // already set above
@ -2149,8 +2148,8 @@ CCamera::StartTransition(int16 newMode)
m_fFOVSpeedAtStartInter = Cams[ActiveCam].m_fFovSpeedOverOneFrame;
Cams[ActiveCam].ResetStatics = true;
if(!m_bLookingAtPlayer && m_bScriptParametersSetForInterPol){
m_fFractionInterToStopMovingTarget = m_fScriptPercentageInterToStopMoving;
m_fFractionInterToStopCatchUpTarget = m_fScriptPercentageInterToCatchUp;
m_fFractionInterToStopMoving = m_fScriptPercentageInterToStopMoving;
m_fFractionInterToStopCatchUp = m_fScriptPercentageInterToCatchUp;
m_uiTransitionDuration = m_fScriptTimeForInterPolation;
}
}

View file

@ -524,8 +524,8 @@ public:
float m_fFLOATingFadeMusic;
float m_fTimeToFadeOut;
float m_fTimeToFadeMusic;
float m_fFractionInterToStopMovingTarget;
float m_fFractionInterToStopCatchUpTarget;
float m_fFractionInterToStopMoving;
float m_fFractionInterToStopCatchUp;
float m_fGaitSwayBuffer;
float m_fScriptPercentageInterToStopMoving;
float m_fScriptPercentageInterToCatchUp;