* Add a seperate step for I_STARTUPSKINS - "Load characters" - since it takes a similar length to loading all other types of sprites.

* Adjust several loading strings, and left-align their rendering.
* Don't call HU_LoadGraphics() again (startup cached ALL FONTS twice).
* Adjust when some functions are called during loading to more effectively compartmentalise sections of loading that depend on each other.
    * LOADED_ISTARTUPGRAPHICS now comes after SCR_Startup, as we can explicitly guarantee the palette has been loaded after that function.
    * Make sure everything closely related to configurations (gamedata, console stuff, etc) which is not directly dependent on anything else is loaded under LOADED_CONFIG - "Load settings" (formerly LOADED_MINIT).
    * The `-warp` command line parameter is now checked alongside LOADED_DCHECKNETGAME.
* Don't attempt to draw the loading bar before LOADED_ISTARTUPGRAPHICS, as the palette is not loaded, which means you're wasting cycles on a white screen.
This commit is contained in:
toaster 2021-03-29 17:02:08 +01:00
parent c3c5096ca2
commit 72defa325f
7 changed files with 67 additions and 68 deletions

View file

@ -1880,21 +1880,23 @@ void CON_Drawer(void)
Unlock_state();
}
static const char *CON_LoadingStrings[LOADED_ALLDONE] =
static const char *CON_LoadingStrings[LOADED_ALLDONE+1] =
{
"Init Zone Memory...", //LOADED_ZINIT
"Init zone memory...", //LOADED_ZINIT
"Init game timing...", //LOADED_ISTARTUPTIMER
"Loading main assets...", //LOADED_IWAD
"Loading add-ons...", //LOADED_PWAD
"Init graphics subsystem...", //LOADED_ISTARTUPGRAPHICS
"Cache fonts...", //LOADED_HULOADGRAPHICS
"Init miscellaneous...", //LOADED_MINIT
"Cache fonts...", //LOADED_HUINIT
"Load settings...", //LOADED_CONFIG
"Cache textures...", //LOADED_INITTEXTUREDATA
"Cache sprites...", //LOADED_INITSPIRTES
"Load characters...", //LOADED_INITSKINS
"Init rendering daemon...", //LOADED_RINIT
"Init audio subsystem...", //LOADED_SINITSFXCHANNELS
"Cache HUD...", //LOADED_STINIT
"Check game status...", //LOADED_DCHECKNETGAME
"Now starting..."
}; // see also con_loadprogress_t in console.h
//
@ -1912,9 +1914,11 @@ void CON_SetLoadingProgress(con_loadprogress_t newStep)
con_startup_loadprogress = newStep;
if (con_startup_loadprogress < LOADED_ALLDONE)
if (con_startup_loadprogress <= LOADED_ALLDONE)
CONS_Printf("LOADING UPDATE - %s\n", CON_LoadingStrings[con_startup_loadprogress]);
if (con_startup_loadprogress < LOADED_ISTARTUPGRAPHICS) // rendering not possible?
return;
CON_DrawLoadBar(); // here we display the console text
I_FinishUpdate(); // page flip or blit buffer
}
@ -1940,8 +1944,8 @@ void CON_DrawLoadBar(void)
barwidth = (BASEVIDWIDTH * con_startup_loadprogress) / LOADED_ALLDONE;
V_DrawFill(0, BASEVIDHEIGHT - barheight, barwidth, barheight, 0);
#ifdef DEVELOP
if (con_startup_loadprogress < LOADED_ALLDONE)
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT - (barheight + 8 + 4), 0, CON_LoadingStrings[con_startup_loadprogress]);
if (con_startup_loadprogress <= LOADED_ALLDONE)
V_DrawString(4, BASEVIDHEIGHT - (barheight + 8 + 4), 0, CON_LoadingStrings[con_startup_loadprogress]);
#endif
Unlock_state();

View file

@ -36,10 +36,11 @@ typedef enum
LOADED_IWAD,
LOADED_PWAD,
LOADED_ISTARTUPGRAPHICS,
LOADED_HULOADGRAPHICS,
LOADED_MINIT,
LOADED_HUINIT,
LOADED_CONFIG,
LOADED_INITTEXTUREDATA,
LOADED_INITSPRITES,
LOADED_INITSKINS,
LOADED_RINIT,
LOADED_SINITSFXCHANNELS,
LOADED_STINIT,

View file

