Skip to content

Commit

Permalink
HL 25th anniversary update rpg rocket changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
nekonomicon committed Jan 26, 2024
1 parent 538e3a8 commit fb1ff42
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
42 changes: 34 additions & 8 deletions dlls/rpg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,25 @@ CRpgRocket *CRpgRocket::CreateRpgRocket( Vector vecOrigin, Vector vecAngles, CBa
return pRocket;
}

void CRpgRocket::Explode( TraceResult *pTrace, int bitsDamageType )
{
if( CRpg *pLauncher = GetLauncher())
{
// my launcher is still around, tell it I'm dead.
pLauncher->m_cActiveRockets--;
m_hLauncher = 0;
}

STOP_SOUND( edict(), CHAN_VOICE, "weapons/rocket1.wav" );

CGrenade::Explode( pTrace, bitsDamageType );
}

CRpg *CRpgRocket::GetLauncher( void )
{
return (CRpg*)( (CBaseEntity*)m_hLauncher );
}

//=========================================================
//=========================================================
void CRpgRocket::Spawn( void )
Expand Down Expand Up @@ -150,10 +169,11 @@ void CRpgRocket::Spawn( void )
//=========================================================
void CRpgRocket::RocketTouch( CBaseEntity *pOther )
{
if( CRpg* pLauncher = (CRpg*)( (CBaseEntity*)( m_hLauncher ) ) )
if( CRpg *pLauncher = GetLauncher())
{
// my launcher is still around, tell it I'm dead.
pLauncher->m_cActiveRockets--;
m_hLauncher = 0;
}

STOP_SOUND( edict(), CHAN_VOICE, "weapons/rocket1.wav" );
Expand Down Expand Up @@ -264,17 +284,23 @@ void CRpgRocket::FollowThink( void )
}
pev->velocity = pev->velocity * 0.2f + vecTarget * flSpeed * 0.798f;
if( pev->waterlevel == 0 && pev->velocity.Length() < 1500.0f )
{
if( CRpg *pLauncher = (CRpg*)( (CBaseEntity*)( m_hLauncher ) ) )
{
// my launcher is still around, tell it I'm dead.
pLauncher->m_cActiveRockets--;
}
Detonate();
}
}
// ALERT( at_console, "%.0f\n", flSpeed );

if( CRpg *pLauncher = GetLauncher())
{
if( ( pev->origin - pLauncher->pev->origin ).Length() > 8192 || gpGlobals->time - m_flIgniteTime > 6.0f )
{
// my launcher is still around, tell it I'm dead.
pLauncher->m_cActiveRockets--;
m_hLauncher = 0;
}
}

if( UTIL_PointContents( pev->origin ) == CONTENTS_SKY )
Detonate();

pev->nextthink = gpGlobals->time + 0.1f;
}
#endif
Expand Down
4 changes: 3 additions & 1 deletion dlls/weapons.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CGrenade : public CBaseMonster
static void UseSatchelCharges( entvars_t *pevOwner, SATCHELCODE code );

void Explode( Vector vecSrc, Vector vecAim );
void Explode( TraceResult *pTrace, int bitsDamageType );
virtual void Explode( TraceResult *pTrace, int bitsDamageType );
void EXPORT Smoke( void );

void EXPORT BounceTouch( CBaseEntity *pOther );
Expand Down Expand Up @@ -723,6 +723,8 @@ class CRpgRocket : public CGrenade
void EXPORT IgniteThink( void );
void EXPORT RocketTouch( CBaseEntity *pOther );
static CRpgRocket *CreateRpgRocket( Vector vecOrigin, Vector vecAngles, CBaseEntity *pOwner, CRpg *pLauncher );
void Explode( TraceResult *pTrace, int bitsDamageType );
inline CRpg *GetLauncher( void );

int m_iTrail;
float m_flIgniteTime;
Expand Down

0 comments on commit fb1ff42

Please sign in to comment.