Removed CAM_TYPE_DIALOG

master
krzys-h 2016-05-28 12:50:32 +02:00
parent 9feea63086
commit 942f746a21
6 changed files with 20 additions and 22 deletions

View File

@ -40,6 +40,7 @@ enum PauseType
PAUSE_PHOTO = (1<<2), //!< photo mode, TODO: remove PAUSE_PHOTO = (1<<2), //!< photo mode, TODO: remove
PAUSE_OBJECT_UPDATES = (1<<3), //!< do not send events to objects PAUSE_OBJECT_UPDATES = (1<<3), //!< do not send events to objects
PAUSE_MUTE_SOUND = (1<<4), //!< mute sound PAUSE_MUTE_SOUND = (1<<4), //!< mute sound
PAUSE_CAMERA = (1<<5), //!< freeze camera
}; };
inline PauseType& operator|=(PauseType& a, const PauseType& b) inline PauseType& operator|=(PauseType& a, const PauseType& b)
{ {

View File

@ -1163,6 +1163,9 @@ void CCamera::EventMouseButton(const Event &event)
bool CCamera::EventFrame(const Event &event) bool CCamera::EventFrame(const Event &event)
{ {
if (m_freeze)
return true;
Math::Point newDelta = m_mouseDeltaEdge * m_speed * event.rTime; Math::Point newDelta = m_mouseDeltaEdge * m_speed * event.rTime;
if (m_cameraInvertX) if (m_cameraInvertX)
newDelta.x = -newDelta.x; newDelta.x = -newDelta.x;
@ -1177,9 +1180,6 @@ bool CCamera::EventFrame(const Event &event)
m_type == CAM_TYPE_EDIT) m_type == CAM_TYPE_EDIT)
return EventFrameFree(event, m_type != CAM_TYPE_EDIT); return EventFrameFree(event, m_type != CAM_TYPE_EDIT);
if (m_type == CAM_TYPE_DIALOG)
return EventFrameDialog(event);
if (m_type == CAM_TYPE_BACK) if (m_type == CAM_TYPE_BACK)
return EventFrameBack(event); return EventFrameBack(event);
@ -1262,11 +1262,6 @@ bool CCamera::EventFrameFree(const Event &event, bool keysAllowed)
return true; return true;
} }
bool CCamera::EventFrameDialog(const Event &event)
{
return true;
}
bool CCamera::EventFrameBack(const Event &event) bool CCamera::EventFrameBack(const Event &event)
{ {
Math::Vector cameraMove = CalculateCameraMovement(event); Math::Vector cameraMove = CalculateCameraMovement(event);
@ -1625,4 +1620,9 @@ Math::Vector CCamera::CalculateCameraMovement(const Event &event, bool keysAllow
return delta; return delta;
} }
void CCamera::SetFreeze(bool freeze)
{
m_freeze = freeze;
}
} }

View File

@ -63,8 +63,6 @@ enum CameraType
CAM_TYPE_INFO = 8, CAM_TYPE_INFO = 8,
//! Visit instead of an error //! Visit instead of an error
CAM_TYPE_VISIT = 9, CAM_TYPE_VISIT = 9,
//! Camera for dialog
CAM_TYPE_DIALOG = 10,
//! Static camera height //! Static camera height
CAM_TYPE_PLANE = 11, CAM_TYPE_PLANE = 11,
}; };
@ -211,6 +209,9 @@ public:
void SetCameraInvertY(bool invert); void SetCameraInvertY(bool invert);
bool GetCameraInvertY(); bool GetCameraInvertY();
//! Temporarily freeze camera movement
void SetFreeze(bool freeze);
void SetCameraSpeed(float speed); void SetCameraSpeed(float speed);
protected: protected:
@ -225,8 +226,6 @@ protected:
//! Moves the point of view //! Moves the point of view
bool EventFrameFree(const Event &event, bool keysAllowed); bool EventFrameFree(const Event &event, bool keysAllowed);
//! Moves the point of view //! Moves the point of view
bool EventFrameDialog(const Event &event);
//! Moves the point of view
bool EventFrameBack(const Event &event); bool EventFrameBack(const Event &event);
//! Moves the point of view //! Moves the point of view
bool EventFrameFix(const Event &event); bool EventFrameFix(const Event &event);
@ -389,6 +388,9 @@ protected:
bool m_cameraInvertX; bool m_cameraInvertX;
//! Y inversion in the edges? //! Y inversion in the edges?
bool m_cameraInvertY; bool m_cameraInvertY;
//! Is camera frozen?
bool m_freeze = false;
}; };

View File

