mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Core: Eliminate FreeLookConfig by putting the "active config" within FreeLookCamera.
This commit is contained in:
@@ -4,18 +4,13 @@
|
||||
#include "VideoCommon/FreeLookCamera.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "Common/MathUtil.h"
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Core/Core.h"
|
||||
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
|
||||
FreeLookCamera g_freelook_camera;
|
||||
|
||||
namespace
|
||||
@@ -260,21 +255,18 @@ float CameraControllerInput::GetSpeed() const
|
||||
|
||||
FreeLookCamera::FreeLookCamera()
|
||||
{
|
||||
SetControlType(FreeLook::ControlType::SixAxis);
|
||||
RefreshConfig();
|
||||
}
|
||||
|
||||
void FreeLookCamera::SetControlType(FreeLook::ControlType type)
|
||||
void FreeLookCamera::RefreshConfig()
|
||||
{
|
||||
if (m_current_type && *m_current_type == type)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_is_enabled = Config::Get(Config::FREE_LOOK_ENABLED);
|
||||
const auto type = Config::Get(Config::FL1_CONTROL_TYPE);
|
||||
|
||||
if (type == FreeLook::ControlType::SixAxis)
|
||||
{
|
||||
m_camera_controller = std::make_unique<SixAxisController>();
|
||||
}
|
||||
else if (type == FreeLook::ControlType::Orbital)
|
||||
if (m_current_type == type)
|
||||
return;
|
||||
|
||||
if (type == FreeLook::ControlType::Orbital)
|
||||
{
|
||||
m_camera_controller = std::make_unique<OrbitalController>();
|
||||
}
|
||||
@@ -282,6 +274,10 @@ void FreeLookCamera::SetControlType(FreeLook::ControlType type)
|
||||
{
|
||||
m_camera_controller = std::make_unique<FPSController>();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_camera_controller = std::make_unique<SixAxisController>();
|
||||
}
|
||||
|
||||
m_current_type = type;
|
||||
}
|
||||
@@ -330,7 +326,7 @@ void FreeLookCamera::DoState(PointerWrap& p)
|
||||
|
||||
bool FreeLookCamera::IsActive() const
|
||||
{
|
||||
return FreeLook::GetActiveConfig().enabled;
|
||||
return m_is_enabled;
|
||||
}
|
||||
|
||||
CameraController* FreeLookCamera::GetController() const
|
||||
|
||||
Reference in New Issue
Block a user