- added a parser for WT's developer commentary definitions.

This commit is contained in:
Christoph Oelckers 2020-09-26 16:18:44 +02:00
parent b8dae02464
commit 3a459ac603
3 changed files with 56 additions and 0 deletions

View file

@ -323,6 +323,7 @@ void GameInterface::app_init()
ud.last_level = -1;
enginecompatibility_mode = ENGINECOMPATIBILITY_19961112;//bVanilla;
S_ParseDeveloperCommentary();
}
END_DUKE_NS

View file

@ -733,4 +733,56 @@ void S_WorldTourMappingsForOldSounds()
}
}
static TArray<FString> Commentaries;
void S_ParseDeveloperCommentary()
{
int lumpnum = fileSystem.FindFile("def/developer_commentary.def");
if (lumpnum < 0) return;
FScanner sc;
sc.OpenLumpNum(lumpnum);
try
{
sc.SetCMode(true);
sc.MustGetStringName("def");
sc.MustGetStringName("developercommentary");
sc.MustGetStringName("{");
while (!sc.CheckString("}"))
{
FString path;
int num = -1;
sc.MustGetStringName("def");
sc.MustGetStringName("sound");
sc.MustGetStringName("{");
while (!sc.CheckString("}"))
{
sc.MustGetString();
if (sc.Compare("path"))
{
sc.MustGetStringName(":");
sc.MustGetString();
path = sc.String;
sc.MustGetStringName(";");
}
else if (sc.Compare("num"))
{
sc.MustGetStringName(":");
sc.MustGetNumber();
num = sc.Number;
sc.MustGetStringName(";");
}
}
sc.MustGetStringName(";");
if (Commentaries.Size() <= num) Commentaries.Resize(num + 1);
Commentaries[num] = std::move(path);
}
//sc.MustGetStringName(";");
}
catch (const std::exception& ex)
{
Printf("Failed to read developer commentary definitions:\n%s", ex.what());
return;
}
}
END_DUKE_NS

View file

@ -70,6 +70,9 @@ void S_PlaySpecialMusic(unsigned int);
void S_ContinueLevelMusic(void);
// Placeholders.
void S_ParseDeveloperCommentary();
inline void StopCommentary()
{}