2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-25 03:09:24 +01:00

HL 25th anniversary update satchel changes. (#429)

This commit is contained in:
Andrey Akhmichin 2024-01-28 09:15:15 +00:00 committed by GitHub
parent ccbb5b763e
commit d020f6d474
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 75 additions and 14 deletions

View File

@ -34,7 +34,7 @@ cvar_t falldamage = { "mp_falldamage","0", FCVAR_SERVER };
cvar_t weaponstay = { "mp_weaponstay","0", FCVAR_SERVER }; cvar_t weaponstay = { "mp_weaponstay","0", FCVAR_SERVER };
cvar_t selfgauss = { "selfgauss", "1", FCVAR_SERVER }; cvar_t selfgauss = { "selfgauss", "1", FCVAR_SERVER };
cvar_t chargerfix = { "chargerfix", "0", FCVAR_SERVER }; cvar_t chargerfix = { "chargerfix", "0", FCVAR_SERVER };
cvar_t satchelfix = { "satchelfix", "0", FCVAR_SERVER }; cvar_t satchelfix = { "satchelfix", "1", FCVAR_SERVER };
cvar_t explosionfix = { "explosionfix", "0", FCVAR_SERVER }; cvar_t explosionfix = { "explosionfix", "0", FCVAR_SERVER };
cvar_t monsteryawspeedfix = { "monsteryawspeedfix", "1", FCVAR_SERVER }; cvar_t monsteryawspeedfix = { "monsteryawspeedfix", "1", FCVAR_SERVER };
cvar_t corpsephysics = { "corpsephysics", "0", FCVAR_SERVER }; cvar_t corpsephysics = { "corpsephysics", "0", FCVAR_SERVER };

View File

@ -22,6 +22,7 @@
#include "nodes.h" #include "nodes.h"
#include "player.h" #include "player.h"
#include "gamerules.h" #include "gamerules.h"
#include "game.h"
enum satchel_state enum satchel_state
{ {
@ -191,23 +192,39 @@ LINK_ENTITY_TO_CLASS( weapon_satchel, CSatchel )
//========================================================= //=========================================================
int CSatchel::AddDuplicate( CBasePlayerItem *pOriginal ) int CSatchel::AddDuplicate( CBasePlayerItem *pOriginal )
{ {
#if !CLIENT_DLL
CSatchel *pSatchel; CSatchel *pSatchel;
int nNumSatchels, nSatchelsInPocket;
CBaseEntity *ent;
#if CLIENT_DLL
if( bIsMultiplayer() )
#else
if( g_pGameRules->IsMultiplayer() ) if( g_pGameRules->IsMultiplayer() )
#endif
{ {
if( satchelfix.value )
{
if( !pOriginal->m_pPlayer )
return TRUE;
nNumSatchels = 0;
nSatchelsInPocket = pOriginal->m_pPlayer->m_rgAmmo[pOriginal->PrimaryAmmoIndex()];
ent = NULL;
while( ( ent = UTIL_FindEntityInSphere( ent, pOriginal->m_pPlayer->pev->origin, 4096 )) != NULL )
{
if( FClassnameIs( ent->pev, "monster_satchel" ))
nNumSatchels += ent->pev->owner == pOriginal->m_pPlayer->edict();
}
}
pSatchel = (CSatchel *)pOriginal; pSatchel = (CSatchel *)pOriginal;
if( pSatchel->m_chargeReady != SATCHEL_IDLE ) if( pSatchel->m_chargeReady != SATCHEL_IDLE
&& ( satchelfix.value && nSatchelsInPocket + nNumSatchels > SATCHEL_MAX_CARRY - 1 ))
{ {
// player has some satchels deployed. Refuse to add more. // player has some satchels deployed. Refuse to add more.
return FALSE; return FALSE;
} }
} }
#endif
return CBasePlayerWeapon::AddDuplicate( pOriginal ); return CBasePlayerWeapon::AddDuplicate( pOriginal );
} }
@ -330,8 +347,9 @@ void CSatchel::Holster( int skiplocal /* = 0 */ )
} }
} }
void CSatchel::PrimaryAttack() void CSatchel::PrimaryAttack( void )
{ {
#if SATCHEL_OLD_BEHAVIOUR
switch( m_chargeReady ) switch( m_chargeReady )
{ {
case SATCHEL_IDLE: case SATCHEL_IDLE:
@ -368,14 +386,56 @@ void CSatchel::PrimaryAttack()
// we're reloading, don't allow fire // we're reloading, don't allow fire
break; break;
} }
} #else
void CSatchel::SecondaryAttack( void )
{
if( m_chargeReady != SATCHEL_RELOAD ) if( m_chargeReady != SATCHEL_RELOAD )
{ {
Throw(); Throw();
} }
#endif
}
void CSatchel::SecondaryAttack( void )
{
#if SATCHEL_OLD_BEHAVIOUR
if( m_chargeReady != SATCHEL_RELOAD )
{
Throw();
}
#else
switch( m_chargeReady )
{
case SATCHEL_IDLE:
break;
case SATCHEL_READY:
{
SendWeaponAnim( SATCHEL_RADIO_FIRE );
edict_t *pPlayer = m_pPlayer->edict();
CBaseEntity *pSatchel = NULL;
while( ( pSatchel = UTIL_FindEntityInSphere( pSatchel, m_pPlayer->pev->origin, 4096 )) != NULL )
{
if( FClassnameIs( pSatchel->pev, "monster_satchel" ))
{
if( pSatchel->pev->owner == pPlayer )
{
pSatchel->Use( m_pPlayer, m_pPlayer, USE_ON, 0 );
}
}
}
m_chargeReady = SATCHEL_RELOAD;
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5f );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5f;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5f;
break;
}
case SATCHEL_RELOAD:
// we're reloading, don't allow fire
break;
}
#endif
} }
void CSatchel::Throw( void ) void CSatchel::Throw( void )

View File

@ -7,6 +7,7 @@ GAUSS_OVERCHARGE_FIX=OFF # Gauss overcharge fix
TRIPMINE_BEAM_DUPLICATION_FIX=OFF # Fix of tripmine beam duplication on level transition TRIPMINE_BEAM_DUPLICATION_FIX=OFF # Fix of tripmine beam duplication on level transition
HANDGRENADE_DEPLOY_FIX=OFF # Handgrenade deploy animation fix after finishing a throw HANDGRENADE_DEPLOY_FIX=OFF # Handgrenade deploy animation fix after finishing a throw
WEAPONS_ANIMATION_TIMES_FIX=OFF # Animation times fix for some weapons WEAPONS_ANIMATION_TIMES_FIX=OFF # Animation times fix for some weapons
SATCHEL_OLD_BEHAVIOUR=OFF # Old pre-HL 25th satchel's behaviour
OEM_BUILD=OFF # OEM Build OEM_BUILD=OFF # OEM Build
HLDEMO_BUILD=OFF # Demo Build HLDEMO_BUILD=OFF # Demo Build