-static double loadingscreen_lastupdate;
-
-static void SCR_UpdateVars(void);
-
-void SCR_UpdateLoadingScreen (qbool clear, qbool startup)
-{
- keydest_t old_key_dest;
- int old_key_consoleactive;
-
- // don't do anything if not initialized yet
- if (vid_hidden || cls.state == ca_dedicated)
- return;
-
- // limit update rate
- if (scr_loadingscreen_maxfps.value)
- {
- double t = Sys_DirtyTime();
- if ((t - loadingscreen_lastupdate) < 1.0f/scr_loadingscreen_maxfps.value)
- return;
- loadingscreen_lastupdate = t;
- }
-
- // set up the r_texture_gammaramps texture which we need for rendering the loadingscreenpic
- R_UpdateVariables();
-
- if(!scr_loadingscreen_background.integer)
- clear = true;
-
- if(loadingscreendone)
- clear |= loadingscreencleared;
-
- if(!loadingscreendone)
- {
- if(startup && scr_loadingscreen_firstforstartup.integer)
- loadingscreenpic_number = 0;
- else if(scr_loadingscreen_firstforstartup.integer)
- if(scr_loadingscreen_count.integer > 1)
- loadingscreenpic_number = rand() % (scr_loadingscreen_count.integer - 1) + 1;
- else
- loadingscreenpic_number = 0;
- else
- loadingscreenpic_number = rand() % (scr_loadingscreen_count.integer > 1 ? scr_loadingscreen_count.integer : 1);
- }
-
- if(clear)
- SCR_ClearLoadingScreenTexture();
- else if(!loadingscreendone)
- SCR_SetLoadingScreenTexture();
-
- if(!loadingscreendone)
- {
- loadingscreendone = true;
- loadingscreenheight = 0;
- }
- loadingscreencleared = clear;
-
-#ifdef USE_GLES2
- SCR_DrawLoadingScreen_SharedSetup(clear);
- SCR_DrawLoadingScreen();
-#else
- SCR_DrawLoadingScreen_SharedSetup(clear);
- if (vid.stereobuffer)
- {
- qglDrawBuffer(GL_BACK_LEFT);
- SCR_DrawLoadingScreen();
- qglDrawBuffer(GL_BACK_RIGHT);
- SCR_DrawLoadingScreen();
- }
- else
- {
- qglDrawBuffer(GL_BACK);
- SCR_DrawLoadingScreen();
- }
-#endif
-
- DrawQ_Finish();
- R_Mesh_Finish();
- // refresh
- VID_Finish();
-
- // this goes into the event loop, and should prevent unresponsive cursor on vista
- old_key_dest = key_dest;
- old_key_consoleactive = key_consoleactive;
- key_dest = key_void;
- key_consoleactive = false;
- Key_EventQueue_Block(); Sys_SendKeyEvents();
- key_dest = old_key_dest;
- key_consoleactive = old_key_consoleactive;