本文整理匯總了C++中BloodColor函數的典型用法代碼示例。如果您正苦於以下問題:C++ BloodColor函數的具體用法?C++ BloodColor怎麽用?C++ BloodColor使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了BloodColor函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: if
void CBaseEntity::__MAKE_VHOOK(TraceBleed)(float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
if (BloodColor() == DONT_BLEED)
return;
if (!flDamage)
return;
if (!(bitsDamageType & (DMG_CRUSH | DMG_BULLET | DMG_SLASH | DMG_BLAST | DMG_CLUB | DMG_MORTAR)))
return;
// make blood decal on the wall!
TraceResult Bloodtr;
Vector vecTraceDir;
float flNoise;
int cCount;
int i;
if (flDamage < 10.0f)
{
flNoise = 0.1f;
cCount = 1;
}
else if (flDamage < 25.0f)
{
flNoise = 0.2f;
cCount = 2;
}
else
{
flNoise = 0.3f;
cCount = 4;
}
for (i = 0; i < cCount; ++i)
{
// trace in the opposite direction the shot came from (the direction the shot is going)
vecTraceDir = vecDir * -1.0f;
vecTraceDir.x += RANDOM_FLOAT(-flNoise, flNoise);
vecTraceDir.y += RANDOM_FLOAT(-flNoise, flNoise);
vecTraceDir.z += RANDOM_FLOAT(-flNoise, flNoise);
UTIL_TraceLine(ptr->vecEndPos, ptr->vecEndPos + vecTraceDir * -172.0f, ignore_monsters, ENT(pev), &Bloodtr);
if (Bloodtr.flFraction != 1.0f)
{
if (!RANDOM_LONG(0, 2))
{
UTIL_BloodDecalTrace(&Bloodtr, BloodColor());
}
}
}
}
示例2: BloodColor
void CEffects::PlayerDeath(vec2 Pos, int ClientID)
{
vec3 BloodColor(1.0f,1.0f,1.0f);
if(ClientID >= 0)
{
if(m_pClient->m_aClients[ClientID].m_UseCustomColor)
BloodColor = m_pClient->m_pSkins->GetColorV3(m_pClient->m_aClients[ClientID].m_ColorBody);
else
{
const CSkins::CSkin *s = m_pClient->m_pSkins->Get(m_pClient->m_aClients[ClientID].m_SkinID);
if(s)
BloodColor = s->m_BloodColor;
}
}
for(int i = 0; i < 64; i++)
{
CParticle p;
p.SetDefault();
p.m_Spr = SPRITE_PART_SPLAT01 + (rand()%3);
p.m_Pos = Pos;
p.m_Vel = RandomDir() * ((frandom()+0.1f)*900.0f);
p.m_LifeSpan = 0.3f + frandom()*0.3f;
p.m_StartSize = 24.0f + frandom()*16;
p.m_EndSize = 0;
p.m_Rot = frandom()*pi*2;
p.m_Rotspeed = (frandom()-0.5f) * pi;
p.m_Gravity = 800.0f;
p.m_Friction = 0.8f;
vec3 c = BloodColor * (0.75f + frandom()*0.25f);
p.m_Color = vec4(c.r, c.g, c.b, 0.75f);
m_pClient->m_pParticles->Add(CParticles::GROUP_GENERAL, &p);
}
}
示例3: AddMultiDamage
void C_HL2MP_Player::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr )
{
Vector vecOrigin = ptr->endpos - vecDir * 4;
float flDistance = 0.0f;
if ( info.GetAttacker() )
{
flDistance = (ptr->endpos - info.GetAttacker()->GetAbsOrigin()).Length();
}
if ( m_takedamage )
{
AddMultiDamage( info, this );
int blood = BloodColor();
CBaseEntity *pAttacker = info.GetAttacker();
if ( pAttacker )
{
if ( HL2MPRules()->IsTeamplay() && pAttacker->InSameTeam( this ) == true )
return;
}
if ( blood != DONT_BLEED )
{
SpawnBlood( vecOrigin, vecDir, blood, flDistance );// a little surface blood.
TraceBleed( flDistance, vecDir, ptr, info.GetDamageType() );
}
}
}
示例4: WorldSpaceCenter
//-----------------------------------------------------------------------------
// 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;
}
示例5: Killed
void CSqueakGrenade :: Killed( entvars_t *pevAttacker, int iGib )
{
pev->model = iStringNull;// make invisible
SetThink( SUB_Remove );
SetTouch( NULL );
pev->nextthink = gpGlobals->time + 0.1;
// since squeak grenades never leave a body behind, clear out their takedamage now.
// Squeaks do a bit of radius damage when they pop, and that radius damage will
// continue to call this function unless we acknowledge the Squeak's death now. (sjb)
pev->takedamage = DAMAGE_NO;
// play squeek blast
EMIT_SOUND_DYN(ENT(pev), CHAN_ITEM, "squeek/sqk_blast1.wav", 1, 0.5, 0, PITCH_NORM);
CSoundEnt::InsertSound ( bits_SOUND_COMBAT, pev->origin, SMALL_EXPLOSION_VOLUME, 3.0 );
UTIL_BloodDrips( pev->origin, g_vecZero, BloodColor(), 80 );
if (m_hOwner != NULL)
RadiusDamage ( pev, m_hOwner->pev, pev->dmg, CLASS_NONE, DMG_BLAST );
else
RadiusDamage ( pev, pev, pev->dmg, CLASS_NONE, DMG_BLAST );
// reset owner so death message happens
if (m_hOwner != NULL)
pev->owner = m_hOwner->edict();
CBaseMonster :: Killed( pevAttacker, GIB_ALWAYS );
}
示例6: RANDOM_FLOAT
NOXREF void CBaseMonster::MakeDamageBloodDecal(int cCount, float flNoise, TraceResult *ptr, Vector &vecDir)
{
// make blood decal on the wall!
TraceResult Bloodtr;
Vector vecTraceDir;
int i;
if (!IsAlive())
{
// dealing with a dead monster.
if (pev->max_health <= 0)
{
// no blood decal for a monster that has already decalled its limit.
return;
}
else
pev->max_health--;
}
for (i = 0; i < cCount; ++i)
{
vecTraceDir = vecDir;
vecTraceDir.x += RANDOM_FLOAT(-flNoise, flNoise);
vecTraceDir.y += RANDOM_FLOAT(-flNoise, flNoise);
vecTraceDir.z += RANDOM_FLOAT(-flNoise, flNoise);
UTIL_TraceLine(ptr->vecEndPos, ptr->vecEndPos + vecTraceDir * 172, ignore_monsters, ENT(pev), &Bloodtr);
if (Bloodtr.flFraction != 1.0f)
{
UTIL_BloodDecalTrace(&Bloodtr, BloodColor());
}
}
}
示例7: UTIL_BloodImpact
void CHL1NPCTalker::TraceAttack(const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr, CDmgAccumulator *pAccumulator)
{
if ( info.GetDamage() >= 1.0 && !(info.GetDamageType() & DMG_SHOCK ) )
{
UTIL_BloodImpact( ptr->endpos, vecDir, BloodColor(), 4 );
}
BaseClass::TraceAttack( info, vecDir, ptr, pAccumulator );
}
示例8: UTIL_BloodSpray
void CHL1BaseNPC::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr )
{
if ( info.GetDamage() >= 1.0 && !(info.GetDamageType() & DMG_SHOCK ) )
{
UTIL_BloodSpray( ptr->endpos, vecDir, BloodColor(), 4, FX_BLOODSPRAY_ALL );
}
BaseClass::TraceAttack( info, vecDir, ptr, NULL );
}
示例9: TraceAttack
//=========================================================
// TraceAttack
//=========================================================
void CBaseMonster :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
if ( pev->takedamage )
{
SpawnBlood(ptr->vecEndPos, BloodColor(), flDamage);// a little surface blood.
TraceBleed( flDamage, vecDir, ptr, bitsDamageType );
AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType );
}
}
示例10: MakeDamageBloodDecal
//=========================================================
//=========================================================
void CBaseMonster :: MakeDamageBloodDecal ( int cCount, float flNoise, TraceResult *ptr, const Vector &vecDir )
{
// make blood decal on the wall!
TraceResult Bloodtr;
Vector vecTraceDir;
int i;
if ( !IsAlive() )
{
// dealing with a dead monster.
if ( pev->max_health <= 0 )
{
// no blood decal for a monster that has already decalled its limit.
return;
}
else
{
pev->max_health--;
}
}
for ( i = 0 ; i < cCount ; i++ )
{
vecTraceDir = vecDir;
vecTraceDir.x += RANDOM_FLOAT( -flNoise, flNoise );
vecTraceDir.y += RANDOM_FLOAT( -flNoise, flNoise );
vecTraceDir.z += RANDOM_FLOAT( -flNoise, flNoise );
UTIL_TraceLine( ptr->vecEndPos, ptr->vecEndPos + vecTraceDir * 172, ignore_monsters, ENT(pev), &Bloodtr);
/*
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_SHOWLINE);
WRITE_COORD( ptr->vecEndPos.x );
WRITE_COORD( ptr->vecEndPos.y );
WRITE_COORD( ptr->vecEndPos.z );
WRITE_COORD( Bloodtr.vecEndPos.x );
WRITE_COORD( Bloodtr.vecEndPos.y );
WRITE_COORD( Bloodtr.vecEndPos.z );
MESSAGE_END();
*/
if ( Bloodtr.flFraction != 1.0 )
{
UTIL_BloodDecalTrace( &Bloodtr, BloodColor() );
}
}
}
示例11: AddMultiDamage
/*
================
TraceAttack
================
*/
void CBaseEntity::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
Vector vecOrigin = ptr->vecEndPos - vecDir * 4;
if ( pev->takedamage )
{
AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType );
int blood = BloodColor();
if ( blood != DONT_BLEED )
{
SpawnBlood(vecOrigin, blood, flDamage);// a little surface blood.
TraceBleed( flDamage, vecDir, ptr, bitsDamageType );
}
}
}
示例12: switch
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
float CNPC_CombineS::GetHitgroupDamageMultiplier( int iHitGroup, const CTakeDamageInfo &info )
{
bool isNohead = false;
switch( iHitGroup )
{
case HITGROUP_HEAD:
int HeadshotRandom = random->RandomInt(0, 4);
if (!(g_Language.GetInt() == LANGUAGE_GERMAN || UTIL_IsLowViolence()) && g_fr_headshotgore.GetBool())
{
if (isNohead == false && HeadshotRandom == 0 && !(info.GetDamageType() & DMG_NEVERGIB) || isNohead == false && (info.GetDamageType() & (DMG_SNIPER | DMG_BUCKSHOT)) && !(info.GetDamageType() & DMG_NEVERGIB))
{
SetModel("models/gibs/combine_soldier_beheaded.mdl");
DispatchParticleEffect("headshotspray", PATTACH_POINT_FOLLOW, this, "bloodspurt", true);
SpawnBlood(GetAbsOrigin(), g_vecAttackDir, BloodColor(), info.GetDamage());
CGib::SpawnSpecificGibs(this, 6, 750, 1500, "models/gibs/pgib_p3.mdl", 6);
CGib::SpawnSpecificGibs(this, 6, 750, 1500, "models/gibs/pgib_p4.mdl", 6);
EmitSound("Gore.Headshot");
m_iHealth = 0;
g_pGameRules->iHeadshotCount += 1;
isNohead = true;
CBasePlayer *pPlayer = UTIL_PlayerByIndex(1);
if (g_fr_economy.GetBool())
{
pPlayer->AddMoney(5);
}
if (!g_fr_classic.GetBool())
{
pPlayer->AddXP(7);
}
}
else
{
// Soldiers take double headshot damage
return 2.0f;
}
}
else
{
// Soldiers take double headshot damage
return 2.0f;
}
}
return BaseClass::GetHitgroupDamageMultiplier( iHitGroup, info );
}
示例13: filter
void CNPC_AlienGrunt::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr )
{
CTakeDamageInfo ainfo = info;
float flDamage = ainfo.GetDamage();
if ( ptr->hitgroup == 10 && (ainfo.GetDamageType() & (DMG_BULLET | DMG_SLASH | DMG_CLUB)))
{
// hit armor
if ( m_flDamageTime != gpGlobals->curtime || (random->RandomInt(0,10) < 1) )
{
CPVSFilter filter( ptr->endpos );
te->ArmorRicochet( filter, 0.0, &ptr->endpos, &ptr->plane.normal );
m_flDamageTime = gpGlobals->curtime;
}
if ( random->RandomInt( 0, 1 ) == 0 )
{
Vector vecTracerDir = vecDir;
vecTracerDir.x += random->RandomFloat( -0.3, 0.3 );
vecTracerDir.y += random->RandomFloat( -0.3, 0.3 );
vecTracerDir.z += random->RandomFloat( -0.3, 0.3 );
vecTracerDir = vecTracerDir * -512;
Vector vEndPos = ptr->endpos + vecTracerDir;
UTIL_Tracer( ptr->endpos, vEndPos, ENTINDEX( edict() ) );
}
flDamage -= 20;
if (flDamage <= 0)
flDamage = 0.1;// don't hurt the monster much, but allow bits_COND_LIGHT_DAMAGE to be generated
ainfo.SetDamage( flDamage );
}
else
{
SpawnBlood( ptr->endpos, vecDir, BloodColor(), flDamage);// a little surface blood.
TraceBleed( flDamage, vecDir, ptr, ainfo.GetDamageType() );
}
AddMultiDamage( ainfo, this );
}
示例14: TraceAttack
//=========================================================
// TraceAttack
//=========================================================
void CAGrunt :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
if ( ptr->iHitgroup == 10 && (bitsDamageType & (DMG_BULLET | DMG_SLASH | DMG_CLUB)))
{
// hit armor
if ( pev->dmgtime != gpGlobals->time || (RANDOM_LONG(0,10) < 1) )
{
UTIL_Ricochet( ptr->vecEndPos, RANDOM_FLOAT( 1, 2) );
pev->dmgtime = gpGlobals->time;
}
if ( RANDOM_LONG( 0, 1 ) == 0 )
{
Vector vecTracerDir = vecDir;
vecTracerDir.x += RANDOM_FLOAT( -0.3, 0.3 );
vecTracerDir.y += RANDOM_FLOAT( -0.3, 0.3 );
vecTracerDir.z += RANDOM_FLOAT( -0.3, 0.3 );
vecTracerDir = vecTracerDir * -512;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, ptr->vecEndPos );
WRITE_BYTE( TE_TRACER );
WRITE_COORD( ptr->vecEndPos.x );
WRITE_COORD( ptr->vecEndPos.y );
WRITE_COORD( ptr->vecEndPos.z );
WRITE_COORD( vecTracerDir.x );
WRITE_COORD( vecTracerDir.y );
WRITE_COORD( vecTracerDir.z );
MESSAGE_END();
}
flDamage -= 20;
if (flDamage <= 0)
flDamage = 0.1;// don't hurt the monster much, but allow bits_COND_LIGHT_DAMAGE to be generated
}
else
{
SpawnBlood(ptr->vecEndPos, BloodColor(), flDamage);// a little surface blood.
TraceBleed( flDamage, vecDir, ptr, bitsDamageType );
}
AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType );
}
示例15: UTIL_BloodStream
void CNihilanth::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
if (m_irritation == 3)
m_irritation = 2;
if (m_irritation == 2 && ptr->iHitgroup == 2 && flDamage > 2)
m_irritation = 3;
if (m_irritation != 3)
{
Vector vecBlood = (ptr->vecEndPos - pev->origin).Normalize( );
UTIL_BloodStream( ptr->vecEndPos, vecBlood, BloodColor(), flDamage + (100 - 100 * (pev->health / gSkillData.nihilanthHealth)));
}
// SpawnBlood(ptr->vecEndPos, BloodColor(), flDamage * 5.0);// a little surface blood.
AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType );
}