Fix dedicated servers not waiting for client wipes.

Now they run wipe logic to wait the same amount of
time that clients do, without actually rendering anything.
Previously, the server would start the new map immediately,
and clients would frameskip up to the server when they were done wiping.
This commit is contained in:
Ashnal 2020-04-20 19:08:31 -04:00 committed by Wolfy
parent 96d1946c8d
commit e33e15d87f
4 changed files with 78 additions and 43 deletions

View file

@ -5072,6 +5072,18 @@ static void CL_SendClientKeepAlive(void)
HSendPacket(servernode, false, 0, 0);
}
static void SV_SendServerKeepAlive(void)
{
for (INT32 n = 1; n < MAXNETNODES; n++)
{
if (nodeingame[n])
{
netbuffer->packettype = PT_BASICKEEPALIVE;
HSendPacket(n, false, 0, 0);
}
}
}
// send the client packet to the server
static void CL_SendClientCmd(void)
{
@ -5589,9 +5601,6 @@ void NetKeepAlive(void)
UpdatePingTable();
if (server)
CL_SendClientKeepAlive();
// Sryder: What is FILESTAMP???
FILESTAMP
GetPackets();
@ -5605,6 +5614,11 @@ FILESTAMP
CL_SendClientKeepAlive();
// No need to check for resynch because we aren't running any tics
}
else
{
SV_SendServerKeepAlive();
}
// No else because no tics are being run and we can't resynch during this
Net_AckTicker();

View file

@ -279,16 +279,11 @@ static void D_Display(void)
INT32 wipedefindex = 0;
UINT8 i;
if (dedicated)
return;
if (!dedicated)
{
if (nodrawers)
return; // for comparative timing/profiling
// check for change of screen size (video mode)
if (setmodeneeded && !wipe)
SCR_SetMode(); // change video mode
if (vid.recalc)
SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc()
@ -302,6 +297,7 @@ static void D_Display(void)
// draw buffered stuff to screen
// Used only by linux GGI version
I_UpdateNoBlit();
}
// save the current screen if about to wipe
wipe = (gamestate != wipegamestate);
@ -319,7 +315,7 @@ static void D_Display(void)
wipedefindex = wipe_multinter_toblack;
}
if (rendermode != render_none)
if (!dedicated)
{
// Fade to black first
if (gamestate != GS_LEVEL // fades to black on its own timing, always
@ -339,7 +335,15 @@ static void D_Display(void)
F_WipeStartScreen();
}
else //dedicated servers
{
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
wipegamestate = gamestate;
}
}
if (dedicated) //bail out after wipe logic
return false;
// do buffered drawing
switch (gamestate)

View file

@ -372,7 +372,9 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
HWR_DoWipe(wipetype, wipeframe-1); // send in the wipe type and wipeframe because we need to cache the graphic
else
#endif
if (rendermode != render_none) //this allows F_RunWipe to be called in dedicated servers
F_DoWipe(fmask);
I_OsPolling();
I_UpdateNoBlit();

View file

@ -2889,10 +2889,12 @@ boolean P_SetupLevel(boolean skipprecip)
// Encore mode fade to pink to white
// This is handled BEFORE sounds are stopped.
if (rendermode != render_none && encoremode && !prevencoremode && !demo.rewinding)
if (encoremode && !prevencoremode && !demo.rewinding)
{
tic_t locstarttime, endtime, nowtime;
if (rendermode != render_none)
{
S_StopMusic(); // er, about that...
S_StartSound(NULL, sfx_ruby1);
@ -2908,6 +2910,12 @@ boolean P_SetupLevel(boolean skipprecip)
F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_level_final], false);
}
else //dedicated servers can call this now, to wait the appropriate amount of time for clients to wipe
{
F_RunWipe(wipedefs[wipe_speclevel_towhite], false);
F_RunWipe(wipedefs[wipe_level_final], false);
}
locstarttime = nowtime = lastwipetic;
endtime = locstarttime + (3*TICRATE)/2;
@ -2941,7 +2949,9 @@ boolean P_SetupLevel(boolean skipprecip)
// Let's fade to white here
// But only if we didn't do the encore startup wipe
if (rendermode != render_none && !ranspecialwipe && !demo.rewinding)
if (!ranspecialwipe && !demo.rewinding)
{
if(rendermode != render_none)
{
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
@ -2949,6 +2959,11 @@ boolean P_SetupLevel(boolean skipprecip)
F_WipeEndScreen();
F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false);
}
else //dedicated servers
{
F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false);
}
}
// Reset the palette now all fades have been done
if (rendermode != render_none)