Night Owl 8 years ago
parent
commit
9ef79aee9e
  1. 8
      dlls/rpg.cpp
  2. 2
      dlls/weapons.cpp
  3. 2
      dlls/weapons.h

8
dlls/rpg.cpp

@ -109,8 +109,8 @@ CRpgRocket *CRpgRocket::CreateRpgRocket( Vector vecOrigin, Vector vecAngles, CBa
pRocket->pev->angles = vecAngles; pRocket->pev->angles = vecAngles;
pRocket->Spawn(); pRocket->Spawn();
pRocket->SetTouch( &CRpgRocket::RocketTouch ); pRocket->SetTouch( &CRpgRocket::RocketTouch );
pRocket->m_pLauncher = pLauncher;// remember what RPG fired me. pRocket->m_hLauncher = pLauncher;// remember what RPG fired me.
pRocket->m_pLauncher->m_cActiveRockets++;// register this missile as active for the launcher pLauncher->m_cActiveRockets++;// register this missile as active for the launcher
pRocket->pev->owner = pOwner->edict(); pRocket->pev->owner = pOwner->edict();
return pRocket; return pRocket;
@ -150,10 +150,10 @@ void CRpgRocket::Spawn( void )
//========================================================= //=========================================================
void CRpgRocket::RocketTouch( CBaseEntity *pOther ) void CRpgRocket::RocketTouch( CBaseEntity *pOther )
{ {
if( m_pLauncher ) if( CRpg* pLauncher = (CRpg*)( (CBaseEntity*)( m_hLauncher ) ) )
{ {
// my launcher is still around, tell it I'm dead. // my launcher is still around, tell it I'm dead.
m_pLauncher->m_cActiveRockets--; pLauncher->m_cActiveRockets--;
} }
STOP_SOUND( edict(), CHAN_VOICE, "weapons/rocket1.wav" ); STOP_SOUND( edict(), CHAN_VOICE, "weapons/rocket1.wav" );

2
dlls/weapons.cpp

@ -1518,7 +1518,7 @@ IMPLEMENT_SAVERESTORE( CRpg, CBasePlayerWeapon )
TYPEDESCRIPTION CRpgRocket::m_SaveData[] = TYPEDESCRIPTION CRpgRocket::m_SaveData[] =
{ {
DEFINE_FIELD( CRpgRocket, m_flIgniteTime, FIELD_TIME ), DEFINE_FIELD( CRpgRocket, m_flIgniteTime, FIELD_TIME ),
DEFINE_FIELD( CRpgRocket, m_pLauncher, FIELD_CLASSPTR ), DEFINE_FIELD( CRpgRocket, m_hLauncher, FIELD_EHANDLE ),
}; };
IMPLEMENT_SAVERESTORE( CRpgRocket, CGrenade ) IMPLEMENT_SAVERESTORE( CRpgRocket, CGrenade )

2
dlls/weapons.h

@ -725,7 +725,7 @@ public:
int m_iTrail; int m_iTrail;
float m_flIgniteTime; float m_flIgniteTime;
CRpg *m_pLauncher;// pointer back to the launcher that fired me. EHANDLE m_hLauncher; // handle back to the launcher that fired me.
}; };
class CGauss : public CBasePlayerWeapon class CGauss : public CBasePlayerWeapon

Loading…
Cancel
Save