]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Fix intermission music being played each frame. Also fix another issue
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 27 Sep 2010 14:01:07 +0000 (17:01 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 27 Sep 2010 14:01:07 +0000 (17:01 +0300)
data/qcsrc/client/View.qc

index a0e9db92bc153ceea52169bd9e3325b42ed832ec..ff0d8b68be1af8714856ddbaa748a389ce9ec4eb 100644 (file)
@@ -253,6 +253,7 @@ float camera_mode;
 float chase_active_old;\r
 float artwork_fade;\r
 string artwork_image;\r
+string intermission_song;\r
 string NextFrameCommand;\r
 void CSQC_UpdateView(float w, float h)\r
 {\r
@@ -491,8 +492,7 @@ void CSQC_UpdateView(float w, float h)
                teamradar_view();\r
 \r
        // Draw artwork and play intermission music\r
-       if(intermission && !isdemo()) // the match has ended\r
-       if(!spectatee_status && gametype != GAME_RPG) // no one wins or loses in RPG\r
+       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\r
        {\r
                if(cvar("cl_artwork"))\r
                {\r
@@ -501,14 +501,19 @@ void CSQC_UpdateView(float w, float h)
                                if(getstati(STAT_WINNING)) // we are the winner\r
                                {\r
                                        if(cvar("cl_artwork_win"))\r
+                                       {\r
                                                artwork_image = strcat("gfx/artwork_won_", ftos(floor(1 + (random() * cvar("cl_artwork_win")))));\r
+                                               artwork_image = strzone(artwork_image);\r
+                                       }\r
                                }\r
                                else // we have lost\r
                                {\r
                                        if(cvar("cl_artwork_lose"))\r
+                                       {\r
                                                artwork_image = strcat("gfx/artwork_lost_", ftos(floor(1 + (random() * cvar("cl_artwork_lose")))));\r
+                                               artwork_image = strzone(artwork_image);\r
+                                       }\r
                                }\r
-                               artwork_image = strzone(artwork_image);\r
                        }\r
 \r
                        if(cvar("cl_artwork_stretch"))\r
@@ -534,25 +539,33 @@ void CSQC_UpdateView(float w, float h)
                        if(artwork_image != "")\r
                                drawpic(artwork_pos, artwork_image, artwork_size, '1 1 1', artwork_fade, DRAWFLAG_NORMAL);\r
                }\r
-               else\r
+\r
+               if(cvar("cl_intermission") && intermission_song == "") // don't start the song each frame\r
                {\r
-                       if(artwork_image != "")\r
+                       if(getstati(STAT_WINNING))\r
+                               intermission_song = cvar_string("cl_intermission_cdtrack_win");\r
+                       else\r
+                               intermission_song = cvar_string("cl_intermission_cdtrack_lose");\r
+                       if(intermission_song != "")\r
                        {\r
-                               strunzone(artwork_image);\r
-                               artwork_image = "";\r
+                               localcmd(strcat("\ncd play ", intermission_song, "\n"));\r
+                               intermission_song = strzone(intermission_song);\r
                        }\r
-                       artwork_fade = 0;\r
+               }\r
+       }\r
+       else\r
+       {\r
+               artwork_fade = 0;\r
+               if(artwork_image != "")\r
+               {\r
+                       strunzone(artwork_image);\r
+                       artwork_image = "";\r
                }\r
 \r
-               if(cvar("cl_intermission"))\r
+               if(intermission_song != "")\r
                {\r
-                       string s;\r
-                       if(getstati(STAT_WINNING))\r
-                               s = cvar_string("cl_intermission_cdtrack_win");\r
-                       else\r
-                               s = cvar_string("cl_intermission_cdtrack_lose");\r
-                       if(s != "")\r
-                               localcmd(strcat("\ncd play ", s, "\n"));\r
+                       strunzone(intermission_song);\r
+                       intermission_song = "";\r
                }\r
        }\r
 \r