HL 25th anniversary update rpg rocket changes.

This commit is contained in:
Andrey Akhmichin 2024-01-26 20:54:27 +05:00
parent 538e3a84d7
commit fb1ff42a60
2 changed files with 37 additions and 9 deletions

View File

@ -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 )
@ -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" );
@ -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

View File

@ -37,7 +37,7 @@ public:
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 );
@ -723,6 +723,8 @@ public:
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;