diff --git a/src/gamedata/g_mapinfo.cpp b/src/gamedata/g_mapinfo.cpp index e8cb532a5a..c946979f4b 100644 --- a/src/gamedata/g_mapinfo.cpp +++ b/src/gamedata/g_mapinfo.cpp @@ -50,6 +50,7 @@ #include "g_levellocals.h" #include "events.h" #include "i_system.h" +#include "screenjob.h" static TArray wadclusterinfos; TArray wadlevelinfos; @@ -741,6 +742,30 @@ void FMapInfoParser::ParseMusic(FString &name, int &order) } } +//========================================================================== +// +// +// +//========================================================================== + +void FMapInfoParser::ParseCutscene(CutsceneDef& cdef) +{ + FString sound; + sc.MustGetStringName("{"); + while (!sc.CheckString("}")) + { + sc.MustGetString(); + if (sc.Compare("video")) { ParseAssign(); sc.MustGetString(); cdef.video = sc.String; cdef.function = ""; } + else if (sc.Compare("function")) { ParseAssign(); sc.SetCMode(false); sc.MustGetString(); sc.SetCMode(true); cdef.function = sc.String; cdef.video = ""; } + else if (sc.Compare("sound")) { ParseAssign(); sc.MustGetString(); cdef.soundName = sc.String; } + else if (sc.Compare("soundid")) { ParseAssign(); sc.MustGetNumber(); cdef.soundID = sc.Number; } + else if (sc.Compare("fps")) { ParseAssign(); sc.MustGetNumber(); cdef.framespersec = sc.Number; } + //else if (sc.Compare("transitiononly")) cdef.transitiononly = true; + else if (sc.Compare("delete")) { cdef.function = "none"; cdef.video = ""; } // this means 'play nothing', not 'not defined'. + else if (sc.Compare("clear")) cdef = {}; + } +} + //========================================================================== // // ParseCluster @@ -845,6 +870,18 @@ void FMapInfoParser::ParseCluster() { clusterinfo->flags |= CLUSTER_EXITTEXTINLUMP; } + else if (sc.Compare("intro")) + { + ParseCutscene(clusterinfo->intro); + } + else if (sc.Compare("outro")) + { + ParseCutscene(clusterinfo->outro); + } + else if (sc.Compare("gameover")) + { + ParseCutscene(clusterinfo->gameover); + } else if (!ParseCloseBrace()) { // Unknown @@ -1540,6 +1577,16 @@ DEFINE_MAP_OPTION(loadacs, false) info->acsName = parse.sc.String; } +DEFINE_MAP_OPTION(intro, true) +{ + parse.ParseCutscene(info->intro); +} + +DEFINE_MAP_OPTION(outro, true) +{ + parse.ParseCutscene(info->outro); +} + //========================================================================== // @@ -2067,6 +2114,7 @@ void FMapInfoParser::ParseEpisodeInfo () bool noskill = false; bool optional = false; bool extended = false; + CutsceneDef introscene; // Get map name sc.MustGetString (); @@ -2123,6 +2171,11 @@ void FMapInfoParser::ParseEpisodeInfo () { noskill = true; } + else if (sc.Compare("intro")) + { + ParseCutscene(introscene); + } + else if (!ParseCloseBrace()) { // Unknown @@ -2181,6 +2234,7 @@ void FMapInfoParser::ParseEpisodeInfo () epi->mPicName = pic; epi->mShortcut = tolower(key); epi->mNoSkill = noskill; + epi->mIntro = introscene; } } diff --git a/src/gamedata/g_mapinfo.h b/src/gamedata/g_mapinfo.h index 4ed13e5baa..88e80fe1d8 100644 --- a/src/gamedata/g_mapinfo.h +++ b/src/gamedata/g_mapinfo.h @@ -39,6 +39,7 @@ #include "vectors.h" #include "sc_man.h" #include "file_zip.h" +#include "screenjob.h" struct level_info_t; struct cluster_info_t; @@ -73,6 +74,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, acsdefered_t &defer, a struct FIntermissionDescriptor; struct FIntermissionAction; +struct CutsceneDef; struct FMapInfoParser { @@ -95,6 +97,8 @@ struct FMapInfoParser bool ParseLookupName(FString &dest); void ParseMusic(FString &name, int &order); + void ParseCutscene(CutsceneDef& cdef); + //void ParseLumpOrTextureName(char *name); void ParseLumpOrTextureName(FString &name); void ParseExitText(FName formap, level_info_t *info); @@ -401,6 +405,8 @@ struct level_info_t FString EDName; FString acsName; bool fs_nocheckposition; + + CutsceneDef intro, outro; level_info_t() @@ -430,6 +436,9 @@ struct cluster_info_t FString ExitText; FString EnterText; FString MessageMusic; + CutsceneDef intro; // plays when entering this cluster, aside from starting a new game + CutsceneDef outro; // plays when leaving this cluster + CutsceneDef gameover; // when defined, plays when the player dies in this cluster int musicorder; int flags; int cdtrack; @@ -571,6 +580,7 @@ struct FEpisode FString mPicName; char mShortcut; bool mNoSkill; + CutsceneDef mIntro; }; extern TArray AllEpisodes; diff --git a/src/gamedata/gi.cpp b/src/gamedata/gi.cpp index ebbd5a365d..8b05a1a41f 100644 --- a/src/gamedata/gi.cpp +++ b/src/gamedata/gi.cpp @@ -362,6 +362,11 @@ void FMapInfoParser::ParseGameInfo() gameinfo.Dialogue = sc.String; gameinfo.AddDialogues.Clear(); } + else if (nextKey.CompareNoCase("intro") == 0) + { + ParseCutscene(gameinfo.IntroScene); + } + // Insert valid keys here. GAMEINFOKEY_STRING(mCheatKey, "cheatKey") GAMEINFOKEY_STRING(mEasyKey, "easyKey") diff --git a/src/gamedata/gi.h b/src/gamedata/gi.h index ce811ea3eb..439ffe7275 100644 --- a/src/gamedata/gi.h +++ b/src/gamedata/gi.h @@ -37,6 +37,7 @@ #include "basics.h" #include "zstring.h" #include "name.h" +#include "screenjob.h" // Flags are not user configurable and only depend on the standard IWADs enum @@ -212,6 +213,7 @@ struct gameinfo_t int fullscreenautoaspect = 3; bool nomergepickupmsg; bool mHideParTimes; + CutsceneDef IntroScene; const char *GetFinalePage(unsigned int num) const; };