From: MirceaKitsune Date: Mon, 27 Sep 2010 14:01:07 +0000 (+0300) Subject: Fix intermission music being played each frame. Also fix another issue X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3abdde7ccd381907cfacdc9ae8589a70a75147ea;p=voretournament%2Fvoretournament.git Fix intermission music being played each frame. Also fix another issue --- diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc index a0e9db92..ff0d8b68 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -253,6 +253,7 @@ float camera_mode; float chase_active_old; float artwork_fade; string artwork_image; +string intermission_song; string NextFrameCommand; void CSQC_UpdateView(float w, float h) { @@ -491,8 +492,7 @@ void CSQC_UpdateView(float w, float h) teamradar_view(); // Draw artwork and play intermission music - if(intermission && !isdemo()) // the match has ended - if(!spectatee_status && gametype != GAME_RPG) // no one wins or loses in RPG + if(intermission && !isdemo() && gametype != GAME_RPG && !spectatee_status) // the match has ended. Don't do this for RPG because no one wins or loses there { if(cvar("cl_artwork")) { @@ -501,14 +501,19 @@ void CSQC_UpdateView(float w, float h) if(getstati(STAT_WINNING)) // we are the winner { if(cvar("cl_artwork_win")) + { artwork_image = strcat("gfx/artwork_won_", ftos(floor(1 + (random() * cvar("cl_artwork_win"))))); + artwork_image = strzone(artwork_image); + } } else // we have lost { if(cvar("cl_artwork_lose")) + { artwork_image = strcat("gfx/artwork_lost_", ftos(floor(1 + (random() * cvar("cl_artwork_lose"))))); + artwork_image = strzone(artwork_image); + } } - artwork_image = strzone(artwork_image); } if(cvar("cl_artwork_stretch")) @@ -534,25 +539,33 @@ void CSQC_UpdateView(float w, float h) if(artwork_image != "") drawpic(artwork_pos, artwork_image, artwork_size, '1 1 1', artwork_fade, DRAWFLAG_NORMAL); } - else + + if(cvar("cl_intermission") && intermission_song == "") // don't start the song each frame { - if(artwork_image != "") + if(getstati(STAT_WINNING)) + intermission_song = cvar_string("cl_intermission_cdtrack_win"); + else + intermission_song = cvar_string("cl_intermission_cdtrack_lose"); + if(intermission_song != "") { - strunzone(artwork_image); - artwork_image = ""; + localcmd(strcat("\ncd play ", intermission_song, "\n")); + intermission_song = strzone(intermission_song); } - artwork_fade = 0; + } + } + else + { + artwork_fade = 0; + if(artwork_image != "") + { + strunzone(artwork_image); + artwork_image = ""; } - if(cvar("cl_intermission")) + if(intermission_song != "") { - string s; - if(getstati(STAT_WINNING)) - s = cvar_string("cl_intermission_cdtrack_win"); - else - s = cvar_string("cl_intermission_cdtrack_lose"); - if(s != "") - localcmd(strcat("\ncd play ", s, "\n")); + strunzone(intermission_song); + intermission_song = ""; } }