Disable Freelook in hardcore mode
The player getting a better view of their surroundings than the game would normally allow could possibly give the player an advantage over the original hardware, so Freelook is disabled in hardcore mode. To do this, I disable the config flag for Freelook when it is accessed, to make sure that it is disabled whether it was enabled before or after hardcore mode was enabled.
This commit is contained in:
parent
1a19a92943
commit
0abfa94bc8
|
@ -3,7 +3,9 @@
|
|||
|
||||
#include "Core/FreeLookConfig.h"
|
||||
|
||||
#include "Core/AchievementManager.h"
|
||||
#include "Core/CPUThreadConfigCallback.h"
|
||||
#include "Core/Config/AchievementSettings.h"
|
||||
#include "Core/Config/FreeLookSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
|
@ -44,6 +46,11 @@ void Config::Refresh()
|
|||
}
|
||||
|
||||
camera_config.control_type = ::Config::Get(::Config::FL1_CONTROL_TYPE);
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
enabled = ::Config::Get(::Config::FREE_LOOK_ENABLED) &&
|
||||
!AchievementManager::GetInstance()->IsHardcoreModeActive();
|
||||
#else // USE_RETRO_ACHIEVEMENTS
|
||||
enabled = ::Config::Get(::Config::FREE_LOOK_ENABLED);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
}
|
||||
} // namespace FreeLook
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Core/AchievementManager.h"
|
||||
#include "Core/Config/AchievementSettings.h"
|
||||
#include "Core/Config/FreeLookSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
|
@ -36,6 +38,10 @@ void FreeLookWidget::CreateLayout()
|
|||
m_enable_freelook->SetDescription(
|
||||
tr("Allows manipulation of the in-game camera.<br><br><dolphin_emphasis>If unsure, "
|
||||
"leave this unchecked.</dolphin_emphasis>"));
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
bool hardcore = AchievementManager::GetInstance()->IsHardcoreModeActive();
|
||||
m_enable_freelook->setEnabled(!hardcore);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
m_freelook_controller_configure_button = new NonDefaultQPushButton(tr("Configure Controller"));
|
||||
|
||||
m_freelook_control_type = new ConfigChoice({tr("Six Axis"), tr("First Person"), tr("Orbital")},
|
||||
|
@ -106,6 +112,10 @@ void FreeLookWidget::LoadSettings()
|
|||
{
|
||||
const bool checked = Config::Get(Config::FREE_LOOK_ENABLED);
|
||||
m_enable_freelook->setChecked(checked);
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
bool hardcore = AchievementManager::GetInstance()->IsHardcoreModeActive();
|
||||
m_enable_freelook->setEnabled(!hardcore);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
m_freelook_control_type->setEnabled(checked);
|
||||
m_freelook_controller_configure_button->setEnabled(checked);
|
||||
m_freelook_background_input->setEnabled(checked);
|
||||
|
|
|
@ -9,10 +9,12 @@
|
|||
#include <QVBoxLayout>
|
||||
|
||||
#include "DolphinQt/Config/FreeLookWidget.h"
|
||||
#include "DolphinQt/Config/HardcoreWarningWidget.h"
|
||||
|
||||
FreeLookWindow::FreeLookWindow(QWidget* parent) : QDialog(parent)
|
||||
{
|
||||
CreateMainLayout();
|
||||
ConnectWidgets();
|
||||
|
||||
setWindowTitle(tr("Free Look Settings"));
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
@ -20,11 +22,26 @@ FreeLookWindow::FreeLookWindow(QWidget* parent) : QDialog(parent)
|
|||
|
||||
void FreeLookWindow::CreateMainLayout()
|
||||
{
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
m_hc_warning = new HardcoreWarningWidget(this);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
|
||||
auto* main_layout = new QVBoxLayout();
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
main_layout->addWidget(m_hc_warning);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
main_layout->addWidget(new FreeLookWidget(this));
|
||||
main_layout->addWidget(m_button_box);
|
||||
setLayout(main_layout);
|
||||
}
|
||||
|
||||
void FreeLookWindow::ConnectWidgets()
|
||||
{
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
connect(m_hc_warning, &HardcoreWarningWidget::OpenAchievementSettings, this,
|
||||
&FreeLookWindow::OpenAchievementSettings);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
class HardcoreWarningWidget;
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
class QDialogButtonBox;
|
||||
|
||||
class FreeLookWindow final : public QDialog
|
||||
|
@ -13,8 +16,17 @@ class FreeLookWindow final : public QDialog
|
|||
public:
|
||||
explicit FreeLookWindow(QWidget* parent);
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
signals:
|
||||
void OpenAchievementSettings();
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
private:
|
||||
void CreateMainLayout();
|
||||
void ConnectWidgets();
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
HardcoreWarningWidget* m_hc_warning;
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
QDialogButtonBox* m_button_box;
|
||||
};
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include "Common/Config/Config.h"
|
||||
#include "Common/Thread.h"
|
||||
|
||||
#include "Core/AchievementManager.h"
|
||||
#include "Core/Config/AchievementSettings.h"
|
||||
#include "Core/Config/FreeLookSettings.h"
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
|
@ -579,7 +581,15 @@ void HotkeyScheduler::Run()
|
|||
{
|
||||
const bool new_value = !Config::Get(Config::FREE_LOOK_ENABLED);
|
||||
Config::SetCurrent(Config::FREE_LOOK_ENABLED, new_value);
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
bool hardcore = AchievementManager::GetInstance()->IsHardcoreModeActive();
|
||||
if (hardcore)
|
||||
OSD::AddMessage("Free Look is Disabled in Hardcore Mode");
|
||||
else
|
||||
OSD::AddMessage(fmt::format("Free Look: {}", new_value ? "Enabled" : "Disabled"));
|
||||
#else // USE_RETRO_ACHIEVEMENTS
|
||||
OSD::AddMessage(fmt::format("Free Look: {}", new_value ? "Enabled" : "Disabled"));
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
}
|
||||
|
||||
// Savestates
|
||||
|
|
|
@ -1244,6 +1244,11 @@ void MainWindow::ShowFreeLookWindow()
|
|||
{
|
||||
m_freelook_window = new FreeLookWindow(this);
|
||||
InstallHotkeyFilter(m_freelook_window);
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
connect(m_freelook_window, &FreeLookWindow::OpenAchievementSettings, this,
|
||||
&MainWindow::ShowAchievementSettings);
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
}
|
||||
|
||||
SetQWidgetWindowDecorations(m_freelook_window);
|
||||
|
|
Loading…
Reference in New Issue