Merge branch 'loadbar_plus' into '22-merge-again'

(22mergeagain) Loadbar plus

See merge request KartKrew/Kart!407
This commit is contained in:
Sal 2021-03-31 10:47:24 -04:00
commit 553d708525
10 changed files with 108 additions and 104 deletions

View file

@ -57,7 +57,6 @@ I_mutex con_mutex;
static boolean con_started = false; // console has been initialised
boolean con_startup = false; // true at game startup
boolean con_refresh = false; // screen needs refreshing
con_loadprogress_t con_startup_loadprogress = 0; // Progress for startup load bar
@ -457,7 +456,6 @@ void CON_Init(void)
con_started = true;
con_startup = true;
con_refresh = true; // needs explicit screen refresh until we are in the main game loop
consoletoggle = false;
Unlock_state();
@ -477,7 +475,6 @@ void CON_Init(void)
con_started = true;
con_startup = false;
con_refresh = false; // disable explicit screen refresh
consoletoggle = true;
Unlock_state();
@ -1497,7 +1494,6 @@ void CONS_Printf(const char *fmt, ...)
{
va_list argptr;
static char *txt = NULL;
boolean refresh;
if (txt == NULL)
txt = malloc(8192);
@ -1519,16 +1515,8 @@ void CONS_Printf(const char *fmt, ...)
// make sure new text is visible
con_scrollup = 0;
refresh = con_refresh;
Unlock_state();
// if not in display loop, force screen update
if (refresh)
{
CON_Drawer(); // here we display the console text
I_FinishUpdate(); // page flip or blit buffer
}
}
void CONS_Alert(alerttype_t level, const char *fmt, ...)
@ -1892,6 +1880,25 @@ void CON_Drawer(void)
Unlock_state();
}
static const char *CON_LoadingStrings[LOADED_ALLDONE+1] =
{
"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_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
//
// Error handling for the loading bar, to ensure it doesn't skip any steps.
//
@ -1906,6 +1913,14 @@ void CON_SetLoadingProgress(con_loadprogress_t newStep)
}
con_startup_loadprogress = newStep;
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
}
//
@ -1928,6 +1943,10 @@ 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_DrawString(4, BASEVIDHEIGHT - (barheight + 8 + 4), 0, CON_LoadingStrings[con_startup_loadprogress]);
#endif
Unlock_state();
}

View file

@ -28,9 +28,7 @@ extern boolean con_recalc;
// console being displayed at game startup
extern boolean con_startup;
// needs explicit screen refresh until we are in the main game loop
extern boolean con_refresh;
// when modifying the below, you must also adjust d_main and console.c
typedef enum
{
LOADED_ZINIT = 1,
@ -38,8 +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

@ -706,7 +706,6 @@ void D_SRB2Loop(void)
oldentertics = I_GetTime();
// end of loading screen: CONS_Printf() will no more call FinishUpdate()
con_refresh = false;
con_startup = false;
// make sure to do a d_display to init mode _before_ load a level
@ -1435,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.
@ -1448,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));
@ -1464,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
@ -1480,35 +1479,28 @@ 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
CON_SetLoadingProgress(LOADED_CONFIG);
// 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;
}
}
CONS_Printf("R_InitTextureData()...\n");
R_InitTextureData(); // seperated out from below because it takes ages by itself
CON_SetLoadingProgress(LOADED_INITTEXTUREDATA);
if (M_CheckParm("-noupload"))
COM_BufAddText("downloading 0\n");
CONS_Printf("R_InitSprites()...\n");
R_InitSprites(); // ditto
CON_SetLoadingProgress(LOADED_INITSPRITES);
CONS_Printf("M_Init(): Init miscellaneous info.\n");
M_Init();
CON_SetLoadingProgress(LOADED_MINIT);
CONS_Printf("R_InitSkins()...\n");
R_InitSkins(); // ditto
CON_SetLoadingProgress(LOADED_INITSKINS);
CONS_Printf("R_Init(): Init SRB2 refresh daemon.\n");
R_Init();
@ -1556,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

@ -262,27 +262,10 @@ static void R_InitExtraColormaps(void)
}
#endif
//
// R_InitSpriteLumps
// Finds the width and hoffset of all sprites in the wad, so the sprite does not need to be
// cached completely, just for having the header info ready during rendering.
//
//
// allocate sprite lookup tables
//
static void R_InitSpriteLumps(void)
{
numspritelumps = 0;
max_spritelumps = 8192;
Z_Malloc(max_spritelumps*sizeof(*spritecachedinfo), PU_STATIC, &spritecachedinfo);
}
//
// R_InitColormaps
//
static void R_InitColormaps(void)
void R_InitColormaps(void)
{
size_t len;
lumpnum_t lump;
@ -1180,12 +1163,12 @@ static void R_Init8to16(void)
}
//
// R_InitData
// R_InitTextureData
//
// Locates all the lumps that will be used by all views
// Must be called after W_Init.
//
void R_InitData(void)
void R_InitTextureData(void)
{
if (highcolor)
{
@ -1198,13 +1181,6 @@ void R_InitData(void)
CONS_Printf("P_InitPicAnims()...\n");
P_InitPicAnims();
CONS_Printf("R_InitSprites()...\n");
R_InitSpriteLumps();
R_InitSprites();
CONS_Printf("R_InitColormaps()...\n");
R_InitColormaps();
}
//

View file

@ -46,7 +46,7 @@ extern CV_PossibleValue_t Color_cons_t[];
extern CV_PossibleValue_t Followercolor_cons_t[]; // follower colours table, not a duplicate because of the "Match" option.
// I/O, setting up the stuff.
void R_InitData(void);
void R_InitTextureData(void);
void R_PrecacheLevel(void);
extern size_t flatmemory, spritememory, texturememory;
@ -58,6 +58,7 @@ extern size_t flatmemory, spritememory, texturememory;
// Uncomment to make extra_colormaps order Newest -> Oldest
//#define COLORMAPREVERSELIST
void R_InitColormaps(void);
void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap);
void R_ClearColormaps(void);
extracolormap_t *R_CreateDefaultColormap(boolean lighttable);

View file

@ -1084,7 +1084,9 @@ void R_Init(void)
{
// screensize independent
//I_OutputMsg("\nR_InitData");
R_InitData();
//R_InitData(); -- split to d_main for its own startup steps since it takes AGES
CONS_Printf("R_InitColormaps()...\n");
R_InitColormaps();
//I_OutputMsg("\nR_InitViewBorder");
R_InitViewBorder();

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

@ -513,6 +513,11 @@ void R_InitSprites(void)
float fa;
#endif
// allocate sprite lookup tables
numspritelumps = 0;
max_spritelumps = 8192;
Z_Malloc(max_spritelumps*sizeof(*spritecachedinfo), PU_STATIC, &spritecachedinfo);
for (i = 0; i < MAXVIDWIDTH; i++)
negonearray[i] = -1;
@ -541,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_CONFIG)
return false;
#define diffcons(cv) (cv.value != atoi(cv.defaultvalue))
doinggamma = diffcons(cv_globalgamma);
@ -1089,7 +1092,7 @@ void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c)
return;
#ifdef HWRENDER
if (rendermode != render_soft && !con_startup)
if (rendermode == render_opengl)
{
HWR_DrawDiag(x, y, wh, c);
return;