mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-26 23:05: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;
|
||||
#endif //HL2_DLL
|
||||
|
||||
#ifdef MAPBASE
|
||||
extern acttable_t *GetSMG1Acttable();
|
||||
extern int GetSMG1ActtableCount();
|
||||
#endif
|
||||
|
||||
extern ConVar weapon_showproficiency;
|
||||
|
||||
ConVar ai_show_hull_attacks( "ai_show_hull_attacks", "0" );
|
||||
@ -2751,19 +2746,22 @@ Activity CBaseCombatCharacter::Weapon_BackupActivity( Activity activity, bool we
|
||||
return activity;
|
||||
}
|
||||
|
||||
acttable_t *pTable = GetSMG1Acttable();
|
||||
int actCount = GetSMG1ActtableCount();
|
||||
for ( int i = 0; i < actCount; i++, pTable++ )
|
||||
acttable_t *pTable = pWeapon->GetBackupActivityList();
|
||||
if (pTable)
|
||||
{
|
||||
if ( activity == pTable->baseAct )
|
||||
int actCount = pWeapon->GetBackupActivityListCount();
|
||||
for ( int i = 0; i < actCount; i++, pTable++ )
|
||||
{
|
||||
// Don't pick SMG animations we don't actually have an animation for.
|
||||
if (GetModelPtr() ? !GetModelPtr()->HaveSequenceForActivity(pTable->weaponAct) : false)
|
||||
if ( activity == pTable->baseAct )
|
||||
{
|
||||
return activity;
|
||||
}
|
||||
// Don't pick SMG animations we don't actually have an animation for.
|
||||
if (GetModelPtr() ? !GetModelPtr()->HaveSequenceForActivity(pTable->weaponAct) : false)
|
||||
{
|
||||
return activity;
|
||||
}
|
||||
|
||||
return (Activity)pTable->weaponAct;
|
||||
return (Activity)pTable->weaponAct;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,11 @@
|
||||
// CWeapon357
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifdef MAPBASE
|
||||
extern acttable_t *GetPistolActtable();
|
||||
extern int GetPistolActtableCount();
|
||||
#endif
|
||||
|
||||
class CWeapon357 : public CBaseHLCombatWeapon
|
||||
{
|
||||
DECLARE_CLASS( CWeapon357, CBaseHLCombatWeapon );
|
||||
@ -69,6 +74,9 @@ public:
|
||||
|
||||
void FireNPCPrimaryAttack( CBaseCombatCharacter *pOperator, Vector &vecShootOrigin, Vector &vecShootDir );
|
||||
void Operator_ForceNPCFire( CBaseCombatCharacter *pOperator, bool bSecondary );
|
||||
|
||||
virtual acttable_t *GetBackupActivityList() { return GetPistolActtable(); }
|
||||
virtual int GetBackupActivityListCount() { return GetPistolActtableCount(); }
|
||||
#endif
|
||||
|
||||
DECLARE_SERVERCLASS();
|
||||
|
@ -13,6 +13,11 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifdef MAPBASE
|
||||
extern acttable_t *GetPistolActtable();
|
||||
extern int GetPistolActtableCount();
|
||||
#endif
|
||||
|
||||
class CWeaponAlyxGun : public CHLSelectFireMachineGun
|
||||
{
|
||||
DECLARE_DATADESC();
|
||||
@ -51,6 +56,11 @@ public:
|
||||
SetTouch(NULL);
|
||||
}
|
||||
|
||||
#ifdef MAPBASE
|
||||
virtual acttable_t *GetBackupActivityList() { return GetPistolActtable(); }
|
||||
virtual int GetBackupActivityListCount() { return GetPistolActtableCount(); }
|
||||
#endif
|
||||
|
||||
float m_flTooCloseTimer;
|
||||
|
||||
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_mass( "sk_weapon_ar2_alt_fire_mass", "150" );
|
||||
|
||||
#ifdef MAPBASE
|
||||
extern acttable_t *GetSMG1Acttable();
|
||||
#endif
|
||||
|
||||
//=========================================================
|
||||
//=========================================================
|
||||
|
||||
|
@ -46,6 +46,12 @@ public:
|
||||
// Animation event
|
||||
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:
|
||||
// Animation event handlers
|
||||
void HandleAnimEventMeleeHit( animevent_t *pEvent, CBaseCombatCharacter *pOperator );
|
||||
|
@ -108,6 +108,12 @@ public:
|
||||
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();
|
||||
|
||||
private:
|
||||
|
@ -1077,6 +1077,11 @@ WeaponClass_t CBaseCombatWeapon::WeaponClassFromString(const char *str)
|
||||
return WEPCLASS_INVALID;
|
||||
}
|
||||
|
||||
#ifdef HL2_DLL
|
||||
extern acttable_t *GetSMG1Acttable();
|
||||
extern int GetSMG1ActtableCount();
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -1084,12 +1089,32 @@ bool CBaseCombatWeapon::SupportsBackupActivity(Activity activity)
|
||||
{
|
||||
// Derived classes should override this.
|
||||
|
||||
// Pistol and melee users should not use SMG animations for missing pistol activities.
|
||||
if (WeaponClassify() == WEPCLASS_HANDGUN || IsMeleeWeapon())
|
||||
#ifdef HL2_DLL
|
||||
// Melee users should not use SMG animations for missing activities.
|
||||
if (IsMeleeWeapon() && GetBackupActivityList() == GetSMG1Acttable())
|
||||
return false;
|
||||
#endif
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
@ -230,6 +230,8 @@ public:
|
||||
static WeaponClass_t WeaponClassFromString(const char *str);
|
||||
|
||||
virtual bool SupportsBackupActivity(Activity activity);
|
||||
virtual acttable_t *GetBackupActivityList();
|
||||
virtual int GetBackupActivityListCount();
|
||||
#endif
|
||||
|
||||
virtual void Equip( CBaseCombatCharacter *pOwner );
|
||||
|
@ -83,6 +83,12 @@ public:
|
||||
|
||||
float GetDamageForActivity( Activity hitActivity );
|
||||
|
||||
#ifdef MAPBASE
|
||||
// Don't use backup activities
|
||||
acttable_t *GetBackupActivityList() { return NULL; }
|
||||
int GetBackupActivityListCount() { return 0; }
|
||||
#endif
|
||||
|
||||
CWeaponStunStick( const CWeaponStunStick & );
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user