mirror of
https://github.com/FWGS/hlsdk-xash3d
synced 2025-01-23 02:10:13 +01:00
Merge 68c9b7cf6b
This commit is contained in:
parent
cf9ba71686
commit
70c6e42907
@ -277,7 +277,7 @@ void CBasePlayer::ForceClientDllUpdate( void ) { }
|
||||
void CBasePlayer::ImpulseCommands() { }
|
||||
void CBasePlayer::CheatImpulseCommands( int iImpulse ) { }
|
||||
int CBasePlayer::AddPlayerItem( CBasePlayerItem *pItem ) { return FALSE; }
|
||||
int CBasePlayer::RemovePlayerItem( CBasePlayerItem *pItem ) { return FALSE; }
|
||||
int CBasePlayer::RemovePlayerItem( CBasePlayerItem *pItem, bool bCallHoster ) { return FALSE; }
|
||||
void CBasePlayer::ItemPreFrame() { }
|
||||
void CBasePlayer::ItemPostFrame() { }
|
||||
int CBasePlayer::AmmoInventory( int iAmmoIndex ) { return -1; }
|
||||
|
@ -99,8 +99,7 @@ void CHandGrenade::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
// no more grenades!
|
||||
m_pPlayer->pev->weapons &= ~( 1 << WEAPON_HANDGRENADE );
|
||||
SetThink( &CBasePlayerItem::DestroyItem );
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
DestroyItem();
|
||||
}
|
||||
|
||||
if( m_flStartThrow )
|
||||
|
@ -666,8 +666,8 @@ void CBasePlayer::PackDeadPlayerItems( void )
|
||||
int iWeaponRules;
|
||||
int iAmmoRules;
|
||||
int i;
|
||||
CBasePlayerWeapon *rgpPackWeapons[20] = {0};// 20 hardcoded for now. How to determine exactly how many weapons we have?
|
||||
int iPackAmmo[MAX_AMMO_SLOTS + 1];
|
||||
CBasePlayerWeapon *rgpPackWeapons[MAX_WEAPONS] = {};
|
||||
int iPackAmmo[MAX_AMMO_SLOTS];
|
||||
int iPW = 0;// index into packweapons array
|
||||
int iPA = 0;// index into packammo array
|
||||
|
||||
@ -675,7 +675,7 @@ void CBasePlayer::PackDeadPlayerItems( void )
|
||||
|
||||
// get the game rules
|
||||
iWeaponRules = g_pGameRules->DeadPlayerWeapons( this );
|
||||
iAmmoRules = g_pGameRules->DeadPlayerAmmo( this );
|
||||
iAmmoRules = g_pGameRules->DeadPlayerAmmo( this );
|
||||
|
||||
if( iWeaponRules == GR_PLR_DROP_GUN_NO && iAmmoRules == GR_PLR_DROP_AMMO_NO )
|
||||
{
|
||||
@ -685,14 +685,14 @@ void CBasePlayer::PackDeadPlayerItems( void )
|
||||
}
|
||||
|
||||
// go through all of the weapons and make a list of the ones to pack
|
||||
for( i = 0; i < MAX_ITEM_TYPES; i++ )
|
||||
for( i = 0; i < MAX_ITEM_TYPES && iPW < MAX_WEAPONS; i++ )
|
||||
{
|
||||
if( m_rgpPlayerItems[i] )
|
||||
{
|
||||
// there's a weapon here. Should I pack it?
|
||||
CBasePlayerItem *pPlayerItem = m_rgpPlayerItems[i];
|
||||
|
||||
while( pPlayerItem )
|
||||
while( pPlayerItem && iPW < MAX_WEAPONS )
|
||||
{
|
||||
switch( iWeaponRules )
|
||||
{
|
||||
@ -3640,14 +3640,16 @@ int CBasePlayer::AddPlayerItem( CBasePlayerItem *pItem )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int CBasePlayer::RemovePlayerItem( CBasePlayerItem *pItem )
|
||||
int CBasePlayer::RemovePlayerItem( CBasePlayerItem *pItem, bool bCallHolster )
|
||||
{
|
||||
pItem->pev->nextthink = 0;// crowbar may be trying to swing again, etc.
|
||||
pItem->SetThink( NULL );
|
||||
|
||||
if( m_pActiveItem == pItem )
|
||||
{
|
||||
ResetAutoaim();
|
||||
pItem->Holster();
|
||||
pItem->pev->nextthink = 0;// crowbar may be trying to swing again, etc.
|
||||
pItem->SetThink( NULL );
|
||||
if( bCallHolster )
|
||||
pItem->Holster();
|
||||
m_pActiveItem = NULL;
|
||||
pev->viewmodel = 0;
|
||||
pev->weaponmodel = 0;
|
||||
|
@ -259,7 +259,7 @@ public:
|
||||
void AddPoints( int score, BOOL bAllowNegativeScore );
|
||||
void AddPointsToTeam( int score, BOOL bAllowNegativeScore );
|
||||
BOOL AddPlayerItem( CBasePlayerItem *pItem );
|
||||
BOOL RemovePlayerItem( CBasePlayerItem *pItem );
|
||||
BOOL RemovePlayerItem( CBasePlayerItem *pItem, bool bCallHoster );
|
||||
void DropPlayerItem ( char *pszItemName );
|
||||
BOOL HasPlayerItem( CBasePlayerItem *pCheckItem );
|
||||
BOOL HasNamedPlayerItem( const char *pszItemName );
|
||||
|
@ -23,6 +23,13 @@
|
||||
#include "player.h"
|
||||
#include "gamerules.h"
|
||||
|
||||
enum satchel_state
|
||||
{
|
||||
SATCHEL_IDLE = 0,
|
||||
SATCHEL_READY,
|
||||
SATCHEL_RELOAD
|
||||
};
|
||||
|
||||
enum satchel_e
|
||||
{
|
||||
SATCHEL_IDLE1 = 0,
|
||||
@ -194,7 +201,7 @@ int CSatchel::AddDuplicate( CBasePlayerItem *pOriginal )
|
||||
{
|
||||
pSatchel = (CSatchel *)pOriginal;
|
||||
|
||||
if( pSatchel->m_chargeReady != 0 )
|
||||
if( pSatchel->m_chargeReady != SATCHEL_IDLE )
|
||||
{
|
||||
// player has some satchels deployed. Refuse to add more.
|
||||
return FALSE;
|
||||
@ -211,7 +218,7 @@ int CSatchel::AddToPlayer( CBasePlayer *pPlayer )
|
||||
int bResult = CBasePlayerItem::AddToPlayer( pPlayer );
|
||||
|
||||
pPlayer->pev->weapons |= ( 1 << m_iId );
|
||||
m_chargeReady = 0;// this satchel charge weapon now forgets that any satchels are deployed by it.
|
||||
m_chargeReady = SATCHEL_IDLE;// this satchel charge weapon now forgets that any satchels are deployed by it.
|
||||
|
||||
if( bResult )
|
||||
{
|
||||
@ -263,19 +270,7 @@ int CSatchel::GetItemInfo( ItemInfo *p )
|
||||
//=========================================================
|
||||
BOOL CSatchel::IsUseable( void )
|
||||
{
|
||||
if( m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] > 0 )
|
||||
{
|
||||
// player is carrying some satchels
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if( m_chargeReady != 0 )
|
||||
{
|
||||
// player isn't carrying any satchels, but has some out
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return CanDeploy();
|
||||
}
|
||||
|
||||
BOOL CSatchel::CanDeploy( void )
|
||||
@ -286,7 +281,7 @@ BOOL CSatchel::CanDeploy( void )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if( m_chargeReady != 0 )
|
||||
if( m_chargeReady )
|
||||
{
|
||||
// player isn't carrying any satchels, but has some out
|
||||
return TRUE;
|
||||
@ -322,11 +317,10 @@ void CSatchel::Holster( int skiplocal /* = 0 */ )
|
||||
}
|
||||
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "common/null.wav", 1.0, ATTN_NORM );
|
||||
|
||||
if( !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] && !m_chargeReady )
|
||||
if( !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] && m_chargeReady != SATCHEL_READY )
|
||||
{
|
||||
m_pPlayer->pev->weapons &= ~( 1 << WEAPON_SATCHEL );
|
||||
SetThink( &CBasePlayerItem::DestroyItem );
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
DestroyItem();
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,38 +328,37 @@ void CSatchel::PrimaryAttack()
|
||||
{
|
||||
switch( m_chargeReady )
|
||||
{
|
||||
case 0:
|
||||
case SATCHEL_IDLE:
|
||||
{
|
||||
Throw();
|
||||
Throw();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case SATCHEL_READY:
|
||||
{
|
||||
SendWeaponAnim( SATCHEL_RADIO_FIRE );
|
||||
SendWeaponAnim( SATCHEL_RADIO_FIRE );
|
||||
|
||||
edict_t *pPlayer = m_pPlayer->edict();
|
||||
edict_t *pPlayer = m_pPlayer->edict();
|
||||
|
||||
CBaseEntity *pSatchel = NULL;
|
||||
CBaseEntity *pSatchel = NULL;
|
||||
|
||||
while( ( pSatchel = UTIL_FindEntityInSphere( pSatchel, m_pPlayer->pev->origin, 4096 ) ) != NULL )
|
||||
{
|
||||
if( FClassnameIs( pSatchel->pev, "monster_satchel" ) )
|
||||
while( ( pSatchel = UTIL_FindEntityInSphere( pSatchel, m_pPlayer->pev->origin, 4096 ) ) != NULL )
|
||||
{
|
||||
if( pSatchel->pev->owner == pPlayer )
|
||||
if( FClassnameIs( pSatchel->pev, "monster_satchel" ) )
|
||||
{
|
||||
pSatchel->Use( m_pPlayer, m_pPlayer, USE_ON, 0 );
|
||||
m_chargeReady = 2;
|
||||
if( pSatchel->pev->owner == pPlayer )
|
||||
{
|
||||
pSatchel->Use( m_pPlayer, m_pPlayer, USE_ON, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_chargeReady = 2;
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
|
||||
break;
|
||||
m_chargeReady = SATCHEL_RELOAD;
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case SATCHEL_RELOAD:
|
||||
// we're reloading, don't allow fire
|
||||
break;
|
||||
}
|
||||
@ -373,7 +366,7 @@ void CSatchel::PrimaryAttack()
|
||||
|
||||
void CSatchel::SecondaryAttack( void )
|
||||
{
|
||||
if( m_chargeReady != 2 )
|
||||
if( m_chargeReady != SATCHEL_RELOAD )
|
||||
{
|
||||
Throw();
|
||||
}
|
||||
@ -403,8 +396,8 @@ void CSatchel::Throw( void )
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
m_chargeReady = 1;
|
||||
|
||||
m_chargeReady = SATCHEL_READY;
|
||||
|
||||
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
|
||||
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 1.0 );
|
||||
@ -419,17 +412,17 @@ void CSatchel::WeaponIdle( void )
|
||||
|
||||
switch( m_chargeReady )
|
||||
{
|
||||
case 0:
|
||||
case SATCHEL_IDLE:
|
||||
SendWeaponAnim( SATCHEL_FIDGET1 );
|
||||
// use tripmine animations
|
||||
strcpy( m_pPlayer->m_szAnimExtention, "trip" );
|
||||
break;
|
||||
case 1:
|
||||
case SATCHEL_READY:
|
||||
SendWeaponAnim( SATCHEL_RADIO_FIDGET1 );
|
||||
// use hivehand animations
|
||||
strcpy( m_pPlayer->m_szAnimExtention, "hive" );
|
||||
break;
|
||||
case 2:
|
||||
case SATCHEL_RELOAD:
|
||||
if( !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
|
||||
{
|
||||
m_chargeReady = 0;
|
||||
@ -450,7 +443,7 @@ void CSatchel::WeaponIdle( void )
|
||||
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_chargeReady = 0;
|
||||
m_chargeReady = SATCHEL_IDLE;
|
||||
break;
|
||||
}
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );// how long till we do this again.
|
||||
|
@ -475,8 +475,7 @@ void CSqueak::Holster( int skiplocal /* = 0 */ )
|
||||
if( !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
|
||||
{
|
||||
m_pPlayer->pev->weapons &= ~( 1 << WEAPON_SNARK );
|
||||
SetThink( &CBasePlayerItem::DestroyItem );
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
DestroyItem();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -418,8 +418,7 @@ void CTripmine::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
// out of mines
|
||||
m_pPlayer->pev->weapons &= ~( 1 << WEAPON_TRIPMINE );
|
||||
SetThink( &CBasePlayerItem::DestroyItem );
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
DestroyItem();
|
||||
}
|
||||
|
||||
SendWeaponAnim( TRIPMINE_HOLSTER );
|
||||
|
@ -688,8 +688,8 @@ void CBasePlayerItem::DestroyItem( void )
|
||||
{
|
||||
if( m_pPlayer )
|
||||
{
|
||||
// if attached to a player, remove.
|
||||
m_pPlayer->RemovePlayerItem( this );
|
||||
// if attached to a player, remove.
|
||||
m_pPlayer->RemovePlayerItem( this, false );
|
||||
}
|
||||
|
||||
Kill();
|
||||
@ -1140,7 +1140,17 @@ void CBasePlayerWeapon::RetireWeapon( void )
|
||||
m_pPlayer->pev->weaponmodel = iStringNull;
|
||||
//m_pPlayer->pev->viewmodelindex = NULL;
|
||||
|
||||
g_pGameRules->GetNextBestWeapon( m_pPlayer, this );
|
||||
if( !g_pGameRules->GetNextBestWeapon( m_pPlayer, this ) )
|
||||
{
|
||||
// Another weapon wasn't selected. Get rid of current one
|
||||
if( m_pPlayer->m_pActiveItem == this )
|
||||
{
|
||||
m_pPlayer->ResetAutoaim();
|
||||
m_pPlayer->m_pActiveItem->Holster();
|
||||
m_pPlayer->m_pLastItem = NULL;
|
||||
m_pPlayer->m_pActiveItem = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
@ -1340,7 +1350,7 @@ BOOL CWeaponBox::PackWeapon( CBasePlayerItem *pWeapon )
|
||||
|
||||
if( pWeapon->m_pPlayer )
|
||||
{
|
||||
if( !pWeapon->m_pPlayer->RemovePlayerItem( pWeapon ) )
|
||||
if( !pWeapon->m_pPlayer->RemovePlayerItem( pWeapon, true ) )
|
||||
{
|
||||
// failed to unhook the weapon from the player!
|
||||
return FALSE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user