Skip to content

Commit

Permalink
cgame: add cg_killbeep
Browse files Browse the repository at this point in the history
  • Loading branch information
yumirak committed Mar 4, 2024
1 parent b3f7455 commit 7eff10b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion code/cgame/cg_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ static void CG_Obituary( entityState_t *ent ) {
char attackerName[32];
gender_t gender;
clientInfo_t *ci;
clientInfo_t *us;

target = ent->otherEntityNum;
attacker = ent->otherEntityNum2;
Expand All @@ -92,6 +93,7 @@ static void CG_Obituary( entityState_t *ent ) {
CG_Error( "CG_Obituary: target out of range" );
}
ci = &cgs.clientinfo[target];
us = &cgs.clientinfo[cg.snap->ps.clientNum];

if ( attacker < 0 || attacker >= MAX_CLIENTS ) {
attacker = ENTITYNUM_WORLD;
Expand Down Expand Up @@ -221,7 +223,9 @@ static void CG_Obituary( entityState_t *ent ) {
#else
CG_CenterPrint( s, SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH );
#endif

if ( ( (cgs.gametype >= GT_TEAM && ci->team != us->team) || cgs.gametype < GT_TEAM ) && cg_killBeep.integer > 0 && cg_killBeep.integer <= 8) {
trap_S_StartLocalSound(cgs.media.killBeep[cg_killBeep.integer - 1], CHAN_LOCAL_SOUND);
}
// print the text message as well
}

Expand Down
1 change: 1 addition & 0 deletions code/cgame/cg_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,7 @@ extern vmCvar_t cg_hudTextScale;
extern vmCvar_t cg_announcer;
extern vmCvar_t cg_lightningStyle;
extern vmCvar_t cg_hitBeep;
extern vmCvar_t cg_killBeep;

//
extern vmCvar_t cg_kickScale;
Expand Down
10 changes: 10 additions & 0 deletions code/cgame/cg_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ vmCvar_t cg_hudTextScale;
vmCvar_t cg_announcer;
vmCvar_t cg_lightningStyle;
vmCvar_t cg_hitBeep;
vmCvar_t cg_killBeep;
//
vmCvar_t cg_kickScale;
vmCvar_t cg_screenDamageAlpha;
Expand Down Expand Up @@ -369,6 +370,7 @@ static cvarTable_t cvarTable[] = {
{ &cg_lightningStyle, "cg_lightningStyle", "0", CVAR_ARCHIVE},
{ &cg_announcer, "cg_announcer", "1", CVAR_ARCHIVE | CVAR_LATCH}, //FIXME: reload announcer without snd_restart ?
{ &cg_hitBeep, "cg_hitBeep", "1", CVAR_ARCHIVE},
{ &cg_killBeep, "cg_killBeep", "7", CVAR_ARCHIVE },
// ttf
{ &cg_forceBitmapFonts, "cg_forceBitmapFonts", "0", CVAR_ARCHIVE | CVAR_LATCH },
{ &cg_hudTextScale, "cg_hudTextScale", "1", CVAR_ARCHIVE },
Expand Down Expand Up @@ -832,6 +834,14 @@ static void CG_RegisterSounds( void ) {
for (i = 0; i < 4; i++) {
cgs.media.hitSound[i] = trap_S_RegisterSound(va( "sound/feedback/hit%d.ogg", i ), qfalse);
}
cgs.media.hitTeamSound = trap_S_RegisterSound("sound/feedback/hit_teammate.ogg", qfalse);

for (i = 0; i < 6; i++) {
cgs.media.killBeep[i] = trap_S_RegisterSound(va("sound/feedback/impact%i.ogg", i + 1), qfalse);
}
cgs.media.killBeep[6] = trap_S_RegisterSound("sound/world/bell_01.ogg", qfalse);
cgs.media.killBeep[7] = trap_S_RegisterSound("sound/misc/chaching.ogg", qfalse);

cgs.media.watrInSound = trap_S_RegisterSound( "sound/player/watr_in.wav", qfalse);
cgs.media.watrOutSound = trap_S_RegisterSound( "sound/player/watr_out.wav", qfalse);
cgs.media.watrUnSound = trap_S_RegisterSound( "sound/player/watr_un.wav", qfalse);
Expand Down

0 comments on commit 7eff10b

Please sign in to comment.