Avoid using too much performance to update the loading screen, especially on low-end PCs

This commit is contained in:
smallmodel 2024-10-10 19:48:23 +02:00
parent be5deddc1d
commit a3050f6c64
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512

View file

@ -136,7 +136,8 @@ static unsigned int startCountHigh;
static unsigned int loadCountLow;
static unsigned int loadCountHigh;
static unsigned int loadCount;
static unsigned int lastTime;
static unsigned int lastTime = 0;
static unsigned int updateTime = 0;
static unsigned int loadNumber;
static unsigned int totalLoadTime;
static unsigned int currentLoadTime;
@ -5507,12 +5508,19 @@ UI_TestUpdateScreen
void UI_TestUpdateScreen(unsigned int timeout)
{
unsigned int newTime = Sys_Milliseconds();
unsigned int startRenderTime, endRenderTime;
if (newTime - lastTime >= timeout) {
lastTime = newTime;
Sys_PumpMessageLoop();
SCR_UpdateScreen();
if (timeout > 0 && (newTime - lastTime) < (timeout + updateTime)) {
return;
}
startRenderTime = Sys_Milliseconds();
Sys_PumpMessageLoop();
SCR_UpdateScreen();
endRenderTime = Sys_Milliseconds();
updateTime = Q_min(endRenderTime - startRenderTime, 1000);
lastTime = endRenderTime;
}
/*