diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2025-11-12 17:22:41 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2025-11-12 18:01:53 -0600 |
| commit | be95035cc47fe747c567a3907e9086da89437d67 (patch) | |
| tree | d3e7f0e5c61c82bb916e3737d2176605e9a9353b /Source/Core/VideoCommon | |
| parent | c08fda96ca26d207fe5af8a41fff4caaabfda60b (diff) | |
Core: Eliminate FreeLookConfig by putting the "active config" within FreeLookCamera.
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/FreeLookCamera.cpp | 30 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/FreeLookCamera.h | 10 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/VideoConfig.cpp | 3 |
3 files changed, 21 insertions, 22 deletions
diff --git a/Source/Core/VideoCommon/FreeLookCamera.cpp b/Source/Core/VideoCommon/FreeLookCamera.cpp index 2bc7d11bb9..ba6be77d6c 100644 --- a/Source/Core/VideoCommon/FreeLookCamera.cpp +++ b/Source/Core/VideoCommon/FreeLookCamera.cpp @@ -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) - { + m_is_enabled = Config::Get(Config::FREE_LOOK_ENABLED); + const auto type = Config::Get(Config::FL1_CONTROL_TYPE); + + if (m_current_type == type) return; - } - if (type == FreeLook::ControlType::SixAxis) - { - m_camera_controller = std::make_unique<SixAxisController>(); - } - else if (type == FreeLook::ControlType::Orbital) + 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 diff --git a/Source/Core/VideoCommon/FreeLookCamera.h b/Source/Core/VideoCommon/FreeLookCamera.h index f1ae46ce4d..91c296ad16 100644 --- a/Source/Core/VideoCommon/FreeLookCamera.h +++ b/Source/Core/VideoCommon/FreeLookCamera.h @@ -7,7 +7,7 @@ #include <optional> #include "Common/Matrix.h" -#include "Core/FreeLookConfig.h" +#include "Core/Config/FreeLookSettings.h" class PointerWrap; @@ -79,7 +79,9 @@ class FreeLookCamera { public: FreeLookCamera(); - void SetControlType(FreeLook::ControlType type); + + void RefreshConfig(); + Common::Matrix44 GetView() const; Common::Vec2 GetFieldOfViewMultiplier() const; @@ -90,8 +92,10 @@ public: CameraController* GetController() const; private: - std::optional<FreeLook::ControlType> m_current_type; std::unique_ptr<CameraController> m_camera_controller; + + bool m_is_enabled{}; + std::optional<FreeLook::ControlType> m_current_type; }; extern FreeLookCamera g_freelook_camera; diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index a15331569d..d2cacd7276 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -305,10 +305,9 @@ void CheckForConfigChanges() const auto old_hdr = g_ActiveConfig.bHDR; UpdateActiveConfig(); - FreeLook::UpdateActiveConfig(); g_vertex_manager->OnConfigChange(); - g_freelook_camera.SetControlType(FreeLook::GetActiveConfig().camera_config.control_type); + g_freelook_camera.RefreshConfig(); if (g_ActiveConfig.bGraphicMods && !old_graphics_mods_enabled) { |
