diff --git a/source/games/duke/src/game.cpp b/source/games/duke/src/game.cpp index f73f6fae4..da43cf148 100644 --- a/source/games/duke/src/game.cpp +++ b/source/games/duke/src/game.cpp @@ -323,6 +323,7 @@ void GameInterface::app_init() ud.last_level = -1; enginecompatibility_mode = ENGINECOMPATIBILITY_19961112;//bVanilla; + S_ParseDeveloperCommentary(); } END_DUKE_NS diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index 65e938fc3..24c5f236d 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -733,4 +733,56 @@ void S_WorldTourMappingsForOldSounds() } } +static TArray 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 diff --git a/source/games/duke/src/sounds.h b/source/games/duke/src/sounds.h index cb9b4f4da..2cfa03b8d 100644 --- a/source/games/duke/src/sounds.h +++ b/source/games/duke/src/sounds.h @@ -70,6 +70,9 @@ void S_PlaySpecialMusic(unsigned int); void S_ContinueLevelMusic(void); // Placeholders. + +void S_ParseDeveloperCommentary(); + inline void StopCommentary() {}