mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-26 11:04:15 +01:00
ccamera cleanup
This commit is contained in:
parent
5f3eb76cff
commit
4cd4f91e57
@ -234,7 +234,7 @@ CCamera::Process(void)
|
||||
float oldBeta, newBeta;
|
||||
float deltaBeta = 0.0f;
|
||||
bool lookLRBVehicle = false;
|
||||
CVector CamFront, CamUp, CamSource, Target;
|
||||
CVector CamFront, CamUp, CamRight, CamSource, Target;
|
||||
|
||||
m_bJust_Switched = false;
|
||||
m_RealPreviousCameraPosition = GetPosition();
|
||||
@ -378,15 +378,17 @@ CCamera::Process(void)
|
||||
|
||||
if(Cams[ActiveCam].Mode == CCam::MODE_TOPDOWN || Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
|
||||
CamFront.Normalise();
|
||||
CamUp = CrossProduct(CamFront, CVector(-1.0f, 0.0f, 0.0f));
|
||||
CamRight = CVector(-1.0f, 0.0f, 0.0f);
|
||||
CamUp = CrossProduct(CamFront, CamRight);
|
||||
CamUp.Normalise();
|
||||
}else{
|
||||
CamFront.Normalise();
|
||||
CamUp.Normalise();
|
||||
CVector right = CrossProduct(CamFront, CamUp);
|
||||
right.Normalise();
|
||||
CamUp = CrossProduct(right, CamFront);
|
||||
}
|
||||
CamRight = CrossProduct(CamFront, CamUp);
|
||||
CamRight.Normalise();
|
||||
CamUp = CrossProduct(CamRight, CamFront);
|
||||
CamUp.Normalise();
|
||||
}
|
||||
FOV = m_fFOVWhenInterPol;
|
||||
}else if(fractionInter > m_fFractionInterToStopMoving && fractionInter <= 1.0f){
|
||||
float inter;
|
||||
@ -433,15 +435,17 @@ CCamera::Process(void)
|
||||
|
||||
if(Cams[ActiveCam].Mode == CCam::MODE_TOPDOWN || Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
|
||||
CamFront.Normalise();
|
||||
CamUp = CrossProduct(CamFront, CVector(-1.0f, 0.0f, 0.0f));
|
||||
CamRight = CVector(-1.0f, 0.0f, 0.0f);
|
||||
CamUp = CrossProduct(CamFront, CamRight);
|
||||
CamUp.Normalise();
|
||||
}else{
|
||||
CamFront.Normalise();
|
||||
CamUp.Normalise();
|
||||
CVector right = CrossProduct(CamFront, CamUp);
|
||||
right.Normalise();
|
||||
CamUp = CrossProduct(right, CamFront);
|
||||
}
|
||||
CamRight = CrossProduct(CamFront, CamUp);
|
||||
CamRight.Normalise();
|
||||
CamUp = CrossProduct(CamRight, CamFront);
|
||||
CamUp.Normalise();
|
||||
}
|
||||
#ifndef FIX_BUGS
|
||||
// BUG: FOV was already interpolated but m_fFOVWhenInterPol was not
|
||||
FOV = m_fFOVWhenInterPol;
|
||||
@ -563,7 +567,7 @@ CCamera::Process(void)
|
||||
}
|
||||
m_PreviousCameraPosition = GetPosition();
|
||||
|
||||
// PS2: something doing on with forward vector here
|
||||
// PS2: something going on with forward vector here
|
||||
|
||||
if(Cams[ActiveCam].DirectionWasLooking != LOOKING_FORWARD && Cams[ActiveCam].Mode != CCam::MODE_TOP_DOWN_PED){
|
||||
Cams[ActiveCam].Source = Cams[ActiveCam].SourceBeforeLookBehind;
|
||||
@ -994,7 +998,7 @@ CCamera::CamControl(void)
|
||||
garageCenter.y = (az->miny + az->maxy)/2.0f;
|
||||
garageCenter.z = 0.0f;
|
||||
}else
|
||||
garageCenter = pTargetEntity->GetPosition();
|
||||
garageCenter = CVector(pTargetEntity->GetPosition().x, pTargetEntity->GetPosition().y, 0.0f);
|
||||
}
|
||||
if(whichDoor == 1)
|
||||
garageCenterToDoor = garageDoorPos1 - garageCenter;
|
||||
@ -2243,25 +2247,22 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
|
||||
switch(obbeMode){
|
||||
case OBBE_WHEEL:
|
||||
veh = FindPlayerVehicle();
|
||||
if(veh == nil){
|
||||
if(CTimer::GetTimeInMilliseconds() > t+5000)
|
||||
return true;
|
||||
SetNearClipScript(0.6f);
|
||||
return false;
|
||||
}
|
||||
if(veh){
|
||||
if(veh->IsBoat() || veh->GetModelIndex() == MI_RHINO)
|
||||
return true;
|
||||
if(CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false)){
|
||||
if(!CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false))
|
||||
return true;
|
||||
}
|
||||
if(CTimer::GetTimeInMilliseconds() > t+5000)
|
||||
return true;
|
||||
SetNearClipScript(0.6f);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case OBBE_1:
|
||||
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
|
||||
return true;
|
||||
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
|
||||
if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
|
||||
return true;
|
||||
|
||||
fwd = FindPlayerCoors() - m_vecFixedModeSource;
|
||||
fwd.z = 0.0f;
|
||||
|
||||
@ -2272,12 +2273,12 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
|
||||
if(fwd.Magnitude() < 1.6f)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case OBBE_2:
|
||||
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
|
||||
return true;
|
||||
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
|
||||
if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
|
||||
return true;
|
||||
|
||||
fwd = FindPlayerCoors() - m_vecFixedModeSource;
|
||||
fwd.z = 0.0f;
|
||||
|
||||
@ -2291,10 +2292,10 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
|
||||
if(fwd.Magnitude() < 1.6f)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case OBBE_3:
|
||||
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
|
||||
if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
|
||||
return true;
|
||||
|
||||
fwd = FindPlayerCoors() - m_vecFixedModeSource;
|
||||
fwd.z = 0.0f;
|
||||
|
||||
@ -2302,14 +2303,14 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
|
||||
if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case OBBE_1STPERSON:
|
||||
return CTimer::GetTimeInMilliseconds() > t+3000;
|
||||
case OBBE_5:
|
||||
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
|
||||
return true;
|
||||
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
|
||||
if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
|
||||
return true;
|
||||
|
||||
fwd = FindPlayerCoors() - m_vecFixedModeSource;
|
||||
fwd.z = 0.0f;
|
||||
|
||||
@ -2317,8 +2318,6 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
|
||||
if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case OBBE_ONSTRING:
|
||||
return CTimer::GetTimeInMilliseconds() > t+3000;
|
||||
case OBBE_COPCAR:
|
||||
@ -2326,17 +2325,18 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
|
||||
case OBBE_COPCAR_WHEEL:
|
||||
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
|
||||
return true;
|
||||
if(CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false)){
|
||||
if(!CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false))
|
||||
return true;
|
||||
if(CTimer::GetTimeInMilliseconds() > t+1000)
|
||||
return true;
|
||||
SetNearClipScript(0.6f);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
// Ped modes
|
||||
case OBBE_9:
|
||||
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
|
||||
if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
|
||||
return true;
|
||||
|
||||
fwd = FindPlayerCoors() - m_vecFixedModeSource;
|
||||
fwd.z = 0.0f;
|
||||
|
||||
@ -2344,10 +2344,10 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
|
||||
if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case OBBE_10:
|
||||
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
|
||||
if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
|
||||
return true;
|
||||
|
||||
fwd = FindPlayerCoors() - m_vecFixedModeSource;
|
||||
fwd.z = 0.0f;
|
||||
|
||||
@ -2355,10 +2355,10 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
|
||||
if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case OBBE_11:
|
||||
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
|
||||
if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
|
||||
return true;
|
||||
|
||||
fwd = FindPlayerCoors() - m_vecFixedModeSource;
|
||||
fwd.z = 0.0f;
|
||||
|
||||
@ -2366,10 +2366,10 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
|
||||
if(fwd.Magnitude() > 25.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case OBBE_12:
|
||||
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){
|
||||
if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
|
||||
return true;
|
||||
|
||||
fwd = FindPlayerCoors() - m_vecFixedModeSource;
|
||||
fwd.z = 0.0f;
|
||||
|
||||
@ -2377,8 +2377,6 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
|
||||
if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case OBBE_13:
|
||||
return CTimer::GetTimeInMilliseconds() > t+5000;
|
||||
default:
|
||||
@ -2653,7 +2651,7 @@ CCamera::TryToStartNewCamMode(int obbeMode)
|
||||
}
|
||||
}
|
||||
|
||||
static int32 SequenceOfCams[16] = {
|
||||
int32 SequenceOfCams[16] = {
|
||||
OBBE_WHEEL, OBBE_COPCAR, OBBE_3, OBBE_1, OBBE_3, OBBE_COPCAR_WHEEL,
|
||||
OBBE_2, OBBE_3, OBBE_COPCAR_WHEEL, OBBE_COPCAR, OBBE_2, OBBE_3,
|
||||
OBBE_5, OBBE_3,
|
||||
@ -2689,7 +2687,7 @@ CCamera::ProcessObbeCinemaCameraCar(void)
|
||||
bDidWeProcessAnyCinemaCam = true;
|
||||
}
|
||||
|
||||
static int32 SequenceOfPedCams[5] = { OBBE_9, OBBE_10, OBBE_11, OBBE_12, OBBE_13 };
|
||||
int32 SequenceOfPedCams[5] = { OBBE_9, OBBE_10, OBBE_11, OBBE_12, OBBE_13 };
|
||||
|
||||
void
|
||||
CCamera::ProcessObbeCinemaCameraPed(void)
|
||||
@ -3282,12 +3280,13 @@ CCamera::UpdateAimingCoors(CVector const &coors)
|
||||
m_cvecAimingTargetCoors = coors;
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
CCamera::Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target)
|
||||
{
|
||||
if(CPad::GetPad(0)->GetLookBehindForPed()){
|
||||
source = pos;
|
||||
target = dist*Cams[ActiveCam].CamTargetEntity->GetForward() + source;
|
||||
return false;
|
||||
}else{
|
||||
float angleX = DEGTORAD((m_f3rdPersonCHairMultX-0.5f) * 1.8f * 0.5f * Cams[ActiveCam].FOV * CDraw::GetAspectRatio());
|
||||
float angleY = DEGTORAD((0.5f-m_f3rdPersonCHairMultY) * 1.8f * 0.5f * Cams[ActiveCam].FOV);
|
||||
@ -3296,9 +3295,9 @@ CCamera::Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source,
|
||||
target += Cams[ActiveCam].Up * Tan(angleY);
|
||||
target += CrossProduct(Cams[ActiveCam].Front, Cams[ActiveCam].Up) * Tan(angleX);
|
||||
target.Normalise();
|
||||
float dot = DotProduct(pos - source, target);
|
||||
source += dot*target;
|
||||
source += DotProduct(pos - source, target)*target;
|
||||
target = dist*target + source;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -624,7 +624,7 @@ public:
|
||||
void SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom);
|
||||
void ClearPlayerWeaponMode(void);
|
||||
void UpdateAimingCoors(CVector const &coors);
|
||||
void Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target);
|
||||
bool Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target);
|
||||
float Find3rdPersonQuickAimPitch(void);
|
||||
|
||||
// Physical camera
|
||||
|
Loading…
Reference in New Issue
Block a user