fix cd all mode for playlist

This commit is contained in:
nehalmistry 2003-03-27 04:18:54 +00:00
parent 5ca8f47a69
commit 4e0e434653
4 changed files with 24 additions and 20 deletions

View file

@ -68,6 +68,7 @@ typedef struct _game_sound_ {
} GameSound;
typedef enum _play_section_type_ {
PlaySectionUnknown = -1, /// Unknown
PlaySectionGame, /// Game
PlaySectionBriefing, /// Briefing
PlaySectionStats, /// Stats

View file

@ -84,6 +84,8 @@ global struct cdrom_tocentry CDtocentry[64];
global struct cdrom_read_audio CDdata;
#endif
global PlaySectionType CurrentPlaySection;
/*----------------------------------------------------------------------------
-- Functions
----------------------------------------------------------------------------*/
@ -447,10 +449,16 @@ global void PlaySectionMusic(PlaySectionType section)
int found;
int numfiles;
printf("in playsecmu\n");
if (NumPlaySections == 0) {
return;
}
if (section == PlaySectionUnknown) {
section = CurrentPlaySection;
}
if (section == PlaySectionStats) {
if (GameResult == GameVictory) {
section = PlaySectionStatsVictory;
@ -465,6 +473,7 @@ global void PlaySectionMusic(PlaySectionType section)
break;
}
}
CurrentPlaySection = PlaySections[i].Type;
#ifdef USE_LIBCDA
if (CDMode == CDModeDefined) {
@ -473,11 +482,16 @@ global void PlaySectionMusic(PlaySectionType section)
if ( (1 << track) & PlaySections[i].CDTracks ) {
newtrack = 0;
} else {
if ( !((1 << CDTrack) & PlaySections[i].CDTracks) ) {
CDTrack = 0;
}
if (PlaySections[i].CDOrder == PlaySectionOrderAll) {
for (j = 1; j < 32; ++j) {
for (j = CDTrack + 1; j != CDTrack; ++j) {
if ( (1 << j) & PlaySections[i].CDTracks ) {
newtrack = j;
break;
} else if (j == 31) {
j = 0;
}
}
} else if (PlaySections[i].CDOrder == PlaySectionOrderRandom) {
@ -489,6 +503,7 @@ global void PlaySectionMusic(PlaySectionType section)
}
if (newtrack) {
cd_play(newtrack);
CDTrack = newtrack;
}
} else if (PlaySections[i].Files && (CDMode == CDModeOff || CDMode == CDModeStopped)) {
#else

View file

@ -233,36 +233,19 @@ global int CDRomCheck(void *unused __attribute__ ((unused)))
if (CDMode != CDModeOff && CDMode != CDModeStopped
&& SDL_CDStatus(CDRom) == 1) {
DebugLevel0Fn("Playing new track\n");
if (CDMode == CDModeAll) {
PlayCDRom(CDModeAll);
} else if (CDMode == CDModeRandom) {
PlayCDRom(CDModeRandom);
}
PlayCDRom(CDMode);
}
#elif defined(USE_LIBCDA)
if (CDMode != CDModeOff && CDMode != CDModeStopped
&& !cd_current_track() && CDMode != CDModeDefined) {
DebugLevel0Fn("Playing new track\n");
PlayCDRom(CDMode);
} else if (CDMode != CDModeOff && CDMode != CDModeStopped) {
if (CDMode == CDModeDefined) {
PlayCDRom(CDMode);
}
DebugLevel0Fn("get track\n");
CDTrack = cd_current_track() + 1;
if (CDTrack > NumCDTracks) {
CDTrack = 1;
}
}
#elif defined(USE_CDDA)
if (CDMode != CDModeOff && CDMode != CDModeStopped
&& !PlayingMusic) {
DebugLevel0Fn("Playing new track\n");
if (CDMode == CDModeAll) {
PlayCDRom(CDModeAll);
} else if (CDMode == CDModeRandom) {
PlayCDRom(CDModeRandom);
}
PlayCDRom(CDMode);
}
#endif
return 0;

View file

@ -729,6 +729,11 @@ global void GameMainLoop(void)
CDRomCheck(NULL);
#endif
break;
case 10:
if ( !(GameCycle%2) ) {
PlaySectionMusic(PlaySectionUnknown);
}
break;
}
#endif
}