|
|
@ -104,7 +104,7 @@ hsScalar plVirtualCam1::fFallTimerDelay = 0.25f; |
|
|
|
hsBool plVirtualCam1::alwaysCutForColin = false; |
|
|
|
hsBool plVirtualCam1::alwaysCutForColin = false; |
|
|
|
hsBool plVirtualCam1::WalkPan3rdPerson = false; |
|
|
|
hsBool plVirtualCam1::WalkPan3rdPerson = false; |
|
|
|
hsBool plVirtualCam1::StayInFirstPersonForever = false; |
|
|
|
hsBool plVirtualCam1::StayInFirstPersonForever = false; |
|
|
|
float plVirtualCam1::fAspectRatio = fFOVw / fFOVh; |
|
|
|
float plVirtualCam1::fAspectRatio = 4.f/3.f; |
|
|
|
|
|
|
|
|
|
|
|
// #define STATUS_LOG
|
|
|
|
// #define STATUS_LOG
|
|
|
|
|
|
|
|
|
|
|
@ -287,58 +287,48 @@ void plVirtualCam1::SetOffset(float x, float y, float z) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// static function
|
|
|
|
// static function
|
|
|
|
void plVirtualCam1::SetFOV(hsScalar x, hsScalar y) |
|
|
|
void plVirtualCam1::SetFOV(hsScalar w, hsScalar h) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
float fovW = y * fAspectRatio; |
|
|
|
static float fourXthree = (4.f/3.f); |
|
|
|
|
|
|
|
|
|
|
|
fFOVw = fovW; |
|
|
|
fFOVh = h; |
|
|
|
fFOVh = y; |
|
|
|
if (fAspectRatio == fourXthree) |
|
|
|
|
|
|
|
fFOVw = w; |
|
|
|
if (! plVirtualCam1::Instance()->fPipe)
|
|
|
|
else |
|
|
|
return; |
|
|
|
{ |
|
|
|
|
|
|
|
float scale = fAspectRatio / fourXthree; |
|
|
|
|
|
|
|
fFOVw = (hsScalar)(2 * hsScalarRadToDeg(atan(scale * tan(hsScalarDegToRad(w/2))))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
plVirtualCam1::Instance()->SetFlags(plVirtualCam1::kSetFOV); |
|
|
|
plVirtualCam1::Instance()->SetFlags(plVirtualCam1::kSetFOV); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef STATUS_LOG |
|
|
|
|
|
|
|
if (printFOV) |
|
|
|
|
|
|
|
camLog->AddLineF("FOV changed by console command to %f", fFOVw); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// static function
|
|
|
|
// static function
|
|
|
|
void plVirtualCam1::SetFOV(hsScalar x, hsScalar y, plCameraModifier1* pCam) |
|
|
|
void plVirtualCam1::SetFOV(plCameraModifier1* pCam) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (plVirtualCam1::Instance()->GetCurrentCamera() != pCam) |
|
|
|
if (plVirtualCam1::Instance()->GetCurrentCamera() != pCam) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
SetFOV(pCam->GetFOVw(), pCam->GetFOVh()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hsScalar diff = hsABS(fFOVw - x); |
|
|
|
void plVirtualCam1::Refresh() |
|
|
|
if (diff > 10.0f) |
|
|
|
{ |
|
|
|
{ |
|
|
|
plPipeline* pipe = plVirtualCam1::Instance()->fPipe; |
|
|
|
#ifdef STATUS_LOG |
|
|
|
SetAspectRatio((float)pipe->Width() / (float)pipe->Height()); |
|
|
|
camLog->AddLineF("Radical FOV change of %f", diff); |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float fovW = y * fAspectRatio; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fFOVw = fovW; |
|
|
|
|
|
|
|
fFOVh = y; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (! plVirtualCam1::Instance()->fPipe)
|
|
|
|
void plVirtualCam1::SetAspectRatio(float ratio) |
|
|
|
return; |
|
|
|
{ |
|
|
|
|
|
|
|
fAspectRatio = ratio; |
|
|
|
plVirtualCam1::Instance()->SetFlags(plVirtualCam1::kSetFOV); |
|
|
|
// resize the FOV accordingly
|
|
|
|
|
|
|
|
plCameraModifier1* pCam = plVirtualCam1::Instance()->GetCurrentCamera(); |
|
|
|
#ifdef STATUS_LOG |
|
|
|
hsAssert(pCam, "CameraModifier1 shouldn't be nullptr?"); |
|
|
|
if (printFOV) |
|
|
|
if (pCam) |
|
|
|
camLog->AddLineF("FOV changed to %f", fFOVw); |
|
|
|
SetFOV(pCam->GetFOVw(), pCam->GetFOVh()); |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// static function
|
|
|
|
// static function
|
|
|
|
|
|
|
|
|
|
|
|
void plVirtualCam1::SetDepth(hsScalar h, hsScalar y) |
|
|
|
void plVirtualCam1::SetDepth(hsScalar h, hsScalar y) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return; |
|
|
|
return; |
|
|
@ -913,7 +903,7 @@ void plVirtualCam1::FirstPersonOverride() |
|
|
|
#ifdef STATUS_LOG |
|
|
|
#ifdef STATUS_LOG |
|
|
|
camLog->AddLineF("Built-In First Person Camera Disabled"); |
|
|
|
camLog->AddLineF("Built-In First Person Camera Disabled"); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
|
|
|
SetFOV(GetCurrentStackCamera()); |
|
|
|
GetCurrentStackCamera()->Push(!HasFlags(kAvatarWalking)); |
|
|
|
GetCurrentStackCamera()->Push(!HasFlags(kAvatarWalking)); |
|
|
|
plAvatarInputInterface::GetInstance()->CameraInThirdPerson(true); |
|
|
|
plAvatarInputInterface::GetInstance()->CameraInThirdPerson(true); |
|
|
|
FreezeOutput(2);
|
|
|
|
FreezeOutput(2);
|
|
|
@ -938,7 +928,7 @@ void plVirtualCam1::FirstPersonOverride() |
|
|
|
fFirstPersonOverride = (plCameraModifier1*)pKey->GetObjectPtr(); |
|
|
|
fFirstPersonOverride = (plCameraModifier1*)pKey->GetObjectPtr(); |
|
|
|
GetCurrentStackCamera()->Pop(); |
|
|
|
GetCurrentStackCamera()->Pop(); |
|
|
|
fFirstPersonOverride->Push(!HasFlags(kAvatarWalking)); |
|
|
|
fFirstPersonOverride->Push(!HasFlags(kAvatarWalking)); |
|
|
|
SetFOV(fFirstPersonOverride->GetFOVw(), fFirstPersonOverride->GetFOVh(), fFirstPersonOverride);
|
|
|
|
SetFOV(fFirstPersonOverride); |
|
|
|
plAvatarInputInterface::GetInstance()->CameraInThirdPerson(false); |
|
|
|
plAvatarInputInterface::GetInstance()->CameraInThirdPerson(false); |
|
|
|
// no need to keep transitioning if we are currently...
|
|
|
|
// no need to keep transitioning if we are currently...
|
|
|
|
if (fTransPos == POS_TRANS_FOLLOW) |
|
|
|
if (fTransPos == POS_TRANS_FOLLOW) |
|
|
@ -1178,12 +1168,12 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
if (fFirstPersonOverride) |
|
|
|
if (fFirstPersonOverride) |
|
|
|
{ |
|
|
|
{ |
|
|
|
SetFOV(fFirstPersonOverride->GetFOVw(), fFirstPersonOverride->GetFOVh(), fFirstPersonOverride); |
|
|
|
SetFOV(fFirstPersonOverride); |
|
|
|
fFirstPersonOverride->Push(!HasFlags(kAvatarWalking)); |
|
|
|
fFirstPersonOverride->Push(!HasFlags(kAvatarWalking)); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
|
|
|
SetFOV(GetCurrentStackCamera()); |
|
|
|
GetCurrentStackCamera()->Push(!HasFlags(kAvatarWalking)); |
|
|
|
GetCurrentStackCamera()->Push(!HasFlags(kAvatarWalking)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1243,7 +1233,7 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg) |
|
|
|
pTrans->fCutPOA = pTrans->fCutPos = true;
|
|
|
|
pTrans->fCutPOA = pTrans->fCutPos = true;
|
|
|
|
StartTransition(pTrans); |
|
|
|
StartTransition(pTrans); |
|
|
|
delete(pTrans); |
|
|
|
delete(pTrans); |
|
|
|
SetFOV(fPythonOverride->GetFOVw(), fPythonOverride->GetFOVh(), fPythonOverride); |
|
|
|
SetFOV(fPythonOverride); |
|
|
|
ClearFlags(kFirstPersonEnabled); |
|
|
|
ClearFlags(kFirstPersonEnabled); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1289,7 +1279,7 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg) |
|
|
|
#ifdef STATUS_LOG |
|
|
|
#ifdef STATUS_LOG |
|
|
|
camLog->AddLineF("Forcing 3rd Person from scripts"); |
|
|
|
camLog->AddLineF("Forcing 3rd Person from scripts"); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
|
|
|
SetFOV(GetCurrentStackCamera()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1320,7 +1310,7 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg) |
|
|
|
#ifdef STATUS_LOG |
|
|
|
#ifdef STATUS_LOG |
|
|
|
camLog->AddLineF("Forcing 3rd Person from code"); |
|
|
|
camLog->AddLineF("Forcing 3rd Person from code"); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera()); |
|
|
|
SetFOV(GetCurrentStackCamera()); |
|
|
|
} |
|
|
|
} |
|
|
|
ClearFlags(kFirstPersonEnabled); |
|
|
|
ClearFlags(kFirstPersonEnabled); |
|
|
|
#ifdef STATUS_LOG |
|
|
|
#ifdef STATUS_LOG |
|
|
@ -1384,6 +1374,11 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
if (pCam->Cmd(plCameraMsg::kRefreshFOV)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Refresh(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
plGenRefMsg* pRefMsg = plGenRefMsg::ConvertNoRef(msg); |
|
|
|
plGenRefMsg* pRefMsg = plGenRefMsg::ConvertNoRef(msg); |
|
|
|
if (pRefMsg ) |
|
|
|
if (pRefMsg ) |
|
|
@ -1678,7 +1673,7 @@ void plVirtualCam1::PushCamera(plCameraModifier1* pCam, hsBool bDefault) |
|
|
|
camLog->AddLineF("Camera %s is now the DEFAULT camera for this age", pCam->GetKeyName()); |
|
|
|
camLog->AddLineF("Camera %s is now the DEFAULT camera for this age", pCam->GetKeyName()); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
|
|
|
SetFOV(GetCurrentStackCamera()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void plVirtualCam1::PopCamera(plCameraModifier1* pCam) |
|
|
|
void plVirtualCam1::PopCamera(plCameraModifier1* pCam) |
|
|
@ -1819,7 +1814,7 @@ void plVirtualCam1::PopCamera(plCameraModifier1* pCam) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!InTransition()) |
|
|
|
if (!InTransition()) |
|
|
|
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
|
|
|
SetFOV(GetCurrentStackCamera()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void plVirtualCam1::PopAll() |
|
|
|
void plVirtualCam1::PopAll() |
|
|
@ -1838,7 +1833,6 @@ void plVirtualCam1::StartTransition(CamTrans* transition) |
|
|
|
{ |
|
|
|
{ |
|
|
|
GetCurrentStackCamera()->GetBrain()->SetFlags(plCameraBrain1::kCutPOAOnce); |
|
|
|
GetCurrentStackCamera()->GetBrain()->SetFlags(plCameraBrain1::kCutPOAOnce); |
|
|
|
GetCurrentStackCamera()->GetBrain()->SetFlags(plCameraBrain1::kCutPosOnce); |
|
|
|
GetCurrentStackCamera()->GetBrain()->SetFlags(plCameraBrain1::kCutPosOnce); |
|
|
|
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
|
|
|
|
|
|
|
fXPanLimit = GetCurrentStackCamera()->GetBrain()->GetXPanLimit(); |
|
|
|
fXPanLimit = GetCurrentStackCamera()->GetBrain()->GetXPanLimit(); |
|
|
|
fZPanLimit = GetCurrentStackCamera()->GetBrain()->GetZPanLimit(); |
|
|
|
fZPanLimit = GetCurrentStackCamera()->GetBrain()->GetZPanLimit(); |
|
|
|
StartInterpPanLimits(); |
|
|
|
StartInterpPanLimits(); |
|
|
@ -1984,12 +1978,8 @@ void plVirtualCam1::StartTransition(CamTrans* transition) |
|
|
|
else |
|
|
|
else |
|
|
|
dist.Set(&(fTransitionCamera->GetTargetPos() - pCam->GetTargetPos())); |
|
|
|
dist.Set(&(fTransitionCamera->GetTargetPos() - pCam->GetTargetPos())); |
|
|
|
|
|
|
|
|
|
|
|
time = (double)(dist.Magnitude() / pBrain->GetVelocity()); |
|
|
|
time = (dist.Magnitude() / pBrain->GetVelocity()); |
|
|
|
|
|
|
|
fTransitionCamera->GetBrain()->SetFOVGoal(pCam->GetFOVw(), pCam->GetFOVh(), time); |
|
|
|
// set up the transition camera to the current FOV
|
|
|
|
|
|
|
|
fTransitionCamera->SetFOVh(GetFOVh(), false); |
|
|
|
|
|
|
|
fTransitionCamera->SetFOVw(GetFOVw(), false); |
|
|
|
|
|
|
|
fTransitionCamera->GetBrain()->SetFOVGoal(pCam->GetFOVh(), time); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
StartInterpPanLimits(); |
|
|
|
StartInterpPanLimits(); |
|
|
|