Browse Source

Merge branch 'master' into bshift

bshift
Andrey Akhmichin 4 years ago
parent
commit
06b530d9af
  1. 2
      cl_dll/hl/hl_weapons.cpp
  2. 2
      dlls/buttons.cpp
  3. 36
      dlls/gauss.cpp
  4. 1
      dlls/houndeye.cpp
  5. 6
      dlls/mp5.cpp
  6. 4
      dlls/shotgun.cpp
  7. 7
      dlls/squadmonster.cpp
  8. 34
      dlls/weapons.cpp
  9. 6
      dlls/weapons.h

2
cl_dll/hl/hl_weapons.cpp

@ -372,7 +372,7 @@ void CBasePlayerWeapon::ItemPostFrame( void ) @@ -372,7 +372,7 @@ void CBasePlayerWeapon::ItemPostFrame( void )
m_fFireOnEmpty = FALSE;
// weapon is useable. Reload if empty and weapon has waited as long as it has to after firing
if( m_iClip == 0 && !( iFlags() & ITEM_FLAG_NOAUTORELOAD ) && m_flNextPrimaryAttack < 0.0f )
if( m_iClip == 0 && !( iFlags() & ITEM_FLAG_NOAUTORELOAD ) && m_flNextPrimaryAttack <= 0.0f )
{
Reload();
return;

2
dlls/buttons.cpp

@ -637,7 +637,7 @@ void DoSpark( entvars_t *pev, const Vector &location ) @@ -637,7 +637,7 @@ void DoSpark( entvars_t *pev, const Vector &location )
void CBaseButton::ButtonSpark( void )
{
SetThink( &CBaseButton::ButtonSpark );
pev->nextthink = gpGlobals->time + 0.1f + RANDOM_FLOAT( 0.0f, 1.5f );// spark again at random interval
pev->nextthink = pev->ltime + 0.1f + RANDOM_FLOAT( 0.0f, 1.5f );// spark again at random interval
DoSpark( pev, pev->mins );
}

36
dlls/gauss.cpp

@ -124,12 +124,6 @@ int CGauss::GetItemInfo( ItemInfo *p ) @@ -124,12 +124,6 @@ int CGauss::GetItemInfo( ItemInfo *p )
return 1;
}
BOOL CGauss::IsUseable()
{
// Currently charging, allow the player to fire it first. - Solokiller
return CBasePlayerWeapon::IsUseable() || m_fInAttack != 0;
}
BOOL CGauss::Deploy()
{
m_pPlayer->m_flPlayAftershock = 0.0;
@ -231,22 +225,6 @@ void CGauss::SecondaryAttack() @@ -231,22 +225,6 @@ void CGauss::SecondaryAttack()
}
else
{
// Moved to before the ammo burn.
// Because we drained 1 when m_InAttack == 0, then 1 again now before checking if we're out of ammo,
// this resuled in the player having -1 ammo, which in turn caused CanDeploy to think it could be deployed.
// This will need to be fixed further down the line by preventing negative ammo unless explicitly required (infinite ammo?),
// But this check will prevent the problem for now. - Solokiller
// TODO: investigate further.
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
{
// out of ammo! force the gun to fire
StartFire();
m_fInAttack = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1;
return;
}
// during the charging process, eat one bit of ammo every once in a while
if( UTIL_WeaponTimeBase() >= m_pPlayer->m_flNextAmmoBurn && m_pPlayer->m_flNextAmmoBurn != 1000 )
{
@ -266,6 +244,16 @@ void CGauss::SecondaryAttack() @@ -266,6 +244,16 @@ void CGauss::SecondaryAttack()
}
}
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
{
// out of ammo! force the gun to fire
StartFire();
m_fInAttack = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1;
return;
}
if( UTIL_WeaponTimeBase() >= m_pPlayer->m_flAmmoStartCharge )
{
// don't eat any more ammo after gun is fully charged.
@ -583,10 +571,6 @@ void CGauss::WeaponIdle( void ) @@ -583,10 +571,6 @@ void CGauss::WeaponIdle( void )
StartFire();
m_fInAttack = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;
// Need to set m_flNextPrimaryAttack so the weapon gets a chance to complete its secondary fire animation. - Solokiller
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5f;
}
else
{

1
dlls/houndeye.cpp

@ -514,6 +514,7 @@ void CHoundeye::WriteBeamColor( void ) @@ -514,6 +514,7 @@ void CHoundeye::WriteBeamColor( void )
bBlue = 255;
break;
case 4:
case 5:
bRed = 62;
bGreen = 33;
bBlue = 211;

6
dlls/mp5.cpp

@ -270,12 +270,6 @@ void CMP5::WeaponIdle( void ) @@ -270,12 +270,6 @@ void CMP5::WeaponIdle( void )
m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); // how long till we do this again.
}
BOOL CMP5::IsUseable()
{
//Can be used if the player has AR grenades. - Solokiller
return CBasePlayerWeapon::IsUseable() || m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] > 0;
}
class CMP5AmmoClip : public CBasePlayerAmmo
{
void Spawn( void )

4
dlls/shotgun.cpp

@ -302,7 +302,7 @@ void CShotgun::Reload( void ) @@ -302,7 +302,7 @@ void CShotgun::Reload( void )
}
}
void CShotgun::WeaponTick()
void CShotgun::ItemPostFrame( void )
{
if( m_flPumpTime && m_flPumpTime < gpGlobals->time )
{
@ -310,6 +310,8 @@ void CShotgun::WeaponTick() @@ -310,6 +310,8 @@ void CShotgun::WeaponTick()
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/scock1.wav", 1, ATTN_NORM, 0, 95 + RANDOM_LONG( 0, 0x1f ) );
m_flPumpTime = 0;
}
CBasePlayerWeapon::ItemPostFrame();
}
void CShotgun::WeaponIdle( void )

