summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2020-03-29 19:59:19 +0200
committerPaweł Redman <pawel.redman@gmail.com>2020-03-29 20:09:17 +0200
commitd9e9bb2d95483cbf2ca5d6cf5ac7b9f490d40204 (patch)
treec71483e197da36ebf8b11fec3e05df5608c7dc78 /src/cgame
parent36ebcd1cc0933ee0bfe9f6ac15879286d3199046 (diff)
Implement coronavirus
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_event.c8
-rw-r--r--src/cgame/cg_local.h3
-rw-r--r--src/cgame/cg_main.c3
3 files changed, 14 insertions, 0 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 07bcea9..c06a05c 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -132,6 +132,9 @@ static void CG_Obituary( entityState_t *ent )
case MOD_SWARM:
message = "was hunted down by the swarm";
break;
+ case MOD_CORONAVIRUS:
+ message = "died of viral lung infection";
+ break;
default:
message = NULL;
break;
@@ -658,6 +661,11 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
trap_S_StartSound( NULL, es->number, CHAN_AUTO, CG_CustomSound( es->number, "*gasp.wav" ) );
break;
+ case EV_COUGH:
+ DEBUGNAME( "EV_COUGH" );
+ trap_S_StartSound( NULL, es->number, CHAN_VOICE, cgs.media.coughingSounds[ rand ( ) % NUM_COUGHING_SOUNDS ] );
+ break;
+
//
// weapon events
//
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 83c3162..f35c438 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1142,6 +1142,7 @@ typedef struct
int ping;
} cg_t;
+#define NUM_COUGHING_SOUNDS 5
// all of the model, shader, and sound references that are
// loaded at gamestate time are stored in cgMedia_t
@@ -1273,6 +1274,8 @@ typedef struct
qhandle_t buildWeaponTimerPie[ 8 ];
qhandle_t upgradeClassIconShader;
+
+ sfxHandle_t coughingSounds[ NUM_COUGHING_SOUNDS ];
} cgMedia_t;
typedef struct
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index c2e55b8..45e2506 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -953,6 +953,9 @@ static void CG_RegisterSounds( void )
cgs.media.buildableRepairedSound = trap_S_RegisterSound( "sound/buildables/human/repaired.wav", qfalse );
cgs.media.lCannonWarningSound = trap_S_RegisterSound( "models/weapons/lcannon/warning.wav", qfalse );
+
+ for( i = 0; i < NUM_COUGHING_SOUNDS; i++ )
+ cgs.media.coughingSounds[ i ] = trap_S_RegisterSound( va( "sound/player/cough%d.wav", i ), qfalse );
}