- allow specification of intermission music based on the destination map.

This commit is contained in:
Christoph Oelckers 2017-02-26 14:50:02 +01:00
parent 03ac816e83
commit bb7e191208
3 changed files with 17 additions and 1 deletions

View file

@ -324,6 +324,7 @@ struct level_info_t
FString ExitPic; FString ExitPic;
FString InterMusic; FString InterMusic;
int intermusicorder; int intermusicorder;
TMap <FName, std::pair<FString, int> > MapInterMusic;
FString SoundInfo; FString SoundInfo;
FString SndSeq; FString SndSeq;

View file

@ -915,6 +915,18 @@ DEFINE_MAP_OPTION(intermusic, true)
parse.ParseMusic(info->InterMusic, info->intermusicorder); parse.ParseMusic(info->InterMusic, info->intermusicorder);
} }
DEFINE_MAP_OPTION(mapintermusic, true)
{
parse.ParseAssign();
parse.sc.MustGetString();
FString mapname = parse.sc.String;
FString music;
int order;
parse.ParseComma();
parse.ParseMusic(music, order);
info->MapInterMusic[FName(mapname)] = std::make_pair(music, order);
}
DEFINE_MAP_OPTION(fadetable, true) DEFINE_MAP_OPTION(fadetable, true)
{ {
parse.ParseAssign(); parse.ParseAssign();

View file

@ -2020,7 +2020,10 @@ public:
if (bcnt == 1) if (bcnt == 1)
{ {
// intermission music - use the defaults if none specified // intermission music - use the defaults if none specified
if (level.info->InterMusic.IsNotEmpty()) auto mus = level.info->MapInterMusic.CheckKey(wbs->next);
if (mus != nullptr)
S_ChangeMusic(mus->first, mus->second);
else if (level.info->InterMusic.IsNotEmpty())
S_ChangeMusic(level.info->InterMusic, level.info->intermusicorder); S_ChangeMusic(level.info->InterMusic, level.info->intermusicorder);
else else
S_ChangeMusic (gameinfo.intermissionMusic.GetChars(), gameinfo.intermissionOrder); S_ChangeMusic (gameinfo.intermissionMusic.GetChars(), gameinfo.intermissionOrder);