mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-15 10:54:18 +00:00
Compare commits
6 Commits
marten/Fil
...
ticket/2
Author | SHA1 | Date | |
---|---|---|---|
874a38b351 | |||
feb0434f25 | |||
2ab6cdf49f | |||
d286bc503d | |||
9a3f202d66 | |||
a984b1159f |
@ -1545,8 +1545,7 @@ hsBool plClient::StartInit()
|
||||
fNewCamera->SetPipeline( GetPipeline() );
|
||||
|
||||
float aspectratio = (float)fPipeline->Width() / (float)fPipeline->Height();
|
||||
plVirtualCam1::SetAspectRatio(aspectratio);
|
||||
plVirtualCam1::SetFOV(plVirtualCam1::GetFOVw(), plVirtualCam1::GetFOVh());
|
||||
plVirtualCam1::Refresh();
|
||||
|
||||
pfGameGUIMgr::GetInstance()->SetAspectRatio( aspectratio );
|
||||
plMouseDevice::Instance()->SetDisplayResolution((float)fPipeline->Width(), (float)fPipeline->Height());
|
||||
|
@ -175,18 +175,32 @@ void plCameraBrain1::Pop()
|
||||
}
|
||||
|
||||
// set the goal to which we want to animate the fov
|
||||
void plCameraBrain1::SetFOVGoal(hsScalar h, double t)
|
||||
void plCameraBrain1::SetFOVGoal(hsScalar w, hsScalar h, double t)
|
||||
{
|
||||
if (fFOVGoal == h || h == fCamera->GetFOVh())
|
||||
if (fFOVhGoal == h || h == fCamera->GetFOVh() &&
|
||||
fFOVwGoal == w || w == fCamera->GetFOVw())
|
||||
return;
|
||||
|
||||
hsScalar dif = h - fCamera->GetFOVh();
|
||||
fFOVAnimRate = dif / ((hsScalar)t);
|
||||
fFOVhAnimRate = dif / ((hsScalar)t);
|
||||
|
||||
fFOVGoal = h;
|
||||
fFOVhGoal = h;
|
||||
fFOVStartTime = hsTimer::GetSysSeconds();
|
||||
fFOVEndTime = fFOVStartTime + t;
|
||||
|
||||
if (w == 0.f)
|
||||
{
|
||||
fFOVwGoal = IMakeFOVwZoom(h);
|
||||
dif = fFOVwGoal - fCamera->GetFOVw();
|
||||
fFOVwAnimRate = dif / ((float)t);
|
||||
}
|
||||
else
|
||||
{
|
||||
dif = w - fCamera->GetFOVw();
|
||||
fFOVwAnimRate = dif / ((float)t);
|
||||
fFOVwGoal = w;
|
||||
}
|
||||
|
||||
fFlags.SetBit(kAnimateFOV);
|
||||
}
|
||||
|
||||
@ -239,19 +253,26 @@ void plCameraBrain1::Update(hsBool forced)
|
||||
// adjust FOV based on elapsed time
|
||||
void plCameraBrain1::IAnimateFOV(double time)
|
||||
{
|
||||
hsScalar dH = fFOVAnimRate * hsTimer::GetDelSysSeconds();
|
||||
hsScalar dH = fFOVhAnimRate * hsTimer::GetDelSysSeconds();
|
||||
hsScalar dW = fFOVwAnimRate * hsTimer::GetDelSysSeconds();
|
||||
|
||||
dH += fCamera->GetFOVh();
|
||||
dW += fCamera->GetFOVw();
|
||||
|
||||
if ( (fFOVAnimRate < 0.0f && dH <= fFOVGoal) ||
|
||||
(fFOVAnimRate > 0.0f && dH >= fFOVGoal) )
|
||||
if ( (fFOVhAnimRate < 0.0f && dH <= fFOVhGoal) ||
|
||||
(fFOVhAnimRate > 0.0f && dH >= fFOVhGoal) )
|
||||
{
|
||||
fFlags.ClearBit(kAnimateFOV);
|
||||
dH = fFOVGoal;
|
||||
dH = fFOVhGoal;
|
||||
}
|
||||
if ( (fFOVwAnimRate < 0.0f && dW <= fFOVwGoal) ||
|
||||
(fFOVwAnimRate > 0.0f && dW >= fFOVwGoal) )
|
||||
{
|
||||
dW = fFOVwGoal;
|
||||
}
|
||||
|
||||
fCamera->SetFOVw( (hsScalar)(dH * plVirtualCam1::GetAspectRatio()) );
|
||||
fCamera->SetFOVh( dH );
|
||||
if (dW == fFOVwGoal && dH == fFOVhGoal)
|
||||
fFlags.ClearBit(kAnimateFOV);
|
||||
fCamera->SetFOV( dW, dH );
|
||||
|
||||
}
|
||||
|
||||
@ -534,6 +555,14 @@ void plCameraBrain1::Write(hsStream* stream, hsResMgr* mgr)
|
||||
stream->WriteSwapFloat(fZoomMin);
|
||||
stream->WriteSwapFloat(fZoomMax);
|
||||
}
|
||||
|
||||
hsScalar plCameraBrain1::IMakeFOVwZoom(hsScalar fovH) const
|
||||
{
|
||||
hsScalar num = hsTan(hsScalarDegToRad(fovH / 2)) * hsTan(hsScalarDegToRad(fCamera->GetFOVw() / 2));
|
||||
hsScalar denom = hsTan(hsScalarDegToRad(fCamera->GetFOVh() / 2));
|
||||
return (hsScalar)(2 * hsABS(hsScalarRadToDeg(atan(num / denom))));
|
||||
}
|
||||
|
||||
hsBool plCameraBrain1::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plCameraMsg* pCamMsg = plCameraMsg::ConvertNoRef(msg);
|
||||
@ -542,16 +571,18 @@ hsBool plCameraBrain1::MsgReceive(plMessage* msg)
|
||||
if (pCamMsg->Cmd(plCameraMsg::kStartZoomIn))
|
||||
{
|
||||
fFlags.SetBit(kAnimateFOV);
|
||||
fFOVGoal = fZoomMin;
|
||||
fFOVAnimRate = -1*fZoomRate;
|
||||
fFOVhGoal = fZoomMin;
|
||||
fFOVwGoal = IMakeFOVwZoom(fZoomMin);
|
||||
fFOVwAnimRate = fFOVhAnimRate = -1*fZoomRate;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if (pCamMsg->Cmd(plCameraMsg::kStartZoomOut))
|
||||
{
|
||||
fFlags.SetBit(kAnimateFOV);
|
||||
fFOVGoal = fZoomMax;
|
||||
fFOVAnimRate = fZoomRate;
|
||||
fFOVhGoal = fZoomMax;
|
||||
fFOVwGoal = IMakeFOVwZoom(fZoomMax);
|
||||
fFOVwAnimRate = fFOVhAnimRate = fZoomRate;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -635,8 +666,9 @@ hsBool plCameraBrain1::MsgReceive(plMessage* msg)
|
||||
if (pCMsg->GetControlCode() == B_CAMERA_ZOOM_IN && fFlags.IsBitSet(kZoomEnabled))
|
||||
{
|
||||
fFlags.SetBit(kAnimateFOV);
|
||||
fFOVGoal = fZoomMin;
|
||||
fFOVAnimRate = -1*fZoomRate;
|
||||
fFOVhGoal = fZoomMin;
|
||||
fFOVwGoal = IMakeFOVwZoom(fZoomMin);
|
||||
fFOVwAnimRate = fFOVhAnimRate = -1*fZoomRate;
|
||||
fFOVEndTime = hsTimer::GetSysSeconds() + 60;
|
||||
return true;
|
||||
}
|
||||
@ -644,8 +676,9 @@ hsBool plCameraBrain1::MsgReceive(plMessage* msg)
|
||||
if (pCMsg->GetControlCode() == B_CAMERA_ZOOM_OUT && fFlags.IsBitSet(kZoomEnabled))
|
||||
{
|
||||
fFlags.SetBit(kAnimateFOV);
|
||||
fFOVGoal = fZoomMax;
|
||||
fFOVAnimRate = fZoomRate;
|
||||
fFOVhGoal = fZoomMax;
|
||||
fFOVwGoal = IMakeFOVwZoom(fZoomMax);
|
||||
fFOVwAnimRate = fFOVhAnimRate = fZoomRate;
|
||||
fFOVEndTime = hsTimer::GetSysSeconds() + 60;
|
||||
return true;
|
||||
}
|
||||
@ -655,11 +688,12 @@ hsBool plCameraBrain1::MsgReceive(plMessage* msg)
|
||||
if (fFlags.IsBitSet(kZoomEnabled))
|
||||
{
|
||||
fFlags.SetBit(kAnimateFOV);
|
||||
fFOVGoal = fZoomMin + ((fZoomMax - fZoomMin) / 2);
|
||||
if (fCamera->GetFOVw() >= fFOVGoal)
|
||||
fFOVAnimRate = -1*fZoomRate;
|
||||
fFOVhGoal = fZoomMin + ((fZoomMax - fZoomMin) / 2);
|
||||
fFOVwGoal = IMakeFOVwZoom(fFOVhGoal);
|
||||
if (fCamera->GetFOVh() >= fFOVhGoal)
|
||||
fFOVwAnimRate = fFOVhAnimRate = -1*fZoomRate;
|
||||
else
|
||||
fFOVAnimRate = fZoomRate;
|
||||
fFOVwAnimRate = fFOVhAnimRate = fZoomRate;
|
||||
fFOVEndTime = hsTimer::GetSysSeconds() + 60;
|
||||
}
|
||||
return true;
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
|
||||
void SetGoal(hsPoint3 pt) { fGoal = pt; }
|
||||
void SetPOAGoal(hsPoint3 pt) { fPOAGoal = pt; }
|
||||
void SetFOVGoal(hsScalar h, double t);
|
||||
void SetFOVGoal(hsScalar w, hsScalar h, double t);
|
||||
void SetZoomParams(hsScalar max, hsScalar min, hsScalar rate);
|
||||
|
||||
void SetXPanLimit(hsScalar x) {fXPanLimit = x;}
|
||||
@ -183,6 +183,7 @@ protected:
|
||||
|
||||
hsScalar IClampVelocity(hsVector3* vel, hsScalar maxSpeed, double elapsedTime);
|
||||
hsBool IShouldDecelerate(hsScalar decelSpeed, hsScalar curSpeed, hsScalar distToGoal);
|
||||
hsScalar IMakeFOVwZoom(hsScalar fovH) const;
|
||||
|
||||
plCameraModifier1* fCamera;
|
||||
plKey fSubjectKey;
|
||||
@ -203,10 +204,10 @@ protected:
|
||||
hsScalar fXPanLimit;
|
||||
hsScalar fZPanLimit;
|
||||
hsScalar fPanSpeed;
|
||||
hsScalar fFOVGoal;
|
||||
hsScalar fFOVwGoal, fFOVhGoal;
|
||||
double fFOVStartTime;
|
||||
double fFOVEndTime;
|
||||
hsScalar fFOVAnimRate;
|
||||
hsScalar fFOVwAnimRate, fFOVhAnimRate;
|
||||
hsScalar fZoomRate;
|
||||
hsScalar fZoomMax;
|
||||
hsScalar fZoomMin;
|
||||
|
@ -137,18 +137,26 @@ plSceneObject* plCameraModifier1::GetSubject()
|
||||
return fSubObj;
|
||||
}
|
||||
|
||||
void plCameraModifier1::SetFOV(hsScalar w, hsScalar h, bool fUpdateVCam)
|
||||
{
|
||||
fFOVw = w;
|
||||
fFOVh = h;
|
||||
if (plVirtualCam1::Instance() && fUpdateVCam)
|
||||
plVirtualCam1::SetFOV(this);
|
||||
}
|
||||
|
||||
void plCameraModifier1::SetFOVw(hsScalar f, hsBool fUpdateVCam)
|
||||
{
|
||||
fFOVw = f;
|
||||
if (plVirtualCam1::Instance() && fUpdateVCam)
|
||||
plVirtualCam1::SetFOV(fFOVw, fFOVh, this);
|
||||
plVirtualCam1::SetFOV(this);
|
||||
}
|
||||
|
||||
void plCameraModifier1::SetFOVh(hsScalar f, hsBool fUpdateVCam)
|
||||
{
|
||||
fFOVh = f;
|
||||
if (plVirtualCam1::Instance() && fUpdateVCam)
|
||||
plVirtualCam1::SetFOV(fFOVw, fFOVh, this);
|
||||
plVirtualCam1::SetFOV(this);
|
||||
}
|
||||
|
||||
hsBool plCameraModifier1::SetFaded(hsBool b)
|
||||
@ -192,8 +200,9 @@ hsBool plCameraModifier1::MsgReceive(plMessage* msg)
|
||||
double time2 = (double)pEventMsg->fEventTime;
|
||||
time = hsABS(time - time2);
|
||||
hsScalar h = fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fFOVh;
|
||||
hsScalar w = fFOVInstructions[pEventMsg->fIndex]->GetConfig()->fFOVw;
|
||||
if (GetBrain())
|
||||
GetBrain()->SetFOVGoal(h, time);
|
||||
GetBrain()->SetFOVGoal(w, h, time);
|
||||
}
|
||||
|
||||
plAnimCmdMsg* pAnimMsg = plAnimCmdMsg::ConvertNoRef(msg);
|
||||
|
@ -130,6 +130,7 @@ public:
|
||||
void SetSubworldPOA(hsPoint3 pos) { fLastSubPOA = pos; }
|
||||
hsScalar GetFOVw() { return fFOVw; }
|
||||
hsScalar GetFOVh() { return fFOVh; }
|
||||
void SetFOV(hsScalar w, hsScalar h, bool fUpdateVCam = true);
|
||||
void SetFOVw(hsScalar f, hsBool fUpdateVCam = true);
|
||||
void SetFOVh(hsScalar f, hsBool fUpdateVCam = true);
|
||||
hsBool GetInSubworld() { return fInSubLastUpdate; }
|
||||
|
@ -104,7 +104,7 @@ hsScalar plVirtualCam1::fFallTimerDelay = 0.25f;
|
||||
hsBool plVirtualCam1::alwaysCutForColin = false;
|
||||
hsBool plVirtualCam1::WalkPan3rdPerson = false;
|
||||
hsBool plVirtualCam1::StayInFirstPersonForever = false;
|
||||
float plVirtualCam1::fAspectRatio = fFOVw / fFOVh;
|
||||
float plVirtualCam1::fAspectRatio = 4.f/3.f;
|
||||
|
||||
// #define STATUS_LOG
|
||||
|
||||
@ -287,58 +287,48 @@ void plVirtualCam1::SetOffset(float x, float y, float z)
|
||||
}
|
||||
|
||||
// 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 = y;
|
||||
|
||||
if (! plVirtualCam1::Instance()->fPipe)
|
||||
return;
|
||||
fFOVh = h;
|
||||
if (fAspectRatio == fourXthree)
|
||||
fFOVw = w;
|
||||
else
|
||||
{
|
||||
float scale = fAspectRatio / fourXthree;
|
||||
fFOVw = (hsScalar)(2 * hsScalarRadToDeg(atan(scale * tan(hsScalarDegToRad(w/2)))));
|
||||
}
|
||||
|
||||
plVirtualCam1::Instance()->SetFlags(plVirtualCam1::kSetFOV);
|
||||
|
||||
#ifdef STATUS_LOG
|
||||
if (printFOV)
|
||||
camLog->AddLineF("FOV changed by console command to %f", fFOVw);
|
||||
#endif
|
||||
|
||||
}
|
||||
// static function
|
||||
void plVirtualCam1::SetFOV(hsScalar x, hsScalar y, plCameraModifier1* pCam)
|
||||
void plVirtualCam1::SetFOV(plCameraModifier1* pCam)
|
||||
{
|
||||
if (plVirtualCam1::Instance()->GetCurrentCamera() != pCam)
|
||||
return;
|
||||
SetFOV(pCam->GetFOVw(), pCam->GetFOVh());
|
||||
}
|
||||
|
||||
hsScalar diff = hsABS(fFOVw - x);
|
||||
if (diff > 10.0f)
|
||||
{
|
||||
#ifdef STATUS_LOG
|
||||
camLog->AddLineF("Radical FOV change of %f", diff);
|
||||
#endif
|
||||
void plVirtualCam1::Refresh()
|
||||
{
|
||||
plPipeline* pipe = plVirtualCam1::Instance()->fPipe;
|
||||
SetAspectRatio((float)pipe->Width() / (float)pipe->Height());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
float fovW = y * fAspectRatio;
|
||||
|
||||
fFOVw = fovW;
|
||||
fFOVh = y;
|
||||
|
||||
if (! plVirtualCam1::Instance()->fPipe)
|
||||
return;
|
||||
|
||||
plVirtualCam1::Instance()->SetFlags(plVirtualCam1::kSetFOV);
|
||||
|
||||
#ifdef STATUS_LOG
|
||||
if (printFOV)
|
||||
camLog->AddLineF("FOV changed to %f", fFOVw);
|
||||
#endif
|
||||
void plVirtualCam1::SetAspectRatio(float ratio)
|
||||
{
|
||||
fAspectRatio = ratio;
|
||||
// resize the FOV accordingly
|
||||
plCameraModifier1* pCam = plVirtualCam1::Instance()->GetCurrentCamera();
|
||||
hsAssert(pCam, "CameraModifier1 shouldn't be nullptr?");
|
||||
if (pCam)
|
||||
SetFOV(pCam->GetFOVw(), pCam->GetFOVh());
|
||||
}
|
||||
|
||||
// static function
|
||||
|
||||
void plVirtualCam1::SetDepth(hsScalar h, hsScalar y)
|
||||
{
|
||||
return;
|
||||
@ -913,7 +903,7 @@ void plVirtualCam1::FirstPersonOverride()
|
||||
#ifdef STATUS_LOG
|
||||
camLog->AddLineF("Built-In First Person Camera Disabled");
|
||||
#endif
|
||||
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
||||
SetFOV(GetCurrentStackCamera());
|
||||
GetCurrentStackCamera()->Push(!HasFlags(kAvatarWalking));
|
||||
plAvatarInputInterface::GetInstance()->CameraInThirdPerson(true);
|
||||
FreezeOutput(2);
|
||||
@ -938,7 +928,7 @@ void plVirtualCam1::FirstPersonOverride()
|
||||
fFirstPersonOverride = (plCameraModifier1*)pKey->GetObjectPtr();
|
||||
GetCurrentStackCamera()->Pop();
|
||||
fFirstPersonOverride->Push(!HasFlags(kAvatarWalking));
|
||||
SetFOV(fFirstPersonOverride->GetFOVw(), fFirstPersonOverride->GetFOVh(), fFirstPersonOverride);
|
||||
SetFOV(fFirstPersonOverride);
|
||||
plAvatarInputInterface::GetInstance()->CameraInThirdPerson(false);
|
||||
// no need to keep transitioning if we are currently...
|
||||
if (fTransPos == POS_TRANS_FOLLOW)
|
||||
@ -1178,12 +1168,12 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg)
|
||||
#endif
|
||||
if (fFirstPersonOverride)
|
||||
{
|
||||
SetFOV(fFirstPersonOverride->GetFOVw(), fFirstPersonOverride->GetFOVh(), fFirstPersonOverride);
|
||||
SetFOV(fFirstPersonOverride);
|
||||
fFirstPersonOverride->Push(!HasFlags(kAvatarWalking));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
||||
SetFOV(GetCurrentStackCamera());
|
||||
GetCurrentStackCamera()->Push(!HasFlags(kAvatarWalking));
|
||||
}
|
||||
|
||||
@ -1243,7 +1233,7 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg)
|
||||
pTrans->fCutPOA = pTrans->fCutPos = true;
|
||||
StartTransition(pTrans);
|
||||
delete(pTrans);
|
||||
SetFOV(fPythonOverride->GetFOVw(), fPythonOverride->GetFOVh(), fPythonOverride);
|
||||
SetFOV(fPythonOverride);
|
||||
ClearFlags(kFirstPersonEnabled);
|
||||
}
|
||||
}
|
||||
@ -1289,7 +1279,7 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg)
|
||||
#ifdef STATUS_LOG
|
||||
camLog->AddLineF("Forcing 3rd Person from scripts");
|
||||
#endif
|
||||
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
||||
SetFOV(GetCurrentStackCamera());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1320,7 +1310,7 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg)
|
||||
#ifdef STATUS_LOG
|
||||
camLog->AddLineF("Forcing 3rd Person from code");
|
||||
#endif
|
||||
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
||||
SetFOV(GetCurrentStackCamera());
|
||||
}
|
||||
ClearFlags(kFirstPersonEnabled);
|
||||
#ifdef STATUS_LOG
|
||||
@ -1384,6 +1374,11 @@ hsBool plVirtualCam1::MsgReceive(plMessage* msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (pCam->Cmd(plCameraMsg::kRefreshFOV))
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
plGenRefMsg* pRefMsg = plGenRefMsg::ConvertNoRef(msg);
|
||||
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());
|
||||
#endif
|
||||
}
|
||||
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
||||
SetFOV(GetCurrentStackCamera());
|
||||
}
|
||||
|
||||
void plVirtualCam1::PopCamera(plCameraModifier1* pCam)
|
||||
@ -1819,7 +1814,7 @@ void plVirtualCam1::PopCamera(plCameraModifier1* pCam)
|
||||
}
|
||||
}
|
||||
if (!InTransition())
|
||||
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
||||
SetFOV(GetCurrentStackCamera());
|
||||
}
|
||||
|
||||
void plVirtualCam1::PopAll()
|
||||
@ -1838,7 +1833,6 @@ void plVirtualCam1::StartTransition(CamTrans* transition)
|
||||
{
|
||||
GetCurrentStackCamera()->GetBrain()->SetFlags(plCameraBrain1::kCutPOAOnce);
|
||||
GetCurrentStackCamera()->GetBrain()->SetFlags(plCameraBrain1::kCutPosOnce);
|
||||
SetFOV(GetCurrentStackCamera()->GetFOVw(), GetCurrentStackCamera()->GetFOVh(), GetCurrentStackCamera());
|
||||
fXPanLimit = GetCurrentStackCamera()->GetBrain()->GetXPanLimit();
|
||||
fZPanLimit = GetCurrentStackCamera()->GetBrain()->GetZPanLimit();
|
||||
StartInterpPanLimits();
|
||||
@ -1984,12 +1978,8 @@ void plVirtualCam1::StartTransition(CamTrans* transition)
|
||||
else
|
||||
dist.Set(&(fTransitionCamera->GetTargetPos() - pCam->GetTargetPos()));
|
||||
|
||||
time = (double)(dist.Magnitude() / pBrain->GetVelocity());
|
||||
|
||||
// set up the transition camera to the current FOV
|
||||
fTransitionCamera->SetFOVh(GetFOVh(), false);
|
||||
fTransitionCamera->SetFOVw(GetFOVw(), false);
|
||||
fTransitionCamera->GetBrain()->SetFOVGoal(pCam->GetFOVh(), time);
|
||||
time = (dist.Magnitude() / pBrain->GetVelocity());
|
||||
fTransitionCamera->GetBrain()->SetFOVGoal(pCam->GetFOVw(), pCam->GetFOVh(), time);
|
||||
|
||||
}
|
||||
StartInterpPanLimits();
|
||||
|
@ -121,16 +121,17 @@ public:
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
static void SetFOV(hsScalar w, hsScalar h);
|
||||
static void SetFOV(hsScalar w, hsScalar h, plCameraModifier1* pCam);
|
||||
static void SetFOV(plCameraModifier1* pCam);
|
||||
static void SetDepth(hsScalar h, hsScalar y);
|
||||
static hsScalar GetFOVw() { return fFOVw; }
|
||||
static hsScalar GetFOVh() { return fFOVh; }
|
||||
static hsScalar GetHither() { return fHither; }
|
||||
static hsScalar GetYon() { return fYon; }
|
||||
static void SetOffset(float x, float y, float z);
|
||||
static void SetAspectRatio(float aspect) { fAspectRatio = aspect; }
|
||||
static void Refresh();
|
||||
static float GetAspectRatio() { return fAspectRatio; }
|
||||
|
||||
static void SetAspectRatio(float ratio);
|
||||
|
||||
hsBool InTransition() { return fTransPos != POS_TRANS_OFF; }
|
||||
plCameraModifier1* GetCurrentCamera();
|
||||
plCameraModifier1* GetCurrentStackCamera();
|
||||
|
@ -101,7 +101,12 @@ void pfGUIDialogNotifyProc::HandleExtendedEvent( pfGUIControlMod *ctrl, UInt32 e
|
||||
{
|
||||
pfGUIEditBoxMod *edit = pfGUIEditBoxMod::ConvertNoRef( ctrl );
|
||||
|
||||
if(edit && event == pfGUIEditBoxMod::kWantMessageHistoryUp)
|
||||
if(edit != nil && event == pfGUIEditBoxMod::kWantAutocomplete)
|
||||
{
|
||||
//send notify, somebody will do something with that (like python script)
|
||||
ISendNotify( ctrl->GetKey(), pfGUINotifyMsg::kSpecialAction );
|
||||
}
|
||||
else if(edit && event == pfGUIEditBoxMod::kWantMessageHistoryUp)
|
||||
{
|
||||
ISendNotify( ctrl->GetKey(), pfGUINotifyMsg::kMessageHistoryUp );
|
||||
}
|
||||
|
@ -502,16 +502,21 @@ hsBool pfGUIEditBoxMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef
|
||||
DoSomething(); // Query WasEscaped() to see if it was escape vs enter
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_UP)
|
||||
{
|
||||
// Send notify for python scripts
|
||||
HandleExtendedEvent(kWantMessageHistoryUp);
|
||||
}
|
||||
else if (key == KEY_DOWN)
|
||||
{
|
||||
// Send notify for python scripts
|
||||
HandleExtendedEvent(kWantMessageHistoryDown);
|
||||
}
|
||||
else if (key == KEY_TAB)
|
||||
{
|
||||
//Send notify for python scripts
|
||||
HandleExtendedEvent(kWantAutocomplete);
|
||||
}
|
||||
else if (key == KEY_UP)
|
||||
{
|
||||
// Send notify for python scripts
|
||||
HandleExtendedEvent(kWantMessageHistoryUp);
|
||||
}
|
||||
else if (key == KEY_DOWN)
|
||||
{
|
||||
// Send notify for python scripts
|
||||
HandleExtendedEvent(kWantMessageHistoryDown);
|
||||
}
|
||||
else if (modifiers & pfGameGUIMgr::kCtrlDown)
|
||||
{
|
||||
if (key == KEY_C)
|
||||
|
@ -135,6 +135,7 @@ class pfGUIEditBoxMod : public pfGUIControlMod
|
||||
enum ExtendedEvents
|
||||
{
|
||||
kValueChanging,
|
||||
kWantAutocomplete,
|
||||
kWantMessageHistoryUp,
|
||||
kWantMessageHistoryDown
|
||||
};
|
||||
|
@ -83,8 +83,9 @@ public:
|
||||
kFocusChange, // when one of its controls loses focus to another
|
||||
kExitMode, // GUI Exit Mode key was pressed
|
||||
kInterestingEvent, // GUI interesting-ness has changed
|
||||
kMessageHistoryUp = 9, // up key to scroll back in history
|
||||
kMessageHistoryDown,// down key to scroll forward in history
|
||||
kSpecialAction, // meaning depends on control functionality (see below)
|
||||
kMessageHistoryUp, // up key to scroll back in history
|
||||
kMessageHistoryDown,// down key to scroll forward in history
|
||||
kEndEventList
|
||||
};
|
||||
|
||||
@ -99,8 +100,9 @@ public:
|
||||
// kAction - single click on item(s)
|
||||
// kEditBox
|
||||
// kAction - enter key hit
|
||||
// kMessageHistoryUp - up key hit
|
||||
// kMessageHistoryDown - down key hit
|
||||
// kSpecialAction - tab key hit (for autocompletion on Python side)
|
||||
// kMessageHistoryUp - up key hit
|
||||
// kMessageHistoryDown - down key hit
|
||||
// kUpDownPair
|
||||
// kValueChanged - the value of the pair has been changed
|
||||
// kKnob
|
||||
|
@ -263,7 +263,7 @@ void cyCamera::SetFOV(hsScalar fov, double t)
|
||||
plCameraBrain1* camBrain = curCam->GetBrain();
|
||||
if (camBrain)
|
||||
{
|
||||
camBrain->SetFOVGoal(fov,t);
|
||||
camBrain->SetFOVGoal(0.f,fov,t);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -370,17 +370,12 @@ hsBool cyCamera::IsStayInFirstPerson()
|
||||
return false;
|
||||
}
|
||||
|
||||
void cyCamera::SetAspectRatio(float aspectratio)
|
||||
{
|
||||
plVirtualCam1::SetAspectRatio(aspectratio);
|
||||
}
|
||||
|
||||
float cyCamera::GetAspectRatio()
|
||||
{
|
||||
return plVirtualCam1::GetAspectRatio();
|
||||
}
|
||||
|
||||
void cyCamera::RefreshFOV()
|
||||
{
|
||||
plVirtualCam1::SetFOV(plVirtualCam1::GetFOVw(), plVirtualCam1::GetFOVh());
|
||||
}
|
||||
|
||||
plCameraMsg* pMsg = new plCameraMsg();
|
||||
pMsg->SetSender(fSender);
|
||||
pMsg->SetCmd(plCameraMsg::kRefreshFOV);
|
||||
pMsg->Send(fTheCam);
|
||||
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ class pyKey;
|
||||
|
||||
#include <python.h>
|
||||
#include "pyGlueHelpers.h"
|
||||
#include "../pfCamera/plVirtualCamNeu.h"
|
||||
|
||||
class cyCamera
|
||||
{
|
||||
@ -114,8 +115,8 @@ public:
|
||||
virtual void SetStayInFirstPerson(hsBool state);
|
||||
virtual hsBool IsStayInFirstPerson();
|
||||
|
||||
virtual void SetAspectRatio(float aspectratio);
|
||||
virtual float GetAspectRatio();
|
||||
virtual void SetAspectRatio(float aspectratio) { plVirtualCam1::SetAspectRatio(aspectratio); }
|
||||
virtual float GetAspectRatio() const { return plVirtualCam1::GetAspectRatio(); }
|
||||
virtual void RefreshFOV();
|
||||
};
|
||||
|
||||
|
@ -207,6 +207,7 @@ public:
|
||||
kNonPhysOn,
|
||||
kNonPhysOff,
|
||||
kResetPanning,
|
||||
kRefreshFOV,
|
||||
kNumCmds
|
||||
};
|
||||
|
||||
|
@ -2209,8 +2209,7 @@ void plDXPipeline::IResetToDefaults(D3DPRESENT_PARAMETERS *params)
|
||||
plBitmap::SetGlobalLevelChopCount(2 - fDefaultPipeParams.TextureQuality);
|
||||
|
||||
// adjust camera properties
|
||||
plVirtualCam1::SetAspectRatio((float)fSettings.fOrigWidth / (float)fSettings.fOrigHeight);
|
||||
plVirtualCam1::SetFOV(plVirtualCam1::GetFOVw(), plVirtualCam1::GetFOVh());
|
||||
plVirtualCam1::Refresh();
|
||||
|
||||
// fire off a message to the client so we can write defaults to the ini file, and adjust the window size
|
||||
plKey clientKey = hsgResMgr::ResMgr()->FindKey( kClient_KEY );
|
||||
@ -2375,8 +2374,7 @@ void plDXPipeline::ResetDisplayDevice(int Width, int Height, int ColorDepth, hsB
|
||||
fDeviceLost = true;
|
||||
fForceDeviceReset = true;
|
||||
|
||||
plVirtualCam1::SetAspectRatio((float)Width / (float)Height);
|
||||
plVirtualCam1::SetFOV(plVirtualCam1::GetFOVw(), plVirtualCam1::GetFOVh());
|
||||
plVirtualCam1::Refresh();
|
||||
|
||||
IResetDevice();
|
||||
|
||||
|
Reference in New Issue
Block a user