@ -456,7 +456,7 @@ void CRobotMain::ChangePhase(Phase phase)
FlushNewScriptName(); FlushNewScriptName();
m_sound->SetListener(Math::Vector(0.0f, 0.0f, 0.0f), Math::Vector(0.0f, 0.0f, 1.0f)); m_sound->SetListener(Math::Vector(0.0f, 0.0f, 0.0f), Math::Vector(0.0f, 0.0f, 1.0f));
m_sound->StopAll(); m_sound->StopAll();
m_camera->SetType(Gfx::CAM_TYPE_DIALOG); m_camera->SetType(Gfx::CAM_TYPE_NULL);
m_movie->Flush(); m_movie->Flush();
m_movieInfoIndex = -1; m_movieInfoIndex = -1;
m_cameraPan = 0.0f; m_cameraPan = 0.0f;
@ -1589,7 +1589,7 @@ void CRobotMain::StartSuspend()
{ {
m_sound->MuteAll(true); m_sound->MuteAll(true);
ClearInterface(); ClearInterface();
m_suspend = m_pause->ActivatePause(PAUSE_ENGINE|PAUSE_HIDE_SHORTCUTS|PAUSE_MUTE_SOUND); m_suspend = m_pause->ActivatePause(PAUSE_ENGINE|PAUSE_HIDE_SHORTCUTS|PAUSE_MUTE_SOUND|PAUSE_CAMERA);
m_engine->SetOverFront(false); // over flat behind m_engine->SetOverFront(false); // over flat behind
CreateShortcuts(); CreateShortcuts();
@ -1597,9 +1597,6 @@ void CRobotMain::StartSuspend()
m_infoObject = DeselectAll(); // removes the control buttons m_infoObject = DeselectAll(); // removes the control buttons
m_displayText->HideText(true); m_displayText->HideText(true);
m_suspendInitCamera = m_camera->GetType();
m_camera->SetType(Gfx::CAM_TYPE_DIALOG);
m_engine->EnablePauseBlur(); m_engine->EnablePauseBlur();
} }
@ -1618,8 +1615,6 @@ void CRobotMain::StopSuspend()
m_map->ShowMap(m_mapShow); m_map->ShowMap(m_mapShow);
m_displayText->HideText(false); m_displayText->HideText(false);
m_camera->SetType(m_suspendInitCamera);
m_engine->DisablePauseBlur(); m_engine->DisablePauseBlur();
} }
@ -4975,7 +4970,7 @@ void CRobotMain::ResetCreate()
m_particle->FlushParticle(); m_particle->FlushParticle();
m_terrain->FlushBuildingLevel(); m_terrain->FlushBuildingLevel();
m_camera->SetType(Gfx::CAM_TYPE_DIALOG); m_camera->SetType(Gfx::CAM_TYPE_NULL);
try try
{ {
@ -5500,6 +5495,7 @@ void CRobotMain::StartMusic()
void CRobotMain::UpdatePause(PauseType pause) void CRobotMain::UpdatePause(PauseType pause)
{ {
m_engine->SetPause(pause & PAUSE_ENGINE); m_engine->SetPause(pause & PAUSE_ENGINE);
m_camera->SetFreeze(pause & PAUSE_CAMERA);
m_sound->MuteAll(pause & PAUSE_MUTE_SOUND); m_sound->MuteAll(pause & PAUSE_MUTE_SOUND);
CreateShortcuts(); CreateShortcuts();
if (pause != PAUSE_NONE) HiliteClear(); if (pause != PAUSE_NONE) HiliteClear();

View File

@ -506,7 +506,6 @@ protected:
char m_mapFilename[100] = {}; char m_mapFilename[100] = {};
ActivePause* m_suspend = nullptr; ActivePause* m_suspend = nullptr;
Gfx::CameraType m_suspendInitCamera = Gfx::CAM_TYPE_NULL;
Math::Point m_tooltipPos; Math::Point m_tooltipPos;
std::string m_tooltipName; std::string m_tooltipName;

View File

@ -148,7 +148,7 @@ CScreenSetup* CMainUserInterface::GetSetupScreen(Phase phase)
void CMainUserInterface::ChangePhase(Phase phase) void CMainUserInterface::ChangePhase(Phase phase)
{ {
m_main->GetCamera()->SetType(Gfx::CAM_TYPE_DIALOG); m_main->GetCamera()->SetType(Gfx::CAM_TYPE_NULL);
m_engine->SetOverFront(false); m_engine->SetOverFront(false);
m_engine->SetOverColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::ENG_RSTATE_TCOLOR_BLACK); // TODO: color ok? m_engine->SetOverColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::ENG_RSTATE_TCOLOR_BLACK); // TODO: color ok?