Adds a simple white loading bar at the bottom of startup, instead of covering the cool reference with text

Mockup of what it looks like, since the window's invisble when you try to print-scr it: https://cdn.discordapp.com/attachments/275750804227489794/769931098636943391/unknown.png
This commit is contained in:
Sally Coolatta 2020-10-25 10:35:24 -04:00
parent f121ed210a
commit 12f56d64a7
3 changed files with 64 additions and 7 deletions

View file

@ -57,6 +57,9 @@ I_mutex con_mutex;
static boolean con_started = false; // console has been initialised
boolean con_startup = false; // true at game startup, screen need refreshing
UINT8 con_startup_loadprogress = 0; // Progress for startup load bar
static boolean con_forcepic = true; // at startup toggle console translucency when first off
boolean con_recalc; // set true when screen size has changed
@ -1517,16 +1520,17 @@ void CONS_Printf(const char *fmt, ...)
if (startup && (!setrenderneeded))
{
#ifdef _WINDOWS
patch_t *con_backpic = W_CachePatchName("KARTKREW", PU_CACHE);
patch_t *con_backpic = W_CachePatchName("STARTUP", PU_CACHE);
// Jimita: CON_DrawBackpic just called V_DrawScaledPatch
V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, con_backpic, NULL);
V_DrawScaledPatch(0, 0, 0, con_backpic);
W_UnlockCachedPatch(con_backpic);
I_LoadingScreen(txt); // Win32/OS2 only
I_LoadingScreen(txt); // Win32/OS2 only
#else
// here we display the console text
CON_Drawer();
//CON_Drawer();
CON_DrawLoadBar();
I_FinishUpdate(); // page flip or blit buffer
#endif
}
@ -1902,3 +1906,34 @@ void CON_Drawer(void)
Unlock_state();
}
//
// Draws a simple white fill at the bottom of startup for load progress
//
void CON_DrawLoadBar(void)
{
const INT16 barheight = 2;
INT16 barwidth = 0;
Lock_state();
if (con_startup_loadprogress > CON_STARTUP_LOADSTEPS)
{
Unlock_state();
I_Error("CON_STARTUP_LOADSTEPS has not been updated!\n");
return;
}
if (!con_started || !graphics_started)
{
Unlock_state();
return;
}
CON_DrawBackpic();
barwidth = (BASEVIDWIDTH * con_startup_loadprogress) / CON_STARTUP_LOADSTEPS;
V_DrawFill(0, BASEVIDHEIGHT - barheight, barwidth, barheight, 0);
Unlock_state();
}

View file

@ -27,6 +27,9 @@ extern boolean con_recalc;
extern boolean con_startup;
extern UINT8 con_startup_loadprogress;
#define CON_STARTUP_LOADSTEPS 12
// top clip value for view render: do not draw part of view hidden by console
extern INT32 con_clipviewtop;
@ -62,3 +65,6 @@ void CON_ToggleOff(void);
boolean CON_Ready(void);
void CON_LogMessage(const char *msg);
// Startup loading bar
void CON_DrawLoadBar(void);

View file

