Fix console colors not working before an iwad has been selected

This commit is contained in:
Magnus Norddahl 2025-01-06 06:22:31 +01:00
commit 306303b9a6
16 changed files with 268 additions and 127 deletions

View file

@ -313,7 +313,7 @@ CUSTOM_CVAR(Int, I_FriendlyWindowTitle, 1, CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_N
}
CVAR(Bool, cl_nointros, false, CVAR_ARCHIVE)
bool RunningAsTool = false;
bool hud_toggled = false;
bool wantToRestart;
bool DrawFSHUD; // [RH] Draw fullscreen HUD?
@ -2035,7 +2035,7 @@ static void D_DoomInit()
gamestate = GS_STARTUP;
if (!batchrun) Printf ("M_LoadDefaults: Load system defaults.\n");
if (!batchrun && !RunningAsTool) Printf ("M_LoadDefaults: Load system defaults.\n");
M_LoadDefaults (); // load before initing other systems
}
@ -2126,7 +2126,7 @@ static void CheckCmdLine()
int p;
const char *v;
if (!batchrun) Printf ("Checking cmd-line parameters...\n");
if (!batchrun && !RunningAsTool) Printf ("Checking cmd-line parameters...\n");
if (Args->CheckParm ("-nomonsters")) flags |= DF_NO_MONSTERS;
if (Args->CheckParm ("-respawn")) flags |= DF_MONSTERS_RESPAWN;
if (Args->CheckParm ("-fast")) flags |= DF_FAST_MONSTERS;
@ -3147,7 +3147,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
{
rngseed = staticrngseed = atoi(v);
use_staticrng = true;
if (!batchrun) Printf("D_DoomInit: Static RNGseed %d set.\n", rngseed);
if (!batchrun && !RunningAsTool) Printf("D_DoomInit: Static RNGseed %d set.\n", rngseed);
}
else
{
@ -3184,7 +3184,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
exec->AddPullins(allwads, GameConfig);
}
if (!batchrun) Printf ("W_Init: Init WADfiles.\n");
if (!batchrun && !RunningAsTool) Printf ("W_Init: Init WADfiles.\n");
LumpFilterInfo lfi;
@ -3244,12 +3244,12 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
D_GrabCVarDefaults(); //parse DEFCVARS
InitPalette();
if (!batchrun) Printf("S_Init: Setting up sound.\n");
if (!batchrun && !RunningAsTool) Printf("S_Init: Setting up sound.\n");
S_Init();
int max_progress = TexMan.GuesstimateNumTextures();
int per_shader_progress = 0;//screen->GetShaderCount()? (max_progress / 10 / screen->GetShaderCount()) : 0;
bool nostartscreen = batchrun || restart || Args->CheckParm("-join") || Args->CheckParm("-host") || Args->CheckParm("-norun");
bool nostartscreen = RunningAsTool || batchrun || restart || Args->CheckParm("-join") || Args->CheckParm("-host") || Args->CheckParm("-norun");
if (GameStartupInfo.Type == FStartupInfo::DefaultStartup)
{
@ -3288,7 +3288,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
if (!restart)
{
if (!batchrun) Printf ("I_Init: Setting up machine state.\n");
if (!batchrun && !RunningAsTool) Printf ("I_Init: Setting up machine state.\n");
CheckCPUID(&CPU);
CalculateCPUSpeed();
auto ci = DumpCPUInfo(&CPU);
@ -3297,7 +3297,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
TexMan.Init();
if (!batchrun) Printf ("V_Init: allocate screen.\n");
if (!batchrun && !RunningAsTool) Printf ("V_Init: allocate screen.\n");
if (!restart)
{
screen->CompileNextShader();
@ -3319,7 +3319,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
compatmode = (int)strtoll(compatmodeval, nullptr, 10);
}
if (!batchrun) Printf ("ST_Init: Init startup screen.\n");
if (!batchrun && !RunningAsTool) Printf ("ST_Init: Init startup screen.\n");
if (!restart)
{
StartWindow = FStartupScreen::CreateInstance (TexMan.GuesstimateNumTextures() + 5);
@ -3335,11 +3335,11 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
S_ParseReverbDef ();
// [RH] Parse any SNDINFO lumps
if (!batchrun) Printf ("S_InitData: Load sound definitions.\n");
if (!batchrun && !RunningAsTool) Printf ("S_InitData: Load sound definitions.\n");
S_InitData ();
// [RH] Parse through all loaded mapinfo lumps
if (!batchrun) Printf ("G_ParseMapInfo: Load map definitions.\n");
if (!batchrun && !RunningAsTool) Printf ("G_ParseMapInfo: Load map definitions.\n");
G_ParseMapInfo (iwad_info->MapInfo);
MessageBoxClass = gameinfo.MessageBoxClass;
endoomName = gameinfo.Endoom;
@ -3349,7 +3349,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
// MUSINFO must be parsed after MAPINFO
S_ParseMusInfo();
if (!batchrun) Printf ("Texman.Init: Init texture manager.\n");
if (!batchrun && !RunningAsTool) Printf ("Texman.Init: Init texture manager.\n");
UpdateUpscaleMask();
SpriteFrames.Clear();
TexMan.AddTextures([]()
@ -3371,7 +3371,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
UpdateGenericUI(false);
// [CW] Parse any TEAMINFO lumps.
if (!batchrun) Printf ("ParseTeamInfo: Load team definitions.\n");
if (!batchrun && !RunningAsTool) Printf ("ParseTeamInfo: Load team definitions.\n");
FTeam::ParseTeamInfo ();
R_ParseTrnslate();
@ -3397,13 +3397,13 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
ParseGLDefs();
if (!batchrun) Printf ("R_Init: Init %s refresh subsystem.\n", gameinfo.ConfigName.GetChars());
if (!batchrun && !RunningAsTool) Printf ("R_Init: Init %s refresh subsystem.\n", gameinfo.ConfigName.GetChars());
if (StartScreen) StartScreen->LoadingStatus ("Loading graphics", 0x3f);
if (StartScreen) StartScreen->Progress(1);
StartWindow->Progress();
R_Init ();
if (!batchrun) Printf ("DecalLibrary: Load decals.\n");
if (!batchrun && !RunningAsTool) Printf ("DecalLibrary: Load decals.\n");
DecalLibrary.ReadAllDecals ();
auto numbasesounds = soundEngine->GetNumSounds();
@ -3425,7 +3425,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
{
if (stricmp (key, "Path") == 0 && FileExists (value))
{
if (!batchrun) Printf ("Applying patch %s\n", value);
if (!batchrun && !RunningAsTool) Printf ("Applying patch %s\n", value);
D_LoadDehFile(value, 0);
}
}
@ -3440,7 +3440,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
auto numdehsounds = soundEngine->GetNumSounds();
if (numbasesounds < numdehsounds) S_LockLocalSndinfo(); // DSDHacked sounds are not compatible with map-local SNDINFOs.
if (!batchrun) Printf("M_Init: Init menus.\n");
if (!batchrun && !RunningAsTool) Printf("M_Init: Init menus.\n");
SetDefaultMenuColors();
M_Init();
M_CreateGameMenus();
@ -3465,7 +3465,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
primaryLevel->BotInfo.spawn_tries = 0;
primaryLevel->BotInfo.wanted_botnum = primaryLevel->BotInfo.getspawned.Size();
if (!batchrun) Printf ("P_Init: Init Playloop state.\n");
if (!batchrun && !RunningAsTool) Printf ("P_Init: Init Playloop state.\n");
if (StartScreen) StartScreen->LoadingStatus ("Init game engine", 0x3f);
AM_StaticInit();
P_Init ();
@ -3475,7 +3475,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
//SBarInfo support. Note that the first SBARINFO lump contains the mugshot definition so it even needs to be read when a regular status bar is being used.
SBarInfo::Load();
if (!batchrun)
if (!batchrun && !RunningAsTool)
{
// [RH] User-configurable startup strings. Because BOOM does.
static const char *startupString[5] = {
@ -3494,7 +3494,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
if (!restart)
{
if (!batchrun) Printf ("D_CheckNetGame: Checking network game status.\n");
if (!batchrun && !RunningAsTool) Printf ("D_CheckNetGame: Checking network game status.\n");
if (StartScreen) StartScreen->LoadingStatus ("Checking network game status.", 0x3f);
if (!D_CheckNetGame ())
{
@ -3537,6 +3537,12 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
return 1337; // special exit
}
if (RunningAsTool)
{
// To do: is enough of the engine initialized now for running tool commandlets?
return 0;
}
if (StartScreen)
{
StartScreen->Progress(max_progress); // advance progress bar to the end.