/* ============ Killed ============ */ void CBaseMonster :: Killed( entvars_t *pevAttacker, int iGib ) { unsigned int cCount = 0; BOOL fDone = FALSE; CBaseEntity* theBaseEntity = CBaseEntity::Instance(pevAttacker->owner); if(!theBaseEntity) { theBaseEntity = CBaseEntity::Instance(pevAttacker); } ASSERT(theBaseEntity); theBaseEntity->AwardKill(this->pev); if ( HasMemory( bits_MEMORY_KILLED ) ) { if ( ShouldGibMonster( iGib ) ) CallGibMonster(); return; } Remember( bits_MEMORY_KILLED ); // clear the deceased's sound channels.(may have been firing or reloading when killed) EMIT_SOUND(ENT(pev), CHAN_WEAPON, "common/null.wav", 1, ATTN_NORM); m_IdealMonsterState = MONSTERSTATE_DEAD; // Make sure this condition is fired too (TakeDamage breaks out before this happens on death) SetConditions( bits_COND_LIGHT_DAMAGE ); // tell owner ( if any ) that we're dead.This is mostly for MonsterMaker functionality. CBaseEntity *pOwner = CBaseEntity::Instance(pev->owner); if ( pOwner ) { pOwner->DeathNotice( pev ); } if ( ShouldGibMonster( iGib ) ) { CallGibMonster(); return; } else if ( pev->flags & FL_MONSTER ) { SetTouch( NULL ); BecomeDead(); } // don't let the status bar glitch for players.with <0 health. if (pev->health < -99) { pev->health = 0; } //pev->enemy = ENT( pevAttacker );//why? (sjb) m_IdealMonsterState = MONSTERSTATE_DEAD; }
/* <fc2a1> ../cstrike/dlls/mpstubb.cpp:62 */ void CBaseMonster::__MAKE_VHOOK(MonsterInitDead)(void) { InitBoneControllers(); pev->solid = SOLID_BBOX; pev->movetype = MOVETYPE_TOSS; pev->frame = 0; ResetSequenceInfo(); pev->framerate = 0; pev->max_health = pev->health; pev->deadflag = DEAD_DEAD; UTIL_SetSize(pev, g_vecZero, g_vecZero); UTIL_SetOrigin(pev, pev->origin); BecomeDead(); SetThink(&CBaseEntity::SUB_Remove); pev->nextthink = gpGlobals->time + 0.5; }
// Call after animation/pose is set up void CBaseMonster :: MonsterInitDead( void ) { InitBoneControllers(); pev->solid = SOLID_BBOX; pev->movetype = MOVETYPE_TOSS;// so he'll fall to ground pev->frame = 0; ResetSequenceInfo( ); pev->framerate = 0; // Copy health pev->max_health = pev->health; pev->deadflag = DEAD_DEAD; UTIL_SetSize(pev, g_vecZero, g_vecZero ); UTIL_SetOrigin( pev, pev->origin ); // Setup health counters, etc. BecomeDead(); SetThink( &CBaseMonster::CorpseFallThink ); pev->nextthink = gpGlobals->time + 0.5; }