From 858e5ea0a485790d1235b08c892ba8c547cac4ee Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 2 Oct 2010 13:02:36 +0000 Subject: [PATCH] - create intermissions from text screen clusterinfos. - restore end of game action special. - move game's default end sequence into gameinfo section. SVN r2879 (finale) --- src/g_level.cpp | 24 ++++---- src/gi.cpp | 1 + src/gi.h | 1 + src/intermission/intermission.cpp | 74 +------------------------ src/intermission/intermission.h | 3 +- src/intermission/intermission_parse.cpp | 64 ++++++++++++++++++++- wadsrc/static/mapinfo/chex.txt | 1 + wadsrc/static/mapinfo/common.txt | 8 +++ wadsrc/static/mapinfo/doomcommon.txt | 1 + wadsrc/static/mapinfo/heretic.txt | 1 + wadsrc/static/mapinfo/hexen.txt | 1 + wadsrc/static/mapinfo/strife.txt | 1 + 12 files changed, 94 insertions(+), 86 deletions(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index a56d52c75d..db8504c607 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -463,7 +463,6 @@ static bool unloading; // //========================================================================== - void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill) { level_info_t *nextinfo = NULL; @@ -476,7 +475,16 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill if (levelname == NULL || *levelname == 0) { - // todo: play the default end sequence here + // end the game + levelname = NULL; + if (!strncmp(level.nextmap, "enDSeQ",6)) + { + levelname = level.nextmap; // If there is already an end sequence please leave it alone! + } + else + { + nextlevel.Format("enDSeQ%04x", int(gameinfo.DefaultEndSequence)); + } } else if (strncmp(levelname, "enDSeQ", 6) != 0) { @@ -492,7 +500,7 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill } } - nextlevel = levelname; + if (levelname != NULL) nextlevel = levelname; if (nextSkill != -1) NextSkill = nextSkill; @@ -950,12 +958,7 @@ void G_WorldDone (void) thiscluster = FindClusterInfo (level.cluster); - /* - if (level.info->Intermission != NAME_None) - { - // todo start intermission - } - else if (strncmp (nextlevel, "enDSeQ", 6) == 0) + if (strncmp (nextlevel, "enDSeQ", 6) == 0) { F_StartFinale (thiscluster->MessageMusic, thiscluster->musicorder, thiscluster->cdtrack, thiscluster->cdid, @@ -963,7 +966,7 @@ void G_WorldDone (void) thiscluster->flags & CLUSTER_EXITTEXTINLUMP, thiscluster->flags & CLUSTER_FINALEPIC, thiscluster->flags & CLUSTER_LOOKUPEXITTEXT, - true, strtol(nextlevel.GetChars()+6, NULL, 16)); + true, ENamedName(strtol(nextlevel.GetChars()+6, NULL, 16))); } else { @@ -995,7 +998,6 @@ void G_WorldDone (void) } } } - */ } //========================================================================== diff --git a/src/gi.cpp b/src/gi.cpp index af63c990a1..18f8a66742 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -299,6 +299,7 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_CSTRING(mBackButton, "menubackbutton", 8) GAMEINFOKEY_INT(TextScreenX, "textscreenx") GAMEINFOKEY_INT(TextScreenY, "textscreeny") + GAMEINFOKEY_STRING(DefaultEndSequence, "defaultendsequence") else { diff --git a/src/gi.h b/src/gi.h index bfc9eeb8ea..e71b0f7830 100644 --- a/src/gi.h +++ b/src/gi.h @@ -127,6 +127,7 @@ struct gameinfo_t fixed_t gibfactor; int TextScreenX; int TextScreenY; + FName DefaultEndSequence; const char *GetFinalePage(unsigned int num) const; }; diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index fc9077f8cb..096746b99d 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -322,79 +322,7 @@ void F_StartFinale (const char *music, int musicorder, int cdtrack, unsigned int } #endif -void F_StartFinale (const char *music, int musicorder, int cdtrack, unsigned int cdid, const char *flat, - const char *text, INTBOOL textInLump, INTBOOL finalePic, INTBOOL lookupText, - bool ending, int endsequence) -{} - -/* - -//========================================================================== -// -// -//========================================================================== - -int FindEndSequence (int type, const char *picname) +void F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme) { - unsigned int i, num; - - num = EndSequences.Size (); - for (i = 0; i < num; i++) - { - if (EndSequences[i].EndType == type && !EndSequences[i].Advanced && - (type != END_Pic || stricmp (EndSequences[i].PicName, picname) == 0)) - { - return (int)i; - } - } - return -1; } -//========================================================================== -// -// -//========================================================================== - -static void SetEndSequence (char *nextmap, int type) -{ - int seqnum; - - seqnum = FindEndSequence (type, NULL); - if (seqnum == -1) - { - EndSequence newseq; - newseq.EndType = type; - seqnum = (int)EndSequences.Push (newseq); - } - mysnprintf(nextmap, 11, "enDSeQ%04x", (WORD)seqnum); -} - -//========================================================================== -// -// -//========================================================================== - -void G_SetForEndGame (char *nextmap) -{ - if (!strncmp(nextmap, "enDSeQ",6)) return; // If there is already an end sequence please leave it alone!!! - - if (gameinfo.gametype == GAME_Strife) - { - SetEndSequence (nextmap, gameinfo.flags & GI_SHAREWARE ? END_BuyStrife : END_Strife); - } - else if (gameinfo.gametype == GAME_Hexen) - { - SetEndSequence (nextmap, END_Chess); - } - else if (gameinfo.gametype == GAME_Doom && (gameinfo.flags & GI_MAPxx)) - { - SetEndSequence (nextmap, END_Cast); - } - else - { // The ExMx games actually have different ends based on the episode, - // but I want to keep this simple. - SetEndSequence (nextmap, END_Pic1); - } -} -*/ - diff --git a/src/intermission/intermission.h b/src/intermission/intermission.h index 38e173a8db..e8d0443e2c 100644 --- a/src/intermission/intermission.h +++ b/src/intermission/intermission.h @@ -269,11 +269,12 @@ public: bool F_Responder (event_t* ev); void F_Ticker (); void F_Drawer (); +void F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme); // Create an intermission from old cluster data void F_StartFinale (const char *music, int musicorder, int cdtrack, unsigned int cdid, const char *flat, const char *text, INTBOOL textInLump, INTBOOL finalePic, INTBOOL lookupText, - bool ending, int endsequence = 0); + bool ending, FName endsequence = NAME_None); diff --git a/src/intermission/intermission_parse.cpp b/src/intermission/intermission_parse.cpp index 18b45c616b..2519f5c1ba 100644 --- a/src/intermission/intermission_parse.cpp +++ b/src/intermission/intermission_parse.cpp @@ -733,4 +733,66 @@ FName FMapInfoParser::CheckEndSequence() return FName(seqname); } return NAME_None; -} \ No newline at end of file +} + + +//========================================================================== +// +// Creates an intermission from the cluster's finale info +// +//========================================================================== + +void F_StartFinale (const char *music, int musicorder, int cdtrack, unsigned int cdid, const char *flat, + const char *text, INTBOOL textInLump, INTBOOL finalePic, INTBOOL lookupText, + bool ending, FName endsequence) +{ + if (text != NULL && *text != 0) + { + FIntermissionActionTextscreen *textscreen = new FIntermissionActionTextscreen; + if (textInLump) + { + int lump = Wads.CheckNumForFullName(text, true); + if (lump > 0) + { + textscreen->mText = Wads.ReadLump(lump).GetString(); + } + else + { + textscreen->mText.Format("Unknown text lump '%s'", text); + } + } + else if (!lookupText) + { + textscreen->mText = text; + } + else + { + textscreen->mText << '$' << text; + } + textscreen->mBackground = flat; + textscreen->mFlatfill = !finalePic; + + if (music != NULL && *music != 0) + { + textscreen->mMusic = music; + textscreen->mMusicOrder = musicorder; + } + if (cdtrack > 0) + { + textscreen->mCdTrack = cdtrack; + textscreen->mCdId = cdid; + } + textscreen->mLink = ending? endsequence : NAME_None; + FIntermissionDescriptor *desc = new FIntermissionDescriptor; + desc->mActions.Push(textscreen); + F_StartIntermission(desc, true); + } + else if (ending) + { + FIntermissionDescriptor **pdesc = IntermissionDescriptors.CheckKey(endsequence); + if (pdesc != NULL) + { + F_StartIntermission(*pdesc, false); + } + } +} diff --git a/wadsrc/static/mapinfo/chex.txt b/wadsrc/static/mapinfo/chex.txt index f006ad751b..7ff6e2d67c 100644 --- a/wadsrc/static/mapinfo/chex.txt +++ b/wadsrc/static/mapinfo/chex.txt @@ -59,6 +59,7 @@ gameinfo cursorpic = "chexcurs" textscreenx = 10 textscreeny = 10 + defaultendsequence = "Inter_Pic1" } skill baby diff --git a/wadsrc/static/mapinfo/common.txt b/wadsrc/static/mapinfo/common.txt index 15651007cd..9932a501e2 100644 --- a/wadsrc/static/mapinfo/common.txt +++ b/wadsrc/static/mapinfo/common.txt @@ -1,4 +1,12 @@ +Intermission Inter_Titlescreen +{ + GotoTitle + { + } +} + + Intermission Inter_Pic1 { Image diff --git a/wadsrc/static/mapinfo/doomcommon.txt b/wadsrc/static/mapinfo/doomcommon.txt index 0ea66d2bd3..0ad964ca54 100644 --- a/wadsrc/static/mapinfo/doomcommon.txt +++ b/wadsrc/static/mapinfo/doomcommon.txt @@ -60,6 +60,7 @@ gameinfo cursorpic = "doomcurs" textscreenx = 10 textscreeny = 10 + defaultendsequence = "Inter_Cast" } skill baby diff --git a/wadsrc/static/mapinfo/heretic.txt b/wadsrc/static/mapinfo/heretic.txt index 6b57739778..0e269c8f76 100644 --- a/wadsrc/static/mapinfo/heretic.txt +++ b/wadsrc/static/mapinfo/heretic.txt @@ -59,6 +59,7 @@ gameinfo cursorpic = "herecurs" textscreenx = 20 textscreeny = 5 + defaultendsequence = "Inter_Pic1" } skill baby diff --git a/wadsrc/static/mapinfo/hexen.txt b/wadsrc/static/mapinfo/hexen.txt index 94e5a1c755..6022c541ef 100644 --- a/wadsrc/static/mapinfo/hexen.txt +++ b/wadsrc/static/mapinfo/hexen.txt @@ -57,6 +57,7 @@ gameinfo cursorpic = "hexncurs" textscreenx = 10 textscreeny = 5 + defaultendsequence = "Inter_Chess" } skill baby diff --git a/wadsrc/static/mapinfo/strife.txt b/wadsrc/static/mapinfo/strife.txt index 61cd849996..f396fa05a4 100644 --- a/wadsrc/static/mapinfo/strife.txt +++ b/wadsrc/static/mapinfo/strife.txt @@ -59,6 +59,7 @@ gameinfo cursorpic = "strfcurs" textscreenx = 10 textscreeny = 10 + defaultendsequence = "Inter_Strife" } skill baby