|
|
|
@ -33,8 +33,26 @@
@@ -33,8 +33,26 @@
|
|
|
|
|
#define SF_PROP_RESPAWN 8 // enable autorespawn
|
|
|
|
|
#define SF_PROP_BREAKABLE 16 // enable break/explode
|
|
|
|
|
#define SF_PROP_FIXED 32 // don't move untill touch
|
|
|
|
|
typedef enum { expRandom, expDirected} Explosions; |
|
|
|
|
typedef enum { matGlass = 0, matWood, matMetal, matFlesh, matCinderBlock, matCeilingTile, matComputer, matUnbreakableGlass, matRocks, matNone, matLastMaterial } Materials; |
|
|
|
|
typedef enum |
|
|
|
|
{ |
|
|
|
|
expRandom, |
|
|
|
|
expDirected |
|
|
|
|
}Explosions; |
|
|
|
|
|
|
|
|
|
typedef enum |
|
|
|
|
{ |
|
|
|
|
matGlass = 0, |
|
|
|
|
matWood, |
|
|
|
|
matMetal, |
|
|
|
|
matFlesh, |
|
|
|
|
matCinderBlock, |
|
|
|
|
matCeilingTile, |
|
|
|
|
matComputer, |
|
|
|
|
matUnbreakableGlass, |
|
|
|
|
matRocks, |
|
|
|
|
matNone, |
|
|
|
|
matLastMaterial |
|
|
|
|
}Materials; |
|
|
|
|
|
|
|
|
|
//extern "C" void AngleVectors( const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
|
|
|
|
|
Vector UTIL_AngleVectorsF( const Vector &angles ) |
|
|
|
@ -108,7 +126,6 @@ public:
@@ -108,7 +126,6 @@ public:
|
|
|
|
|
inline int ExplosionMagnitude( void ) { return pev->impulse; } |
|
|
|
|
inline void ExplosionSetMagnitude( int magnitude ) { pev->impulse = magnitude; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void MaterialSoundPrecache( Materials precacheMaterial ); |
|
|
|
|
static void MaterialSoundRandom( edict_t *pEdict, Materials soundMaterial, float volume ); |
|
|
|
|
static const char **MaterialSoundList( Materials precacheMaterial, int &soundCount ); |
|
|
|
@ -203,7 +220,6 @@ const char **CProp::MaterialSoundList( Materials precacheMaterial, int &soundCou
@@ -203,7 +220,6 @@ const char **CProp::MaterialSoundList( Materials precacheMaterial, int &soundCou
|
|
|
|
|
pSoundList = pSoundsGlass; |
|
|
|
|
soundCount = ARRAYSIZE( pSoundsGlass ); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case matMetal: |
|
|
|
|
pSoundList = pSoundsMetal; |
|
|
|
|
soundCount = ARRAYSIZE( pSoundsMetal ); |
|
|
|
@ -410,9 +426,11 @@ void CProp::Die( void )
@@ -410,9 +426,11 @@ void CProp::Die( void )
|
|
|
|
|
case matGlass: |
|
|
|
|
switch( RANDOM_LONG( 0, 1 ) ) |
|
|
|
|
{ |
|
|
|
|
case 0: EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustglass1.wav", fvol, ATTN_NORM, 0, pitch); |
|
|
|
|
case 0: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "debris/bustglass1.wav", fvol, ATTN_NORM, 0, pitch ); |
|
|
|
|
break; |
|
|
|
|
case 1: EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustglass2.wav", fvol, ATTN_NORM, 0, pitch); |
|
|
|
|
case 1: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "debris/bustglass2.wav", fvol, ATTN_NORM, 0, pitch ); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
cFlag = BREAK_GLASS; |
|
|
|
@ -420,9 +438,11 @@ void CProp::Die( void )
@@ -420,9 +438,11 @@ void CProp::Die( void )
|
|
|
|
|
case matWood: |
|
|
|
|
switch( RANDOM_LONG( 0, 1 ) ) |
|
|
|
|
{ |
|
|
|
|
case 0: EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustcrate1.wav", fvol, ATTN_NORM, 0, pitch); |
|
|
|
|
case 0: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "debris/bustcrate1.wav", fvol, ATTN_NORM, 0, pitch ); |
|
|
|
|
break; |
|
|
|
|
case 1: EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustcrate2.wav", fvol, ATTN_NORM, 0, pitch); |
|
|
|
|
case 1: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "debris/bustcrate2.wav", fvol, ATTN_NORM, 0, pitch ); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
cFlag = BREAK_WOOD; |
|
|
|
@ -431,9 +451,11 @@ void CProp::Die( void )
@@ -431,9 +451,11 @@ void CProp::Die( void )
|
|
|
|
|
case matMetal: |
|
|
|
|
switch( RANDOM_LONG( 0, 1 ) ) |
|
|
|
|
{ |
|
|
|
|
case 0: EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustmetal1.wav", fvol, ATTN_NORM, 0, pitch); |
|
|
|
|
case 0: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "debris/bustmetal1.wav", fvol, ATTN_NORM, 0, pitch ); |
|
|
|
|
break; |
|
|
|
|
case 1: EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustmetal2.wav", fvol, ATTN_NORM, 0, pitch); |
|
|
|
|
case 1: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "debris/bustmetal2.wav", fvol, ATTN_NORM, 0, pitch ); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
cFlag = BREAK_METAL; |
|
|
|
@ -441,9 +463,11 @@ void CProp::Die( void )
@@ -441,9 +463,11 @@ void CProp::Die( void )
|
|
|
|
|
case matFlesh: |
|
|
|
|
switch( RANDOM_LONG( 0, 1 ) ) |
|
|
|
|
{ |
|
|
|
|
case 0: EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustflesh1.wav", fvol, ATTN_NORM, 0, pitch); |
|
|
|
|
case 0: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "debris/bustflesh1.wav", fvol, ATTN_NORM, 0, pitch ); |
|
|
|
|
break; |
|
|
|
|
case 1: EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustflesh2.wav", fvol, ATTN_NORM, 0, pitch); |
|
|
|
|
case 1: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "debris/bustflesh2.wav", fvol, ATTN_NORM, 0, pitch ); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
cFlag = BREAK_FLESH; |
|
|
|
@ -452,9 +476,11 @@ void CProp::Die( void )
@@ -452,9 +476,11 @@ void CProp::Die( void )
|
|
|
|
|
case matCinderBlock: |
|
|
|
|
switch( RANDOM_LONG( 0, 1 ) ) |
|
|
|
|
{ |
|
|
|
|
case 0: EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustconcrete1.wav", fvol, ATTN_NORM, 0, pitch); |
|
|
|
|
case 0: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "debris/bustconcrete1.wav", fvol, ATTN_NORM, 0, pitch ); |
|
|
|
|
break; |
|
|
|
|
case 1: EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "debris/bustconcrete2.wav", fvol, ATTN_NORM, 0, pitch); |
|
|
|
|
case 1: |
|
|
|
|
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "debris/bustconcrete2.wav", fvol, ATTN_NORM, 0, pitch ); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
cFlag = BREAK_CONCRETE; |
|
|
|
@ -667,15 +693,13 @@ void CProp::CheckRotate()
@@ -667,15 +693,13 @@ void CProp::CheckRotate()
|
|
|
|
|
UTIL_SetSize(pev, minsH, maxsH); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if( (fabs(UTIL_AngleDiff(pev->angles.z, 90)) < 20) || |
|
|
|
|
(fabs(sin(pev->angles.x / 180 * M_PI)) > 0.3) ) |
|
|
|
|
if( ( fabs( UTIL_AngleDiff( pev->angles.z, 90 ) ) < 20 ) || ( fabs( sin( pev->angles.x / 180 * M_PI ) ) > 0.3 ) ) |
|
|
|
|
m_shape = SHAPE_CYL_H; |
|
|
|
|
else |
|
|
|
|
m_shape = SHAPE_CYL_V; |
|
|
|
|
|
|
|
|
|
if( m_oldshape != m_shape ) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
if( m_shape == SHAPE_CYL_H ) |
|
|
|
|
{ |
|
|
|
|
pev->angles.y += 90; |
|
|
|
@ -848,9 +872,15 @@ void CProp::BounceSound(void)
@@ -848,9 +872,15 @@ void CProp::BounceSound(void)
|
|
|
|
|
{ |
|
|
|
|
switch( RANDOM_LONG( 0, 2 ) ) |
|
|
|
|
{ |
|
|
|
|
case 0: EMIT_SOUND(ENT(pev), CHAN_VOICE, "weapons/grenade_hit1.wav", 0.25, ATTN_NORM); break; |
|
|
|
|
case 1: EMIT_SOUND(ENT(pev), CHAN_VOICE, "weapons/grenade_hit2.wav", 0.25, ATTN_NORM); break; |
|
|
|
|
case 2: EMIT_SOUND(ENT(pev), CHAN_VOICE, "weapons/grenade_hit3.wav", 0.25, ATTN_NORM); break; |
|
|
|
|
case 0: |
|
|
|
|
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/grenade_hit1.wav", 0.25, ATTN_NORM ); |
|
|
|
|
break; |
|
|
|
|
case 1: |
|
|
|
|
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/grenade_hit2.wav", 0.25, ATTN_NORM ); |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/grenade_hit3.wav", 0.25, ATTN_NORM ); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1027,8 +1057,7 @@ void CProp::DieThink()
@@ -1027,8 +1057,7 @@ void CProp::DieThink()
|
|
|
|
|
int CProp::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) |
|
|
|
|
{ |
|
|
|
|
Vector r = ( pevInflictor->origin - pev->origin ); |
|
|
|
|
if ( (!m_attacker |
|
|
|
|
|| (pev->velocity.Length() < 700)) |
|
|
|
|
if( ( !m_attacker || ( pev->velocity.Length() < 700 ) ) |
|
|
|
|
&& ( (CBaseEntity*)GET_PRIVATE( ENT( pevAttacker ) ) )->IsPlayer() ) |
|
|
|
|
m_attacker = ENT( pevAttacker ); |
|
|
|
|
DeployThink(); |
|
|
|
|