mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Loadbar plus.
* Resolves #145. * Increased granularity, to seperate out texture loading and sprite loading from other render structure initialisation. * Shows small loading string in DEVELOP builds, to show where we can optimise loading times when we're polishing. * Clean up con_refresh/startup, which got split into two variables in the merge by mistake.
This commit is contained in:
parent
8344ac3489
commit
99a764dbc0
8 changed files with 51 additions and 42 deletions
|
|
@ -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,23 @@ void CON_Drawer(void)
|
|||
Unlock_state();
|
||||
}
|
||||
|
||||
static const char *CON_LoadingStrings[LOADED_ALLDONE] =
|
||||
{
|
||||
"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 textures...", //LOADED_INITTEXTUREDATA
|
||||
"Cache sprites...", //LOADED_INITSPIRTES
|
||||
"Init rendering daemon...", //LOADED_RINIT
|
||||
"Init audio subsystem...", //LOADED_SINITSFXCHANNELS
|
||||
"Cache HUD...", //LOADED_STINIT
|
||||
"Check game status...", //LOADED_DCHECKNETGAME
|
||||
}; // see also con_loadprogress_t in console.h
|
||||
|
||||
//
|
||||
// Error handling for the loading bar, to ensure it doesn't skip any steps.
|
||||
//
|
||||
|
|
@ -1906,6 +1911,12 @@ 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]);
|
||||
|
||||
CON_DrawLoadBar(); // here we display the console text
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -1928,6 +1939,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_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT - (barheight + 8 + 4), 0, CON_LoadingStrings[con_startup_loadprogress]);
|
||||
#endif
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ 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,
|
||||
|
|
@ -40,6 +41,8 @@ typedef enum
|
|||
LOADED_ISTARTUPGRAPHICS,
|
||||
LOADED_HULOADGRAPHICS,
|
||||
LOADED_MINIT,
|
||||
LOADED_INITTEXTUREDATA,
|
||||
LOADED_INITSPRITES,
|
||||
LOADED_RINIT,
|
||||
LOADED_SINITSFXCHANNELS,
|
||||
LOADED_STINIT,
|
||||
|
|
|
|||
|
|
@ -1510,6 +1510,13 @@ void D_SRB2Main(void)
|
|||
M_Init();
|
||||
CON_SetLoadingProgress(LOADED_MINIT);
|
||||
|
||||
R_InitTextureData(); // seperated out from below because it takes ages by itself
|
||||
CON_SetLoadingProgress(LOADED_INITTEXTUREDATA);
|
||||
|
||||
CONS_Printf("R_InitSprites()...\n");
|
||||
R_InitSprites(); // ditto
|
||||
CON_SetLoadingProgress(LOADED_INITSPRITES);
|
||||
|
||||
CONS_Printf("R_Init(): Init SRB2 refresh daemon.\n");
|
||||
R_Init();
|
||||
CON_SetLoadingProgress(LOADED_RINIT);
|
||||
|
|
|
|||
30
src/r_data.c
30
src/r_data.c
|
|
@ -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();
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -1081,7 +1081,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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue