converted CDPlaySection to PlaySection enum

This commit is contained in:
nehalmistry 2003-02-15 00:43:47 +00:00
parent 0512cb6a95
commit fbaacaf971
5 changed files with 17 additions and 11 deletions

View file

@ -434,7 +434,7 @@ global void ShowIntro(const Intro *intro)
CallbackMusicOff();
StopMusic();
CDPlaySection = "briefing";
PlaySection = PlaySectionBriefing;
CDRomCheck(NULL);
if( intro->VoiceFile[0] ) {
PlayFile(intro->VoiceFile[0]);

View file

@ -237,7 +237,12 @@ extern unsigned CompressedSoundMemory;
/// cd play mode, ":off" ":random" ":all" or ":defined"
extern char *CDMode;
/// FIXME: docu
extern char *CDPlaySection;
enum _play_section_ {
PlaySectionMainMenu,
PlaySectionGame,
PlaySectionStats,
PlaySectionBriefing,
} PlaySection;
#if defined(USE_SDLCD) || defined(USE_LIBCDA) || defined(USE_CDDA)
/// FIXME: docu
extern int CDTrack;

View file

@ -67,7 +67,7 @@ global Sample* MusicSample; /// Music samples
#endif
global char *CDMode = ":off"; /// cd play mode, ":off" ":random" ":all" or ":defined"
global char *CDPlaySection = "menu";
//global char *CDPlaySection = "menu";
#if defined(USE_SDLCD) || defined(USE_LIBCDA) || defined(USE_CDDA)
global int CDTrack = 0; /// Current cd track
#endif
@ -361,7 +361,7 @@ global int PlayCDRom(const char* name)
if (!strcmp(name, ":defined")) {
CDMode = ":defined";
track = cd_current_track();
if (!strcmp(CDPlaySection, "showstats")) {
if (PlaySection == PlaySectionStats) {
if (GameResult == GameVictory) {
if (!ThisPlayer->Race && track != 8) {
cd_play(8);
@ -375,20 +375,20 @@ global int PlayCDRom(const char* name)
cd_play(17);
}
}
} else if (!strcmp(CDPlaySection, "briefing")) {
} else if (PlaySection == PlaySectionBriefing) {
if (!ThisPlayer->Race && track != 7) {
cd_play(7);
} else if (ThisPlayer->Race && track != 15) {
cd_play(15);
}
} else if (!strcmp(CDPlaySection, "menu") && track != 15) {
} else if ((PlaySection == PlaySectionMainMenu) && track != 15) {
cd_play(15);
} else if (!strcmp(CDPlaySection, "game") &&
} else if ((PlaySection == PlaySectionGame) &&
!ThisPlayer->Race && (track < 3 || track > 6)) {
do CDTrack = (MyRand() % NumCDTracks) + 3;
while (CDTrack < 3 || CDTrack > 7);
cd_play(CDTrack);
} else if (!strcmp(CDPlaySection, "game") &&
} else if ((PlaySection == PlaySectionGame) &&
ThisPlayer->Race && (track < 10 || track > 14)) {
do CDTrack = (MyRand() % NumCDTracks) + 9;
while (CDTrack < 11 || CDTrack > 14);

View file

@ -639,7 +639,7 @@ global void GameMainLoop(void)
MultiPlayerReplayEachCycle();
CDPlaySection = "game";
PlaySection = PlaySectionGame;
CDRomCheck(NULL);
while( GameRunning ) {
@ -813,7 +813,7 @@ global void GameMainLoop(void)
}
if( GameResult==GameVictory || GameResult==GameDefeat ) {
CDPlaySection = "showstats";
PlaySection = PlaySectionStats;
CDRomCheck(NULL);
ShowStats();
}
@ -822,7 +822,6 @@ global void GameMainLoop(void)
ReplayRevealMap=0;
GamePaused=0;
GodMode=0;
CDPlaySection = "menu";
}
//@}

View file

@ -1122,6 +1122,8 @@ global void MenuLoop(char* filename, WorldMap* map)
CleanModules();
CleanFonts();
PlaySection = PlaySectionMainMenu;
LoadCcl(); // Reload the main config file
PreMenuSetup();