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:
LillyJadeKatrin
2023-06-07 22:14:54 -04:00
parent 1a19a92943
commit 0abfa94bc8
6 changed files with 61 additions and 0 deletions

View File

@ -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
}