mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- simplify the music starting code in Blood.
This commit is contained in:
parent
0ac8568be0
commit
598ea99441
4 changed files with 11 additions and 17 deletions
|
@ -893,7 +893,7 @@ static void commonTicker(bool &playvideo)
|
|||
auto completion = [](bool = false)
|
||||
{
|
||||
StartLevel(&gGameOptions);
|
||||
levelTryPlayMusicOrNothing(gGameOptions.nEpisode, gGameOptions.nLevel);
|
||||
levelTryPlayMusic();
|
||||
gNetFifoClock = gFrameClock = totalclock;
|
||||
gamestate = GS_LEVEL;
|
||||
};
|
||||
|
|
|
@ -286,26 +286,21 @@ void levelRestart(void)
|
|||
gStartNewGame = true;
|
||||
}
|
||||
|
||||
bool levelTryPlayMusic(int nEpisode, int nLevel, bool bSetLevelSong)
|
||||
bool levelTryPlayMusic()
|
||||
{
|
||||
auto level = FindMapByLevelNum(levelnum(nEpisode, nLevel));
|
||||
if (!level) return false;
|
||||
FString buffer;
|
||||
if (mus_redbook && level->cdSongId > 0)
|
||||
buffer.Format("blood%02i.ogg", level->cdSongId);
|
||||
if (mus_redbook && currentLevel->cdSongId > 0)
|
||||
buffer.Format("blood%02i.ogg", currentLevel->cdSongId);
|
||||
else
|
||||
{
|
||||
buffer = level->music;
|
||||
if (Mus_Play(level->labelName, buffer, true)) return true;
|
||||
buffer = currentLevel->music;
|
||||
if (Mus_Play(currentLevel->labelName, buffer, true)) return true;
|
||||
DefaultExtension(buffer, ".mid");
|
||||
}
|
||||
return !!Mus_Play(level->labelName, buffer, true);
|
||||
}
|
||||
|
||||
void levelTryPlayMusicOrNothing(int nEpisode, int nLevel)
|
||||
{
|
||||
if (!levelTryPlayMusic(nEpisode, nLevel, true))
|
||||
if (!Mus_Play(currentLevel->labelName, buffer, true))
|
||||
{
|
||||
Mus_Play("", "", true);
|
||||
}
|
||||
}
|
||||
|
||||
class LevelsLoadSave : public LoadSave
|
||||
|
|
|
@ -106,7 +106,6 @@ void levelGetNextLevels(int nEpisode, int nLevel, int *pnEndingA, int *pnEndingB
|
|||
// arg: 0 is normal exit, 1 is secret level
|
||||
void levelEndLevel(int arg);
|
||||
void levelRestart(void);
|
||||
bool levelTryPlayMusic(int nEpisode, int nlevel, bool bSetLevelSong = false);
|
||||
void levelTryPlayMusicOrNothing(int nEpisode, int nLevel);
|
||||
bool levelTryPlayMusic();
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -274,7 +274,7 @@ void LevelWarp(int nEpisode, int nLevel)
|
|||
{
|
||||
levelSetupOptions(nEpisode, nLevel);
|
||||
StartLevel(&gGameOptions);
|
||||
levelTryPlayMusicOrNothing(nEpisode, nLevel);
|
||||
levelTryPlayMusic();
|
||||
}
|
||||
|
||||
bool bPlayerCheated = false;
|
||||
|
|
Loading…
Reference in a new issue