From fecba2b6220cb020feca518069b3691c1817accf Mon Sep 17 00:00:00 2001
From: nehalmistry <>
Date: Fri, 14 Feb 2003 07:01:04 +0000
Subject: [PATCH] wc2 tracks for level briefing works

---
 src/game/intro.cpp         |  2 ++
 src/sound/music.cpp        | 14 +++++++++++---
 src/stratagus/mainloop.cpp |  1 +
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/game/intro.cpp b/src/game/intro.cpp
index 684c3220f..e6451b41d 100644
--- a/src/game/intro.cpp
+++ b/src/game/intro.cpp
@@ -434,6 +434,8 @@ global void ShowIntro(const Intro *intro)
 
     CallbackMusicOff();
     StopMusic();
+    CDPlaySection = "briefing";
+    CDRomCheck(NULL);
     if( intro->VoiceFile[0] ) {
 	PlayFile(intro->VoiceFile[0]);
     }
diff --git a/src/sound/music.cpp b/src/sound/music.cpp
index 63442b2b9..5ff034b65 100644
--- a/src/sound/music.cpp
+++ b/src/sound/music.cpp
@@ -376,13 +376,21 @@ global int PlayCDRom(const char* name)
 			cd_play(17);
 		    }
 		}
-	    } else if (!GameRunning && track != 15) {
+	    } else if (!strcmp(CDPlaySection, "briefing")) {
+		if (!ThisPlayer->Race && track != 7) {
+		    cd_play(7);
+		} else if (ThisPlayer->Race && track != 15) {
+		    cd_play(15);
+		}
+	    } else if (!strcmp(CDPlaySection, "menu") && track != 15) {
 		cd_play(15);
-	    } else if (GameRunning && !ThisPlayer->Race && (track < 3 || track > 7)) {
+	    } else if (!strcmp(CDPlaySection, "game") && 
+		       !ThisPlayer->Race && (track < 3 || track > 6)) {
 		do CDTrack = (MyRand() % NumCDTracks) + 3;
 		while (CDTrack < 3 || CDTrack > 7); 
 		cd_play(CDTrack);
-	    } else if (GameRunning && ThisPlayer->Race && (track < 11 || track > 14)) {
+	    } else if (!strcmp(CDPlaySection, "game") && 
+		       ThisPlayer->Race && (track < 10 || track > 14)) {
 		do CDTrack = (MyRand() % NumCDTracks) + 9;
 		while (CDTrack < 11 || CDTrack > 14); 
 		cd_play(CDTrack);
diff --git a/src/stratagus/mainloop.cpp b/src/stratagus/mainloop.cpp
index 89d3ddcef..2c1417fba 100644
--- a/src/stratagus/mainloop.cpp
+++ b/src/stratagus/mainloop.cpp
@@ -639,6 +639,7 @@ global void GameMainLoop(void)
 
     MultiPlayerReplayEachCycle();
 
+    CDPlaySection = "game";
     CDRomCheck(NULL);
 
     while( GameRunning ) {