From 62bf3a537edd87e5213486b3ae4401291a31ae52 Mon Sep 17 00:00:00 2001 From: mittorn Date: Sun, 4 Sep 2016 09:32:02 +0000 Subject: [PATCH] Disintegrate effect --- dlls/ar2.cpp | 4 ++-- dlls/cbase.h | 1 + dlls/combat.cpp | 20 +++++++++++++++++--- dlls/player.cpp | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/dlls/ar2.cpp b/dlls/ar2.cpp index 6e4061c4..2b762bc1 100644 --- a/dlls/ar2.cpp +++ b/dlls/ar2.cpp @@ -201,11 +201,11 @@ void CAR2Ball::AR2Touch(CBaseEntity *pOther) pevOwner = pev; TraceResult tr = UTIL_GetGlobalTrace(); ClearMultiDamage(); - pOther->TraceAttack(pevOwner, 250, gpGlobals->v_forward, &tr, DMG_CLUB); + pOther->TraceAttack(pevOwner, 2500, gpGlobals->v_forward, &tr, DMG_CLUB | DMG_DISINTEGRATE); if( pOther->IsPlayer() || pOther->IsMoving() ) { pev->velocity = gpGlobals->v_forward.Normalize() * 1600; - // play bounce sound + // play strike sound switch (RANDOM_LONG(0, 2)) { case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "ar2/ar2strike1.wav", 1, ATTN_NORM); break; diff --git a/dlls/cbase.h b/dlls/cbase.h index 8e7bffa3..d3c1ad52 100644 --- a/dlls/cbase.h +++ b/dlls/cbase.h @@ -592,6 +592,7 @@ public: #define DMG_NEVERGIB (1 << 12) // with this bit OR'd in, no damage type will be able to gib victims upon death #define DMG_ALWAYSGIB (1 << 13) // with this bit OR'd in, any damage type can be made to gib victims upon death. #define DMG_DROWN (1 << 14) // Drowning +#define DMG_DISINTEGRATE (1 << 15) // AR2 ball // time-based damage #define DMG_TIMEBASED (~(0x3fff)) // mask for time-based damage diff --git a/dlls/combat.cpp b/dlls/combat.cpp index ec4663cf..13955ed1 100644 --- a/dlls/combat.cpp +++ b/dlls/combat.cpp @@ -193,7 +193,7 @@ void CGib::SpawnRandomGibs( entvars_t *pevVictim, int cGibs, int human ) } else { - if( human ) + if( human & 1 ) { // human pieces pGib->Spawn( "models/hgibs.mdl" ); @@ -247,6 +247,19 @@ void CGib::SpawnRandomGibs( entvars_t *pevVictim, int cGibs, int human ) UTIL_SetSize( pGib->pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) ); } pGib->LimitVelocity(); + if(human & 2) + { + pGib->m_lifeTime = 0.3; + pGib->pev->renderfx = kRenderFxGlowShell; + pGib->pev->renderamt = 100; + + pGib->pev->rendermode = kRenderTransTexture; + + pGib->pev->solid = SOLID_NOT; + + pGib->pev->nextthink = gpGlobals->time + 0.1; + pGib->SetThink( &CBaseEntity::SUB_FadeOut ); + } } } @@ -299,6 +312,7 @@ void CBaseMonster::GibMonster( void ) { TraceResult tr; BOOL gibbed = FALSE; + byte disintegrate = (!!( m_bitsDamageType & DMG_DISINTEGRATE )) << 1; EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "common/bodysplat.wav", 1, ATTN_NORM ); @@ -308,7 +322,7 @@ void CBaseMonster::GibMonster( void ) 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. + CGib::SpawnRandomGibs( pev, 4, 1 | disintegrate ); // throw some human gibs. } gibbed = TRUE; } @@ -316,7 +330,7 @@ void CBaseMonster::GibMonster( void ) { 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 + CGib::SpawnRandomGibs( pev, 4, disintegrate ); // Throw alien gibs } gibbed = TRUE; } diff --git a/dlls/player.cpp b/dlls/player.cpp index 2f097072..8acba9e0 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -671,7 +671,7 @@ void CBasePlayer::PackDeadPlayerItems( void ) iWeaponRules = g_pGameRules->DeadPlayerWeapons( this ); iAmmoRules = g_pGameRules->DeadPlayerAmmo( this ); - if( iWeaponRules == GR_PLR_DROP_GUN_NO && iAmmoRules == GR_PLR_DROP_AMMO_NO ) + if( iWeaponRules == GR_PLR_DROP_GUN_NO && iAmmoRules == GR_PLR_DROP_AMMO_NO && !(m_bitsDamageType & DMG_DISINTEGRATE) ) { // nothing to pack. Remove the weapons and return. Don't call create on the box! RemoveAllItems( TRUE );