Skip to content

added OptionsSubModification #413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build_waf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
./waf configure -T release --destdir=E:/source_engine --prefix=E:/source_engine --build-game=hl1 &&
./waf install --strip

# use can set --destdir and --prefix and set path , where you located source code
20 changes: 6 additions & 14 deletions game/client/hl1/hl1_clientmode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "hl1_clientscoreboard.h"

// default FOV for HL1
ConVar default_fov( "default_fov", "90", 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 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, 130.0 );

// The current client mode. Always ClientModeNormal in HL.
IClientMode *g_pClientMode = NULL;
Expand All @@ -32,13 +32,9 @@ class CHLModeManager : public IVModeManager
virtual void LevelShutdown( void );
};

CHLModeManager::CHLModeManager( void )
{
}
CHLModeManager::CHLModeManager( void ) = default;

CHLModeManager::~CHLModeManager( void )
{
}
CHLModeManager::~CHLModeManager( void ) = default;

void CHLModeManager::Init( void )
{
Expand Down Expand Up @@ -99,16 +95,12 @@ class CHudViewport : public CBaseViewport
//-----------------------------------------------------------------------------
// 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()
{
Expand Down
6 changes: 2 additions & 4 deletions game/client/hl2/clientmode_hlnormal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

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
Expand Down Expand Up @@ -70,9 +70,7 @@ ClientModeHLNormal::ClientModeHLNormal()
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
ClientModeHLNormal::~ClientModeHLNormal()
{
}
ClientModeHLNormal::~ClientModeHLNormal() = default;


//-----------------------------------------------------------------------------
Expand Down
12 changes: 12 additions & 0 deletions game/server/hl1/hl1_npc_barney.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,20 @@ int CNPC_Barney::OnTakeDamage_Alive( const CTakeDamageInfo &inputInfo )
{
Speak( BA_SHOT );
}


}
if (gpGlobals->curtime >= m_flPainTime)
{
m_flPainTime = gpGlobals->curtime + random->RandomFloat(0.5, 0.75);

CPASAttenuationFilter filter(this);
EmitSound(filter, entindex(), "Barney.Pain");
}




return ret;
}

Expand Down
6 changes: 3 additions & 3 deletions game/server/hl1/hl1_npc_bigmomma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -1310,4 +1310,4 @@ AI_BEGIN_CUSTOM_NPC( monster_bigmomma, CNPC_BigMomma )

AI_END_CUSTOM_NPC()



41 changes: 36 additions & 5 deletions game/server/hl1/hl1_npc_hgrunt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// $NoKeywords: $
//=============================================================================//

#include "ai_condition.h"
#include "cbase.h"
#include "beam_shared.h"
#include "ai_default.h"
Expand Down Expand Up @@ -236,7 +237,7 @@ void CNPC_HGrunt::Spawn()
m_bloodColor = BLOOD_COLOR_RED;
ClearEffects();
m_iHealth = sk_hgrunt_health.GetFloat();
m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_flFieldOfView = 0.4;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_NPCState = NPC_STATE_NONE;
m_flNextGrenadeCheck = gpGlobals->curtime + 1;
m_flNextPainTime = gpGlobals->curtime;
Expand Down Expand Up @@ -299,8 +300,25 @@ void CNPC_HGrunt::Spawn()
BaseClass::Spawn();

NPCInit();
CreateVPhysics();
}