@ -1434,7 +1434,6 @@ void D_SRB2Main(void)
CONS_Printf("I_StartupGraphics()...\n");
I_StartupGraphics();
CON_SetLoadingProgress(LOADED_ISTARTUPGRAPHICS);
#ifdef HWRENDER
// Lactozilla: Add every hardware mode CVAR and CCMD.
@ -1447,10 +1446,15 @@ void D_SRB2Main(void)
// setup loading screen
SCR_Startup();
CON_SetLoadingProgress(LOADED_ISTARTUPGRAPHICS);
CONS_Printf("HU_Init()...\n");
HU_Init();
CON_Init();
CON_SetLoadingProgress(LOADED_HUINIT);
memset(timelimits, 0, sizeof(timelimits));
memset(pointlimits, 0, sizeof(pointlimits));
@ -1463,14 +1467,10 @@ void D_SRB2Main(void)
I_RegisterSysCommands();
CONS_Printf("HU_LoadGraphics()...\n");
HU_LoadGraphics();
CON_SetLoadingProgress(LOADED_HULOADGRAPHICS);
//--------------------------------------------------------- CONFIG.CFG
M_FirstLoadConfig(); // WARNING : this do a "COM_BufExecute()"
G_LoadGameData();
M_Init();
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen
@ -1479,36 +1479,18 @@ void D_SRB2Main(void)
// set user default mode or mode set at cmdline
SCR_CheckDefaultMode();
if (M_CheckParm("-noupload"))
COM_BufAddText("downloading 0\n");
G_LoadGameData();
wipegamestate = gamestate;
savedata.lives = 0; // flag this as not-used
//------------------------------------------------ COMMAND LINE PARAMS
// this must be done after loading gamedata,
// to avoid setting off the corrupted gamedata code in G_LoadGameData if a SOC with custom gamedata is added
// -- Monster Iestyn 20/02/20
if (M_CheckParm("-warp") && M_IsNextParm())
{
const char *word = M_GetNextParm();
pstartmap = G_FindMapByNameOrCode(word, 0);
if (! pstartmap)
I_Error("Cannot find a map remotely named '%s'\n", word);
else
{
if (!M_CheckParm("-server"))
G_SetGameModified(multiplayer, true);
autostart = true;
}
}
if (M_CheckParm("-noupload"))
COM_BufAddText("downloading 0\n");
CONS_Printf("M_Init(): Init miscellaneous info.\n");
M_Init();
CON_SetLoadingProgress(LOADED_MINIT);
CON_SetLoadingProgress(LOADED_CONFIG);
CONS_Printf("R_InitTextureData()...\n");
R_InitTextureData(); // seperated out from below because it takes ages by itself
CON_SetLoadingProgress(LOADED_INITTEXTUREDATA);
@ -1516,6 +1498,10 @@ void D_SRB2Main(void)
R_InitSprites(); // ditto
CON_SetLoadingProgress(LOADED_INITSPRITES);
CONS_Printf("R_InitSkins()...\n");
R_InitSkins(); // ditto
CON_SetLoadingProgress(LOADED_INITSKINS);
CONS_Printf("R_Init(): Init SRB2 refresh daemon.\n");
R_Init();
CON_SetLoadingProgress(LOADED_RINIT);
@ -1562,6 +1548,25 @@ void D_SRB2Main(void)
ST_Init();
CON_SetLoadingProgress(LOADED_STINIT);
//------------------------------------------------ COMMAND LINE PARAMS
// this must be done after loading gamedata,
// to avoid setting off the corrupted gamedata code in G_LoadGameData if a SOC with custom gamedata is added
// -- Monster Iestyn 20/02/20
if (M_CheckParm("-warp") && M_IsNextParm())
{
const char *word = M_GetNextParm();
pstartmap = G_FindMapByNameOrCode(word, 0);
if (! pstartmap)
I_Error("Cannot find a map remotely named '%s'\n", word);
else
{
if (!M_CheckParm("-server"))
G_SetGameModified(multiplayer, true);
autostart = true;
}
}
// Set up splitscreen players before joining!
if (!dedicated && (M_CheckParm("-splitscreen") && M_IsNextParm()))
{

View file

@ -3466,8 +3466,6 @@ void M_Init(void)
{
UINT8 i;
COM_AddCommand("manual", Command_Manual_f);
CV_RegisterVar(&cv_nextmap);
CV_RegisterVar(&cv_newgametype);
CV_RegisterVar(&cv_chooseskin);
@ -3476,6 +3474,8 @@ void M_Init(void)
if (dedicated)
return;
COM_AddCommand("manual", Command_Manual_f);
// Menu hacks
CV_RegisterVar(&cv_dummymenuplayer);
CV_RegisterVar(&cv_dummyteam);

View file

@ -133,9 +133,11 @@ static void Sk_SetDefaultValue(skin_t *skin)
//
void R_InitSkins(void)
{
#ifdef SKINVALUES
INT32 i;
size_t i;
// it can be is do before loading config for skin cvar possible value
// (... what the fuck did you just say to me? "it can be is do"?)
#ifdef SKINVALUES
for (i = 0; i <= MAXSKINS; i++)
{
skin_cons_t[i].value = 0;
@ -145,6 +147,14 @@ void R_InitSkins(void)
// no default skin!
numskins = 0;
for (i = 0; i < numwadfiles; i++)
{
R_AddSkins((UINT16)i);
R_PatchSkins((UINT16)i);
R_LoadSpriteInfoLumps(i, wadfiles[i]->numlumps);
}
ST_ReloadSkinFaceGraphics();
}
UINT32 R_GetSkinAvailabilities(void)

View file

@ -546,30 +546,6 @@ void R_InitSprites(void)
for (i = 0; i < numwadfiles; i++)
R_AddSpriteDefs((UINT16)i);
//
// now check for skins
//
// it can be is do before loading config for skin cvar possible value
// (... what the fuck did you just say to me? "it can be is do"?)
#ifdef SKINVALUES
for (i = 0; i <= MAXSKINS; i++)
{
skin_cons_t[i].value = 0;
skin_cons_t[i].strvalue = NULL;
}
#endif
numskins = 0;
for (i = 0; i < numwadfiles; i++)
{
R_AddSkins((UINT16)i);
R_PatchSkins((UINT16)i);
R_LoadSpriteInfoLumps(i, wadfiles[i]->numlumps);
}
ST_ReloadSkinFaceGraphics();
//
// check if all sprites have frames
//

View file

@ -131,6 +131,9 @@ static boolean InitCube(void)
float globalgammamul, globalgammaoffs;
boolean doinggamma;
if (con_startup_loadprogress < LOADED_MINIT)
return false;
#define diffcons(cv) (cv.value != atoi(cv.defaultvalue))
doinggamma = diffcons(cv_globalgamma);