summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
authorMikko Tiusanen <ams@daug.net>2014-08-20 20:32:12 +0300
committerMikko Tiusanen <ams@daug.net>2014-08-20 20:32:12 +0300
commit613030b05c409cef42b0e98d5180a41f8f67c661 (patch)
tree480cdbf625d7dcce1bb5477ab1dca6c9d8102106 /src/cgame
parent7ad16ee1fea76bab54d97a78c1063b7c2c2adef6 (diff)
parent0a382e146ac52e111c90ad1e093ade77b710d993 (diff)
Merge branch 'master' of https://github.com/mtiusane/new-edge
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_event.c57
-rw-r--r--src/cgame/cg_local.h7
-rw-r--r--src/cgame/cg_main.c8
-rw-r--r--src/cgame/cg_particles.c13
4 files changed, 81 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;
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 1498af9..a477336 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1331,6 +1331,11 @@ typedef struct
qhandle_t healthCross3X;
qhandle_t healthCrossMedkit;
qhandle_t healthCrossPoisoned;
+
+ sfxHandle_t humanGibSound;
+ qhandle_t headShotPS;
+ qhandle_t humanWoundsBleedPS;
+ qhandle_t alienWoundsBleedPS;
} cgMedia_t;
typedef struct
@@ -1540,6 +1545,8 @@ extern vmCvar_t cg_disableBuildDialogs;
extern vmCvar_t cg_disableCommandDialogs;
extern vmCvar_t cg_disableScannerPlane;
extern vmCvar_t cg_tutorial;
+extern vmCvar_t cg_bleedSelfWounds;
+extern vmCvar_t cg_bleedSelfHeadShots;
extern vmCvar_t cg_painBlendUpRate;
extern vmCvar_t cg_painBlendDownRate;
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 1bd5c7f..c7b470c 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -190,6 +190,8 @@ vmCvar_t cg_disableBuildDialogs;
vmCvar_t cg_disableCommandDialogs;
vmCvar_t cg_disableScannerPlane;
vmCvar_t cg_tutorial;
+vmCvar_t cg_bleedSelfWounds;
+vmCvar_t cg_bleedSelfHeadShots;
vmCvar_t cg_painBlendUpRate;
vmCvar_t cg_painBlendDownRate;
@@ -317,6 +319,8 @@ static cvarTable_t cvarTable[ ] =
{ &cg_disableCommandDialogs, "cg_disableCommandDialogs", "0", CVAR_ARCHIVE },
{ &cg_disableScannerPlane, "cg_disableScannerPlane", "0", CVAR_ARCHIVE },
{ &cg_tutorial, "cg_tutorial", "1", CVAR_ARCHIVE },
+ { &cg_bleedSelfWounds, "cg_bleedSelfWounds", "1", CVAR_ARCHIVE },
+ { &cg_bleedSelfHeadShots, "cg_bleedSelfHeadShots", "1", CVAR_ARCHIVE },
{ &cg_hudFiles, "cg_hudFiles", "ui/hud.txt", CVAR_ARCHIVE},
{ &cg_hudFilesEnable, "cg_hudFilesEnable", "0", CVAR_ARCHIVE},
{ NULL, "cg_alienConfig", "", CVAR_ARCHIVE },
@@ -858,6 +862,10 @@ static void CG_RegisterGraphics( void )
cgs.media.alienSpiteful_AbcessDestroyedPS = CG_RegisterParticleSystem( "alienSpiteful_AbcessDestroyedPS" );
+ cgs.media.alienWoundsBleedPS = CG_RegisterParticleSystem( "alienWoundBleedPS" );
+ cgs.media.humanWoundsBleedPS = CG_RegisterParticleSystem( "humanWoundBleedPS" );
+ cgs.media.headShotPS = CG_RegisterParticleSystem( "headShotPS" );
+
CG_BuildableStatusParse( "ui/assets/human/buildstat.cfg", &cgs.humanBuildStat );
CG_BuildableStatusParse( "ui/assets/alien/buildstat.cfg", &cgs.alienBuildStat );
diff --git a/src/cgame/cg_particles.c b/src/cgame/cg_particles.c
index c2374c7..b718600 100644
--- a/src/cgame/cg_particles.c
+++ b/src/cgame/cg_particles.c
@@ -2156,6 +2156,19 @@ static void CG_EvaluateParticlePhysics( particle_t *p )
return;
}
+ if( bp->bounceMarkName[ 0 ] && p->bounceMarkCount > 0 )
+ {
+ CG_ImpactMark( bp->bounceMark, trace.endpos, trace.plane.normal,
+ random( ) * 360, 1, 1, 1, 1, qtrue, bp->bounceMarkRadius, qfalse );
+ p->bounceMarkCount--;
+ }
+
+ if( bp->bounceSoundName[ 0 ] && p->bounceSoundCount > 0 )
+ {
+ trap_S_StartSound( trace.endpos, ENTITYNUM_WORLD, CHAN_AUTO, bp->bounceSound );
+ p->bounceSoundCount--;
+ }
+
//remove particles that get into a CONTENTS_NODROP brush
if( ( trap_CM_PointContents( trace.endpos, 0 ) & CONTENTS_NODROP ) ||
( bp->cullOnStartSolid && trace.startsolid ) )