Skip to content

Commit 8ddc213

Browse files
committed
CGAME: Vote announcer sound feedback
1 parent 9096dde commit 8ddc213

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

code/cgame/cg_main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,10 @@ static void CG_RegisterSounds(void) {
763763
cgs.media.watchpadSound = trap_S_RegisterSound("sound/feedback/awards/watchpad", qtrue);
764764
cgs.media.padstarSound = trap_S_RegisterSound("sound/feedback/awards/padstar", qtrue);
765765

766+
cgs.media.voteNow = trap_S_RegisterSound("sound/feedback/vote_now", qtrue);
767+
cgs.media.votePassed = trap_S_RegisterSound("sound/feedback/vote_passed", qtrue);
768+
cgs.media.voteFailed = trap_S_RegisterSound("sound/feedback/vote_failed", qtrue);
769+
766770
cgs.media.watrInSound = trap_S_RegisterSound("sound/padplayer/water_in", qfalse);
767771
cgs.media.watrOutSound = trap_S_RegisterSound("sound/padplayer/water_out", qfalse);
768772
cgs.media.watrUnSound = trap_S_RegisterSound("sound/padplayer/water_under", qfalse);

code/cgame/cg_servercmds.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ static void CG_ConfigStringModified(void) {
349349
cgs.voteModified = qtrue;
350350
} else if (num == CS_VOTE_STRING) {
351351
Q_strncpyz(cgs.voteString, str, sizeof(cgs.voteString));
352+
trap_S_StartLocalSound(cgs.media.voteNow, CHAN_ANNOUNCER);
352353
} else if (num >= CS_TEAMVOTE_TIME && num <= CS_TEAMVOTE_TIME + 1) {
353354
cgs.teamVoteTime[num - CS_TEAMVOTE_TIME] = atoi(str);
354355
cgs.teamVoteModified[num - CS_TEAMVOTE_TIME] = qtrue;
@@ -360,6 +361,7 @@ static void CG_ConfigStringModified(void) {
360361
cgs.teamVoteModified[num - CS_TEAMVOTE_NO] = qtrue;
361362
} else if (num >= CS_TEAMVOTE_STRING && num <= CS_TEAMVOTE_STRING + 1) {
362363
Q_strncpyz(cgs.teamVoteString[num - CS_TEAMVOTE_STRING], str, sizeof(cgs.teamVoteString));
364+
trap_S_StartLocalSound(cgs.media.voteNow, CHAN_ANNOUNCER);
363365
} else if (num == CS_INTERMISSION) {
364366
cg.intermissionStarted = atoi(str);
365367
} else if (num >= CS_MODELS && num < CS_MODELS + MAX_MODELS) {
@@ -570,6 +572,13 @@ static void CG_ServerCommand(void) {
570572

571573
if (!strcmp(cmd, "print")) {
572574
CG_Printf("%s", CG_Argv(1));
575+
cmd = CG_Argv(1); // yes, this is obviously a hack, but so is the way we hear about
576+
// votes passing or failing
577+
if (!Q_stricmpn(cmd, "vote failed", 11) || !Q_stricmpn(cmd, "team vote failed", 16)) {
578+
trap_S_StartLocalSound(cgs.media.voteFailed, CHAN_ANNOUNCER);
579+
} else if (!Q_stricmpn(cmd, "vote passed", 11) || !Q_stricmpn(cmd, "team vote passed", 16)) {
580+
trap_S_StartLocalSound(cgs.media.votePassed, CHAN_ANNOUNCER);
581+
}
573582
return;
574583
}
575584

0 commit comments

Comments
 (0)