PS2 cam transition mostly working
This commit is contained in:
parent
5ad739f096
commit
e1c58131c4
@ -3816,7 +3816,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
|
|||||||
Source.y += 1.0f;
|
Source.y += 1.0f;
|
||||||
GetVectorsReadyForRW();
|
GetVectorsReadyForRW();
|
||||||
|
|
||||||
CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_DISABLED_1;
|
// CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_DISABLED_1;
|
||||||
|
|
||||||
if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn)
|
if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn)
|
||||||
CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source,
|
CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source,
|
||||||
|
@ -230,7 +230,7 @@ CCamera::Process(void)
|
|||||||
// static bool InterpolatorNotInitialised = true; // unused
|
// static bool InterpolatorNotInitialised = true; // unused
|
||||||
static CVector PreviousFudgedTargetCoors; // only PS2
|
static CVector PreviousFudgedTargetCoors; // only PS2
|
||||||
static float PlayerMinDist = 1.6f; // not on PS2
|
static float PlayerMinDist = 1.6f; // not on PS2
|
||||||
static bool WasPreviouslyInterSyhonFollowPed = false; // only written
|
static bool WasPreviouslyInterSyhonFollowPed = false; // only used on PS2
|
||||||
float FOV = 0.0f;
|
float FOV = 0.0f;
|
||||||
float oldBeta, newBeta;
|
float oldBeta, newBeta;
|
||||||
float deltaBeta = 0.0f;
|
float deltaBeta = 0.0f;
|
||||||
@ -382,13 +382,13 @@ CCamera::Process(void)
|
|||||||
if(Alpha_other > PI) Alpha_other -= TWOPI;
|
if(Alpha_other > PI) Alpha_other -= TWOPI;
|
||||||
float Beta_other = 0.0f;
|
float Beta_other = 0.0f;
|
||||||
if(tmpFront.x != 0.0f || tmpFront.y != 0.0f)
|
if(tmpFront.x != 0.0f || tmpFront.y != 0.0f)
|
||||||
Beta_other = CGeneral::GetATanOfXY(tmpFront.x, tmpFront.y);
|
Beta_other = CGeneral::GetATanOfXY(-tmpFront.y, tmpFront.x);
|
||||||
tmpFront = Cams[ActiveCam].Front;
|
tmpFront = Cams[ActiveCam].Front;
|
||||||
float Alpha_active = CGeneral::GetATanOfXY(tmpFront.Magnitude2D(), tmpFront.z);
|
float Alpha_active = CGeneral::GetATanOfXY(tmpFront.Magnitude2D(), tmpFront.z);
|
||||||
if(Alpha_active > PI) Alpha_other -= TWOPI;
|
if(Alpha_active > PI) Alpha_active -= TWOPI;
|
||||||
float Beta_active = 0.0f;
|
float Beta_active = 0.0f;
|
||||||
if(tmpFront.x != 0.0f || tmpFront.y != 0.0f)
|
if(tmpFront.x != 0.0f || tmpFront.y != 0.0f)
|
||||||
Beta_active = CGeneral::GetATanOfXY(tmpFront.x, tmpFront.y);
|
Beta_active = CGeneral::GetATanOfXY(-tmpFront.y, tmpFront.x);
|
||||||
|
|
||||||
float DeltaBeta = Beta_active - Beta_other;
|
float DeltaBeta = Beta_active - Beta_other;
|
||||||
float Alpha = inter*Alpha_active + (1.0f-inter)*Alpha_other;
|
float Alpha = inter*Alpha_active + (1.0f-inter)*Alpha_other;
|
||||||
@ -405,7 +405,71 @@ CCamera::Process(void)
|
|||||||
}
|
}
|
||||||
m_fOldBetaDiff = DeltaBeta;
|
m_fOldBetaDiff = DeltaBeta;
|
||||||
float Beta = inter*DeltaBeta + Beta_other;
|
float Beta = inter*DeltaBeta + Beta_other;
|
||||||
assert(0 && "TODO");
|
|
||||||
|
CVector FudgedTargetCoors;
|
||||||
|
if(lookingAtPlayerNow && wasLookingAtPlayer){
|
||||||
|
// BUG? how is this interpolation ever used when values are overwritten below?
|
||||||
|
float PlayerDist = (pTargetEntity->GetPosition() - CamSource).Magnitude2D();
|
||||||
|
float MinDist = Min(Cams[(ActiveCam+1)%2].m_fMinDistAwayFromCamWhenInterPolating, Cams[ActiveCam].m_fMinDistAwayFromCamWhenInterPolating);
|
||||||
|
if(PlayerDist < MinDist){
|
||||||
|
CamSource.x = pTargetEntity->GetPosition().x - MinDist*Cos(Beta - HALFPI);
|
||||||
|
CamSource.y = pTargetEntity->GetPosition().y - MinDist*Sin(Beta - HALFPI);
|
||||||
|
}else{
|
||||||
|
CamSource.x = pTargetEntity->GetPosition().x - PlayerDist*Cos(Beta - HALFPI);
|
||||||
|
CamSource.y = pTargetEntity->GetPosition().y - PlayerDist*Sin(Beta - HALFPI);
|
||||||
|
}
|
||||||
|
|
||||||
|
CColPoint colpoint;
|
||||||
|
CEntity *entity = nil;
|
||||||
|
if(CWorld::ProcessLineOfSight(pTargetEntity->GetPosition(), CamSource, colpoint, entity, true, false, false, true, false, true, true)){
|
||||||
|
CamSource = colpoint.point;
|
||||||
|
RwCameraSetNearClipPlane(Scene.camera, 0.05f);
|
||||||
|
}
|
||||||
|
|
||||||
|
CamFront = pTargetEntity->GetPosition() - CamSource;
|
||||||
|
FudgedTargetCoors = inter*Cams[ActiveCam].m_cvecTargetCoorsForFudgeInter + (1.0f-inter)*Cams[(ActiveCam+1)%2].m_cvecTargetCoorsForFudgeInter;
|
||||||
|
PreviousFudgedTargetCoors = FudgedTargetCoors;
|
||||||
|
CamFront.Normalise();
|
||||||
|
CamUp = CVector(0.0f, 0.0f, 1.0f);
|
||||||
|
CamRight = CrossProduct(CamFront, CamUp);
|
||||||
|
CamRight.Normalise();
|
||||||
|
CamUp = CrossProduct(CamRight, CamFront);
|
||||||
|
|
||||||
|
WasPreviouslyInterSyhonFollowPed = true;
|
||||||
|
}else
|
||||||
|
WasPreviouslyInterSyhonFollowPed = false;
|
||||||
|
|
||||||
|
if(transitionPedMode){
|
||||||
|
FudgedTargetCoors = inter*Cams[ActiveCam].m_cvecTargetCoorsForFudgeInter + (1.0f-inter)*Cams[(ActiveCam+1)%2].m_cvecTargetCoorsForFudgeInter;
|
||||||
|
PreviousFudgedTargetCoors = FudgedTargetCoors;
|
||||||
|
CVector CamToTarget = pTargetEntity->GetPosition() - CamSource;
|
||||||
|
float tmpBeta = CGeneral::GetATanOfXY(CamToTarget.x, CamToTarget.y);
|
||||||
|
float PlayerDist = (pTargetEntity->GetPosition() - CamSource).Magnitude2D();
|
||||||
|
float MinDist = Min(Cams[(ActiveCam+1)%2].m_fMinDistAwayFromCamWhenInterPolating, Cams[ActiveCam].m_fMinDistAwayFromCamWhenInterPolating);
|
||||||
|
if(PlayerDist < MinDist){
|
||||||
|
CamSource.x = pTargetEntity->GetPosition().x - MinDist*Cos(tmpBeta - HALFPI);
|
||||||
|
CamSource.y = pTargetEntity->GetPosition().y - MinDist*Sin(tmpBeta - HALFPI);
|
||||||
|
}
|
||||||
|
CamFront = FudgedTargetCoors - CamSource;
|
||||||
|
CamFront.Normalise();
|
||||||
|
CamUp = CVector(0.0f, 0.0f, 1.0f);
|
||||||
|
CamUp.Normalise();
|
||||||
|
CamRight = CrossProduct(CamFront, CamUp);
|
||||||
|
CamRight.Normalise();
|
||||||
|
CamUp = CrossProduct(CamRight, CamFront);
|
||||||
|
CamUp.Normalise();
|
||||||
|
}else{
|
||||||
|
CamFront.x = Cos(Alpha) * Sin(Beta);
|
||||||
|
CamFront.y = Cos(Alpha) * -Cos(Beta);
|
||||||
|
CamFront.z = Sin(Alpha);
|
||||||
|
CamFront.Normalise();
|
||||||
|
CamUp = inter*Cams[ActiveCam].Up + (1.0f-inter)*Cams[(ActiveCam+1)%2].Up;
|
||||||
|
CamUp.Normalise();
|
||||||
|
CamRight = CrossProduct(CamFront, CamUp);
|
||||||
|
CamRight.Normalise();
|
||||||
|
CamUp = CrossProduct(CamRight, CamFront);
|
||||||
|
CamUp.Normalise();
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
uint32 currentTime = CTimer::GetTimeInMilliseconds() - m_uiTimeTransitionStart;
|
uint32 currentTime = CTimer::GetTimeInMilliseconds() - m_uiTimeTransitionStart;
|
||||||
if(currentTime >= m_uiTransitionDuration)
|
if(currentTime >= m_uiTransitionDuration)
|
||||||
@ -699,6 +763,16 @@ CCamera::CamControl(void)
|
|||||||
if(Cams[ActiveCam].CamTargetEntity == nil && pTargetEntity == nil)
|
if(Cams[ActiveCam].CamTargetEntity == nil && pTargetEntity == nil)
|
||||||
pTargetEntity = PLAYER;
|
pTargetEntity = PLAYER;
|
||||||
|
|
||||||
|
#ifdef PS2_CAM_TRANSITION
|
||||||
|
// Stop transition when it's done
|
||||||
|
if(m_uiTransitionState != 0)
|
||||||
|
if(CTimer::GetTimeInMilliseconds() > m_uiTransitionDuration+m_uiTimeTransitionStart){
|
||||||
|
m_uiTransitionState = 0;
|
||||||
|
m_vecDoingSpecialInterPolation = false;
|
||||||
|
m_bWaitForInterpolToFinish = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
m_iZoneCullFrameNumWereAt++;
|
m_iZoneCullFrameNumWereAt++;
|
||||||
if(m_iZoneCullFrameNumWereAt > m_iCheckCullZoneThisNumFrames)
|
if(m_iZoneCullFrameNumWereAt > m_iCheckCullZoneThisNumFrames)
|
||||||
m_iZoneCullFrameNumWereAt = 1;
|
m_iZoneCullFrameNumWereAt = 1;
|
||||||
@ -2248,10 +2322,17 @@ CCamera::StartTransition(int16 newMode)
|
|||||||
void
|
void
|
||||||
CCamera::StartTransitionWhenNotFinishedInter(int16 mode)
|
CCamera::StartTransitionWhenNotFinishedInter(int16 mode)
|
||||||
{
|
{
|
||||||
|
#ifdef PS2_CAM_TRANSITION
|
||||||
|
m_vecOldSourceForInter = GetPosition();
|
||||||
|
m_vecOldFrontForInter = GetForward();
|
||||||
|
m_vecOldUpForInter = GetUp();
|
||||||
|
m_vecOldFOVForInter = CDraw::GetFOV();
|
||||||
|
#endif
|
||||||
m_vecDoingSpecialInterPolation = true;
|
m_vecDoingSpecialInterPolation = true;
|
||||||
StartTransition(mode);
|
StartTransition(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PS2_CAM_TRANSITION
|
||||||
void
|
void
|
||||||
CCamera::StoreValuesDuringInterPol(CVector &source, CVector &target, CVector &up, float &FOV)
|
CCamera::StoreValuesDuringInterPol(CVector &source, CVector &target, CVector &up, float &FOV)
|
||||||
{
|
{
|
||||||
@ -2264,7 +2345,7 @@ CCamera::StoreValuesDuringInterPol(CVector &source, CVector &target, CVector &up
|
|||||||
m_fBetaDuringInterPol = CGeneral::GetATanOfXY(Dist.x, Dist.y);
|
m_fBetaDuringInterPol = CGeneral::GetATanOfXY(Dist.x, Dist.y);
|
||||||
m_fAlphaDuringInterPol = CGeneral::GetATanOfXY(DistOnGround, Dist.z);
|
m_fAlphaDuringInterPol = CGeneral::GetATanOfXY(DistOnGround, Dist.z);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -425,9 +425,12 @@ public:
|
|||||||
float CarZoomValueSmooth;
|
float CarZoomValueSmooth;
|
||||||
|
|
||||||
float DistanceToWater;
|
float DistanceToWater;
|
||||||
|
#ifndef PS2_CAM_TRANSITION
|
||||||
float FOVDuringInter;
|
float FOVDuringInter;
|
||||||
|
#endif
|
||||||
float LODDistMultiplier;
|
float LODDistMultiplier;
|
||||||
float GenerationDistMultiplier;
|
float GenerationDistMultiplier;
|
||||||
|
#ifndef PS2_CAM_TRANSITION
|
||||||
float m_fAlphaSpeedAtStartInter;
|
float m_fAlphaSpeedAtStartInter;
|
||||||
float m_fAlphaWhenInterPol;
|
float m_fAlphaWhenInterPol;
|
||||||
float m_fAlphaDuringInterPol;
|
float m_fAlphaDuringInterPol;
|
||||||
@ -438,6 +441,7 @@ public:
|
|||||||
float m_fFOVSpeedAtStartInter;
|
float m_fFOVSpeedAtStartInter;
|
||||||
float m_fStartingBetaForInterPol;
|
float m_fStartingBetaForInterPol;
|
||||||
float m_fStartingAlphaForInterPol;
|
float m_fStartingAlphaForInterPol;
|
||||||
|
#endif
|
||||||
float m_PedOrientForBehindOrInFront;
|
float m_PedOrientForBehindOrInFront;
|
||||||
float m_CameraAverageSpeed;
|
float m_CameraAverageSpeed;
|
||||||
float m_CameraSpeedSoFar;
|
float m_CameraSpeedSoFar;
|
||||||
@ -487,7 +491,7 @@ public:
|
|||||||
CVector m_vecFixedModeSource;
|
CVector m_vecFixedModeSource;
|
||||||
CVector m_vecFixedModeUpOffSet;
|
CVector m_vecFixedModeUpOffSet;
|
||||||
CVector m_vecCutSceneOffset;
|
CVector m_vecCutSceneOffset;
|
||||||
|
#ifndef PS2_CAM_TRANSITION
|
||||||
CVector m_cvecStartingSourceForInterPol;
|
CVector m_cvecStartingSourceForInterPol;
|
||||||
CVector m_cvecStartingTargetForInterPol;
|
CVector m_cvecStartingTargetForInterPol;
|
||||||
CVector m_cvecStartingUpForInterPol;
|
CVector m_cvecStartingUpForInterPol;
|
||||||
@ -497,11 +501,13 @@ public:
|
|||||||
CVector m_vecSourceWhenInterPol;
|
CVector m_vecSourceWhenInterPol;
|
||||||
CVector m_vecTargetWhenInterPol;
|
CVector m_vecTargetWhenInterPol;
|
||||||
CVector m_vecUpWhenInterPol;
|
CVector m_vecUpWhenInterPol;
|
||||||
|
#endif
|
||||||
CVector m_vecGameCamPos;
|
CVector m_vecGameCamPos;
|
||||||
|
#ifndef PS2_CAM_TRANSITION
|
||||||
CVector SourceDuringInter;
|
CVector SourceDuringInter;
|
||||||
CVector TargetDuringInter;
|
CVector TargetDuringInter;
|
||||||
CVector UpDuringInter;
|
CVector UpDuringInter;
|
||||||
|
#endif
|
||||||
RwCamera *m_pRwCamera;
|
RwCamera *m_pRwCamera;
|
||||||
CEntity *pTargetEntity;
|
CEntity *pTargetEntity;
|
||||||
CCamPathSplines m_arrPathArray[MAX_NUM_OF_SPLINETYPES];
|
CCamPathSplines m_arrPathArray[MAX_NUM_OF_SPLINETYPES];
|
||||||
|
Loading…
Reference in New Issue
Block a user