@ -733,7 +733,6 @@ tic_t rendergametic;
void D_SRB2Loop(void)
{
tic_t oldentertics = 0, entertic = 0, realtics = 0, rendertimeout = INFTICS;
static lumpnum_t gstartuplumpnum;
if (dedicated)
server = true;
@ -770,14 +769,17 @@ void D_SRB2Loop(void)
LMFAO this was showing garbage under OpenGL
because I_FinishUpdate was called afterward
*/
#if 0
/* Smells like a hack... Don't fade Sonic's ass into the title screen. */
if (gamestate != GS_TITLESCREEN)
{
gstartuplumpnum = W_CheckNumForName("STARTUP");
static lumpnum_t gstartuplumpnum = W_CheckNumForName("STARTUP");
if (gstartuplumpnum == LUMPERROR)
gstartuplumpnum = W_GetNumForName("MISSING");
V_DrawScaledPatch(0, 0, 0, W_CachePatchNum(gstartuplumpnum, PU_PATCH));
}
#endif
for (;;)
{
@ -1256,7 +1258,6 @@ void D_SRB2Main(void)
configfile[sizeof configfile - 1] = '\0';
}
// Create addons dir
snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons");
I_mkdir(addonsdir, 0755);
@ -1280,6 +1281,7 @@ void D_SRB2Main(void)
CONS_Printf("Z_Init(): Init zone memory allocation daemon. \n");
Z_Init();
con_startup_loadprogress++;
// Do this up here so that WADs loaded through the command line can use ExecCfg
COM_Init();
@ -1363,6 +1365,7 @@ void D_SRB2Main(void)
CONS_Printf("I_StartupTimer()...\n");
I_StartupTimer();
con_startup_loadprogress++;
// Make backups of some SOCcable tables.
P_BackupTables();
@ -1426,6 +1429,8 @@ void D_SRB2Main(void)
}
}
con_startup_loadprogress++; // finished IWADs
CONS_Printf("W_InitMultipleFiles(): Adding external PWADs.\n");
W_InitMultipleFiles(startuppwads, true);
D_CleanFile(startuppwads);
@ -1463,6 +1468,8 @@ void D_SRB2Main(void)
}
}
con_startup_loadprogress++; // finished PWADs
cht_Init();
//---------------------------------------------------- READY SCREEN
@ -1470,6 +1477,7 @@ void D_SRB2Main(void)
CONS_Printf("I_StartupGraphics()...\n");
I_StartupGraphics();
con_startup_loadprogress++;
#ifdef HWRENDER
// Lactozilla: Add every hardware mode CVAR and CCMD.
@ -1495,6 +1503,7 @@ void D_SRB2Main(void)
CONS_Printf("HU_LoadGraphics()...\n");
HU_LoadGraphics();
con_startup_loadprogress++;
//--------------------------------------------------------- CONFIG.CFG
M_FirstLoadConfig(); // WARNING : this do a "COM_BufExecute()"
@ -1525,6 +1534,7 @@ void D_SRB2Main(void)
// check the renderer's state
D_CheckRendererState();
}
con_startup_loadprogress++;
wipegamestate = gamestate;
@ -1554,9 +1564,11 @@ void D_SRB2Main(void)
CONS_Printf("M_Init(): Init miscellaneous info.\n");
M_Init();
con_startup_loadprogress++;
CONS_Printf("R_Init(): Init SRB2 refresh daemon.\n");
R_Init();
con_startup_loadprogress++;
// setting up sound
if (dedicated)
@ -1584,6 +1596,7 @@ void D_SRB2Main(void)
digital_disabled = true; // WARNING: DOS version initmusic in I_StartupSound
}
}
if (!( sound_disabled && digital_disabled ))
{
CONS_Printf("S_InitSfxChannels(): Setting up sound channels.\n");
@ -1591,11 +1604,13 @@ void D_SRB2Main(void)
I_InitMusic();
S_InitSfxChannels(cv_soundvolume.value);
}
con_startup_loadprogress++;
S_InitMusicDefs();
CONS_Printf("ST_Init(): Init status bar.\n");
ST_Init();
con_startup_loadprogress++;
// Set up splitscreen players before joining!
if (!dedicated && (M_CheckParm("-splitscreen") && M_IsNextParm()))
@ -1613,6 +1628,7 @@ void D_SRB2Main(void)
CONS_Printf("D_CheckNetGame(): Checking network game status.\n");
if (D_CheckNetGame())
autostart = true;
con_startup_loadprogress++;
if (splitscreen && !M_CheckParm("-connect")) // Make sure multiplayer & autostart is set if you have splitscreen, even after D_CheckNetGame
multiplayer = autostart = true;