mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-27 15:25:30 +03:00
Redid the backup activity system so that individual weapons can choose which activity tables to fall back to
This commit is contained in:
parent
3431f21f4d
commit
b9f3ac03fa
@ -61,11 +61,6 @@
|
|||||||
extern int g_interactionBarnacleVictimReleased;
|
extern int g_interactionBarnacleVictimReleased;
|
||||||
#endif //HL2_DLL
|
#endif //HL2_DLL
|
||||||
|
|
||||||
#ifdef MAPBASE
|
|
||||||
extern acttable_t *GetSMG1Acttable();
|
|
||||||
extern int GetSMG1ActtableCount();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern ConVar weapon_showproficiency;
|
extern ConVar weapon_showproficiency;
|
||||||
|
|
||||||
ConVar ai_show_hull_attacks( "ai_show_hull_attacks", "0" );
|
ConVar ai_show_hull_attacks( "ai_show_hull_attacks", "0" );
|
||||||
@ -2751,8 +2746,10 @@ Activity CBaseCombatCharacter::Weapon_BackupActivity( Activity activity, bool we
|
|||||||
return activity;
|
return activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
acttable_t *pTable = GetSMG1Acttable();
|
acttable_t *pTable = pWeapon->GetBackupActivityList();
|
||||||
int actCount = GetSMG1ActtableCount();
|
if (pTable)
|
||||||
|
{
|
||||||
|
int actCount = pWeapon->GetBackupActivityListCount();
|
||||||
for ( int i = 0; i < actCount; i++, pTable++ )
|
for ( int i = 0; i < actCount; i++, pTable++ )
|
||||||
{
|
{
|
||||||
if ( activity == pTable->baseAct )
|
if ( activity == pTable->baseAct )
|
||||||
@ -2766,6 +2763,7 @@ Activity CBaseCombatCharacter::Weapon_BackupActivity( Activity activity, bool we
|
|||||||
return (Activity)pTable->weaponAct;
|
return (Activity)pTable->weaponAct;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return activity;
|
return activity;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
// CWeapon357
|
// CWeapon357
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
extern acttable_t *GetPistolActtable();
|
||||||
|
extern int GetPistolActtableCount();
|
||||||
|
#endif
|
||||||
|
|
||||||
class CWeapon357 : public CBaseHLCombatWeapon
|
class CWeapon357 : public CBaseHLCombatWeapon
|
||||||
{
|
{
|
||||||
DECLARE_CLASS( CWeapon357, CBaseHLCombatWeapon );
|
DECLARE_CLASS( CWeapon357, CBaseHLCombatWeapon );
|
||||||
@ -69,6 +74,9 @@ public:
|
|||||||
|
|
||||||
void FireNPCPrimaryAttack( CBaseCombatCharacter *pOperator, Vector &vecShootOrigin, Vector &vecShootDir );
|
void FireNPCPrimaryAttack( CBaseCombatCharacter *pOperator, Vector &vecShootOrigin, Vector &vecShootDir );
|
||||||
void Operator_ForceNPCFire( CBaseCombatCharacter *pOperator, bool bSecondary );
|
void Operator_ForceNPCFire( CBaseCombatCharacter *pOperator, bool bSecondary );
|
||||||
|
|
||||||
|
virtual acttable_t *GetBackupActivityList() { return GetPistolActtable(); }
|
||||||
|
virtual int GetBackupActivityListCount() { return GetPistolActtableCount(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DECLARE_SERVERCLASS();
|
DECLARE_SERVERCLASS();
|
||||||
|
@ -13,6 +13,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
extern acttable_t *GetPistolActtable();
|
||||||
|
extern int GetPistolActtableCount();
|
||||||
|
#endif
|
||||||
|
|
||||||
class CWeaponAlyxGun : public CHLSelectFireMachineGun
|
class CWeaponAlyxGun : public CHLSelectFireMachineGun
|
||||||
{
|
{
|
||||||
DECLARE_DATADESC();
|
DECLARE_DATADESC();
|
||||||
@ -51,6 +56,11 @@ public:
|
|||||||
SetTouch(NULL);
|
SetTouch(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
virtual acttable_t *GetBackupActivityList() { return GetPistolActtable(); }
|
||||||
|
virtual int GetBackupActivityListCount() { return GetPistolActtableCount(); }
|
||||||
|
#endif
|
||||||
|
|
||||||
float m_flTooCloseTimer;
|
float m_flTooCloseTimer;
|
||||||
|
|
||||||
DECLARE_ACTTABLE();
|
DECLARE_ACTTABLE();
|
||||||
|
@ -38,10 +38,6 @@ ConVar sk_weapon_ar2_alt_fire_radius( "sk_weapon_ar2_alt_fire_radius", "10" );
|
|||||||
ConVar sk_weapon_ar2_alt_fire_duration( "sk_weapon_ar2_alt_fire_duration", "2" );
|
ConVar sk_weapon_ar2_alt_fire_duration( "sk_weapon_ar2_alt_fire_duration", "2" );
|
||||||
ConVar sk_weapon_ar2_alt_fire_mass( "sk_weapon_ar2_alt_fire_mass", "150" );
|
ConVar sk_weapon_ar2_alt_fire_mass( "sk_weapon_ar2_alt_fire_mass", "150" );
|
||||||
|
|
||||||
#ifdef MAPBASE
|
|
||||||
extern acttable_t *GetSMG1Acttable();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//=========================================================
|
//=========================================================
|
||||||
//=========================================================
|
//=========================================================
|
||||||
|
|
||||||
|
@ -46,6 +46,12 @@ public:
|
|||||||
// Animation event
|
// Animation event
|
||||||
virtual void Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator );
|
virtual void Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// Don't use backup activities
|
||||||
|
acttable_t *GetBackupActivityList() { return NULL; }
|
||||||
|
int GetBackupActivityListCount() { return 0; }
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Animation event handlers
|
// Animation event handlers
|
||||||
void HandleAnimEventMeleeHit( animevent_t *pEvent, CBaseCombatCharacter *pOperator );
|
void HandleAnimEventMeleeHit( animevent_t *pEvent, CBaseCombatCharacter *pOperator );
|
||||||
|
@ -108,6 +108,12 @@ public:
|
|||||||
return 0.5f;
|
return 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// Pistols are their own backup activities
|
||||||
|
virtual acttable_t *GetBackupActivityList() { return NULL; }
|
||||||
|
virtual int GetBackupActivityListCount() { return 0; }
|
||||||
|
#endif
|
||||||
|
|
||||||
DECLARE_ACTTABLE();
|
DECLARE_ACTTABLE();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1077,6 +1077,11 @@ WeaponClass_t CBaseCombatWeapon::WeaponClassFromString(const char *str)
|
|||||||
return WEPCLASS_INVALID;
|
return WEPCLASS_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HL2_DLL
|
||||||
|
extern acttable_t *GetSMG1Acttable();
|
||||||
|
extern int GetSMG1ActtableCount();
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -1084,12 +1089,32 @@ bool CBaseCombatWeapon::SupportsBackupActivity(Activity activity)
|
|||||||
{
|
{
|
||||||
// Derived classes should override this.
|
// Derived classes should override this.
|
||||||
|
|
||||||
// Pistol and melee users should not use SMG animations for missing pistol activities.
|
#ifdef HL2_DLL
|
||||||
if (WeaponClassify() == WEPCLASS_HANDGUN || IsMeleeWeapon())
|
// Melee users should not use SMG animations for missing activities.
|
||||||
|
if (IsMeleeWeapon() && GetBackupActivityList() == GetSMG1Acttable())
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
acttable_t *CBaseCombatWeapon::GetBackupActivityList()
|
||||||
|
{
|
||||||
|
#ifdef HL2_DLL
|
||||||
|
return GetSMG1Acttable();
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int CBaseCombatWeapon::GetBackupActivityListCount()
|
||||||
|
{
|
||||||
|
#ifdef HL2_DLL
|
||||||
|
return GetSMG1ActtableCount();
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -230,6 +230,8 @@ public:
|
|||||||
static WeaponClass_t WeaponClassFromString(const char *str);
|
static WeaponClass_t WeaponClassFromString(const char *str);
|
||||||
|
|
||||||
virtual bool SupportsBackupActivity(Activity activity);
|
virtual bool SupportsBackupActivity(Activity activity);
|
||||||
|
virtual acttable_t *GetBackupActivityList();
|
||||||
|
virtual int GetBackupActivityListCount();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual void Equip( CBaseCombatCharacter *pOwner );
|
virtual void Equip( CBaseCombatCharacter *pOwner );
|
||||||
|
@ -83,6 +83,12 @@ public:
|
|||||||
|
|
||||||
float GetDamageForActivity( Activity hitActivity );
|
float GetDamageForActivity( Activity hitActivity );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// Don't use backup activities
|
||||||
|
acttable_t *GetBackupActivityList() { return NULL; }
|
||||||
|
int GetBackupActivityListCount() { return 0; }
|
||||||
|
#endif
|
||||||
|
|
||||||
CWeaponStunStick( const CWeaponStunStick & );
|
CWeaponStunStick( const CWeaponStunStick & );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user