From 4fb355d8da8b752be74b2aa583b9890870ad18fb Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 14 Oct 2017 17:41:43 -0400 Subject: [PATCH] - added 'startuptype' to iwadinfo, allowing to change the game startup screen with custom iwads --- src/d_iwad.cpp | 16 ++++++++++++++++ src/d_main.h | 36 ++++++++++++++++++------------------ 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index 44ecb2ff5..ebce048bc 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -182,6 +182,21 @@ void FIWadManager::ParseIWadInfo(const char *fn, const char *data, int datasize, sc.MustGetString(); iwad->Required = sc.String; } + else if (sc.Compare("StartupType")) + { + sc.MustGetStringName("="); + sc.MustGetString(); + FString sttype = sc.String; + if (!sttype.CompareNoCase("DOOM")) + iwad->StartupType = FStartupInfo::DoomStartup; + else if (!sttype.CompareNoCase("HERETIC")) + iwad->StartupType = FStartupInfo::HereticStartup; + else if (!sttype.CompareNoCase("HEXEN")) + iwad->StartupType = FStartupInfo::HexenStartup; + else if (!sttype.CompareNoCase("STRIFE")) + iwad->StartupType = FStartupInfo::StrifeStartup; + else iwad->StartupType = FStartupInfo::DefaultStartup; + } else { sc.ScriptError("Unknown keyword '%s'", sc.String); @@ -739,6 +754,7 @@ const FIWADInfo *FIWadManager::FindIWAD(TArray &wadfiles, const char *i DoomStartupInfo.BkColor = iwad_info->BkColor; DoomStartupInfo.FgColor = iwad_info->FgColor; } + if (DoomStartupInfo.Type == 0) DoomStartupInfo.Type = iwad_info->StartupType; I_SetIWADInfo(); return iwad_info; } diff --git a/src/d_main.h b/src/d_main.h index e5abd0e01..1fa0368d6 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -74,6 +74,23 @@ struct WadStuff FString Name; }; +struct FStartupInfo +{ + FString Name; + uint32_t FgColor; // Foreground color for title banner + uint32_t BkColor; // Background color for title banner + FString Song; + int Type; + enum + { + DefaultStartup, + DoomStartup, + HereticStartup, + HexenStartup, + StrifeStartup, + }; +}; + struct FIWADInfo { FString Name; // Title banner text for this IWAD @@ -85,6 +102,7 @@ struct FIWADInfo uint32_t FgColor = 0; // Foreground color for title banner uint32_t BkColor = 0xc0c0c0; // Background color for title banner EGameType gametype = GAME_Doom; // which game are we playing? + int StartupType = FStartupInfo::DefaultStartup; // alternate startup type FString MapInfo; // Base mapinfo to load TArray Load; // Wads to be loaded with this one. TArray Lumps; // Lump names for identification @@ -104,24 +122,6 @@ struct FFoundWadInfo } }; -struct FStartupInfo -{ - FString Name; - uint32_t FgColor; // Foreground color for title banner - uint32_t BkColor; // Background color for title banner - FString Song; - int Type; - enum - { - DefaultStartup, - DoomStartup, - HereticStartup, - HexenStartup, - StrifeStartup, - }; - -}; - extern FStartupInfo DoomStartupInfo; //==========================================================================