mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-19 07:31:03 +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)
|
auto completion = [](bool = false)
|
||||||
{
|
{
|
||||||
StartLevel(&gGameOptions);
|
StartLevel(&gGameOptions);
|
||||||
levelTryPlayMusicOrNothing(gGameOptions.nEpisode, gGameOptions.nLevel);
|
levelTryPlayMusic();
|
||||||
gNetFifoClock = gFrameClock = totalclock;
|
gNetFifoClock = gFrameClock = totalclock;
|
||||||
gamestate = GS_LEVEL;
|
gamestate = GS_LEVEL;
|
||||||
};
|
};
|
||||||
|
|
|
@ -286,27 +286,22 @@ void levelRestart(void)
|
||||||
gStartNewGame = true;
|
gStartNewGame = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool levelTryPlayMusic(int nEpisode, int nLevel, bool bSetLevelSong)
|
bool levelTryPlayMusic()
|
||||||
{
|
{
|
||||||
auto level = FindMapByLevelNum(levelnum(nEpisode, nLevel));
|
|
||||||
if (!level) return false;
|
|
||||||
FString buffer;
|
FString buffer;
|
||||||
if (mus_redbook && level->cdSongId > 0)
|
if (mus_redbook && currentLevel->cdSongId > 0)
|
||||||
buffer.Format("blood%02i.ogg", level->cdSongId);
|
buffer.Format("blood%02i.ogg", currentLevel->cdSongId);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer = level->music;
|
buffer = currentLevel->music;
|
||||||
if (Mus_Play(level->labelName, buffer, true)) return true;
|
if (Mus_Play(currentLevel->labelName, buffer, true)) return true;
|
||||||
DefaultExtension(buffer, ".mid");
|
DefaultExtension(buffer, ".mid");
|
||||||
}
|
}
|
||||||
return !!Mus_Play(level->labelName, buffer, true);
|
if (!Mus_Play(currentLevel->labelName, buffer, true))
|
||||||
}
|
|
||||||
|
|
||||||
void levelTryPlayMusicOrNothing(int nEpisode, int nLevel)
|
|
||||||
{
|
{
|
||||||
if (!levelTryPlayMusic(nEpisode, nLevel, true))
|
|
||||||
Mus_Play("", "", true);
|
Mus_Play("", "", true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class LevelsLoadSave : public LoadSave
|
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
|
// arg: 0 is normal exit, 1 is secret level
|
||||||
void levelEndLevel(int arg);
|
void levelEndLevel(int arg);
|
||||||
void levelRestart(void);
|
void levelRestart(void);
|
||||||
bool levelTryPlayMusic(int nEpisode, int nlevel, bool bSetLevelSong = false);
|
bool levelTryPlayMusic();
|
||||||
void levelTryPlayMusicOrNothing(int nEpisode, int nLevel);
|
|
||||||
|
|
||||||
END_BLD_NS
|
END_BLD_NS
|
||||||
|
|
|
@ -274,7 +274,7 @@ void LevelWarp(int nEpisode, int nLevel)
|
||||||
{
|
{
|
||||||
levelSetupOptions(nEpisode, nLevel);
|
levelSetupOptions(nEpisode, nLevel);
|
||||||
StartLevel(&gGameOptions);
|
StartLevel(&gGameOptions);
|
||||||
levelTryPlayMusicOrNothing(nEpisode, nLevel);
|
levelTryPlayMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bPlayerCheated = false;
|
bool bPlayerCheated = false;
|
||||||
|
|
Loading…
Reference in a new issue