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:07:29 +0200
commitcad9e7c0e6bb22a945273ab6a39601db86d7db20 (patch)
tree947c5dc828da424df1de90a71ae845599f7de92b /src/cgame
parent0e6b1bc4a15f598d5eab507cbbe0f11410d5df1f (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 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 );
}