- fixed .def 'music' parsing.

This was incomplete and just ignored Duke's special music, and the levelnum generation used an outdated formula so that it never managed to assign any music to the maps.
This commit is contained in:
Christoph Oelckers 2021-04-08 16:35:26 +02:00
parent e2f570a70a
commit fc1fbfe8b3
5 changed files with 6 additions and 5 deletions

View file

@ -38,6 +38,7 @@
#include "raze_music.h"
#include "filesystem.h"
#include "printf.h"
#include "raze_sound.h"
FString gSkillNames[MAXSKILLS];
FString gVolumeNames[MAXVOLUMES];
@ -109,7 +110,8 @@ bool SetMusicForMap(const char* mapname, const char* music, bool namehack)
{
if (!stricmp(mapname, specials[i]))
{
// todo: store this properly.
if (specialmusic.Size() <= i) specialmusic.Resize(i + 1);
specialmusic[i] = music;
return true;
}
}
@ -127,7 +129,7 @@ bool SetMusicForMap(const char* mapname, const char* music, bool namehack)
if (numMatches != 4 || toupper(b1) != 'E' || toupper(b2) != 'L')
return false;
index = FindMapByLevelNum(ep*100 + lev);
index = FindMapByLevelNum(levelnum(ep - 1, lev - 1));
}
if (index != nullptr)

View file

@ -46,6 +46,7 @@
static bool mus_blocked;
static FString lastStartedMusic;
TArray<FString> specialmusic;
MusicAliasMap MusicAliases;
MusicAliasMap LevelMusicAliases;

View file

@ -6,6 +6,7 @@
typedef TMap<FName, FName> MusicAliasMap;
extern MusicAliasMap MusicAliases;
extern TArray<FString> specialmusic;
// Totally minimalistic interface - should be all the game modules need.
void Mus_InitMusic();

View file

@ -65,7 +65,6 @@ inline DDukeActor* getSndActor(const void* source)
return source ? &hittype[((spritetype*)source) - sprite] : nullptr;
}
TArray<FString> specialmusic;
static FSoundID currentCommentarySound;
static DDukeActor* currentCommentarySprite; // todo: GC this once actors become objects

View file

@ -74,8 +74,6 @@ void S_ParseDeveloperCommentary();
void StopCommentary();
bool StartCommentary(int tag, DDukeActor* sprnum);
extern TArray<FString> specialmusic;
END_DUKE_NS