Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better vote feedback with announcer sounds #175

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions code/cgame/cg_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,10 @@ static void CG_RegisterSounds(void) {
cgs.media.watchpadSound = trap_S_RegisterSound("sound/feedback/awards/watchpad", qtrue);
cgs.media.padstarSound = trap_S_RegisterSound("sound/feedback/awards/padstar", qtrue);

cgs.media.voteNow = trap_S_RegisterSound("sound/feedback/vote_now", qtrue);
cgs.media.votePassed = trap_S_RegisterSound("sound/feedback/vote_passed", qtrue);
cgs.media.voteFailed = trap_S_RegisterSound("sound/feedback/vote_failed", qtrue);

cgs.media.watrInSound = trap_S_RegisterSound("sound/padplayer/water_in", qfalse);
cgs.media.watrOutSound = trap_S_RegisterSound("sound/padplayer/water_out", qfalse);
cgs.media.watrUnSound = trap_S_RegisterSound("sound/padplayer/water_under", qfalse);
Expand Down
9 changes: 9 additions & 0 deletions code/cgame/cg_servercmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ static void CG_ConfigStringModified(void) {
cgs.voteModified = qtrue;
} else if (num == CS_VOTE_STRING) {
Q_strncpyz(cgs.voteString, str, sizeof(cgs.voteString));
trap_S_StartLocalSound(cgs.media.voteNow, CHAN_ANNOUNCER);
} else if (num >= CS_TEAMVOTE_TIME && num <= CS_TEAMVOTE_TIME + 1) {
cgs.teamVoteTime[num - CS_TEAMVOTE_TIME] = atoi(str);
cgs.teamVoteModified[num - CS_TEAMVOTE_TIME] = qtrue;
Expand All @@ -360,6 +361,7 @@ static void CG_ConfigStringModified(void) {
cgs.teamVoteModified[num - CS_TEAMVOTE_NO] = qtrue;
} else if (num >= CS_TEAMVOTE_STRING && num <= CS_TEAMVOTE_STRING + 1) {
Q_strncpyz(cgs.teamVoteString[num - CS_TEAMVOTE_STRING], str, sizeof(cgs.teamVoteString));
trap_S_StartLocalSound(cgs.media.voteNow, CHAN_ANNOUNCER);
} else if (num == CS_INTERMISSION) {
cg.intermissionStarted = atoi(str);
} else if (num >= CS_MODELS && num < CS_MODELS + MAX_MODELS) {
Expand Down Expand Up @@ -570,6 +572,13 @@ static void CG_ServerCommand(void) {

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

Expand Down
Loading