Backport framelimitter fix

# Conflicts:
#	source/rr/src/demo.cpp
#	source/rr/src/game.cpp
#	source/rr/src/net.cpp
#	source/rr/src/screens.cpp
This commit is contained in:
nukeykt 2019-07-28 19:15:35 +09:00 committed by Christoph Oelckers
parent 6fea4bf527
commit 3458a88f8e
10 changed files with 46 additions and 32 deletions

View file

@ -459,6 +459,7 @@ void PreloadCache(void)
{
Bsprintf(tempbuf, "Loaded %d%% (%d/%d textures)\n", percentDisplayed, cnt, nPrecacheCount);
viewLoadingScreenUpdate(tempbuf, percentDisplayed);
videoNextPage();
timerUpdate();
if (totalclock - clock >= 1)
@ -1694,6 +1695,7 @@ RESTART:
default:
break;
}
videoNextPage();
}
//scrNextPage();
if (TestBitString(gotpic, 2342))

View file

@ -411,6 +411,7 @@ _DEMOPLAYBACK:
viewDrawScreen();
if (gInputMode == INPUT_MODE_1 && CGameMenuMgr::m_bActive)
gGameMenuMgr.Draw();
videoNextPage();
}
if (TestBitString(gotpic, 2342))
{

View file

@ -2071,6 +2071,7 @@ void SaveGame(CGameMenuItemZEditBitmap *pItem, CGameMenuEvent *event)
sprintf(gGameOptions.szSaveGameName, "%s", strSaveGameName);
gGameOptions.nSaveGameSlot = nSlot;
viewLoadingScreen(2518, "Saving", "Saving Your Game", strRestoreGameStrings[nSlot]);
videoNextPage();
gSaveGameNum = nSlot;
LoadSave::SaveGame(strSaveGameName);
gQuickSaveSlot = nSlot;
@ -2092,6 +2093,7 @@ void QuickSaveGame(void)
sprintf(gGameOptions.szSaveGameName, "%s", strSaveGameName);
gGameOptions.nSaveGameSlot = gQuickSaveSlot;
viewLoadingScreen(2518, "Saving", "Saving Your Game", strRestoreGameStrings[gQuickSaveSlot]);
videoNextPage();
LoadSave::SaveGame(strSaveGameName);
gGameOptions.picEntry = gSavedOffset;
gSaveGameOptions[gQuickSaveSlot] = gGameOptions;
@ -2110,6 +2112,7 @@ void LoadGame(CGameMenuItemZEditBitmap *pItem, CGameMenuEvent *event)
if (!testkopen(strLoadGameName, 0))
return;
viewLoadingScreen(2518, "Loading", "Loading Saved Game", strRestoreGameStrings[nSlot]);
videoNextPage();
LoadSave::LoadGame(strLoadGameName);
gGameMenuMgr.Deactivate();
gQuickLoadSlot = nSlot;
@ -2124,6 +2127,7 @@ void QuickLoadGame(void)
if (!testkopen(strLoadGameName, 0))
return;
viewLoadingScreen(2518, "Loading", "Loading Saved Game", strRestoreGameStrings[gQuickLoadSlot]);
videoNextPage();
LoadSave::LoadGame(strLoadGameName);
gGameMenuMgr.Deactivate();
}

View file

