//----------------------------------------------------------------------------- // Purpose: // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CHL1BaseNPC::CorpseGib( const CTakeDamageInfo &info ) { CEffectData data; data.m_vOrigin = WorldSpaceCenter(); data.m_vNormal = data.m_vOrigin - info.GetDamagePosition(); VectorNormalize( data.m_vNormal ); data.m_flScale = RemapVal( m_iHealth, 0, -500, 1, 3 ); data.m_flScale = clamp( data.m_flScale, 1, 3 ); if ( HasAlienGibs() ) data.m_nMaterial = ALIEN_GIBS; else if ( HasHumanGibs() ) data.m_nMaterial = HUMAN_GIBS; data.m_nColor = BloodColor(); DispatchEffect( "HL1Gib", data ); CSoundEnt::InsertSound( SOUND_MEAT, GetAbsOrigin(), 256, 0.5f, this ); /// BaseClass::CorpseGib( info ); return true; }
//========================================================= // GibMonster - create some gore and get rid of a monster's // model. //========================================================= void CBaseMonster :: GibMonster( void ) { TraceResult tr; BOOL gibbed = FALSE; int iszCustomGibs; EMIT_SOUND(ENT(pev), CHAN_WEAPON, "common/bodysplat.wav", 1, ATTN_NORM); if ( iszCustomGibs = HasCustomGibs() ) //LRC - monster_generic can have a custom gibset { if ( CVAR_GET_FLOAT("violence_hgibs") != 0 ) { CGib::SpawnHeadGib( pev, STRING(iszCustomGibs) ); CGib::SpawnRandomGibs( pev, 4, 1, STRING(iszCustomGibs) ); } gibbed = TRUE; } // only humans throw skulls !!!UNDONE - eventually monsters will have their own sets of gibs else if ( HasHumanGibs() ) { if ( CVAR_GET_FLOAT("violence_hgibs") != 0 )// Only the player will ever fail this test { CGib::SpawnHeadGib( pev ); CGib::SpawnRandomGibs( pev, 4, 1 ); // throw some human gibs. } gibbed = TRUE; } else if ( HasAlienGibs() ) { if ( CVAR_GET_FLOAT("violence_agibs") != 0 )// Should never fail this test, but someone might call it directly { CGib::SpawnRandomGibs( pev, 4, 0 ); // Throw alien gibs } gibbed = TRUE; } if ( !IsPlayer() ) { if ( gibbed ) { // don't remove players! SetThink(&CBaseMonster :: SUB_Remove ); SetNextThink( 0 ); } else { FadeMonster(); } } }
void CBaseMonster::__MAKE_VHOOK(GibMonster)() { TraceResult tr; bool gibbed = false; EMIT_SOUND(ENT(pev), CHAN_WEAPON, "common/bodysplat.wav", VOL_NORM, ATTN_NORM); // only humans throw skulls UNDONE - eventually monsters will have their own sets of gibs if (HasHumanGibs()) { // Only the player will ever get here if (CVAR_GET_FLOAT("violence_hgibs") != 0) { CGib::SpawnHeadGib(pev); // throw some human gibs. CGib::SpawnRandomGibs(pev, 4, 1); } gibbed = true; } else if (HasAlienGibs()) { // Should never get here, but someone might call it directly if (CVAR_GET_FLOAT("violence_agibs") != 0) { // Throw alien gibs CGib::SpawnRandomGibs(pev, 4, 0); } gibbed = true; } if (!IsPlayer()) { if (gibbed) { // don't remove players! SetThink(&CBaseMonster::SUB_Remove); pev->nextthink = gpGlobals->time; } else FadeMonster(); } }
void CBaseMonster::CallGibMonster() { BOOL fade = FALSE; if (HasHumanGibs()) { if (CVAR_GET_FLOAT("violence_hgibs") == 0) fade = TRUE; } else if (HasAlienGibs()) { if (CVAR_GET_FLOAT("violence_agibs") == 0) fade = TRUE; } // do something with the body. while monster blows up pev->solid = SOLID_NOT; pev->takedamage = DAMAGE_NO; if (fade) { FadeMonster(); } else { // make the model invisible. pev->effects = EF_NODRAW; GibMonster(); } pev->deadflag = DEAD_DEAD; FCheckAITrigger(); // don't let the status bar glitch for players.with <0 health. if (pev->health < -99.0f) { pev->health = 0; } if (ShouldFadeOnDeath() && !fade) UTIL_Remove(this); }
//========================================================= // GibMonster - create some gore and get rid of a monster's // model. //========================================================= void CBaseMonster :: GibMonster( void ) { TraceResult tr; BOOL gibbed = FALSE; EMIT_SOUND(ENT(pev), CHAN_WEAPON, "common/bodysplat.wav", 1, ATTN_NORM); // only humans throw skulls !!!UNDONE - eventually monsters will have their own sets of gibs if ( HasHumanGibs() ) { if ( CVAR_GET_FLOAT("violence_hgibs") != 0 ) // Only the player will ever get here { CGib::SpawnHeadGib( pev ); CGib::SpawnRandomGibs( pev, 4, 1 ); // throw some human gibs. } gibbed = TRUE; } else if ( HasAlienGibs() ) { if ( CVAR_GET_FLOAT("violence_agibs") != 0 ) // Should never get here, but someone might call it directly { CGib::SpawnRandomGibs( pev, 4, 0 ); // Throw alien gibs } gibbed = TRUE; } if ( !IsPlayer() ) { if ( gibbed ) { // don't remove players! SetThink ( SUB_Remove ); pev->nextthink = gpGlobals->time; } else { FadeMonster(); } } }