bool CNPC_HGrunt::CreateVPhysics(void)
{
VPhysicsDestroyObject();

CPhysCollide* pModel = PhysCreateBbox(NAI_Hull::Mins(HULL_HUMAN), NAI_Hull::Maxs(HULL_HUMAN));
IPhysicsObject* pPhysics = PhysModelCreateCustom(this, pModel, GetAbsOrigin(), GetAbsAngles(), "barney_hull", false);

VPhysicsSetObject(pPhysics);
if (pPhysics)
{
pPhysics->SetCallbackFlags(CALLBACK_GLOBAL_COLLISION | CALLBACK_SHADOW_COLLISION);
}
PhysAddShadow(this);

return true;
}
int CNPC_HGrunt::IRelationPriority( CBaseEntity *pTarget )
{
//I hate alien grunts more than anything.
Expand Down Expand Up @@ -425,10 +443,11 @@ void CNPC_HGrunt::PrescheduleThink ( void )
}
else
{
if ( gpGlobals->curtime - pSquadLeader->m_flLastEnemySightTime > 5 )
if ( gpGlobals->curtime - pSquadLeader->m_flLastEnemySightTime > 5.0f )
{
// been a while since we've seen the enemy
pSquadLeader->GetEnemies()->MarkAsEluded( GetEnemy() );
pSquadLeader->GetEnemies()->MarkAsEluded( GetEnemy() );

}
}
}
Expand Down Expand Up @@ -624,6 +643,10 @@ int CNPC_HGrunt::RangeAttack1Conditions ( float flDot, float flDist )
// kick nonclients, but don't shoot at them.
return COND_NONE;
}
if (GetEnemy())
{
return COND_CAN_RANGE_ATTACK1;
}

Vector vecSrc;
QAngle angAngles;
Expand Down Expand Up @@ -768,7 +791,7 @@ int CNPC_HGrunt::GetGrenadeConditions( float flDot, float flDist )
m_vecTossVelocity = vecToss;

// don't check again for a while.
m_flNextGrenadeCheck = gpGlobals->curtime + 0.3; // 1/3 second.
m_flNextGrenadeCheck = gpGlobals->curtime + 0.1; // 1/3 second.

return COND_CAN_RANGE_ATTACK2;
}
Expand Down Expand Up @@ -1640,6 +1663,7 @@ int CNPC_HGrunt::SelectSchedule( void )
// little time and give the player a chance to turn.
if ( pSquadLeader && pSquadLeader->EnemyHasEludedMe() && !HasCondition ( COND_ENEMY_FACING_ME ) )
{
pSquadLeader->EnemyHasEludedMe(); // try to fix bug in chapter we`re all hostiles
return SCHED_GRUNT_FOUND_ENEMY;
}
}
Expand Down Expand Up @@ -2557,7 +2581,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
//=========================================================
Expand Down Expand Up @@ -2641,4 +2672,4 @@ void CNPC_DeadHGrunt::Spawn( void )
}

NPCInitDead();
}
}
1 change: 1 addition & 0 deletions game/server/hl1/hl1_npc_hgrunt.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class CNPC_HGrunt : public CHL1BaseNPC
void PrescheduleThink ( void );

bool FOkToSpeak( void );
bool CreateVPhysics( void );

Class_T Classify ( void );
int RangeAttack1Conditions ( float flDot, float flDist );
Expand Down
6 changes: 3 additions & 3 deletions game/server/hl1/hl1_npc_tentacle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,13 +936,13 @@ void CNPC_Tentacle::HitTouch( CBaseEntity *pOther )
//as the ragdoll only covers the top portion of the tentacle.
if ( pOther->m_takedamage )
{
CTakeDamageInfo info( this, this, m_iHitDmg, DMG_CLUB );
CTakeDamageInfo info( this, this, m_iHitDmg, DMG_CLUB | DMG_ALWAYSGIB );

Vector vDamageForce = pOther->GetAbsOrigin() - GetAbsOrigin();
VectorNormalize( vDamageForce );

CalculateMeleeDamageForce( &info, vDamageForce, pOther->GetAbsOrigin() );
pOther->TakeDamage( info );
CalculateMeleeDamageForce( &info, vDamageForce, pOther->GetAbsOrigin());


m_flHitTime = gpGlobals->curtime + 0.5;
}
Expand Down
33 changes: 22 additions & 11 deletions game/server/hl1/hl1_weapon_crowbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "cbase.h"
#include "hl1mp_basecombatweapon_shared.h"
#include "weapon_parse.h"

#ifdef CLIENT_DLL
#include "c_baseplayer.h"
Expand All @@ -22,6 +23,7 @@
#include "mathlib/mathlib.h"
#include "in_buttons.h"


