VideoCommon: Add speed to Free Look camera

This commit is contained in:
iwubcode 2020-06-12 00:17:40 -05:00
parent d61c64684b
commit cb6ae6a4b1
2 changed files with 22 additions and 0 deletions

View File

@ -258,10 +258,26 @@ void FreeLookCamera::Reset()
m_dirty = true;
}
void FreeLookCamera::ModifySpeed(float multiplier)
{
m_speed *= multiplier;
}
void FreeLookCamera::ResetSpeed()
{
m_speed = 1.0f;
}
float FreeLookCamera::GetSpeed() const
{
return m_speed;
}
void FreeLookCamera::DoState(PointerWrap& p)
{
if (p.mode == PointerWrap::MODE_WRITE || p.mode == PointerWrap::MODE_MEASURE)
{
p.Do(m_speed);
p.Do(m_current_type);
p.Do(m_fov_x);
p.Do(m_fov_y);
@ -273,6 +289,7 @@ void FreeLookCamera::DoState(PointerWrap& p)
else
{
const auto old_type = m_current_type;
p.Do(m_speed);
p.Do(m_current_type);
p.Do(m_fov_x);
p.Do(m_fov_y);

View File

@ -63,6 +63,10 @@ public:
bool IsDirty() const;
void SetClean();
void ModifySpeed(float multiplier);
void ResetSpeed();
float GetSpeed() const;
private:
bool m_dirty = false;
float m_fov_x = 1.0f;
@ -71,6 +75,7 @@ private:
std::unique_ptr<CameraController> m_camera_controller;
float m_fov_step_size = 0.025f;
float m_speed = 1.0f;
};
extern FreeLookCamera g_freelook_camera;