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); 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 // send the client packet to the server
static void CL_SendClientCmd(void) static void CL_SendClientCmd(void)
{ {
@ -5589,9 +5601,6 @@ void NetKeepAlive(void)
UpdatePingTable(); UpdatePingTable();
if (server)
CL_SendClientKeepAlive();
// Sryder: What is FILESTAMP??? // Sryder: What is FILESTAMP???
FILESTAMP FILESTAMP
GetPackets(); GetPackets();
@ -5605,6 +5614,11 @@ FILESTAMP
CL_SendClientKeepAlive(); CL_SendClientKeepAlive();
// No need to check for resynch because we aren't running any tics // 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 // No else because no tics are being run and we can't resynch during this
Net_AckTicker(); Net_AckTicker();

View file

@ -279,29 +279,25 @@ static void D_Display(void)
INT32 wipedefindex = 0; INT32 wipedefindex = 0;
UINT8 i; UINT8 i;
if (dedicated) if (!dedicated)
return;
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()
// change the view size if needed
if (setsizeneeded)
{ {
R_ExecuteSetViewSize(); if (nodrawers)
forcerefresh = true; // force background redraw return; // for comparative timing/profiling
}
// draw buffered stuff to screen if (vid.recalc)
// Used only by linux GGI version SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc()
I_UpdateNoBlit();
// change the view size if needed
if (setsizeneeded)
{
R_ExecuteSetViewSize();
forcerefresh = true; // force background redraw
}
// draw buffered stuff to screen
// Used only by linux GGI version
I_UpdateNoBlit();
}
// save the current screen if about to wipe // save the current screen if about to wipe
wipe = (gamestate != wipegamestate); wipe = (gamestate != wipegamestate);
@ -319,7 +315,7 @@ static void D_Display(void)
wipedefindex = wipe_multinter_toblack; wipedefindex = wipe_multinter_toblack;
} }
if (rendermode != render_none) if (!dedicated)
{ {
// Fade to black first // Fade to black first
if (gamestate != GS_LEVEL // fades to black on its own timing, always if (gamestate != GS_LEVEL // fades to black on its own timing, always
@ -339,8 +335,16 @@ static void D_Display(void)
F_WipeStartScreen(); 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 // do buffered drawing
switch (gamestate) 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 HWR_DoWipe(wipetype, wipeframe-1); // send in the wipe type and wipeframe because we need to cache the graphic
else else
#endif #endif
F_DoWipe(fmask); if (rendermode != render_none) //this allows F_RunWipe to be called in dedicated servers
F_DoWipe(fmask);
I_OsPolling(); I_OsPolling();
I_UpdateNoBlit(); I_UpdateNoBlit();

View file

@ -2889,26 +2889,34 @@ boolean P_SetupLevel(boolean skipprecip)
// Encore mode fade to pink to white // Encore mode fade to pink to white
// This is handled BEFORE sounds are stopped. // 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; tic_t locstarttime, endtime, nowtime;
S_StopMusic(); // er, about that... if (rendermode != render_none)
{
S_StopMusic(); // er, about that...
S_StartSound(NULL, sfx_ruby1); S_StartSound(NULL, sfx_ruby1);
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 122); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 122);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_speclevel_towhite], false); F_RunWipe(wipedefs[wipe_speclevel_towhite], false);
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 120); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 120);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_level_final], false);
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; locstarttime = nowtime = lastwipetic;
endtime = locstarttime + (3*TICRATE)/2; endtime = locstarttime + (3*TICRATE)/2;
@ -2941,13 +2949,20 @@ boolean P_SetupLevel(boolean skipprecip)
// Let's fade to white here // Let's fade to white here
// But only if we didn't do the encore startup wipe // But only if we didn't do the encore startup wipe
if (rendermode != render_none && !ranspecialwipe && !demo.rewinding) if (!ranspecialwipe && !demo.rewinding)
{ {
F_WipeStartScreen(); if(rendermode != render_none)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol); {
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false); 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 // Reset the palette now all fades have been done