- added cutscene data parser

This covers:

game start
episode start
cluster start/end
level start/end
This commit is contained in:
Christoph Oelckers 2022-05-31 15:02:52 +02:00
parent bb42e541e9
commit cda6394a95
4 changed files with 71 additions and 0 deletions

View file

@ -50,6 +50,7 @@
#include "g_levellocals.h" #include "g_levellocals.h"
#include "events.h" #include "events.h"
#include "i_system.h" #include "i_system.h"
#include "screenjob.h"
static TArray<cluster_info_t> wadclusterinfos; static TArray<cluster_info_t> wadclusterinfos;
TArray<level_info_t> wadlevelinfos; TArray<level_info_t> 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 // ParseCluster
@ -845,6 +870,18 @@ void FMapInfoParser::ParseCluster()
{ {
clusterinfo->flags |= CLUSTER_EXITTEXTINLUMP; 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()) else if (!ParseCloseBrace())
{ {
// Unknown // Unknown
@ -1540,6 +1577,16 @@ DEFINE_MAP_OPTION(loadacs, false)
info->acsName = parse.sc.String; 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 noskill = false;
bool optional = false; bool optional = false;
bool extended = false; bool extended = false;
CutsceneDef introscene;
// Get map name // Get map name
sc.MustGetString (); sc.MustGetString ();
@ -2123,6 +2171,11 @@ void FMapInfoParser::ParseEpisodeInfo ()
{ {
noskill = true; noskill = true;
} }
else if (sc.Compare("intro"))
{
ParseCutscene(introscene);
}
else if (!ParseCloseBrace()) else if (!ParseCloseBrace())
{ {
// Unknown // Unknown
@ -2181,6 +2234,7 @@ void FMapInfoParser::ParseEpisodeInfo ()
epi->mPicName = pic; epi->mPicName = pic;
epi->mShortcut = tolower(key); epi->mShortcut = tolower(key);
epi->mNoSkill = noskill; epi->mNoSkill = noskill;
epi->mIntro = introscene;
} }
} }

View file

@ -39,6 +39,7 @@
#include "vectors.h" #include "vectors.h"
#include "sc_man.h" #include "sc_man.h"
#include "file_zip.h" #include "file_zip.h"
#include "screenjob.h"
struct level_info_t; struct level_info_t;
struct cluster_info_t; struct cluster_info_t;
@ -73,6 +74,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, acsdefered_t &defer, a
struct FIntermissionDescriptor; struct FIntermissionDescriptor;
struct FIntermissionAction; struct FIntermissionAction;
struct CutsceneDef;
struct FMapInfoParser struct FMapInfoParser
{ {
@ -95,6 +97,8 @@ struct FMapInfoParser
bool ParseLookupName(FString &dest); bool ParseLookupName(FString &dest);
void ParseMusic(FString &name, int &order); void ParseMusic(FString &name, int &order);
void ParseCutscene(CutsceneDef& cdef);
//void ParseLumpOrTextureName(char *name); //void ParseLumpOrTextureName(char *name);
void ParseLumpOrTextureName(FString &name); void ParseLumpOrTextureName(FString &name);
void ParseExitText(FName formap, level_info_t *info); void ParseExitText(FName formap, level_info_t *info);
@ -401,6 +405,8 @@ struct level_info_t
FString EDName; FString EDName;
FString acsName; FString acsName;
bool fs_nocheckposition; bool fs_nocheckposition;
CutsceneDef intro, outro;
level_info_t() level_info_t()
@ -430,6 +436,9 @@ struct cluster_info_t
FString ExitText; FString ExitText;
FString EnterText; FString EnterText;
FString MessageMusic; 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 musicorder;
int flags; int flags;
int cdtrack; int cdtrack;
@ -571,6 +580,7 @@ struct FEpisode
FString mPicName; FString mPicName;
char mShortcut; char mShortcut;
bool mNoSkill; bool mNoSkill;
CutsceneDef mIntro;
}; };
extern TArray<FEpisode> AllEpisodes; extern TArray<FEpisode> AllEpisodes;

View file

@ -362,6 +362,11 @@ void FMapInfoParser::ParseGameInfo()
gameinfo.Dialogue = sc.String; gameinfo.Dialogue = sc.String;
gameinfo.AddDialogues.Clear(); gameinfo.AddDialogues.Clear();
} }
else if (nextKey.CompareNoCase("intro") == 0)
{
ParseCutscene(gameinfo.IntroScene);
}
// Insert valid keys here. // Insert valid keys here.
GAMEINFOKEY_STRING(mCheatKey, "cheatKey") GAMEINFOKEY_STRING(mCheatKey, "cheatKey")
GAMEINFOKEY_STRING(mEasyKey, "easyKey") GAMEINFOKEY_STRING(mEasyKey, "easyKey")

View file

@ -37,6 +37,7 @@
#include "basics.h" #include "basics.h"
#include "zstring.h" #include "zstring.h"
#include "name.h" #include "name.h"
#include "screenjob.h"
// Flags are not user configurable and only depend on the standard IWADs // Flags are not user configurable and only depend on the standard IWADs
enum enum
@ -212,6 +213,7 @@ struct gameinfo_t
int fullscreenautoaspect = 3; int fullscreenautoaspect = 3;
bool nomergepickupmsg; bool nomergepickupmsg;
bool mHideParTimes; bool mHideParTimes;
CutsceneDef IntroScene;
const char *GetFinalePage(unsigned int num) const; const char *GetFinalePage(unsigned int num) const;
}; };