mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-27 22:27:57 +03:00
Added unique annabelle activities and adjusted AI to better-handle the weapon
This commit is contained in:
parent
ebfd715843
commit
7dab039099
@ -2283,6 +2283,13 @@ void CAI_BaseNPC::InitDefaultActivitySR(void)
|
||||
ADD_ACTIVITY_TO_SR( ACT_RANGE_ATTACK_RPG_LOW );
|
||||
ADD_ACTIVITY_TO_SR( ACT_GESTURE_RANGE_ATTACK_RPG );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_RANGE_ATTACK_ANNABELLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_RANGE_ATTACK_ANNABELLE_LOW );
|
||||
ADD_ACTIVITY_TO_SR( ACT_GESTURE_RANGE_ATTACK_ANNABELLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_RELOAD_ANNABELLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_RELOAD_ANNABELLE_LOW );
|
||||
ADD_ACTIVITY_TO_SR( ACT_GESTURE_RELOAD_ANNABELLE );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_WALK_MELEE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_RUN_MELEE );
|
||||
|
||||
|
@ -412,6 +412,9 @@ public:
|
||||
}
|
||||
void SetCurrentWeaponProficiency( WeaponProficiency_t iProficiency ) { m_CurrentWeaponProficiency = iProficiency; }
|
||||
virtual WeaponProficiency_t CalcWeaponProficiency( CBaseCombatWeapon *pWeapon );
|
||||
#ifdef MAPBASE
|
||||
inline bool OverridingWeaponProficiency() { return (m_ProficiencyOverride > WEAPON_PROFICIENCY_INVALID); }
|
||||
#endif
|
||||
virtual Vector GetAttackSpread( CBaseCombatWeapon *pWeapon, CBaseEntity *pTarget = NULL );
|
||||
virtual float GetSpreadBias( CBaseCombatWeapon *pWeapon, CBaseEntity *pTarget );
|
||||
virtual void DoMuzzleFlash();
|
||||
|
@ -4933,8 +4933,8 @@ int CNPC_MetroPolice::SelectSchedule( void )
|
||||
if ( !bHighHealth && !HasBaton() )
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
// Don't do this with the 357 or any weapons which don't use clips
|
||||
if ( GetActiveWeapon() && GetActiveWeapon()->UsesClipsForAmmo1() && GetActiveWeapon()->m_iClassname != gm_isz_class_357 && (GetActiveWeapon()->m_iClip1 <= 5) )
|
||||
// Don't do this with low-capacity weapons or weapons which don't use clips
|
||||
if ( GetActiveWeapon() && GetActiveWeapon()->UsesClipsForAmmo1() && GetActiveWeapon()->GetMaxClip1() > 10 && (GetActiveWeapon()->m_iClip1 <= 5) )
|
||||
#else
|
||||
if ( GetActiveWeapon() && (GetActiveWeapon()->m_iClip1 <= 5) )
|
||||
#endif
|
||||
|
@ -196,6 +196,9 @@ Class_T CNPC_Monk::Classify( void )
|
||||
return CLASS_PLAYER_ALLY_VITAL;
|
||||
}
|
||||
|
||||
#ifdef MAPBASE
|
||||
ConVar npc_monk_use_old_acts( "npc_monk_use_old_acts", "1" );
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
@ -229,6 +232,45 @@ Activity CNPC_Monk::NPC_TranslateActivity( Activity eNewActivity )
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(EXPANDED_HL2_WEAPON_ACTIVITIES) && AR2_ACTIVITY_FIX == 1
|
||||
if (npc_monk_use_old_acts.GetBool())
|
||||
{
|
||||
// HACKHACK: Don't break the balcony scene
|
||||
if ( FStrEq( STRING(gpGlobals->mapname), "d1_town_02" ) && eNewActivity == ACT_IDLE )
|
||||
{
|
||||
eNewActivity = ACT_IDLE_SMG1;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (eNewActivity)
|
||||
{
|
||||
case ACT_IDLE_AR2:
|
||||
eNewActivity = ACT_IDLE_SMG1;
|
||||
break;
|
||||
|
||||
case ACT_IDLE_ANGRY_SHOTGUN:
|
||||
case ACT_IDLE_ANGRY_AR2:
|
||||
eNewActivity = ACT_IDLE_ANGRY_SMG1;
|
||||
break;
|
||||
|
||||
case ACT_WALK_AIM_SHOTGUN:
|
||||
case ACT_WALK_AIM_AR2:
|
||||
eNewActivity = ACT_WALK_AIM_RIFLE;
|
||||
break;
|
||||
|
||||
case ACT_RUN_AIM_SHOTGUN:
|
||||
case ACT_RUN_AIM_AR2:
|
||||
eNewActivity = ACT_RUN_AIM_RIFLE;
|
||||
break;
|
||||
|
||||
case ACT_RANGE_ATTACK_SHOTGUN_LOW:
|
||||
case ACT_RANGE_ATTACK_AR2_LOW:
|
||||
eNewActivity = ACT_RANGE_ATTACK_SMG1_LOW;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
// We need these so that we can pick up the shotgun to throw it in the balcony scene
|
||||
if ( eNewActivity == ACT_IDLE_ANGRY_SHOTGUN )
|
||||
{
|
||||
@ -246,6 +288,7 @@ Activity CNPC_Monk::NPC_TranslateActivity( Activity eNewActivity )
|
||||
{
|
||||
return ACT_RANGE_ATTACK_SMG1_LOW;
|
||||
}
|
||||
#endif
|
||||
|
||||
return eNewActivity;
|
||||
}
|
||||
|
@ -20,6 +20,11 @@
|
||||
|
||||
extern ConVar sk_auto_reload_time;
|
||||
|
||||
#ifdef MAPBASE
|
||||
extern acttable_t *GetShotgunActtable();
|
||||
extern int GetShotgunActtableCount();
|
||||
#endif
|
||||
|
||||
class CWeaponAnnabelle : public CBaseHLCombatWeapon
|
||||
{
|
||||
DECLARE_DATADESC();
|
||||
@ -41,6 +46,16 @@ public:
|
||||
virtual const Vector& GetBulletSpread( void )
|
||||
{
|
||||
static Vector cone = vec3_origin;
|
||||
|
||||
#ifdef MAPBASE
|
||||
if (GetOwner() && GetOwner()->OverridingWeaponProficiency())
|
||||
{
|
||||
// If the owner's weapon proficiency is being overridden, return a more realistic spread
|
||||
static Vector cone2 = VECTOR_CONE_6DEGREES;
|
||||
return cone2;
|
||||
}
|
||||
#endif
|
||||
|
||||
return cone;
|
||||
}
|
||||
|
||||
@ -61,6 +76,11 @@ public:
|
||||
|
||||
void Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator );
|
||||
|
||||
#ifdef MAPBASE
|
||||
virtual acttable_t *GetBackupActivityList() { return GetShotgunActtable(); }
|
||||
virtual int GetBackupActivityListCount() { return GetShotgunActtableCount(); }
|
||||
#endif
|
||||
|
||||
DECLARE_ACTTABLE();
|
||||
|
||||
CWeaponAnnabelle(void);
|
||||
@ -82,6 +102,28 @@ END_DATADESC()
|
||||
|
||||
acttable_t CWeaponAnnabelle::m_acttable[] =
|
||||
{
|
||||
#if defined(EXPANDED_HL2_WEAPON_ACTIVITIES) && AR2_ACTIVITY_FIX == 1
|
||||
{ ACT_IDLE, ACT_IDLE_AR2, false },
|
||||
{ ACT_IDLE_ANGRY, ACT_IDLE_ANGRY_AR2, true },
|
||||
{ ACT_RANGE_AIM_LOW, ACT_RANGE_AIM_AR2_LOW, false },
|
||||
{ ACT_RANGE_ATTACK1, ACT_RANGE_ATTACK_ANNABELLE, true },
|
||||
{ ACT_RANGE_ATTACK1_LOW, ACT_RANGE_ATTACK_ANNABELLE_LOW, true },
|
||||
{ ACT_RELOAD, ACT_RELOAD_ANNABELLE, true },
|
||||
{ ACT_WALK, ACT_WALK_AR2, true },
|
||||
{ ACT_WALK_AIM, ACT_WALK_AIM_AR2, true },
|
||||
{ ACT_WALK_CROUCH, ACT_WALK_CROUCH_RIFLE, false },
|
||||
{ ACT_WALK_CROUCH_AIM, ACT_WALK_CROUCH_AIM_RIFLE, false },
|
||||
{ ACT_RUN, ACT_RUN_AR2, true },
|
||||
{ ACT_RUN_AIM, ACT_RUN_AIM_AR2, true },
|
||||
{ ACT_RUN_CROUCH, ACT_RUN_CROUCH_RIFLE, false },
|
||||
{ ACT_RUN_CROUCH_AIM, ACT_RUN_CROUCH_AIM_RIFLE, false },
|
||||
{ ACT_GESTURE_RANGE_ATTACK1, ACT_GESTURE_RANGE_ATTACK_ANNABELLE, true },
|
||||
{ ACT_RELOAD_LOW, ACT_RELOAD_ANNABELLE_LOW, false },
|
||||
{ ACT_GESTURE_RELOAD, ACT_GESTURE_RELOAD_ANNABELLE, false },
|
||||
|
||||
{ ACT_ARM, ACT_ARM_RIFLE, true },
|
||||
{ ACT_DISARM, ACT_DISARM_RIFLE, true },
|
||||
#else
|
||||
#ifdef MAPBASE
|
||||
{ ACT_IDLE, ACT_IDLE_SMG1, false },
|
||||
#endif
|
||||
@ -99,6 +141,7 @@ acttable_t CWeaponAnnabelle::m_acttable[] =
|
||||
{ ACT_GESTURE_RANGE_ATTACK1, ACT_GESTURE_RANGE_ATTACK_SHOTGUN, true },
|
||||
{ ACT_RELOAD_LOW, ACT_RELOAD_SMG1_LOW, false },
|
||||
{ ACT_GESTURE_RELOAD, ACT_GESTURE_RELOAD_SMG1, false },
|
||||
#endif
|
||||
|
||||
#ifdef MAPBASE
|
||||
// HL2:DM activities (for third-person animations in SP)
|
||||
@ -190,6 +233,13 @@ bool CWeaponAnnabelle::StartReload( void )
|
||||
pOwner->m_flNextAttack = gpGlobals->curtime;
|
||||
m_flNextPrimaryAttack = gpGlobals->curtime + SequenceDuration();
|
||||
|
||||
#ifdef MAPBASE
|
||||
if ( pOwner->IsPlayer() )
|
||||
{
|
||||
static_cast<CBasePlayer*>(pOwner)->SetAnimation( PLAYER_RELOAD );
|
||||
}
|
||||
#endif
|
||||
|
||||
m_bInReload = true;
|
||||
return true;
|
||||
}
|
||||
|
@ -234,6 +234,19 @@ acttable_t CWeaponShotgun::m_acttable[] =
|
||||
|
||||
IMPLEMENT_ACTTABLE(CWeaponShotgun);
|
||||
|
||||
#ifdef MAPBASE
|
||||
// Allows Weapon_BackupActivity() to access the shotgun's activity table.
|
||||
acttable_t *GetShotgunActtable()
|
||||
{
|
||||
return CWeaponShotgun::m_acttable;
|
||||
}
|
||||
|
||||
int GetShotgunActtableCount()
|
||||
{
|
||||
return ARRAYSIZE(CWeaponShotgun::m_acttable);
|
||||
}
|
||||
#endif
|
||||
|
||||
void CWeaponShotgun::Precache( void )
|
||||
{
|
||||
CBaseCombatWeapon::Precache();
|
||||
|
@ -2399,6 +2399,13 @@ void ActivityList_RegisterSharedActivities( void )
|
||||
REGISTER_SHARED_ACTIVITY( ACT_RANGE_ATTACK_RPG_LOW );
|
||||
REGISTER_SHARED_ACTIVITY( ACT_GESTURE_RANGE_ATTACK_RPG );
|
||||
|
||||
REGISTER_SHARED_ACTIVITY( ACT_RANGE_ATTACK_ANNABELLE );
|
||||
REGISTER_SHARED_ACTIVITY( ACT_RANGE_ATTACK_ANNABELLE_LOW );
|
||||
REGISTER_SHARED_ACTIVITY( ACT_GESTURE_RANGE_ATTACK_ANNABELLE );
|
||||
REGISTER_SHARED_ACTIVITY( ACT_RELOAD_ANNABELLE );
|
||||
REGISTER_SHARED_ACTIVITY( ACT_RELOAD_ANNABELLE_LOW );
|
||||
REGISTER_SHARED_ACTIVITY( ACT_GESTURE_RELOAD_ANNABELLE );
|
||||
|
||||
REGISTER_SHARED_ACTIVITY( ACT_WALK_MELEE );
|
||||
REGISTER_SHARED_ACTIVITY( ACT_RUN_MELEE );
|
||||
|
||||
|
@ -2282,6 +2282,14 @@ typedef enum
|
||||
ACT_RANGE_ATTACK_RPG_LOW,
|
||||
ACT_GESTURE_RANGE_ATTACK_RPG,
|
||||
|
||||
// Annabelle
|
||||
ACT_RANGE_ATTACK_ANNABELLE,
|
||||
ACT_RANGE_ATTACK_ANNABELLE_LOW,
|
||||
ACT_GESTURE_RANGE_ATTACK_ANNABELLE,
|
||||
ACT_RELOAD_ANNABELLE,
|
||||
ACT_RELOAD_ANNABELLE_LOW,
|
||||
ACT_GESTURE_RELOAD_ANNABELLE,
|
||||
|
||||
// Melee
|
||||
ACT_WALK_MELEE,
|
||||
ACT_RUN_MELEE,
|
||||
|
Loading…
x
Reference in New Issue
Block a user