@ -996,6 +996,7 @@ void netInitialize(bool bConsole)
char buffer[128];
sprintf(buffer, "Waiting for players (%i\\%i)", numplayers, gNetPlayers);
viewLoadingScreen(2518, "Network Game", NULL, buffer);
videoNextPage();
}
while (numplayers < gNetPlayers)
{
@ -1037,6 +1038,7 @@ void netInitialize(bool bConsole)
char buffer[128];
sprintf(buffer, "Waiting for players (%i\\%i)", numplayers, gNetPlayers);
viewLoadingScreen(2518, "Network Game", NULL, buffer);
videoNextPage();
}
break;
}
@ -1068,6 +1070,7 @@ void netInitialize(bool bConsole)
char buffer[128];
sprintf(buffer, "Waiting for players (%i\\%i)", numplayers, gNetPlayers);
viewLoadingScreen(2518, "Network Game", NULL, buffer);
videoNextPage();
}
break;
}
@ -1129,6 +1132,7 @@ void netInitialize(bool bConsole)
if (!bConsole)
{
viewLoadingScreen(2518, "Network Game", NULL, buffer);
videoNextPage();
}
gNetENetClient = enet_host_create(NULL, 1, BLOOD_ENET_CHANNEL_MAX, 0, 0);
enet_address_set_host(&gNetENetAddress, gNetAddress);
@ -1153,6 +1157,7 @@ void netInitialize(bool bConsole)
if (!bConsole)
{
viewLoadingScreen(2518, "Network Game", NULL, "Waiting for server response");
videoNextPage();
}
while (bWaitServer)
{

View file

@ -2918,24 +2918,27 @@ double g_frameDelay = 0.0;
int viewFPSLimit(void)
{
static auto nextPageTicks = (double)timerGetTicksU64();
static unsigned frameWaiting = 0;
static double nextPageDelay = g_frameDelay;
static uint64_t lastFrameTicks = timerGetTicksU64() - (uint64_t) g_frameDelay;
int frameWaiting = 0;
if (frameWaiting)
uint64_t const frameTicks = timerGetTicksU64();
uint64_t elapsedTime = frameTicks-lastFrameTicks;
if (!r_maxfps || elapsedTime >= (uint64_t) nextPageDelay)
{
frameWaiting--;
videoNextPage();
}
if (elapsedTime >= (uint64_t) (nextPageDelay + g_frameDelay))
{
//If we missed a frame, reset any cumulated remainder from rendering frames early
nextPageDelay = g_frameDelay;
}
else
{
nextPageDelay += g_frameDelay - elapsedTime;
}
auto const frameTicks = (double)timerGetTicksU64();
if (!r_maxfps || frameTicks >= nextPageTicks)
{
if (frameTicks >= nextPageTicks + g_frameDelay)
nextPageTicks = frameTicks;
nextPageTicks += g_frameDelay;
frameWaiting++;
lastFrameTicks = frameTicks;
++frameWaiting;
}
return frameWaiting;
@ -3588,7 +3591,6 @@ void viewLoadingScreenUpdate(const char *pzText4, int nPercent)
TileHGauge(2260, 86, 110, nPercent, 100, 0, 131072);
viewDrawText(3, "Please Wait", 160, 134, -128, 0, 1, 1);
scrNextPage();
}
void viewLoadingScreen(int nTile, const char *pText, const char *pText2, const char *pText3)

View file

@ -1046,7 +1046,7 @@ nextdemo_nomenu:
if ((g_player[myconnectindex].ps->gm&MODE_MENU) && (g_player[myconnectindex].ps->gm&MODE_EOL))
{
Demo_FinishProfile();
videoNextPage();
videoNextPage();
goto RECHECK;
}
@ -1105,7 +1105,7 @@ nextdemo_nomenu:
if (ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, BETAVERSION, 0, 0, 2+8+16+128);
}
videoNextPage();
videoNextPage();
}
// NOTE: We must prevent handleevents() and Net_GetPackets() from

View file

@ -8424,7 +8424,7 @@ MAIN_LOOP_RESTART:
if (videoGetRenderMode() >= REND_POLYMOST)
G_DrawBackground();
G_DisplayRest(smoothRatio);
videoNextPage();
videoNextPage();
if (gameUpdate)
{

View file

@ -1147,8 +1147,7 @@ void Screen_Play(void)
if (I_CheckAllInput())
running = 0;
// nextpage();
videoNextPage();
I_ClearAllInput();
videoNextPage();
} while (running);

View file

@ -170,9 +170,9 @@ void Net_WaitForEverybody(void)
if (G_FPSLimit())
{
display_betascreen();
gametext_center_shade(170, "Waiting for server", 14);
videoNextPage();
}
gametext_center_shade(170, "Waiting for players", 14);
videoNextPage();
};
G_HandleAsync();
Net_GetPackets();

View file

@ -1632,7 +1632,7 @@ void G_DisplayLogo(void)
P_SetGamePalette(g_player[myconnectindex].ps, g_player[myconnectindex].ps->palette, 0);
g_restorePalette = 0;
}
videoNextPage();
videoNextPage();
}
}
@ -1723,7 +1723,8 @@ void G_DisplayLogo(void)
P_SetGamePalette(g_player[myconnectindex].ps, g_player[myconnectindex].ps->palette, 0);
g_restorePalette = 0;
}
videoNextPage();
videoNextPage();
}
G_HandleAsync();
@ -1911,7 +1912,8 @@ static void G_BonusCutscenes(void)
rotatesprite_fs(breathe[t+3]<<16, breathe[t+4]<<16, 65536L, 0, breathe[t+2], 0, 0, 2+8+16+64+128+BGSTRETCH);
}
}
videoNextPage();
videoNextPage();
}
G_HandleAsync();
@ -2311,7 +2313,7 @@ void G_BonusScreen(int32_t bonusonly)
{
videoClearScreen(0);
G_DisplayMPResultsScreen();
videoNextPage();
videoNextPage();
}
if (I_CheckAllInput())
@ -2679,7 +2681,7 @@ void G_BonusScreen(int32_t bonusonly)
else
break;
videoNextPage();
videoNextPage();
}
} while (1);
if (g_turdLevel)
@ -2905,7 +2907,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
{
videoClearScreen(0);
G_DisplayMPResultsScreen();
videoNextPage();
videoNextPage();
}
if (I_CheckAllInput())
@ -3190,8 +3192,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
}
else
break;
videoNextPage();
videoNextPage();
}
} while (1);
if (ud.eog)