This commit is contained in:
Night Owl 2017-07-17 12:01:53 +05:00
parent 73a99df894
commit 38b2236515

View File

@ -2583,11 +2583,10 @@ void CBasePlayer::PostThink()
CheckPowerups( pev ); CheckPowerups( pev );
UpdatePlayerSound(); UpdatePlayerSound();
pt_end:
// Track button info so we can detect 'pressed' and 'released' buttons next frame // Track button info so we can detect 'pressed' and 'released' buttons next frame
m_afButtonLast = pev->button; m_afButtonLast = pev->button;
pt_end:
#if defined( CLIENT_WEAPONS ) #if defined( CLIENT_WEAPONS )
// Decay timers on weapons // Decay timers on weapons
// go through all of the weapons and make a list of the ones to pack // go through all of the weapons and make a list of the ones to pack
@ -4061,6 +4060,52 @@ void CBasePlayer::UpdateClientData( void )
m_rgpPlayerItems[i]->UpdateClientData( this ); m_rgpPlayerItems[i]->UpdateClientData( this );
} }
if( m_pClientActiveItem != pPlayer->m_pActiveItem )
{
if( pPlayer->m_pActiveItem == NULL )
{
// If no weapon, we have to send update here
CBasePlayer *plr;
for( int i = 1; i <= gpGlobals->maxClients; i++ )
{
plr = (CBasePlayer *)UTIL_PlayerByIndex( i );
if( !plr || !plr->IsObserver() || plr->m_hObserverTarget != pPlayer )
continue;
MESSAGE_BEGIN( MSG_ONE, gmsgCurWeapon, NULL, plr->pev );
WRITE_BYTE( 0 );
WRITE_BYTE( 0 );
WRITE_BYTE( 0 );
MESSAGE_END();
}
MESSAGE_BEGIN( MSG_ONE, gmsgCurWeapon, NULL, pPlayer->pev );
WRITE_BYTE( 0 );
WRITE_BYTE( 0 );
WRITE_BYTE( 0 );
MESSAGE_END();
}
else if( this != pPlayer )
{
// Special case for spectator
CBasePlayerWeapon *gun = (CBasePlayerWeapon *)pPlayer->m_pActiveItem->GetWeaponPtr();
if( gun )
{
int state;
if( pPlayer->m_fOnTarget )
state = WEAPON_IS_ONTARGET;
else
state = 1;
MESSAGE_BEGIN( MSG_ONE, gmsgCurWeapon, NULL, pev );
WRITE_BYTE( state );
WRITE_BYTE( gun->m_iId );
WRITE_BYTE( gun->m_iClip );
MESSAGE_END();
}
}
}
// Cache and client weapon change // Cache and client weapon change
m_pClientActiveItem = m_pActiveItem; m_pClientActiveItem = m_pActiveItem;
m_iClientFOV = m_iFOV; m_iClientFOV = m_iFOV;