7
dlls/squadmonster.cpp

@ -167,7 +167,7 @@ void CSquadMonster::SquadRemove( CSquadMonster *pRemove ) @@ -167,7 +167,7 @@ void CSquadMonster::SquadRemove( CSquadMonster *pRemove )
{
for( int i = 0; i < MAX_SQUAD_MEMBERS - 1; i++ )
{
if( pSquadLeader->m_hSquadMember[i] == this )
if( pSquadLeader->m_hSquadMember[i] == pRemove )
{
pSquadLeader->m_hSquadMember[i] = NULL;
break;
@ -256,7 +256,10 @@ void CSquadMonster::SquadMakeEnemy( CBaseEntity *pEnemy ) @@ -256,7 +256,10 @@ void CSquadMonster::SquadMakeEnemy( CBaseEntity *pEnemy )
if( pMember )
{
// reset members who aren't activly engaged in fighting
if( pMember->m_hEnemy != pEnemy && !pMember->HasConditions( bits_COND_SEE_ENEMY ) )
if( pMember->m_hEnemy != pEnemy && !pMember->HasConditions( bits_COND_SEE_ENEMY )
&& ( pMember->m_pSchedule && (pMember->m_pSchedule->iInterruptMask & bits_COND_NEW_ENEMY) )
// My enemy might be not an enemy for member of my squad, e.g. if I was provoked by player.
&& pMember->IRelationship(pEnemy) >= R_DL )
{
if( pMember->m_hEnemy != 0 )
{

34
dlls/weapons.cpp

@ -604,8 +604,6 @@ BOOL CanAttack( float attack_time, float curtime, BOOL isPredicted ) @@ -604,8 +604,6 @@ BOOL CanAttack( float attack_time, float curtime, BOOL isPredicted )
void CBasePlayerWeapon::ItemPostFrame( void )
{
WeaponTick();
if( ( m_fInReload ) && ( m_pPlayer->m_flNextAttack <= UTIL_WeaponTimeBase() ) )
{
// complete the reload.
@ -901,16 +899,38 @@ BOOL CBasePlayerWeapon::AddSecondaryAmmo( int iCount, char *szName, int iMax ) @@ -901,16 +899,38 @@ BOOL CBasePlayerWeapon::AddSecondaryAmmo( int iCount, char *szName, int iMax )
//=========================================================
BOOL CBasePlayerWeapon::IsUseable( void )
{
if( m_iClip <= 0 )
if( m_iClip > 0 )
{
return TRUE;
}
// Player has unlimited ammo for this weapon or does not use magazines
if( iMaxAmmo1() == WEAPON_NOCLIP )
{
if( m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] <= 0 && iMaxAmmo1() != -1 )
return TRUE;
}
if( m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] > 0 )
{
return TRUE;
}
if( pszAmmo2() )
{
// Player has unlimited ammo for this weapon or does not use magazines
if( iMaxAmmo2() == WEAPON_NOCLIP )
{
// clip is empty (or nonexistant) and the player has no more ammo of this type.
return FALSE;
return TRUE;
}
if( m_pPlayer->m_rgAmmo[SecondaryAmmoIndex()] > 0 )
{
return TRUE;
}
}
return TRUE;
// clip is empty (or nonexistant) and the player has no more ammo of this type.
return FALSE;
}
BOOL CBasePlayerWeapon::CanDeploy( void )

6
dlls/weapons.h

@ -319,7 +319,6 @@ public: @@ -319,7 +319,6 @@ public:
virtual void PrimaryAttack( void ) { return; } // do "+ATTACK"
virtual void SecondaryAttack( void ) { return; } // do "+ATTACK2"
virtual void Reload( void ) { return; } // do "+RELOAD"
virtual void WeaponTick() {} // Always called at beginning of ItemPostFrame. - Solokiller
virtual void WeaponIdle( void ) { return; } // called when no buttons pressed
virtual int UpdateClientData( CBasePlayer *pPlayer ); // sends hud info to client dll, if things have changed
virtual void RetireWeapon( void );
@ -569,7 +568,6 @@ public: @@ -569,7 +568,6 @@ public:
BOOL Deploy( void );
void Reload( void );
void WeaponIdle( void );
BOOL IsUseable();
float m_flNextAnimTime;
int m_iShell;
@ -639,8 +637,8 @@ public: @@ -639,8 +637,8 @@ public:
void SecondaryAttack( void );
BOOL Deploy( );
void Reload( void );
void WeaponTick();
void WeaponIdle( void );
void ItemPostFrame( void );
int m_fInReload;
float m_flNextReload;
int m_iShell;
@ -747,7 +745,7 @@ public: @@ -747,7 +745,7 @@ public:
int iItemSlot( void ) { return 4; }
int GetItemInfo(ItemInfo *p);
int AddToPlayer( CBasePlayer *pPlayer );
BOOL IsUseable();
BOOL Deploy( void );
void Holster( int skiplocal = 0 );

Loading…
Cancel
Save