From cad9e7c0e6bb22a945273ab6a39601db86d7db20 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sun, 29 Mar 2020 19:59:19 +0200 Subject: Implement coronavirus --- src/cgame/cg_event.c | 8 ++++++++ src/cgame/cg_local.h | 3 +++ src/cgame/cg_main.c | 3 +++ 3 files changed, 14 insertions(+) (limited to 'src/cgame') 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 e68e94b..7618118 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1146,6 +1146,7 @@ typedef struct int topSpeedTime; } 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 @@ -1277,6 +1278,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 89a4c5c..24a82c2 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -955,6 +955,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 ); } -- cgit