diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2015-04-04 11:44:44 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2015-04-04 11:44:44 +0200 |
commit | 72f038ae632b0f9af485129747f5fca45898b52e (patch) | |
tree | bd58e3af45d4b0e78e1b8fe689334e3e03175263 | |
parent | 0c1ea391f80ade922bbc0fc34e88d089e41ea353 (diff) |
Fix the vote start sound being played every frame for a second.
-rw-r--r-- | src/cgame/cg_draw.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index fafddb6..f57e44a 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -3610,17 +3610,17 @@ static void CG_DrawVote( team_t team ) int offset = 0; vec4_t white = { 1.0f, 1.0f, 1.0f, 1.0f }; char yeskey[ 32 ] = "", nokey[ 32 ] = ""; + static int lastVoteTime[ NUM_TEAMS ] = { 0 }; - if( !cgs.voteTime[ team ] ) return; - + sec = ( VOTE_TIME - ( cg.time - cgs.voteTime[ team ] ) ) / 1000; - //play dong sound - if(sec > 28 ) + if( cgs.voteTime[ team ] != lastVoteTime[ team ] ) { trap_S_StartLocalSound( cgs.media.iniVote, CHAN_LOCAL_SOUND ); + lastVoteTime[ team ] = cgs.voteTime[ team ]; } // if( cgs.voteModified[ team ] && (sec < 26 ) ) |