From 4458f8c9293a19e7448f8d9b85301ae35bdd467e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 2 May 2021 12:22:40 +0200 Subject: [PATCH] - migrated the global cutscenes to RMAPINFO as well. --- source/core/g_mapinfo.cpp | 92 ++++++++++++++++++- source/core/g_mapinfo.h | 3 +- source/core/mapinfo.h | 1 + wadsrc/static/filter/duke/engine/engine.def | 16 ---- wadsrc/static/filter/duke/engine/rmapinfo.txt | 17 ++++ 5 files changed, 110 insertions(+), 19 deletions(-) diff --git a/source/core/g_mapinfo.cpp b/source/core/g_mapinfo.cpp index dda3500d5..060434ebb 100644 --- a/source/core/g_mapinfo.cpp +++ b/source/core/g_mapinfo.cpp @@ -876,6 +876,96 @@ void FMapInfoParser::ParseEpisodeInfo () } +//========================================================================== +// +// +// +//========================================================================== + +void FMapInfoParser::ParseCutsceneInfo() +{ + unsigned int i; + FString map; + FString pic; + FString name; + bool remove = false; + char key = 0; + int flags = 0; + + ParseOpenBrace(); + + while (sc.GetString()) + { + if (sc.Compare("intro")) + { + ParseCutscene(globalCutscenes.Intro); + } + else if (sc.Compare("defaultmapintro")) + { + ParseCutscene(globalCutscenes.DefaultMapIntro); + } + else if (sc.Compare("defaultmapoutro")) + { + ParseCutscene(globalCutscenes.DefaultMapOutro); + } + else if (sc.Compare("defaultgameover")) + { + ParseCutscene(globalCutscenes.DefaultGameover); + } + else if (sc.Compare("sharewareend")) + { + ParseCutscene(globalCutscenes.SharewareEnd); + } + else if (sc.Compare("loadscreen")) + { + ParseCutscene(globalCutscenes.LoadingScreen); + } + else if (!ParseCloseBrace()) + { + // Unknown + sc.ScriptMessage("Unknown property '%s' found in episode definition\n", sc.String); + SkipToNext(); + } + else + { + break; + } + } + CheckEndOfFile("episode"); + + + for (i = 0; i < volumes.Size(); i++) + { + if (volumes[i].startmap.CompareNoCase(map) == 0) + { + break; + } + } + + if (remove) + { + // If the remove property is given for an episode, remove it. + volumes.Delete(i); + } + else + { + // Only allocate a new entry if this doesn't replace an existing episode. + if (i >= volumes.Size()) + { + i = volumes.Reserve(1); + } + + auto epi = &volumes[i]; + + epi->startmap = map; + epi->name = name; + epi->shortcut = tolower(key); + epi->flags = flags; + epi->index = i; + } +} + + //========================================================================== // // SetLevelNum @@ -988,7 +1078,7 @@ void FMapInfoParser::ParseMapInfo (int lump, MapRecord &gamedefaults, MapRecord } else if (sc.Compare("cutscenes")) { - //ParseCutsceneInfo(); + ParseCutsceneInfo(); } else if (sc.Compare("gameinfo")) { diff --git a/source/core/g_mapinfo.h b/source/core/g_mapinfo.h index 375091bbc..be7e22284 100644 --- a/source/core/g_mapinfo.h +++ b/source/core/g_mapinfo.h @@ -53,7 +53,6 @@ struct FMapInfoParser bool CheckLegacyMapDefinition(FString& mapname); bool ParseLookupName(FString &dest); void ParseMusic(FString &name, int &order); - //void ParseLumpOrTextureName(char *name); void ParseLumpOrTextureName(FString &name); void ParseCutscene(CutsceneDef& cdef); @@ -62,7 +61,7 @@ struct FMapInfoParser MapRecord *ParseMapHeader(MapRecord &defaultinfo); void ParseMapDefinition(MapRecord &leveldef); void ParseEpisodeInfo (); - void ParseSkill (); + void ParseCutsceneInfo(); void ParseMapInfo (int lump, MapRecord &gamedefaults, MapRecord &defaultinfo); void ParseOpenBrace(); diff --git a/source/core/mapinfo.h b/source/core/mapinfo.h index 64cf1ae0b..7b51c9566 100644 --- a/source/core/mapinfo.h +++ b/source/core/mapinfo.h @@ -85,6 +85,7 @@ struct GlobalCutscenes CutsceneDef Intro; CutsceneDef DefaultMapIntro; CutsceneDef DefaultMapOutro; + CutsceneDef DefaultGameover; CutsceneDef SharewareEnd; CutsceneDef LoadingScreen; FString MPSummaryScreen; diff --git a/wadsrc/static/filter/duke/engine/engine.def b/wadsrc/static/filter/duke/engine/engine.def index d85394543..78677d761 100644 --- a/wadsrc/static/filter/duke/engine/engine.def +++ b/wadsrc/static/filter/duke/engine/engine.def @@ -1,19 +1,3 @@ -// Cutscene definitions for Duke - -definecutscene intro -{ - function DukeCutscenes.BuildIntro -} - -definecutscene sharewareend -{ - function DukeCutscenes.BuildSharewareEnd -} - -definecutscene loading -{ - function DukeCutscenes.BuildLoading -} definecutscene summary DukeCutscenes.BuildSPSummary definecutscene mpsummary DukeCutscenes.BuildMPSummary diff --git a/wadsrc/static/filter/duke/engine/rmapinfo.txt b/wadsrc/static/filter/duke/engine/rmapinfo.txt index 0ed96c42d..21ee09ac5 100644 --- a/wadsrc/static/filter/duke/engine/rmapinfo.txt +++ b/wadsrc/static/filter/duke/engine/rmapinfo.txt @@ -49,3 +49,20 @@ map { 4, 1 } } } +cutscenes +{ + intro + { + function = DukeCutscenes.BuildIntro + } + + sharewareend + { + function = DukeCutscenes.BuildSharewareEnd + } + + loadscreen + { + function = DukeCutscenes.BuildLoading + } +}