|
|
@ -225,21 +225,21 @@ plVirtualCam1::~plVirtualCam1() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// for saving camera stack
|
|
|
|
// for saving camera stack
|
|
|
|
plCameraModifier1* plVirtualCam1::GetCameraNumber(int camNumber) |
|
|
|
plCameraModifier1* plVirtualCam1::GetCameraNumber(size_t camNumber) |
|
|
|
{
|
|
|
|
{
|
|
|
|
return (fCameraStack[camNumber]);
|
|
|
|
return (fCameraStack[camNumber]);
|
|
|
|
} |
|
|
|
} |
|
|
|
// for rebuilding camera stack
|
|
|
|
// for rebuilding camera stack
|
|
|
|
void plVirtualCam1::RebuildStack(const plKey& key) |
|
|
|
void plVirtualCam1::RebuildStack(const plKey& key) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fCameraStack.Count() == 1) |
|
|
|
if (fCameraStack.size() == 1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
plUoid U(kDefaultCameraMod1_KEY); |
|
|
|
plUoid U(kDefaultCameraMod1_KEY); |
|
|
|
plKey pKey = hsgResMgr::ResMgr()->FindKey(U); |
|
|
|
plKey pKey = hsgResMgr::ResMgr()->FindKey(U); |
|
|
|
if (pKey) |
|
|
|
if (pKey) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fCameraStack[0]->GetKey() == pKey) |
|
|
|
if (fCameraStack[0]->GetKey() == pKey) |
|
|
|
fCameraStack.SetCountAndZero(0); |
|
|
|
fCameraStack.clear(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
plSceneObject* pObj = plSceneObject::ConvertNoRef(key->GetObjectPtr()); |
|
|
|
plSceneObject* pObj = plSceneObject::ConvertNoRef(key->GetObjectPtr()); |
|
|
@ -398,14 +398,13 @@ void plVirtualCam1::Reset(hsBool bRender) |
|
|
|
fPythonOverride = nil; |
|
|
|
fPythonOverride = nil; |
|
|
|
if (fFirstPersonOverride) |
|
|
|
if (fFirstPersonOverride) |
|
|
|
fFirstPersonOverride = nil; |
|
|
|
fFirstPersonOverride = nil; |
|
|
|
fCamerasLoaded.SetCountAndZero(0); |
|
|
|
fCamerasLoaded.clear(); |
|
|
|
fCameraStack.SetCountAndZero(0); |
|
|
|
fCameraStack.clear(); |
|
|
|
fCameraStack.Append(fDriveCamera); |
|
|
|
fCameraStack.push_back(fDriveCamera); |
|
|
|
plUoid U(kDefaultCameraMod1_KEY); |
|
|
|
plUoid U(kDefaultCameraMod1_KEY); |
|
|
|
plKey pKey = hsgResMgr::ResMgr()->FindKey(U); |
|
|
|
plKey pKey = hsgResMgr::ResMgr()->FindKey(U); |
|
|
|
if (pKey) |
|
|
|
if (pKey) |
|
|
|
PushCamera((plCameraModifier1*)pKey->GetObjectPtr()); |
|
|
|
PushCamera((plCameraModifier1*)pKey->GetObjectPtr()); |
|
|
|
//fCameraStack.Append((plCameraModifier1*)pKey->GetObjectPtr());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (fThirdPersonCam) |
|
|
|
if (fThirdPersonCam) |
|
|
|
PushCamera(fThirdPersonCam); |
|
|
|
PushCamera(fThirdPersonCam); |
|
|
@ -429,7 +428,7 @@ void plVirtualCam1::Reset(hsBool bRender) |
|
|
|
|
|
|
|
|
|
|
|
void plVirtualCam1::ClearStack() |
|
|
|
void plVirtualCam1::ClearStack() |
|
|
|
{ |
|
|
|
{ |
|
|
|
fCameraStack.SetCountAndZero(0); |
|
|
|
fCameraStack.clear(); |
|
|
|
plUoid U(kDefaultCameraMod1_KEY); |
|
|
|
plUoid U(kDefaultCameraMod1_KEY); |
|
|
|
plKey pKey = hsgResMgr::ResMgr()->FindKey(U); |
|
|
|
plKey pKey = hsgResMgr::ResMgr()->FindKey(U); |
|
|
|
if (pKey) |
|
|
|
if (pKey) |
|
|
@ -451,10 +450,9 @@ plCameraModifier1* plVirtualCam1::GetCurrentCamera() |
|
|
|
return(fFirstPersonOverride); |
|
|
|
return(fFirstPersonOverride); |
|
|
|
if (fTransPos == POS_TRANS_FOLLOW) |
|
|
|
if (fTransPos == POS_TRANS_FOLLOW) |
|
|
|
return(fTransitionCamera); |
|
|
|
return(fTransitionCamera); |
|
|
|
|
|
|
|
if (fCameraStack.size()) |
|
|
|
if (fCameraStack.Count()) |
|
|
|
return fCameraStack.back(); |
|
|
|
return fCameraStack[fCameraStack.Count() - 1]; |
|
|
|
return nil; |
|
|
|
else return nil; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hsBool plVirtualCam1::Is1stPersonCamera() |
|
|
|
hsBool plVirtualCam1::Is1stPersonCamera() |
|
|
@ -471,9 +469,10 @@ hsBool plVirtualCam1::Is1stPersonCamera() |
|
|
|
|
|
|
|
|
|
|
|
plCameraModifier1* plVirtualCam1::GetCurrentStackCamera() |
|
|
|
plCameraModifier1* plVirtualCam1::GetCurrentStackCamera() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fCameraStack.Count()) |
|
|
|
if (fCameraStack.size()) |
|
|
|
return fCameraStack[fCameraStack.Count() - 1]; |
|
|
|
return fCameraStack.back(); |
|
|
|
else return nil; |
|
|
|
else |
|
|
|
|
|
|
|
return nil; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void plVirtualCam1::ICreatePlate() |
|
|
|
void plVirtualCam1::ICreatePlate() |
|
|
@ -535,11 +534,12 @@ void plVirtualCam1::SetRender(hsBool render) |
|
|
|
// hack, hack, hack
|
|
|
|
// hack, hack, hack
|
|
|
|
hsBool plVirtualCam1::RestoreFromName(const plString& name) |
|
|
|
hsBool plVirtualCam1::RestoreFromName(const plString& name) |
|
|
|
{ |
|
|
|
{ |
|
|
|
for(int i = 0; i < fCamerasLoaded.Count(); i++) |
|
|
|
for(plSOVec::iterator it = fCamerasLoaded.begin(); it != fCamerasLoaded.end(); ++it) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (name.Compare(fCamerasLoaded[i]->GetKeyName()) == 0) |
|
|
|
plKey cam = (*it)->GetKey(); |
|
|
|
|
|
|
|
if (name.Compare(cam->GetName(), plString::kCaseInsensitive) == 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
RebuildStack(fCamerasLoaded[i]->GetKey()); |
|
|
|
RebuildStack(cam); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -775,33 +775,34 @@ void plVirtualCam1::IUpdate() |
|
|
|
|
|
|
|
|
|
|
|
RunTransition(); |
|
|
|
RunTransition(); |
|
|
|
|
|
|
|
|
|
|
|
for (int i=0; i < fCameraStack.Count(); i++) |
|
|
|
for (plCameraVec::iterator i = fCameraStack.begin(); i != fCameraStack.end(); ++i) |
|
|
|
{
|
|
|
|
{
|
|
|
|
hsBool update = true; |
|
|
|
hsBool update = true; |
|
|
|
for (int j=i+1; j<fCameraStack.Count(); j++) |
|
|
|
for (plCameraVec::iterator j = (i+1); j != fCameraStack.end(); ++j) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fCameraStack[i] == fCameraStack[j]) |
|
|
|
if (*i != *j) |
|
|
|
{ |
|
|
|
{ |
|
|
|
update = false; |
|
|
|
update = false; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if ((fCameraStack[i] == GetCurrentStackCamera()) && fTransPos != POS_TRANS_OFF) |
|
|
|
plCameraModifier1* cam = *i; |
|
|
|
|
|
|
|
if ((cam == GetCurrentStackCamera()) && fTransPos != POS_TRANS_OFF) |
|
|
|
update = false; |
|
|
|
update = false; |
|
|
|
if(update) |
|
|
|
if(update) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// eek...
|
|
|
|
// eek...
|
|
|
|
if(alwaysCutForColin && fCameraStack[i]->GetBrain()) |
|
|
|
if(alwaysCutForColin && cam->GetBrain()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
fCameraStack[i]->GetBrain()->SetFlags(plCameraBrain1::kCutPos); |
|
|
|
cam->GetBrain()->SetFlags(plCameraBrain1::kCutPos); |
|
|
|
fCameraStack[i]->GetBrain()->SetFlags(plCameraBrain1::kCutPOA); |
|
|
|
cam->GetBrain()->SetFlags(plCameraBrain1::kCutPOA); |
|
|
|
} |
|
|
|
} |
|
|
|
if(fForceCutOnce) |
|
|
|
if(fForceCutOnce) |
|
|
|
{ |
|
|
|
{ |
|
|
|
fCameraStack[i]->GetBrain()->SetFlags(plCameraBrain1::kCutPosOnce); |
|
|
|
cam->GetBrain()->SetFlags(plCameraBrain1::kCutPosOnce); |
|
|
|
fCameraStack[i]->GetBrain()->SetFlags(plCameraBrain1::kCutPOAOnce); |
|
|
|
cam->GetBrain()->SetFlags(plCameraBrain1::kCutPOAOnce); |
|
|
|
} |
|
|
|
} |
|
|
|
fCameraStack[i]->Update(); |
|
|
|
cam->Update(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(fForceCutOnce)fForceCutOnce=false; |
|
|
|
if(fForceCutOnce)fForceCutOnce=false; |
|
|
@ -1397,12 +1398,9 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg) |
|
|
|
// array. Since this message indicates it was destroyed anyway, this should be
|
|
|
|
// array. Since this message indicates it was destroyed anyway, this should be
|
|
|
|
// ok.
|
|
|
|
// ok.
|
|
|
|
plCameraModifier1* pMod = (plCameraModifier1*)(pRefMsg->GetRef()); |
|
|
|
plCameraModifier1* pMod = (plCameraModifier1*)(pRefMsg->GetRef()); |
|
|
|
// we go in reverse so that removes don't mess up our index
|
|
|
|
plCameraVec::iterator it = std::find(fCameraStack.begin(), fCameraStack.end(), pMod); |
|
|
|
for (int i = fCameraStack.Count() - 1; i >= 0; --i) |
|
|
|
if (it != fCameraStack.end()) |
|
|
|
{ |
|
|
|
fCameraStack.erase(it); |
|
|
|
if (fCameraStack[i] == pMod) |
|
|
|
|
|
|
|
fCameraStack.Remove(i); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
@ -1495,7 +1493,7 @@ void plVirtualCam1::CreateDefaultCamera(plSceneObject* subject) |
|
|
|
|
|
|
|
|
|
|
|
void plVirtualCam1::AddCameraToStack(plCameraModifier1* pCam) |
|
|
|
void plVirtualCam1::AddCameraToStack(plCameraModifier1* pCam) |
|
|
|
{ |
|
|
|
{ |
|
|
|
fCameraStack.Append(pCam); |
|
|
|
fCameraStack.push_back(pCam); |
|
|
|
if (pCam->GetBrain()) |
|
|
|
if (pCam->GetBrain()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (HasMovementFlag(B_CONTROL_CAMERA_WALK_PAN)) |
|
|
|
if (HasMovementFlag(B_CONTROL_CAMERA_WALK_PAN)) |
|
|
@ -1665,9 +1663,9 @@ void plVirtualCam1::PushCamera(plCameraModifier1* pCam, hsBool bDefault) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
// make this the default camera if that's what we want...
|
|
|
|
// make this the default camera if that's what we want...
|
|
|
|
if (fCameraStack.Count() > 0 && bDefault) |
|
|
|
if (fCameraStack.size() > 0 && bDefault) |
|
|
|
{
|
|
|
|
{
|
|
|
|
fCameraStack.SetCountAndZero(0); |
|
|
|
fCameraStack.clear(); |
|
|
|
AddCameraToStack(pCam); |
|
|
|
AddCameraToStack(pCam); |
|
|
|
#ifdef STATUS_LOG |
|
|
|
#ifdef STATUS_LOG |
|
|
|
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()); |
|
|
@ -1679,15 +1677,15 @@ void plVirtualCam1::PushCamera(plCameraModifier1* pCam, hsBool bDefault) |
|
|
|
void plVirtualCam1::PopCamera(plCameraModifier1* pCam) |
|
|
|
void plVirtualCam1::PopCamera(plCameraModifier1* pCam) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// sanity / new default camera check
|
|
|
|
// sanity / new default camera check
|
|
|
|
if (fCameraStack.Count() <= 1) |
|
|
|
if (fCameraStack.size() <= 1) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
// is it the current camera AND the same camera we would otherwise switch to?
|
|
|
|
// is it the current camera AND the same camera we would otherwise switch to?
|
|
|
|
if (pCam==GetCurrentStackCamera() && pCam == fCameraStack[fCameraStack.Count() - 2]) |
|
|
|
if (pCam==GetCurrentStackCamera() && pCam == fCameraStack[fCameraStack.size() - 2]) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// pop but don't transition to a new camera
|
|
|
|
// pop but don't transition to a new camera
|
|
|
|
// or do anything else:
|
|
|
|
// or do anything else:
|
|
|
|
fCameraStack.Remove(fCameraStack.Count() - 1); |
|
|
|
fCameraStack.pop_back(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1709,7 +1707,7 @@ void plVirtualCam1::PopCamera(plCameraModifier1* pCam) |
|
|
|
!GetCurrentStackCamera()) |
|
|
|
!GetCurrentStackCamera()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// special camera mode (like drive) just pop it
|
|
|
|
// special camera mode (like drive) just pop it
|
|
|
|
fCameraStack.Remove(fCameraStack.Count() - 1); |
|
|
|
fCameraStack.pop_back(); |
|
|
|
GetCurrentStackCamera()->Push(!HasFlags(kAvatarWalking));
|
|
|
|
GetCurrentStackCamera()->Push(!HasFlags(kAvatarWalking));
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -1721,7 +1719,7 @@ void plVirtualCam1::PopCamera(plCameraModifier1* pCam) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// pop and actually transition to a new camera
|
|
|
|
// pop and actually transition to a new camera
|
|
|
|
fCameraStack.Remove(fCameraStack.Count() - 1); |
|
|
|
fCameraStack.pop_back(); |
|
|
|
|
|
|
|
|
|
|
|
if (GetCurrentStackCamera()) |
|
|
|
if (GetCurrentStackCamera()) |
|
|
|
{
|
|
|
|
{
|
|
|
@ -1804,14 +1802,9 @@ void plVirtualCam1::PopCamera(plCameraModifier1* pCam) |
|
|
|
IHandleCameraStatusLog(pCam, kBackgroundPop); |
|
|
|
IHandleCameraStatusLog(pCam, kBackgroundPop); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
// just remove this from the stack
|
|
|
|
// just remove this from the stack
|
|
|
|
for (int i = 0; i < fCameraStack.Count(); i++) |
|
|
|
plCameraVec::iterator it = std::find(fCameraStack.begin(), fCameraStack.end(), pCam); |
|
|
|
{ |
|
|
|
if (it != fCameraStack.end()) |
|
|
|
if (fCameraStack[i] == pCam) |
|
|
|
fCameraStack.erase(it); |
|
|
|
{
|
|
|
|
|
|
|
|
fCameraStack.Remove(i); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (!InTransition()) |
|
|
|
if (!InTransition()) |
|
|
|
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
|
|
|
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
|
|
|