void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, int amount ) { if ( !UTIL_ShouldShowBlood( color ) ) return; if ( color == DONT_BLEED || amount == 0 ) return; if ( g_Language == LANGUAGE_GERMAN && color == BLOOD_COLOR_RED ) color = 0; if ( g_pGameRules->IsMultiplayer() ) { // scale up blood effect in multiplayer for better visibility amount *= 2; } if ( amount > 255 ) amount = 255; MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, origin ); WRITE_BYTE( TE_BLOODSPRITE ); WRITE_COORD( origin.x); // pos WRITE_COORD( origin.y); WRITE_COORD( origin.z); WRITE_SHORT( g_sModelIndexBloodSpray ); // initial sprite model WRITE_SHORT( g_sModelIndexBloodDrop ); // droplet sprite models WRITE_BYTE( color ); // color index into host_basepal WRITE_BYTE( min( max( 3, amount / 10 ), 16 ) ); // size MESSAGE_END(); }
void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, int amount ) { if ( !UTIL_ShouldShowBlood( color ) ) return; if ( color == DONT_BLEED || amount == 0 ) return; if ( g_Language.GetInt() == LANGUAGE_GERMAN && color == BLOOD_COLOR_RED ) color = 0; if ( g_pGameRules->IsMultiplayer() ) { // scale up blood effect in multiplayer for better visibility amount *= 5; } if ( amount > 255 ) amount = 255; if (color == BLOOD_COLOR_MECH) { g_pEffects->Sparks(origin); if (random->RandomFloat(0, 2) >= 1) { UTIL_Smoke(origin, random->RandomInt(10, 15), 10); } } else { // Normal blood impact UTIL_BloodImpact( origin, direction, color, amount ); } }
void UTIL_BloodDecalTrace( trace_t *pTrace, int bloodColor ) { if ( UTIL_ShouldShowBlood( bloodColor ) ) { if ( bloodColor == BLOOD_COLOR_RED ) UTIL_DecalTrace( pTrace, "Blood" ); else UTIL_DecalTrace( pTrace, "YellowBlood" ); } }
void UTIL_BloodDecalTrace( TraceResult *pTrace, int bloodColor ) { if ( UTIL_ShouldShowBlood( bloodColor ) ) { if ( bloodColor == BLOOD_COLOR_RED ) UTIL_DecalTrace( pTrace, DECAL_BLOOD1 + RANDOM_LONG(0,5) ); else UTIL_DecalTrace( pTrace, DECAL_YBLOOD1 + RANDOM_LONG(0,5) ); } }
void UTIL_BloodStream( const Vector &origin, const Vector &direction, int color, int amount ) { if ( !UTIL_ShouldShowBlood( color ) ) return; if ( g_Language == LANGUAGE_GERMAN && color == BLOOD_COLOR_RED ) color = 0; MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, origin ); WRITE_BYTE( TE_BLOODSTREAM ); WRITE_COORD( origin.x ); WRITE_COORD( origin.y ); WRITE_COORD( origin.z ); WRITE_COORD( direction.x ); WRITE_COORD( direction.y ); WRITE_COORD( direction.z ); WRITE_BYTE( color ); WRITE_BYTE( min( amount, 255 ) ); MESSAGE_END(); }
void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, int amount ) { #ifdef HL2SB //Andrew; see https://developer.valvesoftware.com/wiki/Fixing_AI_in_multiplayer#Blood IPredictionSystem::SuppressHostEvents( NULL ); #endif if ( !UTIL_ShouldShowBlood( color ) ) return; if ( color == DONT_BLEED || amount == 0 ) return; if ( g_Language.GetInt() == LANGUAGE_GERMAN && color == BLOOD_COLOR_RED ) color = 0; if ( g_pGameRules->IsMultiplayer() ) { // scale up blood effect in multiplayer for better visibility amount *= 5; } if ( amount > 255 ) amount = 255; if (color == BLOOD_COLOR_MECH) { g_pEffects->Sparks(origin); if (random->RandomFloat(0, 2) >= 1) { UTIL_Smoke(origin, random->RandomInt(10, 15), 10); } } else { // Normal blood impact UTIL_BloodImpact( origin, direction, color, amount ); } }
void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, int amount ) { //Thanks to the prediction, the blood of NPCs is suppressed. This is because in HL2DM the blood of players is done client-side. need to break it for bots IPredictionSystem::SuppressHostEvents( NULL ); if ( !UTIL_ShouldShowBlood( color ) ) return; if ( color == DONT_BLEED || amount == 0 ) return; if ( g_Language.GetInt() == LANGUAGE_GERMAN && color == BLOOD_COLOR_RED ) color = 0; /* if ( g_pGameRules->IsMultiplayer() ) { // scale up blood effect in multiplayer for better visibility amount *= 5; } */ if ( amount > 255 ) amount = 255; if (color == BLOOD_COLOR_MECH) { g_pEffects->Sparks(origin); if (random->RandomFloat(0, 2) >= 1) { UTIL_Smoke(origin, random->RandomInt(10, 15), 10); } } else { // Normal blood impact UTIL_BloodImpact( origin, direction, color, amount ); } }
static int luasrc_UTIL_ShouldShowBlood (lua_State *L) { lua_pushboolean(L, UTIL_ShouldShowBlood(luaL_checkint(L, 1))); return 1; }
void CASW_Simple_Alien::MeleeAttack( float distance, float damage, QAngle &viewPunch, Vector &shove ) { Vector vecForceDir; // Always hurt bullseyes for now if ( ( GetEnemy() != NULL ) && ( GetEnemy()->Classify() == CLASS_BULLSEYE ) ) { vecForceDir = (GetEnemy()->GetAbsOrigin() - GetAbsOrigin()); CTakeDamageInfo info( this, this, damage, DMG_SLASH ); CalculateMeleeDamageForce( &info, vecForceDir, GetEnemy()->GetAbsOrigin() ); GetEnemy()->TakeDamage( info ); return; } CBaseEntity *pHurt = CheckTraceHullAttack( distance, -Vector(16,16,32), Vector(16,16,32), damage, DMG_SLASH, 5.0f ); if ( pHurt ) { vecForceDir = ( pHurt->WorldSpaceCenter() - WorldSpaceCenter() ); CBasePlayer *pPlayer = ToBasePlayer( pHurt ); if ( pPlayer != NULL ) { //Kick the player angles pPlayer->ViewPunch( viewPunch ); Vector dir = pHurt->GetAbsOrigin() - GetAbsOrigin(); VectorNormalize(dir); QAngle angles; VectorAngles( dir, angles ); Vector forward, right; AngleVectors( angles, &forward, &right, NULL ); //Push the target back pHurt->ApplyAbsVelocityImpulse( - right * shove[1] - forward * shove[0] ); } // Play a random attack hit sound AttackSound(); // bleed em if ( UTIL_ShouldShowBlood(pHurt->BloodColor()) ) { // Hit an NPC. Bleed them! Vector vecBloodPos; Vector forward, right, up; AngleVectors( GetAbsAngles(), &forward, &right, &up ); //if( GetAttachment( "leftclaw", vecBloodPos ) ) { //Vector diff = vecBloodPos - GetAbsOrigin(); //if (diff.z < 0) //vecBloodPos.z = GetAbsOrigin().z - (diff.z * 2); vecBloodPos = GetAbsOrigin() + forward * 60 - right * 14 + up * 50; SpawnBlood( vecBloodPos, g_vecAttackDir, pHurt->BloodColor(), MIN( damage, 30 ) ); } //if( GetAttachment( "rightclaw", vecBloodPos ) ) { vecBloodPos = GetAbsOrigin() + forward * 60 + right * 14 + up * 50; SpawnBlood( vecBloodPos, g_vecAttackDir, pHurt->BloodColor(), MIN( damage, 30 ) ); } } } }