Browse Source

Fix build.

thegate
Night Owl 8 years ago
parent
commit
709b288307
  1. 1
      cl_dll/hl/hl_baseentity.cpp
  2. 15
      dlls/handgrenade.cpp
  3. 38
      dlls/weapons.cpp
  4. 5
      dlls/weapons.h

1
cl_dll/hl/hl_baseentity.cpp

@ -314,6 +314,7 @@ int CBasePlayerItem::Restore( class CRestore & ) { return 1; } @@ -314,6 +314,7 @@ int CBasePlayerItem::Restore( class CRestore & ) { return 1; }
int CBasePlayerItem::Save( class CSave & ) { return 1; }
int CBasePlayerWeapon::Restore( class CRestore & ) { return 1; }
int CBasePlayerWeapon::Save( class CSave & ) { return 1; }
float CBasePlayerWeapon::GetNextAttackDelay( float flTime ) { return flTime; }
void CBasePlayerItem::SetObjectCollisionBox( void ) { }
void CBasePlayerItem::FallInit( void ) { }
void CBasePlayerItem::FallThink( void ) { }

15
dlls/handgrenade.cpp

@ -198,20 +198,5 @@ void CHandGrenade::WeaponIdle( void ) @@ -198,20 +198,5 @@ void CHandGrenade::WeaponIdle( void )
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 31.0 / 10.0;
SendWeaponAnim( HANDGRENADE_IDLE );
int iAnim;
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
if( flRand <= 0.75 )
{
iAnim = HANDGRENADE_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );// how long till we do this again.
}
else
{
iAnim = HANDGRENADE_FIDGET;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 75.0 / 30.0;
}
SendWeaponAnim( iAnim );
}
}

38
dlls/weapons.cpp

@ -613,6 +613,11 @@ void CBasePlayerWeapon::ItemPostFrame( void ) @@ -613,6 +613,11 @@ void CBasePlayerWeapon::ItemPostFrame( void )
m_fInReload = FALSE;
}
if( !( m_pPlayer->pev->button & IN_ATTACK ) )
{
m_flLastFireTime = 0.0f;
}
if( ( m_pPlayer->pev->button & IN_ATTACK2 ) && CanAttack( m_flNextSecondaryAttack, gpGlobals->time, UseDecrement() ) )
{
if( pszAmmo2() && !m_pPlayer->m_rgAmmo[SecondaryAmmoIndex()] )
@ -944,6 +949,7 @@ BOOL CBasePlayerWeapon::DefaultDeploy( char *szViewModel, char *szWeaponModel, i @@ -944,6 +949,7 @@ BOOL CBasePlayerWeapon::DefaultDeploy( char *szViewModel, char *szWeaponModel, i
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0;
m_flLastFireTime = 0.0f;
return TRUE;
}
@ -1131,6 +1137,38 @@ void CBasePlayerWeapon::RetireWeapon( void ) @@ -1131,6 +1137,38 @@ void CBasePlayerWeapon::RetireWeapon( void )
g_pGameRules->GetNextBestWeapon( m_pPlayer, this );
}
//=========================================================================
// GetNextAttackDelay - An accurate way of calcualting the next attack time.
//=========================================================================
float CBasePlayerWeapon::GetNextAttackDelay( float delay )
{
if( m_flLastFireTime == 0 || m_flNextPrimaryAttack == -1 )
{
// At this point, we are assuming that the client has stopped firing
// and we are going to reset our book keeping variables.
m_flLastFireTime = gpGlobals->time;
m_flPrevPrimaryAttack = delay;
}
// calculate the time between this shot and the previous
float flTimeBetweenFires = gpGlobals->time - m_flLastFireTime;
float flCreep = 0.0f;
if( flTimeBetweenFires > 0 )
flCreep = flTimeBetweenFires - m_flPrevPrimaryAttack; // postive or negative
// save the last fire time
m_flLastFireTime = gpGlobals->time;
float flNextAttack = UTIL_WeaponTimeBase() + delay - flCreep;
// we need to remember what the m_flNextPrimaryAttack time is set to for each shot,
// store it as m_flPrevPrimaryAttack.
m_flPrevPrimaryAttack = flNextAttack - UTIL_WeaponTimeBase();
//char szMsg[256];
//_snprintf( szMsg, sizeof(szMsg), "next attack time: %0.4f\n", gpGlobals->time + flNextAttack );
//OutputDebugString( szMsg );
return flNextAttack;
}
//*********************************************************
// weaponbox code:
//*********************************************************

5
dlls/weapons.h

@ -331,6 +331,7 @@ public: @@ -331,6 +331,7 @@ public:
void PrintState( void );
virtual CBasePlayerItem *GetWeaponPtr( void ) { return (CBasePlayerItem *)this; };
float GetNextAttackDelay( float delay );
float m_flPumpTime;
int m_fInSpecialReload; // Are we in the middle of a reload for the shotguns
@ -345,6 +346,10 @@ public: @@ -345,6 +346,10 @@ public:
int m_fInReload; // Are we in the middle of a reload;
int m_iDefaultAmmo;// how much ammo you get when you pick up this weapon as placed by a level designer.
// hle time creep vars
float m_flPrevPrimaryAttack;
float m_flLastFireTime;
};
class CBasePlayerAmmo : public CBaseEntity

Loading…
Cancel
Save