Minor improvments to plane camera

master
krzys-h 2015-09-06 20:33:04 +02:00
parent 582e3c865f
commit b058a6986b
3 changed files with 19 additions and 6 deletions

View File

@ -419,16 +419,26 @@ float CCamera::GetDist()
return m_fixDist; return m_fixDist;
} }
void CCamera::SetFixDirection(float angle) void CCamera::SetFixDirectionH(float angle)
{ {
m_fixDirectionH = angle; m_fixDirectionH = angle;
} }
float CCamera::GetFixDirection() float CCamera::GetFixDirectionH()
{ {
return m_fixDirectionH; return m_fixDirectionH;
} }
void CCamera::SetFixDirectionV(float angle)
{
m_fixDirectionV = angle;
}
float CCamera::GetFixDirectionV()
{
return m_fixDirectionV;
}
void CCamera::SetRemotePan(float value) void CCamera::SetRemotePan(float value)
{ {
m_remotePan = value; m_remotePan = value;
@ -1531,6 +1541,7 @@ bool CCamera::EventFrameFix(const Event &event)
// Up/Down // Up/Down
m_fixDirectionV -= event.cameraInput.y * event.rTime * 0.7f * m_speed; m_fixDirectionV -= event.cameraInput.y * event.rTime * 0.7f * m_speed;
m_fixDirectionV = Math::Min(Math::Max(m_fixDirectionV, -0.5*Math::PI), 0.25*Math::PI);
if ((m_mouseDirH != 0) || (m_mouseDirV != 0)) if ((m_mouseDirH != 0) || (m_mouseDirV != 0))
AbortCentering(); // special stops framing AbortCentering(); // special stops framing

View File

@ -160,8 +160,10 @@ public:
float GetDist(); float GetDist();
//! Manage angle mode CAM_TYPE_FIX //! Manage angle mode CAM_TYPE_FIX
void SetFixDirection(float angle); void SetFixDirectionH(float angle);
float GetFixDirection(); float GetFixDirectionH();
void SetFixDirectionV(float angle);
float GetFixDirectionV();
//! Managing the triggering mode of the camera panning //! Managing the triggering mode of the camera panning
void SetRemotePan(float value); void SetRemotePan(float value);

View File

@ -2637,7 +2637,6 @@ bool CRobotMain::EventFrame(const Event &event)
// NOTE: It's important to do this AFTER the first update event finished processing // NOTE: It's important to do this AFTER the first update event finished processing
// because otherwise all robot parts are misplaced // because otherwise all robot parts are misplaced
m_userPause = m_pause->ActivatePause(PAUSE_CODE_BATTLE_LOCK); m_userPause = m_pause->ActivatePause(PAUSE_CODE_BATTLE_LOCK);
m_sound->MuteAll(false); // Allow sound
m_codeBattleInit = true; // Will start on resume m_codeBattleInit = true; // Will start on resume
} }
@ -2649,6 +2648,7 @@ bool CRobotMain::EventFrame(const Event &event)
// Deselect object, but keep camera attached to it // Deselect object, but keep camera attached to it
CObject* obj = DeselectAll(); CObject* obj = DeselectAll();
SelectObject(obj, false); // this uses code battle selection mode already SelectObject(obj, false); // this uses code battle selection mode already
m_camera->SetFixDirectionV(-0.25f*Math::PI);
m_eventQueue->AddEvent(Event(EVENT_UPDINTERFACE)); m_eventQueue->AddEvent(Event(EVENT_UPDINTERFACE));
} }
@ -3597,7 +3597,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
if (line->GetParam("fadeIn")->AsBool(false)) if (line->GetParam("fadeIn")->AsBool(false))
m_camera->StartOver(Gfx::CAM_OVER_EFFECT_FADEIN_WHITE, Math::Vector(0.0f, 0.0f, 0.0f), 1.0f); m_camera->StartOver(Gfx::CAM_OVER_EFFECT_FADEIN_WHITE, Math::Vector(0.0f, 0.0f, 0.0f), 1.0f);
m_camera->SetFixDirection(line->GetParam("fixDirection")->AsFloat(0.25f)*Math::PI); m_camera->SetFixDirectionH(line->GetParam("fixDirection")->AsFloat(0.25f)*Math::PI);
continue; continue;
} }