#include "vstdlib/random.h"

extern ConVar sk_plr_dmg_crowbar;
Expand Down Expand Up @@ -63,7 +65,7 @@ class CWeaponCrowbar : public CBaseHL1MPCombatWeapon
virtual void Swing( void );
virtual void Hit( void );
virtual void ImpactEffect( void );
void ImpactSound( CBaseEntity *pHitEntity );
void ImpactSound( bool isWorld , trace_t &hitTrace , CBaseEntity *pHitEntity);
virtual Activity ChooseIntersectionPointAndActivity( trace_t &hitTrace, const Vector &mins, const Vector &maxs, CBasePlayer *pOwner );

public:
Expand Down Expand Up @@ -95,7 +97,7 @@ BEGIN_DATADESC( CWeaponCrowbar )

// Function Pointers
DEFINE_FUNCTION( Hit ),

END_DATADESC()
#endif

Expand Down Expand Up @@ -184,8 +186,9 @@ void CWeaponCrowbar::Hit( void )
TraceAttackToTriggers( CTakeDamageInfo( GetOwner(), GetOwner(), sk_plr_dmg_crowbar.GetFloat(), DMG_CLUB ), m_traceHit.startpos, m_traceHit.endpos, hitDirection );

//Play an impact sound
ImpactSound( pHitEntity );
ImpactSound( pHitEntity->Classify() == CLASS_NONE || pHitEntity->Classify() == CLASS_MACHINE, m_traceHit , pHitEntity );
}

#endif

//Apply an impact effect
Expand All @@ -197,23 +200,31 @@ void CWeaponCrowbar::Hit( void )
// Input : pHitEntity - entity that we hit
// assumes pHitEntity is not null
//-----------------------------------------------------------------------------
void CWeaponCrowbar::ImpactSound( CBaseEntity *pHitEntity )
void CWeaponCrowbar::ImpactSound( bool isWorld , trace_t &hitTrace , CBaseEntity *pHitEntity )
{
bool bIsWorld = ( pHitEntity->entindex() == 0 );
bool IsWorld = ( pHitEntity->entindex() );
#ifndef CLIENT_DLL
if ( !bIsWorld )
if ( !isWorld )
{
bIsWorld |= pHitEntity->Classify() == CLASS_NONE || pHitEntity->Classify() == CLASS_MACHINE;
isWorld |= pHitEntity->Classify() == CLASS_NONE || pHitEntity->Classify() == CLASS_MACHINE;
}
#endif

if( bIsWorld )
if( isWorld )
{
WeaponSound( MELEE_HIT_WORLD );
switch (random->RandomInt(0, 1))
{
case 0:
WeaponSound( MELEE_HIT_WORLD );
break;
case 1:
WeaponSound( MELEE_HIT );
break;
}
}
else
{
WeaponSound( MELEE_HIT );
WeaponSound( MELEE_MISS );
}
}

Expand Down Expand Up @@ -376,4 +387,4 @@ void CWeaponCrowbar::Swing( void )
//Send the anim
SendWeaponAnim( m_nHitActivity );
pOwner->SetAnimation( PLAYER_ATTACK1 );
}
}
2 changes: 1 addition & 1 deletion game/server/hl2/weapon_357.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void CWeapon357::PrimaryAttack( void )
else
{
WeaponSound( EMPTY );
m_flNextPrimaryAttack = 0.15;
m_flNextPrimaryAttack = 0.1;
}

return;
Expand Down
6 changes: 3 additions & 3 deletions game/server/items.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@


// Armor given by a battery
#define MAX_NORMAL_BATTERY 100
#define MAX_NORMAL_BATTERY 200

// 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_SMG1 45
#define SIZE_AMMO_SMG1_LARGE 225
Expand All @@ -31,7 +31,7 @@
#define SIZE_AMMO_SMG1_GRENADE 1
#define SIZE_AMMO_BUCKSHOT 20
#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_AR2_ALTFIRE 1

Expand Down
Loading