added new CheatFlag(sv_cheats 1/0)

This commit is contained in:
IOleg-sus 2025-01-15 15:34:14 +02:00
parent f792ec4b30
commit 387ecab0f3
3 changed files with 22 additions and 10 deletions

View File

@ -233,6 +233,10 @@ $Project "GameUI"
$File "OptionsSubVideo.h" $File "OptionsSubVideo.h"
$File "OptionsSubVoice.cpp" $File "OptionsSubVoice.cpp"
$File "OptionsSubVoice.h" $File "OptionsSubVoice.h"
$File "OptionsSubModificcation.cpp"
$File "OptionsSubModificcation.h"
} }
$Folder "Link Libraries" $Folder "Link Libraries"

View File

@ -10,11 +10,13 @@
#include "OptionsSubModification.h" #include "OptionsSubModification.h"
#include "CvarSlider.h" #include "CvarSlider.h"
#include "CvarToggleCheckButton.h"
#include "EngineInterface.h" #include "EngineInterface.h"
#include <KeyValues.h> #include <KeyValues.h>
#include <vgui/IScheme.h> #include <vgui/IScheme.h>
#include "tier1/convar.h" #include "tier1/convar.h"
#include "vgui_controls/Controls.h"
#include <vgui_controls/TextEntry.h> #include <vgui_controls/TextEntry.h>
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
@ -25,7 +27,7 @@ using namespace vgui;
COptionsSubModification::COptionsSubModification(vgui::Panel *parent) : PropertyPage(parent, nullptr) COptionsSubModification::COptionsSubModification(vgui::Panel *parent) : PropertyPage(parent, nullptr)
{ {
// Create the slider for aspect ratio adjustments // Create the slider for aspect ratio adjustments
m_pEnableModificationsCheckBox = new CCvarSlider( m_pAspectRatioSlider = new CCvarSlider(
this, this,
"AspectRatioSlider", "AspectRatioSlider",
"Aspect Ratio", "Aspect Ratio",
@ -33,13 +35,17 @@ COptionsSubModification::COptionsSubModification(vgui::Panel *parent) : Property
"r_aspectratio", "r_aspectratio",
true // Allow fractional values true // Allow fractional values
); );
m_aspectRatioLabel = new TextEntry(this, "AspectRatioLabel"); m_aspectRatioLabel = new TextEntry(this, "AspectRatioLabel");
m_aspectRatioLabel->AddActionSignalTarget(this); m_aspectRatioLabel->AddActionSignalTarget(this);
m_pChangeCheatFlag = new CCvarToggleCheckButton(
this , "ChangeCheatFlag" , "Change Cheat Flag" , "sv_cheats"
);
// Load settings from the associated resource file // Load settings from the associated resource file
LoadControlSettings("Resource\\OptionsSubModification.res"); LoadControlSettings("Resource\\OptionsSubModification.res");
UpdateLabel(m_pEnableModificationsCheckBox, m_aspectRatioLabel); UpdateLabel(m_pAspectRatioSlider, m_aspectRatioLabel);
} }
COptionsSubModification::~COptionsSubModification() = default; COptionsSubModification::~COptionsSubModification() = default;
@ -54,7 +60,7 @@ void COptionsSubModification::OnTextChanged(Panel *panel)
int numParsed = sscanf(buf, "%f", &fValue); int numParsed = sscanf(buf, "%f", &fValue);
if ((numParsed == 1) && (fValue >= 0.0f)) if ((numParsed == 1) && (fValue >= 0.0f))
{ {
m_pEnableModificationsCheckBox->SetSliderValue(fValue); m_pAspectRatioSlider->SetSliderValue(fValue);
PostActionSignal(new KeyValues("ApplyButtonEnable")); PostActionSignal(new KeyValues("ApplyButtonEnable"));
} }
} }
@ -64,8 +70,8 @@ void COptionsSubModification::OnTextChanged(Panel *panel)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void COptionsSubModification::OnResetData() void COptionsSubModification::OnResetData()
{ {
m_pEnableModificationsCheckBox->Reset(); m_pAspectRatioSlider->Reset();
// m_aspectRatioLabel->Reset(); m_pChangeCheatFlag->Reset();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -73,8 +79,9 @@ void COptionsSubModification::OnResetData()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void COptionsSubModification::OnApplyChanges() void COptionsSubModification::OnApplyChanges()
{ {
m_pEnableModificationsCheckBox->ApplyChanges(); m_pAspectRatioSlider->ApplyChanges();
// m_aspectRatioLabel->ApplyChanges(); m_pChangeCheatFlag->ApplyChanges();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -85,9 +92,9 @@ void COptionsSubModification::OnControlModified(Panel *panel)
PostActionSignal(new KeyValues("ApplyButtonEnable")); PostActionSignal(new KeyValues("ApplyButtonEnable"));
// Update the label based on slider changes // Update the label based on slider changes
if (panel == m_pEnableModificationsCheckBox && m_pEnableModificationsCheckBox->HasBeenModified()) if (panel == m_pAspectRatioSlider && m_pAspectRatioSlider->HasBeenModified())
{ {
UpdateLabel(m_pEnableModificationsCheckBox, m_aspectRatioLabel); UpdateLabel(m_pAspectRatioSlider, m_aspectRatioLabel);
} }
} }

View File

@ -76,7 +76,8 @@ private:
vgui::TextEntry *m_pTouchYawSensitivityLabel; vgui::TextEntry *m_pTouchYawSensitivityLabel;
vgui::TextEntry *m_pTouchPitchSensitivityLabel; */ vgui::TextEntry *m_pTouchPitchSensitivityLabel; */
vgui::TextEntry *m_aspectRatioLabel; vgui::TextEntry *m_aspectRatioLabel;
CCvarSlider *m_pEnableModificationsCheckBox; CCvarToggleCheckButton *m_pChangeCheatFlag;
CCvarSlider *m_pAspectRatioSlider;
}; };
#endif // OPTIONS_SUB_MODIFICATION_H #endif // OPTIONS_SUB_MODIFICATION_H