add new modifications and Half Life Source Fixed features

This commit is contained in:
IOleg-sus 2025-01-15 11:28:40 +02:00
parent 13dc30a464
commit f792ec4b30
11 changed files with 126 additions and 31 deletions

View File

@ -95,16 +95,12 @@ protected:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
ClientModeHL1Normal::ClientModeHL1Normal() ClientModeHL1Normal::ClientModeHL1Normal() = default;
{
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: If you don't know what a destructor is by now, you are probably going to get fired // Purpose: If you don't know what a destructor is by now, you are probably going to get fired
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
ClientModeHL1Normal::~ClientModeHL1Normal() ClientModeHL1Normal::~ClientModeHL1Normal() = default;
{
}
void ClientModeHL1Normal::InitViewport() void ClientModeHL1Normal::InitViewport()
{ {

View File

@ -88,8 +88,8 @@ enum
// Attack distance constants // Attack distance constants
#define BIG_ATTACKDIST 170 #define BIG_ATTACKDIST 170
#define BIG_MORTARDIST 800 #define BIG_MORTARDIST 100
#define BIG_MAXCHILDREN 6 // Max # of live headcrab children #define BIG_MAXCHILDREN 8 // Max # of live headcrab children
#define bits_MEMORY_CHILDPAIR (bits_MEMORY_CUSTOM1) #define bits_MEMORY_CHILDPAIR (bits_MEMORY_CUSTOM1)

View File

@ -2557,7 +2557,14 @@ AI_BEGIN_CUSTOM_NPC( monster_human_grunt, CNPC_HGrunt )
AI_END_CUSTOM_NPC() AI_END_CUSTOM_NPC()
// Nothing , just shit
/* void MortarSpray(const Vector& position, const Vector& direction, int spriteModel, int count)
{
CPVSFilter filter(position);
te->SpriteSpray(filter, 0.0, &position, &direction, spriteModel, 200, 80, count);
}
*/
//========================================================= //=========================================================
// DEAD HGRUNT PROP // DEAD HGRUNT PROP
//========================================================= //=========================================================

View File

@ -6,6 +6,8 @@
//=============================================================================// //=============================================================================//
#include "cbase.h" #include "cbase.h"
#include "convar.h"
#include "iconvar.h"
#include "hl1mp_basecombatweapon_shared.h" #include "hl1mp_basecombatweapon_shared.h"
#ifdef CLIENT_DLL #ifdef CLIENT_DLL
@ -16,6 +18,8 @@
#include "player.h" #include "player.h"
#include "soundent.h" #include "soundent.h"
#endif #endif
#include "decals.h"
#include "hl1_basecombatweapon_shared.h"
#include "gamerules.h" #include "gamerules.h"
#include "ammodef.h" #include "ammodef.h"
@ -23,9 +27,34 @@
#include "in_buttons.h" #include "in_buttons.h"
#include "vstdlib/random.h" #include "vstdlib/random.h"
//For CrowbarVolume function
#include <string.h>
extern ConVar sk_plr_dmg_crowbar; extern ConVar sk_plr_dmg_crowbar;
//new conVars for crowbar
//Crowbar Sounds
ConVar hl1_crowbar_sound("hl1_crowbar_sound", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_concrete("hl1_crowbar_concrete", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_metal("hl1_crowbar_metal", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_dirt("hl1_crowbar_dirt", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_vent("hl1_crowbar_vent", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_grate("hl1_crowbar_grate", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_tile("hl1_crowbar_tile", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_wood("hl1_crowbar_wood", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_glass("hl1_crowbar_glass", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_computer("hl1_crowbar_computer", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_concrete_vol("hl1_crowbar_concrete_vol", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_metal_vol("hl1_crowbar_metal_vol", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_dirt_vol("hl1_crowbar_dirt_vol", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_vent_vol("hl1_crowbar_vent_vol", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_grate_vol("hl1_crowbar_grate_vol", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_tile_vol("hl1_crowbar_tile_vol", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_wood_vol("hl1_crowbar_wood_vol", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_glass_vol("hl1_crowbar_glass_vol", "1", FCVAR_NONE, NULL);
ConVar hl1_crowbar_computer_vol("hl1_crowbar_computer_vol", "1", FCVAR_NONE, NULL);
#define CROWBAR_RANGE 64.0f #define CROWBAR_RANGE 64.0f
#define CROWBAR_REFIRE_MISS 0.5f #define CROWBAR_REFIRE_MISS 0.5f
#define CROWBAR_REFIRE_HIT 0.25f #define CROWBAR_REFIRE_HIT 0.25f
@ -35,9 +64,69 @@ extern ConVar sk_plr_dmg_crowbar;
#define CWeaponCrowbar C_WeaponCrowbar #define CWeaponCrowbar C_WeaponCrowbar
#endif #endif
struct TextureVolume
{
char type;
ConVar* enabledVar;
ConVar* volumeVar;
};
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// CWeaponCrowbar // CWeaponCrowbar
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Define texture types and their associated ConVars
TextureVolume textureVolumes[] = {
{CHAR_TEX_CONCRETE, &hl1_crowbar_concrete, &hl1_crowbar_concrete_vol},
{CHAR_TEX_METAL, &hl1_crowbar_metal, &hl1_crowbar_metal_vol},
{CHAR_TEX_DIRT, &hl1_crowbar_dirt, &hl1_crowbar_dirt_vol},
{CHAR_TEX_VENT, &hl1_crowbar_vent, &hl1_crowbar_vent_vol},
{CHAR_TEX_GRATE, &hl1_crowbar_grate, &hl1_crowbar_grate_vol},
{CHAR_TEX_TILE, &hl1_crowbar_tile, &hl1_crowbar_tile_vol},
{CHAR_TEX_WOOD, &hl1_crowbar_wood, &hl1_crowbar_wood_vol},
{CHAR_TEX_GLASS, &hl1_crowbar_glass, &hl1_crowbar_glass_vol},
{CHAR_TEX_COMPUTER, &hl1_crowbar_computer, &hl1_crowbar_computer_vol}
};
float GetCrowbarVolume(const trace_t &ptr)
{
if (!hl1_crowbar_sound.GetBool())
return 0.0f;
float fvol = 0.0;
// Assume we determine the texture type based on entity properties or surface data
char mType = 0;
if (ptr.surface.name)
{
// Check the surface name for certain substrings to classify texture types
if (strstr(ptr.surface.name, "concrete")) mType = CHAR_TEX_CONCRETE;
else if (strstr(ptr.surface.name, "metal")) mType = CHAR_TEX_METAL;
else if (strstr(ptr.surface.name, "dirt")) mType = CHAR_TEX_DIRT;
else if (strstr(ptr.surface.name, "vent")) mType = CHAR_TEX_VENT;
else if (strstr(ptr.surface.name, "grate")) mType = CHAR_TEX_GRATE;
else if (strstr(ptr.surface.name, "tile")) mType = CHAR_TEX_TILE;
else if (strstr(ptr.surface.name, "wood")) mType = CHAR_TEX_WOOD;
else if (strstr(ptr.surface.name, "glass")) mType = CHAR_TEX_GLASS;
else if (strstr(ptr.surface.name, "computer")) mType = CHAR_TEX_COMPUTER;
}
for (const auto& tv : textureVolumes)
{
if (mType == tv.type && tv.enabledVar->GetBool())
{
fvol = tv.volumeVar->GetFloat() / 10;
break;
}
}
CBaseEntity* pEntity = ptr.m_pEnt;
if (pEntity && FClassnameIs(pEntity, "func_breakable"))
{
fvol /= 2.0;
}
return fvol;
}
class CWeaponCrowbar : public CBaseHL1MPCombatWeapon class CWeaponCrowbar : public CBaseHL1MPCombatWeapon
{ {
@ -149,7 +238,7 @@ void CWeaponCrowbar::ItemPostFrame( void )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void CWeaponCrowbar::PrimaryAttack() void CWeaponCrowbar::PrimaryAttack()
{ {
Swing(); this->Swing();
} }
@ -206,14 +295,18 @@ void CWeaponCrowbar::ImpactSound( CBaseEntity *pHitEntity )
bIsWorld |= pHitEntity->Classify() == CLASS_NONE || pHitEntity->Classify() == CLASS_MACHINE; bIsWorld |= pHitEntity->Classify() == CLASS_NONE || pHitEntity->Classify() == CLASS_MACHINE;
} }
#endif #endif
trace_t Trace;
memset(&Trace, 0, sizeof(trace_t));
Trace.m_pEnt = pHitEntity;
float m_SoundTexture = GetCrowbarVolume(Trace);
if (bIsWorld) if (bIsWorld)
{ {
WeaponSound( MELEE_HIT_WORLD ); WeaponSound(MELEE_HIT_WORLD, m_SoundTexture);
} }
else else
{ {
WeaponSound( MELEE_HIT ); WeaponSound(MELEE_HIT, m_SoundTexture);
} }
} }

View File

@ -112,7 +112,7 @@ void CWeapon357::PrimaryAttack( void )
else else
{ {
WeaponSound( EMPTY ); WeaponSound( EMPTY );
m_flNextPrimaryAttack = 0.15; m_flNextPrimaryAttack = 0.1;
} }
return; return;

View File

@ -859,7 +859,7 @@ void CGameRules::ClientSettingsChanged( CBasePlayer *pPlayer )
if ( pszFov ) if ( pszFov )
{ {
int iFov = atoi(pszFov); int iFov = atoi(pszFov);
iFov = clamp( iFov, 75, 110 ); iFov = clamp( iFov, 75, 150 );
pPlayer->SetDefaultFOV( iFov ); pPlayer->SetDefaultFOV( iFov );
} }

View File

@ -72,9 +72,7 @@ COptionsSubAudio::COptionsSubAudio(vgui::Panel *parent) : PropertyPage(parent, N
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Destructor // Purpose: Destructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
COptionsSubAudio::~COptionsSubAudio() COptionsSubAudio::~COptionsSubAudio() = default;
{
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Reloads data // Purpose: Reloads data

View File

@ -51,7 +51,8 @@ protected:
void UpdateLabel(CCvarSlider *slider, vgui::TextEntry *label); void UpdateLabel(CCvarSlider *slider, vgui::TextEntry *label);
private: private:
CCvarToggleCheckButton *m_pReverseTouchCheckBox; // Get from OptionsSubTouchSettings.cpp
/* CCvarToggleCheckButton *m_pReverseTouchCheckBox;
CCvarToggleCheckButton *m_pTouchFilterCheckBox; CCvarToggleCheckButton *m_pTouchFilterCheckBox;
CCvarToggleCheckButton *m_pTouchRawCheckBox; CCvarToggleCheckButton *m_pTouchRawCheckBox;
CCvarToggleCheckButton *m_pTouchAccelerationCheckBox; CCvarToggleCheckButton *m_pTouchAccelerationCheckBox;
@ -73,7 +74,7 @@ private:
CCvarSlider *m_pTouchPitchSensitivitySlider; CCvarSlider *m_pTouchPitchSensitivitySlider;
vgui::Label *m_pTouchPitchSensitivityPreLabel; vgui::Label *m_pTouchPitchSensitivityPreLabel;
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; CCvarSlider *m_pEnableModificationsCheckBox;
}; };

View File

@ -7,7 +7,7 @@
//=============================================================================// //=============================================================================//
#include "OptionsSubMouse.h" #include "OptionsSubMouse.h"
// #include "CommandCheckButton.h" // #include "CommandCheckButton.h"
#include "KeyToggleCheckButton.h" //#include "KeyToggleCheckButton.h" (Not used direcly)
#include "CvarNegateCheckButton.h" #include "CvarNegateCheckButton.h"
#include "CvarToggleCheckButton.h" #include "CvarToggleCheckButton.h"
#include "cvarslider.h" #include "cvarslider.h"

View File

@ -3612,7 +3612,7 @@ bool CDynamicMeshDX8::HasEnoughRoom( int nVertexCount, int nIndexCount ) const
if ( g_pShaderDeviceDx8->IsDeactivated() ) if ( g_pShaderDeviceDx8->IsDeactivated() )
return false; return false;
Assert( m_pVertexBuffer != NULL ); //Assert( m_pVertexBuffer != NULL );
// We need space in both the vertex and index buffer // We need space in both the vertex and index buffer
return m_pVertexBuffer->HasEnoughRoom( nVertexCount ) && return m_pVertexBuffer->HasEnoughRoom( nVertexCount ) &&