diff options
author | Petr Pudlak <petr.mvd@gmail.com> | 2014-08-19 22:24:50 +0200 |
---|---|---|
committer | Petr Pudlak <petr.mvd@gmail.com> | 2014-08-19 22:24:50 +0200 |
commit | 943539a1a7741d395667f2830b31cfdfea5e0816 (patch) | |
tree | e76f922ef468a6230cb97e26f5a72d135eca0e67 /src/cgame/cg_event.c | |
parent | a7ca0aa8c8a66adce30b8ac21d4849b91e4fc75b (diff) |
The head-shot mod: headshots on humans splash blood around
.. using the particle system. Blood drops splat on impact.
Diffstat (limited to 'src/cgame/cg_event.c')
-rw-r--r-- | src/cgame/cg_event.c | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index aa84609..49dec3f 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -532,6 +532,30 @@ void CG_PainEvent( centity_t *cent, int health ) } /* +================ +CG_HeadShotEvent + +Also called by playerstate transition +================ +*/ +void CG_HeadShotEvent( centity_t *cent, int health ) +{ + particleSystem_t *ps; + + if( !cg_bleedSelfHeadShots.integer && + cent->currentState.number == cg.snap->ps.clientNum ) + return; + + ps = CG_SpawnNewParticleSystem( cgs.media.headShotPS ); + if( CG_IsParticleSystemValid( &ps ) ) + { + CG_SetAttachmentCent( &ps->attachment, cent ); + CG_AttachToCent( &ps->attachment ); + } + //trap_S_StartSound( NULL, es->number, CHAN_VOICE, cgs.media.humanGibSound ); +} + +/* ========================= CG_Level2Zap ========================= @@ -1074,10 +1098,15 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) break; case EV_PAIN: - // local player sounds are triggered in CG_CheckLocalSounds, - // so ignore events on the player - if( cent->currentState.number != cg.snap->ps.clientNum ) - CG_PainEvent( cent, es->eventParm ); + { + const int health = es->eventParm & ~EVENT_HEADSHOT_BIT; + // local player sounds are triggered in CG_CheckLocalSounds, + // so ignore events on the player + if( cent->currentState.number != cg.snap->ps.clientNum ) + CG_PainEvent( cent, health ); + if( es->eventParm & EVENT_HEADSHOT_BIT ) + CG_HeadShotEvent( cent, health ); + } break; case EV_DEATH1: @@ -1085,6 +1114,8 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) case EV_DEATH3: trap_S_StartSound( NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, va( "*death%i.wav", event - EV_DEATH1 + 1 ) ) ); + if( es->eventParm & EVENT_HEADSHOT_BIT ) + CG_HeadShotEvent( cent, 0 ); break; case EV_OBITUARY: @@ -1095,6 +1126,24 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) // no gibbing break; + case EV_BLEED: + if( cg_bleedSelfWounds.integer || + cent->currentState.number != cg.snap->ps.clientNum ) + { + particleSystem_t *ps = NULL; + if( ci->team == TEAM_ALIENS ) + ps = CG_SpawnNewParticleSystem( cgs.media.alienWoundsBleedPS ); + else if( ci->team == TEAM_HUMANS ) + ps = CG_SpawnNewParticleSystem( cgs.media.humanWoundsBleedPS ); + + if( ( ps != NULL ) && CG_IsParticleSystemValid( &ps ) ) + { + CG_SetAttachmentCent( &ps->attachment, cent ); + CG_AttachToCent( &ps->attachment ); + } + } + break; + case EV_STOPLOOPINGSOUND: trap_S_StopLoopingSound( es->number ); es->loopSound = 0; |