added OptionsSubModification

This commit is contained in:
IOleg-sus 2025-01-13 14:43:53 +02:00
parent 29985681a1
commit 13dc30a464
18 changed files with 432 additions and 254 deletions

View File

@ -12,8 +12,8 @@
#include "hl1_clientscoreboard.h" #include "hl1_clientscoreboard.h"
// default FOV for HL1 // default FOV for HL1
ConVar default_fov( "default_fov", "90", FCVAR_CHEAT ); ConVar default_fov( "default_fov", "110", FCVAR_CHEAT );
ConVar fov_desired( "fov_desired", "90", FCVAR_ARCHIVE | FCVAR_USERINFO, "Sets the base field-of-view.", true, 75.0, true, 110.0 ); ConVar fov_desired( "fov_desired", "90", FCVAR_ARCHIVE | FCVAR_USERINFO, "Sets the base field-of-view.", true, 75.0, true, 130.0 );
// The current client mode. Always ClientModeNormal in HL. // The current client mode. Always ClientModeNormal in HL.
IClientMode *g_pClientMode = NULL; IClientMode *g_pClientMode = NULL;
@ -32,13 +32,9 @@ public:
virtual void LevelShutdown( void ); virtual void LevelShutdown( void );
}; };
CHLModeManager::CHLModeManager( void ) CHLModeManager::CHLModeManager( void ) = default;
{
}
CHLModeManager::~CHLModeManager( void ) CHLModeManager::~CHLModeManager( void ) = default;
{
}
void CHLModeManager::Init( void ) void CHLModeManager::Init( void )
{ {

View File

@ -19,7 +19,7 @@
extern bool g_bRollingCredits; extern bool g_bRollingCredits;
ConVar fov_desired( "fov_desired", "75", FCVAR_ARCHIVE | FCVAR_USERINFO, "Sets the base field-of-view.", true, 75.0, true, 110.0 ); ConVar fov_desired( "fov_desired", "75", FCVAR_ARCHIVE | FCVAR_USERINFO, "Sets the base field-of-view.", true, 75.0, true, 150.0 );
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Globals // Globals
@ -70,9 +70,7 @@ ClientModeHLNormal::ClientModeHLNormal()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
ClientModeHLNormal::~ClientModeHLNormal() ClientModeHLNormal::~ClientModeHLNormal() = default;
{
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -18,10 +18,10 @@
// Armor given by a battery // Armor given by a battery
#define MAX_NORMAL_BATTERY 100 #define MAX_NORMAL_BATTERY 200
// Ammo counts given by ammo items // Ammo counts given by ammo items
#define SIZE_AMMO_PISTOL 20 #define SIZE_AMMO_PISTOL 18
#define SIZE_AMMO_PISTOL_LARGE 100 #define SIZE_AMMO_PISTOL_LARGE 100
#define SIZE_AMMO_SMG1 45 #define SIZE_AMMO_SMG1 45
#define SIZE_AMMO_SMG1_LARGE 225 #define SIZE_AMMO_SMG1_LARGE 225
@ -31,7 +31,7 @@
#define SIZE_AMMO_SMG1_GRENADE 1 #define SIZE_AMMO_SMG1_GRENADE 1
#define SIZE_AMMO_BUCKSHOT 20 #define SIZE_AMMO_BUCKSHOT 20
#define SIZE_AMMO_357 6 #define SIZE_AMMO_357 6
#define SIZE_AMMO_357_LARGE 20 #define SIZE_AMMO_357_LARGE 80
#define SIZE_AMMO_CROSSBOW 6 #define SIZE_AMMO_CROSSBOW 6
#define SIZE_AMMO_AR2_ALTFIRE 1 #define SIZE_AMMO_AR2_ALTFIRE 1

View File

@ -232,7 +232,7 @@ enum CastVote
#define MAX_PLACE_NAME_LENGTH 18 #define MAX_PLACE_NAME_LENGTH 18
#define MAX_FOV 110 #define MAX_FOV 150
//=================================================================================================================== //===================================================================================================================
// Team Defines // Team Defines

View File

@ -29,6 +29,7 @@
#include "OptionsSubMultiplayer.h" #include "OptionsSubMultiplayer.h"
#include "OptionsSubDifficulty.h" #include "OptionsSubDifficulty.h"
#include "OptionsSubPortal.h" #include "OptionsSubPortal.h"
#include "OptionsSubModification.h"
#ifdef WIN32 #ifdef WIN32
// NVNT haptic configuration dialog // NVNT haptic configuration dialog
#include "OptionsSubHaptics.h" #include "OptionsSubHaptics.h"
@ -94,7 +95,10 @@ COptionsDialog::COptionsDialog(vgui::Panel *parent) : PropertyDialog(parent, "Op
m_pOptionsSubAudio = new COptionsSubAudio(this); m_pOptionsSubAudio = new COptionsSubAudio(this);
AddPage(m_pOptionsSubAudio, "#GameUI_Audio"); AddPage(m_pOptionsSubAudio, "#GameUI_Audio");
m_pOptionsSubVideo = new COptionsSubVideo(this); m_pOptionsSubVideo = new COptionsSubVideo(this);
AddPage(m_pOptionsSubVideo, "#GameUI_Video"); AddPage(m_pOptionsSubVideo, "#GameUI_Video");
AddPage(new COptionsSubModification(this), "ModInfo");
AddPage(new COptionsSubPortal(this), "#GameUI_Portal");
if ( !ModInfo().IsSinglePlayerOnly() ) if ( !ModInfo().IsSinglePlayerOnly() )
{ {
@ -119,9 +123,7 @@ COptionsDialog::COptionsDialog(vgui::Panel *parent) : PropertyDialog(parent, "Op
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Destructor // Purpose: Destructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
COptionsDialog::~COptionsDialog() COptionsDialog::~COptionsDialog() = default;
{
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Brings the dialog to the fore // Purpose: Brings the dialog to the fore

View File

@ -7,6 +7,7 @@
#ifndef OPTIONSDIALOG_H #ifndef OPTIONSDIALOG_H
#define OPTIONSDIALOG_H #define OPTIONSDIALOG_H
#include "OptionsSubModification.h"
#ifdef _WIN32 #ifdef _WIN32
#pragma once #pragma once
#endif #endif
@ -37,6 +38,7 @@ public:
private: private:
class COptionsSubAudio *m_pOptionsSubAudio; class COptionsSubAudio *m_pOptionsSubAudio;
class COptionsSubVideo *m_pOptionsSubVideo; class COptionsSubVideo *m_pOptionsSubVideo;
class COptionsSubModification *m_pOptionsSubModification;
vgui::PropertyPage *m_pOptionsSubMultiplayer; vgui::PropertyPage *m_pOptionsSubMultiplayer;
}; };

View File

@ -22,9 +22,7 @@ COptionsSubGame::COptionsSubGame( vgui::Panel *parent, const char *name ) : Base
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Destructor // Purpose: Destructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
COptionsSubGame::~COptionsSubGame() COptionsSubGame::~COptionsSubGame() = default;
{
}
void COptionsSubGame::OnClose( void ) void COptionsSubGame::OnClose( void )
{ {

View File

@ -0,0 +1,110 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#include "OptionsSubModification.h"
#include "CvarSlider.h"
#include "EngineInterface.h"
#include <KeyValues.h>
#include <vgui/IScheme.h>
#include "tier1/convar.h"
#include <vgui_controls/TextEntry.h>
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
using namespace vgui;
COptionsSubModification::COptionsSubModification(vgui::Panel *parent) : PropertyPage(parent, nullptr)
{
// Create the slider for aspect ratio adjustments
m_pEnableModificationsCheckBox = new CCvarSlider(
this,
"AspectRatioSlider",
"Aspect Ratio",
0.1f, 3.0f, // Slider range: 0.1 to 3.0
"r_aspectratio",
true // Allow fractional values
);
m_aspectRatioLabel = new TextEntry(this, "AspectRatioLabel");
m_aspectRatioLabel->AddActionSignalTarget(this);
// Load settings from the associated resource file
LoadControlSettings("Resource\\OptionsSubModification.res");
UpdateLabel(m_pEnableModificationsCheckBox, m_aspectRatioLabel);
}
COptionsSubModification::~COptionsSubModification() = default;
void COptionsSubModification::OnTextChanged(Panel *panel)
{
if (panel == m_aspectRatioLabel)
{
char buf[64];
m_aspectRatioLabel->GetText(buf, 64);
float fValue;
int numParsed = sscanf(buf, "%f", &fValue);
if ((numParsed == 1) && (fValue >= 0.0f))
{
m_pEnableModificationsCheckBox->SetSliderValue(fValue);
PostActionSignal(new KeyValues("ApplyButtonEnable"));
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Resets the data to the initial state
//-----------------------------------------------------------------------------
void COptionsSubModification::OnResetData()
{
m_pEnableModificationsCheckBox->Reset();
// m_aspectRatioLabel->Reset();
}
//-----------------------------------------------------------------------------
// Purpose: Applies changes made by the user
//-----------------------------------------------------------------------------
void COptionsSubModification::OnApplyChanges()
{
m_pEnableModificationsCheckBox->ApplyChanges();
// m_aspectRatioLabel->ApplyChanges();
}
//-----------------------------------------------------------------------------
// Purpose: Handles slider modifications
//-----------------------------------------------------------------------------
void COptionsSubModification::OnControlModified(Panel *panel)
{
PostActionSignal(new KeyValues("ApplyButtonEnable"));
// Update the label based on slider changes
if (panel == m_pEnableModificationsCheckBox && m_pEnableModificationsCheckBox->HasBeenModified())
{
UpdateLabel(m_pEnableModificationsCheckBox, m_aspectRatioLabel);
}
}
//-----------------------------------------------------------------------------
// Purpose: Sets scheme-specific properties
//-----------------------------------------------------------------------------
void COptionsSubModification::ApplySchemeSettings(IScheme *pScheme)
{
BaseClass::ApplySchemeSettings(pScheme);
}
//-----------------------------------------------------------------------------
// Purpose: Updates the label text based on slider value
//-----------------------------------------------------------------------------
void COptionsSubModification::UpdateLabel(CCvarSlider *slider, vgui::TextEntry *label)
{
char buf[64];
Q_snprintf(buf, sizeof(buf), "%.2f", slider->GetSliderValue());
label->SetText(buf);
}

View File

@ -0,0 +1,81 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef OPTIONS_SUB_MODIFICATION_H
#define OPTIONS_SUB_MODIFICATION_H
#ifdef _WIN32
#pragma once
#endif
#include <vgui_controls/PropertyPage.h>
class CCvarNegateCheckButton;
class CKeyToggleCheckButton;
class CCvarToggleCheckButton;
class CCvarSlider;
namespace vgui
{
class Label;
class Panel;
}
//-----------------------------------------------------------------------------
// Purpose: Touch Details, Part of OptionsDialog
//-----------------------------------------------------------------------------
class COptionsSubModification : public vgui::PropertyPage
{
DECLARE_CLASS_SIMPLE(COptionsSubModification, vgui::PropertyPage);
public:
COptionsSubModification(vgui::Panel *parent);
~COptionsSubModification();
virtual void OnResetData();
virtual void OnApplyChanges();
protected:
virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
MESSAGE_FUNC_PTR(OnControlModified, "ControlModified", panel);
MESSAGE_FUNC_PTR(OnTextChanged, "TextChanged", panel);
MESSAGE_FUNC_PTR(OnCheckButtonChecked, "CheckButtonChecked", panel)
{
OnControlModified(panel);
}
void UpdateLabel(CCvarSlider *slider, vgui::TextEntry *label);
private:
CCvarToggleCheckButton *m_pReverseTouchCheckBox;
CCvarToggleCheckButton *m_pTouchFilterCheckBox;
CCvarToggleCheckButton *m_pTouchRawCheckBox;
CCvarToggleCheckButton *m_pTouchAccelerationCheckBox;
CCvarToggleCheckButton *m_pTouchCheckBox;
CCvarToggleCheckButton *m_pTouchSouthpawCheckBox;
CCvarToggleCheckButton *m_pQuickInfoCheckBox;
CCvarToggleCheckButton *m_pTouchEnableCheckBox;
CCvarToggleCheckButton *m_pTouchDrawCheckBox;
CCvarSlider *m_pTouchSensitivitySlider;
vgui::TextEntry *m_pTouchSensitivityLabel;
CCvarSlider *m_pTouchAccelExponentSlider;
vgui::TextEntry *m_pTouchAccelExponentLabel;
CCvarSlider *m_pTouchYawSensitivitySlider;
vgui::Label *m_pTouchYawSensitivityPreLabel;
CCvarSlider *m_pTouchPitchSensitivitySlider;
vgui::Label *m_pTouchPitchSensitivityPreLabel;
vgui::TextEntry *m_pTouchYawSensitivityLabel;
vgui::TextEntry *m_pTouchPitchSensitivityLabel;
vgui::TextEntry *m_aspectRatioLabel;
CCvarSlider *m_pEnableModificationsCheckBox;
};
#endif // OPTIONS_SUB_MODIFICATION_H

View File

@ -49,7 +49,6 @@ COptionsSubMouse::COptionsSubMouse(vgui::Panel *parent) : PropertyPage(parent, N
"MouseAccelerationCheckbox", "MouseAccelerationCheckbox",
"#GameUI_MouseCustomAccel"); "#GameUI_MouseCustomAccel");
m_pJoystickCheckBox = new CCvarToggleCheckButton( m_pJoystickCheckBox = new CCvarToggleCheckButton(
this, this,
"Joystick", "Joystick",
@ -105,9 +104,7 @@ COptionsSubMouse::COptionsSubMouse(vgui::Panel *parent) : PropertyPage(parent, N
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
COptionsSubMouse::~COptionsSubMouse() COptionsSubMouse::~COptionsSubMouse() = default;
{
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
@ -217,7 +214,7 @@ void COptionsSubMouse::OnTextChanged(Panel *panel)
char buf[64]; char buf[64];
m_pMouseAccelExponentLabel->GetText(buf, 64); m_pMouseAccelExponentLabel->GetText(buf, 64);
float fValue = (float) atof(buf); float fValue = atof(buf);
if (fValue >= 1.0) if (fValue >= 1.0)
{ {
m_pMouseAccelExponentSlider->SetSliderValue(fValue); m_pMouseAccelExponentSlider->SetSliderValue(fValue);
@ -236,7 +233,6 @@ void COptionsSubMouse::UpdateSensitivityLabel()
m_pMouseSensitivityLabel->SetText(buf); m_pMouseSensitivityLabel->SetText(buf);
} }
void COptionsSubMouse::UpdateAccelerationLabel() void COptionsSubMouse::UpdateAccelerationLabel()
{ {
char buf[64]; char buf[64];
@ -244,7 +240,6 @@ void COptionsSubMouse::UpdateAccelerationLabel()
m_pMouseAccelExponentLabel->SetText(buf); m_pMouseAccelExponentLabel->SetText(buf);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -89,9 +89,7 @@ COptionsSubTouch::COptionsSubTouch(vgui::Panel *parent) : PropertyPage(parent, N
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
COptionsSubTouch::~COptionsSubTouch() COptionsSubTouch::~COptionsSubTouch() = default;
{
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:

View File

@ -53,7 +53,6 @@ CSaveGameDialog::CSaveGameDialog(vgui::Panel *parent) : BaseClass(parent, "SaveG
CSaveGameDialog::~CSaveGameDialog() CSaveGameDialog::~CSaveGameDialog()
{ {
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Saves game // Purpose: Saves game
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -57,9 +57,7 @@ CVGuiSystemModuleLoader::CVGuiSystemModuleLoader()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Destructor // Purpose: Destructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
CVGuiSystemModuleLoader::~CVGuiSystemModuleLoader() CVGuiSystemModuleLoader::~CVGuiSystemModuleLoader() = default;
{
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: returns true if the module loader has acquired the platform mutex and loaded the modules // Purpose: returns true if the module loader has acquired the platform mutex and loaded the modules

View File

@ -93,6 +93,7 @@ def build(bld):
'OptionsSubPortal.cpp', 'OptionsSubPortal.cpp',
'OptionsSubVideo.cpp', 'OptionsSubVideo.cpp',
'OptionsSubVoice.cpp', 'OptionsSubVoice.cpp',
'OptionsSubModification.cpp', #added new page
'../public/tier0/memoverride.cpp', '../public/tier0/memoverride.cpp',
] ]

View File

@ -1739,7 +1739,7 @@ jpeg_fdct_13x13 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)
MULTIPLY(tmp1 - tmp5, FIX(0.239678205)); /* (c8-c12)/2 */ MULTIPLY(tmp1 - tmp5, FIX(0.239678205)); /* (c8-c12)/2 */
z2 = MULTIPLY(tmp0 + tmp2, FIX(0.073342435)) - /* (c4-c6)/2 */ z2 = MULTIPLY(tmp0 + tmp2, FIX(0.073342435)) - /* (c4-c6)/2 */
MULTIPLY(tmp3 + tmp4, FIX(0.709910013)) + /* (c2+c10)/2 */ MULTIPLY(tmp3 + tmp4, FIX(0.709910013)) + /* (c2+c10)/2 */
MULTIPLY(tmp1 + tmp5, FIX(0.368787494)); /* (c8+c12)/2 */ MULTIPLY(tmp1 + t, FIX(0.368787494)); /* (c8+c12)/2 */
dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(z1 + z2, CONST_BITS+1); dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(z1 + z2, CONST_BITS+1);
dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 - z2, CONST_BITS+1); dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 - z2, CONST_BITS+1);

View File

@ -24,6 +24,7 @@
#include "pixelwriter.h" #include "pixelwriter.h"
#include "tier2/tier2.h" #include "tier2/tier2.h"
#include "platform.h" #include "platform.h"
#include <iostream>
#if defined ( WIN32 ) #if defined ( WIN32 )
@ -340,8 +341,8 @@ VideoResult_t CQuickTimeVideoSubSystem::PlayVideoFileFullScreen( const char *fil
// what size do we set the output rect to? // what size do we set the output rect to?
// Integral scaling is much faster, so always scale the video as such // Integral scaling is much faster, so always scale the video as such
int nNewWidth = (int) theQTMovieRect.right; int nNewWidth = static_cast<int>theQTMovieRect.right;
int nNewHeight = (int) theQTMovieRect.bottom; int nNewHeight = static_cast<int>theQTMovieRect.bottom;
// Determine the window we are rendering video into // Determine the window we are rendering video into
int displayWidth = windowWidth; int displayWidth = windowWidth;

View File

@ -538,7 +538,7 @@ def configure(conf):
else: else:
cflags += [ cflags += [
'/I'+os.path.abspath('.')+'/thirdparty/SDL', '/I'+os.path.abspath('.')+'/thirdparty/SDL',
'/arch:SSE' if conf.env.DEST_CPU == 'x86' else '/arch:AVX', #'/arch:SSE' if conf.env.DEST_CPU == 'x86' else '/arch:AVX', (no AVX Support)
'/GF', '/GF',
'/Gy', '/Gy',
'/fp:fast', '/fp:fast',
@ -548,7 +548,6 @@ def configure(conf):
'/TP', '/TP',
'/EHsc' '/EHsc'
] ]
if conf.options.BUILD_TYPE == 'debug': if conf.options.BUILD_TYPE == 'debug':
linkflags += [ linkflags += [
'/FORCE:MULTIPLE', '/FORCE:MULTIPLE',