From c8ebe744c3311f1306f88fd88a467abd57029de5 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Wed, 19 Jul 2017 02:00:03 +0500 Subject: [PATCH] Fix my mistakes. Apply fixes for rpg and tank laser again. --- dlls/func_tank.cpp | 11 +++++++++-- dlls/player.cpp | 46 ---------------------------------------------- dlls/rpg.cpp | 5 +++++ 3 files changed, 14 insertions(+), 48 deletions(-) diff --git a/dlls/func_tank.cpp b/dlls/func_tank.cpp index 54f4755a..c4e3cb42 100644 --- a/dlls/func_tank.cpp +++ b/dlls/func_tank.cpp @@ -93,6 +93,7 @@ public: BOOL StartControl( CBasePlayer* pController ); void StopControl( void ); void ControllerPostFrame( void ); + virtual void StopFire( void ){} protected: CBasePlayer* m_pController; @@ -369,8 +370,7 @@ BOOL CFuncTank::StartControl( CBasePlayer *pController ) void CFuncTank::StopControl() { - //if( m_pLaser ) - //m_pLaser->TurnOff(); + StopFire(); // TODO: bring back the controllers current weapon if( !m_pController ) @@ -755,6 +755,7 @@ public: virtual int Save( CSave &save ); virtual int Restore( CRestore &restore ); static TYPEDESCRIPTION m_SaveData[]; + virtual void StopFire( void ); private: CLaser *m_pLaser; @@ -859,6 +860,12 @@ void CFuncTankLaser::Fire( const Vector &barrelEnd, const Vector &forward, entva } } +void CFuncTankLaser::StopFire( void ) +{ + if( m_pLaser ) + m_pLaser->TurnOff(); +} + class CFuncTankRocket : public CFuncTank { public: diff --git a/dlls/player.cpp b/dlls/player.cpp index d8ed7010..04da24c4 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -4060,52 +4060,6 @@ void CBasePlayer::UpdateClientData( void ) 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 m_pClientActiveItem = m_pActiveItem; m_iClientFOV = m_iFOV; diff --git a/dlls/rpg.cpp b/dlls/rpg.cpp index 5fb8cc70..fe1fd8a9 100644 --- a/dlls/rpg.cpp +++ b/dlls/rpg.cpp @@ -265,6 +265,11 @@ void CRpgRocket::FollowThink( void ) pev->velocity = pev->velocity * 0.2 + vecTarget * flSpeed * 0.798; if( pev->waterlevel == 0 && pev->velocity.Length() < 1500 ) { + if( CRpg *pLauncher = (CRpg*)( (CBaseEntity*)( m_hLauncher ) ) ) + { + // my launcher is still around, tell it I'm dead. + pLauncher->m_cActiveRockets--; + } Detonate(); } }