Skip to content

Commit f205eda

Browse files
committed
1 parent 2eba8df commit f205eda

File tree

5 files changed

+67
-3
lines changed

5 files changed

+67
-3
lines changed

src/game/shared/tf/tf_weapon_sniperrifle.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,16 @@ void CTFSniperRifle::HandleZooms( void )
323323
}
324324
}
325325

326+
#ifdef BDSBASE
327+
//-----------------------------------------------------------------------------
328+
// Purpose:
329+
//-----------------------------------------------------------------------------
330+
bool CTFSniperRifle::CanInspect() const
331+
{
332+
return BaseClass::CanInspect() && !IsZoomed() && m_flChargedDamage == 0.f;
333+
}
334+
#endif
335+
326336
//-----------------------------------------------------------------------------
327337
// Purpose:
328338
//-----------------------------------------------------------------------------
@@ -560,7 +570,11 @@ void CTFSniperRifle::ZoomIn( void )
560570

561571

562572
//-----------------------------------------------------------------------------
563-
bool CTFSniperRifle::IsZoomed( void )
573+
#ifdef BDSBASE
574+
bool CTFSniperRifle::IsZoomed(void) const
575+
#else
576+
bool CTFSniperRifle::IsZoomed(void)
577+
#endif
564578
{
565579
CTFPlayer *pPlayer = GetTFPlayerOwner();
566580

@@ -1951,6 +1965,12 @@ void CTFSniperRifleClassic::ItemPostFrame( void )
19511965
// Create the sniper dot.
19521966
CreateSniperDot();
19531967
pPlayer->ClearExpression();
1968+
1969+
#ifdef BDSBASE
1970+
// Stop inspecting and reset our animation.
1971+
StopInspect();
1972+
SendWeaponAnim(ACT_VM_IDLE);
1973+
#endif
19541974
#endif
19551975
}
19561976

src/game/shared/tf/tf_weapon_sniperrifle.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ class CTFSniperRifle : public CTFWeaponBaseGun
117117

118118
virtual void WeaponReset( void );
119119

120+
#ifdef BDSBASE
121+
virtual bool CanInspect() const OVERRIDE;
122+
#endif
123+
120124
virtual bool CanFireCriticalShot( bool bIsHeadshot = false, CBaseEntity *pTarget = NULL ) OVERRIDE;
121125

122126
virtual void PlayWeaponShootSound( void );
@@ -130,7 +134,11 @@ class CTFSniperRifle : public CTFWeaponBaseGun
130134
virtual bool ShouldEjectBrass();
131135
#endif
132136

133-
bool IsZoomed( void );
137+
#ifdef BDSBASE
138+
bool IsZoomed(void) const;
139+
#else
140+
bool IsZoomed(void);
141+
#endif
134142
bool IsFullyCharged( void ) const; // have we been zoomed in long enough for our shot to do max damage
135143

136144
virtual void OnControlStunned( void );

src/game/shared/tf/tf_weaponbase.cpp

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,12 @@ CTFWeaponBase::CTFWeaponBase()
346346
m_eStrangeType = STRANGE_UNKNOWN;
347347
m_eStatTrakModuleType = MODULE_UNKNOWN;
348348

349+
#ifdef BDSBASE
350+
StopInspect();
351+
#else
349352
m_flInspectAnimEndTime = -1.f;
350353
m_nInspectStage = INSPECT_INVALID;
354+
#endif
351355
}
352356

353357
CTFWeaponBase::~CTFWeaponBase()
@@ -800,8 +804,12 @@ bool CTFWeaponBase::SendWeaponAnim( int iActivity )
800804
// allow other activity to override the inspect
801805
if ( !IsInspectActivity( iActivity ) )
802806
{
807+
#ifdef BDSBASE
808+
StopInspect();
809+
#else
803810
m_flInspectAnimEndTime = -1.f;
804811
m_nInspectStage = INSPECT_INVALID;
812+
#endif
805813
return BaseClass::SendWeaponAnim( iActivity );
806814
}
807815

@@ -2614,8 +2622,12 @@ void CTFWeaponBase::HandleInspect()
26142622
}
26152623
#endif
26162624

2617-
m_nInspectStage = INSPECT_INVALID;
2625+
#ifdef BDSBASE
2626+
StopInspect();
2627+
#else
26182628
m_flInspectAnimEndTime = -1.f;
2629+
m_nInspectStage = INSPECT_INVALID;
2630+
#endif
26192631
if ( SendWeaponAnim( GetInspectActivity( INSPECT_START ) ) )
26202632
{
26212633
m_flInspectAnimEndTime = gpGlobals->curtime + SequenceDuration();
@@ -2647,8 +2659,12 @@ void CTFWeaponBase::HandleInspect()
26472659
}
26482660
else if ( m_nInspectStage == INSPECT_END )
26492661
{
2662+
#ifdef BDSBASE
2663+
StopInspect();
2664+
#else
26502665
m_flInspectAnimEndTime = -1.f;
26512666
m_nInspectStage = INSPECT_INVALID;
2667+
#endif
26522668
SendWeaponAnim( ACT_VM_IDLE );
26532669
}
26542670
}
@@ -2657,6 +2673,17 @@ void CTFWeaponBase::HandleInspect()
26572673
m_bInspecting = pPlayer->IsInspecting();
26582674
}
26592675

2676+
#ifdef BDSBASE
2677+
//-----------------------------------------------------------------------------
2678+
// Purpose:
2679+
//-----------------------------------------------------------------------------
2680+
void CTFWeaponBase::StopInspect()
2681+
{
2682+
m_flInspectAnimEndTime = -1.f;
2683+
m_nInspectStage = INSPECT_INVALID;
2684+
}
2685+
#endif
2686+
26602687
//-----------------------------------------------------------------------------
26612688
// Purpose:
26622689
//-----------------------------------------------------------------------------

src/game/shared/tf/tf_weaponbase.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,9 @@ class CTFWeaponBase : public CBaseCombatWeapon, public IHasOwner, public IHasGen
783783

784784
virtual bool CanInspect() const { return true; }
785785
void HandleInspect();
786+
#ifdef BDSBASE
787+
void StopInspect();
788+
#endif
786789

787790
virtual void HookAttributes( void ) {};
788791
virtual void OnUpgraded( void ) { HookAttributes(); }

src/game/shared/tf/tf_weaponbase_gun.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,12 @@ void CTFWeaponBaseGun::ZoomIn( void )
10501050
if ( !pPlayer )
10511051
return;
10521052

1053+
#ifdef BDSBASE
1054+
// Stop inspecting and reset our animation.
1055+
StopInspect();
1056+
SendWeaponAnim(ACT_VM_IDLE);
1057+
#endif
1058+
10531059
// Set the weapon zoom.
10541060
// TODO: The weapon fov should be gotten from the script file.
10551061
float fBaseZoom = TF_WEAPON_ZOOM_FOV;

0 commit comments

Comments
 (0)