mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-04-12 20:50:07 +03:00
Integrated Reload_NPC into more animation events and changed weapon_crossbow to be able to use a bodygroup instead of a skin for the empty bolt
This commit is contained in:
parent
0ce4251ba3
commit
c3176b34d0
@ -9723,7 +9723,7 @@ void CAI_BaseNPC::HandleAnimEvent( animevent_t *pEvent )
|
|||||||
if ( GetActiveWeapon() )
|
if ( GetActiveWeapon() )
|
||||||
{
|
{
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
GetActiveWeapon()->Reload_NPC();
|
GetActiveWeapon()->Reload_NPC( true );
|
||||||
#else
|
#else
|
||||||
GetActiveWeapon()->WeaponSound( RELOAD_NPC );
|
GetActiveWeapon()->WeaponSound( RELOAD_NPC );
|
||||||
GetActiveWeapon()->m_iClip1 = GetActiveWeapon()->GetMaxClip1();
|
GetActiveWeapon()->m_iClip1 = GetActiveWeapon()->GetMaxClip1();
|
||||||
@ -9747,8 +9747,12 @@ void CAI_BaseNPC::HandleAnimEvent( animevent_t *pEvent )
|
|||||||
case EVENT_WEAPON_RELOAD_FILL_CLIP:
|
case EVENT_WEAPON_RELOAD_FILL_CLIP:
|
||||||
{
|
{
|
||||||
if ( GetActiveWeapon() )
|
if ( GetActiveWeapon() )
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
GetActiveWeapon()->Reload_NPC( false );
|
||||||
|
#else
|
||||||
GetActiveWeapon()->m_iClip1 = GetActiveWeapon()->GetMaxClip1();
|
GetActiveWeapon()->m_iClip1 = GetActiveWeapon()->GetMaxClip1();
|
||||||
|
#endif
|
||||||
ClearCondition(COND_LOW_PRIMARY_AMMO);
|
ClearCondition(COND_LOW_PRIMARY_AMMO);
|
||||||
ClearCondition(COND_NO_PRIMARY_AMMO);
|
ClearCondition(COND_NO_PRIMARY_AMMO);
|
||||||
ClearCondition(COND_NO_SECONDARY_AMMO);
|
ClearCondition(COND_NO_SECONDARY_AMMO);
|
||||||
|
@ -542,7 +542,7 @@ public:
|
|||||||
virtual bool Holster( CBaseCombatWeapon *pSwitchingTo = NULL );
|
virtual bool Holster( CBaseCombatWeapon *pSwitchingTo = NULL );
|
||||||
virtual bool Reload( void );
|
virtual bool Reload( void );
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
virtual void Reload_NPC( void );
|
virtual void Reload_NPC( bool bPlaySound = true );
|
||||||
#endif
|
#endif
|
||||||
virtual void ItemPostFrame( void );
|
virtual void ItemPostFrame( void );
|
||||||
virtual void ItemBusyFrame( void );
|
virtual void ItemBusyFrame( void );
|
||||||
@ -819,11 +819,15 @@ bool CWeaponCrossbow::Reload( void )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CWeaponCrossbow::Reload_NPC( void )
|
void CWeaponCrossbow::Reload_NPC( bool bPlaySound )
|
||||||
{
|
{
|
||||||
BaseClass::Reload_NPC();
|
BaseClass::Reload_NPC( bPlaySound );
|
||||||
|
|
||||||
m_nSkin = 0;
|
int iBody = FindBodygroupByName( "bolt" );
|
||||||
|
if (iBody != -1)
|
||||||
|
SetBodygroup( iBody, 0 );
|
||||||
|
else
|
||||||
|
m_nSkin = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -973,7 +977,11 @@ void CWeaponCrossbow::FireNPCBolt( CAI_BaseNPC *pOwner, Vector &vecShootOrigin,
|
|||||||
|
|
||||||
m_iClip1--;
|
m_iClip1--;
|
||||||
|
|
||||||
m_nSkin = 1;
|
int iBody = FindBodygroupByName( "bolt" );
|
||||||
|
if (iBody != -1)
|
||||||
|
SetBodygroup( iBody, 1 );
|
||||||
|
else
|
||||||
|
m_nSkin = 1;
|
||||||
|
|
||||||
WeaponSound( SINGLE_NPC );
|
WeaponSound( SINGLE_NPC );
|
||||||
WeaponSound( SPECIAL2 );
|
WeaponSound( SPECIAL2 );
|
||||||
|
@ -2374,9 +2374,10 @@ bool CBaseCombatWeapon::Reload( void )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CBaseCombatWeapon::Reload_NPC( void )
|
void CBaseCombatWeapon::Reload_NPC( bool bPlaySound )
|
||||||
{
|
{
|
||||||
WeaponSound( RELOAD_NPC );
|
if (bPlaySound)
|
||||||
|
WeaponSound( RELOAD_NPC );
|
||||||
|
|
||||||
if (UsesClipsForAmmo1())
|
if (UsesClipsForAmmo1())
|
||||||
{
|
{
|
||||||
|
@ -321,7 +321,7 @@ public:
|
|||||||
bool ReloadsSingly( void ) const;
|
bool ReloadsSingly( void ) const;
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
// Originally created for the crossbow, can be used to add special NPC reloading behavior
|
// Originally created for the crossbow, can be used to add special NPC reloading behavior
|
||||||
virtual void Reload_NPC( void );
|
virtual void Reload_NPC( bool bPlaySound = true );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual bool AutoFiresFullClip( void ) { return false; }
|
virtual bool AutoFiresFullClip( void ) { return false; }
|
||||||
|
@ -398,9 +398,10 @@ bool CWeaponCustomScripted::Reload( void )
|
|||||||
return BaseClass::Reload();
|
return BaseClass::Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWeaponCustomScripted::Reload_NPC( void )
|
void CWeaponCustomScripted::Reload_NPC( bool bPlaySound )
|
||||||
{
|
{
|
||||||
SIMPLE_VOID_OVERRIDE( Reload_NPC, NULL );
|
ScriptVariant_t pArgs[] = { bPlaySound };
|
||||||
|
SIMPLE_VOID_OVERRIDE( Reload_NPC, pArgs );
|
||||||
|
|
||||||
BaseClass::Reload_NPC();
|
BaseClass::Reload_NPC();
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ public:
|
|||||||
void FinishReload( void );
|
void FinishReload( void );
|
||||||
void AbortReload( void );
|
void AbortReload( void );
|
||||||
bool Reload( void );
|
bool Reload( void );
|
||||||
void Reload_NPC( void );
|
void Reload_NPC( bool bPlaySound = true );
|
||||||
|
|
||||||
// Weapon firing
|
// Weapon firing
|
||||||
void PrimaryAttack( void ); // do "+ATTACK"
|
void PrimaryAttack( void ); // do "+ATTACK"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user