From ffde756ebba896f9991650c0865c46bdbda03240 Mon Sep 17 00:00:00 2001 From: nehalmistry <> Date: Fri, 14 Feb 2003 06:42:56 +0000 Subject: [PATCH] can play correct wc2 tracks for ShowStats() --- src/include/sound_server.h | 2 ++ src/sound/music.cpp | 18 +++++++++++++++++- src/stratagus/mainloop.cpp | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/include/sound_server.h b/src/include/sound_server.h index 4888b9a74..05b98ecc6 100644 --- a/src/include/sound_server.h +++ b/src/include/sound_server.h @@ -240,6 +240,8 @@ extern char *CDMode; #if defined(USE_SDLCD) || defined(USE_LIBCDA) || defined(USE_CDDA) /// FIXME: docu extern int CDTrack; + /// FIXME: docu +extern char *CDPlaySection; #endif #if defined(USE_SDLCD) diff --git a/src/sound/music.cpp b/src/sound/music.cpp index bce249d18..63442b2b9 100644 --- a/src/sound/music.cpp +++ b/src/sound/music.cpp @@ -50,6 +50,7 @@ #include "sound.h" #include "sound_server.h" #include "interface.h" +#include "campaign.h" /*---------------------------------------------------------------------------- -- Declaration @@ -69,6 +70,7 @@ global Sample* MusicSample; /// Music samples global char *CDMode = ":off"; /// cd play mode, ":off" ":random" ":all" or ":wc2" #if defined(USE_SDLCD) || defined(USE_LIBCDA) || defined(USE_CDDA) global int CDTrack = 0; /// Current cd track +global char *CDPlaySection = "menu"; #endif #if defined(USE_SDLCD) @@ -360,7 +362,21 @@ global int PlayCDRom(const char* name) if (!strcmp(name, ":wc2")) { CDMode = ":wc2"; track = cd_current_track(); - if (!GameRunning && track != 15) { + if (!strcmp(CDPlaySection, "showstats")) { + if (GameResult == GameVictory) { + if (!ThisPlayer->Race && track != 8) { + cd_play(8); + } else if (ThisPlayer->Race && track != 16) { + cd_play(16); + } + } else { + if (!ThisPlayer->Race && track != 9) { + cd_play(9); + } else if (ThisPlayer->Race && track != 17) { + cd_play(17); + } + } + } else if (!GameRunning && track != 15) { cd_play(15); } else if (GameRunning && !ThisPlayer->Race && (track < 3 || track > 7)) { do CDTrack = (MyRand() % NumCDTracks) + 3; diff --git a/src/stratagus/mainloop.cpp b/src/stratagus/mainloop.cpp index f0654926b..89d3ddcef 100644 --- a/src/stratagus/mainloop.cpp +++ b/src/stratagus/mainloop.cpp @@ -812,6 +812,8 @@ global void GameMainLoop(void) } if( GameResult==GameVictory || GameResult==GameDefeat ) { + CDPlaySection = "showstats"; + CDRomCheck(NULL); ShowStats(); } @@ -819,6 +821,7 @@ global void GameMainLoop(void) ReplayRevealMap=0; GamePaused=0; GodMode=0; + CDPlaySection = "menu"; } //@}