|
|
@ -90,14 +90,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
|
|
|
|
|
|
|
|
|
|
float plVirtualCam1::fFOVw = 45.0f; |
|
|
|
float plVirtualCam1::fFOVw = 45.0f; |
|
|
|
float plVirtualCam1::fFOVh = 33.75f; |
|
|
|
float plVirtualCam1::fFOVh = 33.75f; |
|
|
|
|
|
|
|
float plVirtualCam1::fAspectRatio = 4.f/3.f; |
|
|
|
float plVirtualCam1::fHither = 0.3f; |
|
|
|
float plVirtualCam1::fHither = 0.3f; |
|
|
|
float plVirtualCam1::fYon = 500.0f; |
|
|
|
float plVirtualCam1::fYon = 500.0f; |
|
|
|
bool plVirtualCam1::printFOV = false; |
|
|
|
bool plVirtualCam1::printFOV = false; |
|
|
|
bool plVirtualCam1::fUseAccelOverride = 1; |
|
|
|
bool plVirtualCam1::fUseAccelOverride = 1; |
|
|
|
bool plVirtualCam1::freeze = 0; |
|
|
|
bool plVirtualCam1::freeze = 0; |
|
|
|
//float plVirtualCam1::fAccel = 5.0f;
|
|
|
|
|
|
|
|
//float plVirtualCam1::fDecel = 5.0f;
|
|
|
|
|
|
|
|
//float plVirtualCam1::fVel = 10.0f;
|
|
|
|
|
|
|
|
float plVirtualCam1::fAccel = 50.0f; |
|
|
|
float plVirtualCam1::fAccel = 50.0f; |
|
|
|
float plVirtualCam1::fDecel = 50.0f; |
|
|
|
float plVirtualCam1::fDecel = 50.0f; |
|
|
|
float plVirtualCam1::fVel = 100.0f; |
|
|
|
float plVirtualCam1::fVel = 100.0f; |
|
|
@ -106,7 +104,6 @@ float plVirtualCam1::fFallTimerDelay = 0.25f; |
|
|
|
bool plVirtualCam1::alwaysCutForColin = false; |
|
|
|
bool plVirtualCam1::alwaysCutForColin = false; |
|
|
|
bool plVirtualCam1::WalkPan3rdPerson = false; |
|
|
|
bool plVirtualCam1::WalkPan3rdPerson = false; |
|
|
|
bool plVirtualCam1::StayInFirstPersonForever = false; |
|
|
|
bool plVirtualCam1::StayInFirstPersonForever = false; |
|
|
|
float plVirtualCam1::fAspectRatio = fFOVw / fFOVh; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// #define STATUS_LOG
|
|
|
|
// #define STATUS_LOG
|
|
|
|
|
|
|
|
|
|
|
@ -286,54 +283,43 @@ void plVirtualCam1::SetOffset(float x, float y, float z) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// static function
|
|
|
|
// static function
|
|
|
|
void plVirtualCam1::SetFOV(float x, float y) |
|
|
|
void plVirtualCam1::SetFOV(float w, float h) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
static float fourXthree = (4.f/3.f); |
|
|
|
|
|
|
|
|
|
|
|
float fovW = y * fAspectRatio; |
|
|
|
fFOVh = h; |
|
|
|
|
|
|
|
if (fAspectRatio == fourXthree) |
|
|
|
fFOVw = fovW; |
|
|
|
fFOVw = w; |
|
|
|
fFOVh = y; |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
if (! plVirtualCam1::Instance()->fPipe)
|
|
|
|
float scale = fAspectRatio / fourXthree; |
|
|
|
return; |
|
|
|
fFOVw = 2 * hsRadiansToDegrees(atan(scale * tan(hsDegreesToRadians(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(float x, float 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()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
float diff = hsABS(fFOVw - x); |
|
|
|
void plVirtualCam1::Refresh() |
|
|
|
if (diff > 10.0f) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
#ifdef STATUS_LOG |
|
|
|
plPipeline* pipe = plVirtualCam1::Instance()->fPipe; |
|
|
|
camLog->AddLineF("Radical FOV change of %f", diff); |
|
|
|
SetAspectRatio((float)pipe->Width() / (float)pipe->Height()); |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
float fovW = y * fAspectRatio; |
|
|
|
void plVirtualCam1::SetAspectRatio(float ratio) |
|
|
|
|
|
|
|
{ |
|
|
|
fFOVw = fovW; |
|
|
|
fAspectRatio = ratio; |
|
|
|
fFOVh = y; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (! plVirtualCam1::Instance()->fPipe)
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plVirtualCam1::Instance()->SetFlags(plVirtualCam1::kSetFOV); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef STATUS_LOG |
|
|
|
// resize the FOV accordingly
|
|
|
|
if (printFOV) |
|
|
|
plCameraModifier1* pCam = plVirtualCam1::Instance()->GetCurrentCamera(); |
|
|
|
camLog->AddLineF("FOV changed to %f", fFOVw); |
|
|
|
hsAssert(pCam, "CameraModifier1 shouldn't be nullptr?"); |
|
|
|
#endif |
|
|
|
if (pCam) |
|
|
|
|
|
|
|
SetFOV(pCam->GetFOVw(), pCam->GetFOVh()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// static function
|
|
|
|
// static function
|
|
|
@ -913,7 +899,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 +924,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 +1164,12 @@ bool 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 +1229,7 @@ bool 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 +1275,7 @@ bool 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 +1306,7 @@ bool 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 |
|
|
@ -1675,7 +1661,7 @@ void plVirtualCam1::PushCamera(plCameraModifier1* pCam, bool bDefault) |
|
|
|
camLog->AddLineF("Camera %s is now the DEFAULT camera for this age", pCam->GetKeyName().c_str()); |
|
|
|
camLog->AddLineF("Camera %s is now the DEFAULT camera for this age", pCam->GetKeyName().c_str()); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
|
|
|
SetFOV(GetCurrentStackCamera());
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void plVirtualCam1::PopCamera(plCameraModifier1* pCam) |
|
|
|
void plVirtualCam1::PopCamera(plCameraModifier1* pCam) |
|
|
@ -1812,7 +1798,7 @@ void plVirtualCam1::PopCamera(plCameraModifier1* pCam) |
|
|
|
fCameraStack.erase(it); |
|
|
|
fCameraStack.erase(it); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!InTransition()) |
|
|
|
if (!InTransition()) |
|
|
|
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
|
|
|
SetFOV(GetCurrentStackCamera());
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void plVirtualCam1::PopAll() |
|
|
|
void plVirtualCam1::PopAll() |
|
|
@ -1831,7 +1817,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(); |
|
|
@ -1983,12 +1968,8 @@ void plVirtualCam1::StartTransition(CamTrans* transition) |
|
|
|
dist.Set(&posdist); |
|
|
|
dist.Set(&posdist); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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(); |
|
|
|