mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-25 22:24:16 +00:00
Add beheaded zombie with jumping headcrab.
This commit is contained in:
parent
e15c4ebf74
commit
4619e536ae
@ -156,6 +156,7 @@ public:
|
||||
Schedule_t *GetSchedule();
|
||||
Schedule_t *GetScheduleOfType( int Type );
|
||||
int TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType);
|
||||
void Killed( entvars_t *pevAttacker, int iGib );
|
||||
|
||||
void SetActivity( Activity NewActivity );
|
||||
|
||||
@ -300,6 +301,11 @@ void CGonome::SetActivity( Activity NewActivity )
|
||||
}
|
||||
}
|
||||
|
||||
void CGonome::Killed( entvars_t *pevAttacker, int iGib )
|
||||
{
|
||||
CBaseMonster::Killed( pevAttacker, iGib );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// TakeDamage - overridden for gonome so we can keep track
|
||||
// of how much time has passed since it was last injured
|
||||
|
@ -121,6 +121,49 @@ int CZombie::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float
|
||||
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
|
||||
}
|
||||
|
||||
void CZombie::Killed( entvars_t *pevAttacker, int iGib )
|
||||
{
|
||||
if( !ShouldGibMonster( iGib ) )
|
||||
{
|
||||
Vector vecSpawn = pev->origin;
|
||||
vecSpawn.z = pev->origin.z + 72;
|
||||
|
||||
pev->body = 1;
|
||||
|
||||
CBaseEntity *pCrab = CBaseEntity::Create( "monster_headcrab", vecSpawn, pev->angles, edict() );
|
||||
pCrab->pev->spawnflags |= SF_MONSTER_FALL_TO_GROUND;
|
||||
|
||||
Vector vecJumpDir;
|
||||
UTIL_MakeVectors( pev->angles );
|
||||
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
float gravity = CVAR_GET_FLOAT( "sv_gravity" );
|
||||
|
||||
float height = ( m_hEnemy->pev->origin.z + m_hEnemy->pev->view_ofs.z - pCrab->pev->origin.z );
|
||||
if( height < 4 )
|
||||
height = 4;
|
||||
float speed = sqrt( 1.5 * gravity * height );
|
||||
float time = speed / gravity;
|
||||
|
||||
vecJumpDir = ( m_hEnemy->pev->origin + m_hEnemy->pev->view_ofs - pCrab->pev->origin );
|
||||
vecJumpDir = vecJumpDir * ( 1.0 / time );
|
||||
|
||||
vecJumpDir.z = speed;
|
||||
|
||||
float distance = vecJumpDir.Length();
|
||||
|
||||
if( distance > 100 )
|
||||
vecJumpDir = vecJumpDir * ( 100.0 / distance );
|
||||
}
|
||||
else
|
||||
vecJumpDir = Vector( gpGlobals->v_forward.x, gpGlobals->v_forward.y, gpGlobals->v_up.z ) * 20;
|
||||
|
||||
pCrab->pev->velocity = vecJumpDir;
|
||||
}
|
||||
CBaseMonster::Killed( pevAttacker, iGib );
|
||||
}
|
||||
|
||||
void CZombie::PainSound( void )
|
||||
{
|
||||
int pitch = 95 + RANDOM_LONG( 0, 9 );
|
||||
@ -286,6 +329,8 @@ void CZombie::Precache()
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( pPainSounds ); i++ )
|
||||
PRECACHE_SOUND( pPainSounds[i] );
|
||||
|
||||
UTIL_PrecacheOther( "monster_headcrab" );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -25,6 +25,7 @@ public:
|
||||
int Classify( void );
|
||||
virtual void HandleAnimEvent( MonsterEvent_t *pEvent );
|
||||
int IgnoreConditions( void );
|
||||
virtual void Killed( entvars_t *pevAttacker, int iGib );
|
||||
|
||||
float m_flNextFlinch;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user