Browse Source

Decrement rocket count only if it was successfully created. (#234)

In addition, make smoke effect and swap sides only if rocket was successfully created.
hl_urbicide
Marc-Antoine Lortie 3 years ago committed by GitHub
parent
commit
8768594509
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      dlls/apache.cpp

6
dlls/apache.cpp

@ -757,6 +757,9 @@ void CApache::FireRocket( void )
break; break;
} }
CBaseEntity *pRocket = CBaseEntity::Create( "hvr_rocket", vecSrc, pev->angles, edict() );
if( pRocket )
{
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc ); MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc );
WRITE_BYTE( TE_SMOKE ); WRITE_BYTE( TE_SMOKE );
WRITE_COORD( vecSrc.x ); WRITE_COORD( vecSrc.x );
@ -767,14 +770,13 @@ void CApache::FireRocket( void )
WRITE_BYTE( 12 ); // framerate WRITE_BYTE( 12 ); // framerate
MESSAGE_END(); MESSAGE_END();
CBaseEntity *pRocket = CBaseEntity::Create( "hvr_rocket", vecSrc, pev->angles, edict() );
if( pRocket )
pRocket->pev->velocity = pev->velocity + gpGlobals->v_forward * 100.0f; pRocket->pev->velocity = pev->velocity + gpGlobals->v_forward * 100.0f;
m_iRockets--; m_iRockets--;
side = - side; side = - side;
} }
}
BOOL CApache::FireGun() BOOL CApache::FireGun()
{ {

Loading…
Cancel
Save