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:
//-----------------------------------------------------------------------------
ClientModeHL1Normal::ClientModeHL1Normal()
{
}
ClientModeHL1Normal::ClientModeHL1Normal() = default;
//-----------------------------------------------------------------------------
// 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()
{

View File

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

View File

@ -2557,7 +2557,14 @@ AI_BEGIN_CUSTOM_NPC( monster_human_grunt, CNPC_HGrunt )
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
//=========================================================
@ -2641,4 +2648,4 @@ void CNPC_DeadHGrunt::Spawn( void )
}
NPCInitDead();
}
}

View File

@ -6,6 +6,8 @@
//=============================================================================//
#include "cbase.h"
#include "convar.h"
#include "iconvar.h"
#include "hl1mp_basecombatweapon_shared.h"
#ifdef CLIENT_DLL
@ -16,6 +18,8 @@
#include "player.h"
#include "soundent.h"
#endif
#include "decals.h"
#include "hl1_basecombatweapon_shared.h"
#include "gamerules.h"
#include "ammodef.h"
@ -23,9 +27,34 @@
#include "in_buttons.h"
#include "vstdlib/random.h"
//For CrowbarVolume function
#include <string.h>
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_REFIRE_MISS 0.5f
#define CROWBAR_REFIRE_HIT 0.25f
@ -35,9 +64,69 @@ extern ConVar sk_plr_dmg_crowbar;
#define CWeaponCrowbar C_WeaponCrowbar
#endif
struct TextureVolume
{
char type;
ConVar* enabledVar;
ConVar* volumeVar;
};
//-----------------------------------------------------------------------------
// 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
{
@ -63,7 +152,7 @@ private:
virtual void Swing( void );
virtual void Hit( void );
virtual void ImpactEffect( void );
void ImpactSound( CBaseEntity *pHitEntity );
void ImpactSound( CBaseEntity *pHitEntity);
virtual Activity ChooseIntersectionPointAndActivity( trace_t &hitTrace, const Vector &mins, const Vector &maxs, CBasePlayer *pOwner );
public:
@ -149,7 +238,7 @@ void CWeaponCrowbar::ItemPostFrame( void )
//------------------------------------------------------------------------------
void CWeaponCrowbar::PrimaryAttack()
{
Swing();
this->Swing();
}
@ -206,15 +295,19 @@ void CWeaponCrowbar::ImpactSound( CBaseEntity *pHitEntity )
bIsWorld |= pHitEntity->Classify() == CLASS_NONE || pHitEntity->Classify() == CLASS_MACHINE;
}
#endif
trace_t Trace;
memset(&Trace, 0, sizeof(trace_t));
Trace.m_pEnt = pHitEntity;
if( bIsWorld )
{
WeaponSound( MELEE_HIT_WORLD );
}
else
{
WeaponSound( MELEE_HIT );
}
float m_SoundTexture = GetCrowbarVolume(Trace);
if (bIsWorld)
{
WeaponSound(MELEE_HIT_WORLD, m_SoundTexture);
}
else
{
WeaponSound(MELEE_HIT, m_SoundTexture);
}
}
Activity CWeaponCrowbar::ChooseIntersectionPointAndActivity( trace_t &hitTrace, const Vector &mins, const Vector &maxs, CBasePlayer *pOwner )

View File

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

View File

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

View File

@ -99,7 +99,7 @@ COptionsDialog::COptionsDialog(vgui::Panel *parent) : PropertyDialog(parent, "Op
AddPage(m_pOptionsSubVideo, "#GameUI_Video");
AddPage(new COptionsSubModification(this), "ModInfo");
AddPage(new COptionsSubPortal(this), "#GameUI_Portal");
if ( !ModInfo().IsSinglePlayerOnly() )
{
AddPage(new COptionsSubVoice(this), "#GameUI_Voice");

View File

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

View File

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

View File

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

View File

@ -3607,12 +3607,12 @@ bool CDynamicMeshDX8::NeedsVertexFormatReset( VertexFormat_t fmt ) const
//-----------------------------------------------------------------------------
// Locks/unlocks the entire mesh
//-----------------------------------------------------------------------------
bool CDynamicMeshDX8::HasEnoughRoom( int nVertexCount, int nIndexCount ) const
bool CDynamicMeshDX8::HasEnoughRoom( int nVertexCount, int nIndexCount ) const
{
if ( g_pShaderDeviceDx8->IsDeactivated() )
return false;
Assert( m_pVertexBuffer != NULL );
//Assert( m_pVertexBuffer != NULL );
// We need space in both the vertex and index buffer
return m_pVertexBuffer->HasEnoughRoom( nVertexCount ) &&