Fix my mistakes. Apply fixes for rpg and tank laser again.

This commit is contained in:
Night Owl 2017-07-19 02:00:03 +05:00
parent 6d2a869ecd
commit c8ebe744c3
3 changed files with 14 additions and 48 deletions

View File

@ -93,6 +93,7 @@ public:
BOOL StartControl( CBasePlayer* pController ); BOOL StartControl( CBasePlayer* pController );
void StopControl( void ); void StopControl( void );
void ControllerPostFrame( void ); void ControllerPostFrame( void );
virtual void StopFire( void ){}
protected: protected:
CBasePlayer* m_pController; CBasePlayer* m_pController;
@ -369,8 +370,7 @@ BOOL CFuncTank::StartControl( CBasePlayer *pController )
void CFuncTank::StopControl() void CFuncTank::StopControl()
{ {
//if( m_pLaser ) StopFire();
//m_pLaser->TurnOff();
// TODO: bring back the controllers current weapon // TODO: bring back the controllers current weapon
if( !m_pController ) if( !m_pController )
@ -755,6 +755,7 @@ public:
virtual int Save( CSave &save ); virtual int Save( CSave &save );
virtual int Restore( CRestore &restore ); virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[]; static TYPEDESCRIPTION m_SaveData[];
virtual void StopFire( void );
private: private:
CLaser *m_pLaser; 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 class CFuncTankRocket : public CFuncTank
{ {
public: public:

View File

@ -4060,52 +4060,6 @@ 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;

View File

@ -265,6 +265,11 @@ void CRpgRocket::FollowThink( void )
pev->velocity = pev->velocity * 0.2 + vecTarget * flSpeed * 0.798; pev->velocity = pev->velocity * 0.2 + vecTarget * flSpeed * 0.798;
if( pev->waterlevel == 0 && pev->velocity.Length() < 1500 ) 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(); Detonate();
} }
} }