Always send gamestate to joiners.

It's cut down already outside of levels, needed to stop Lua sending mobj references during intermission though.
This is needed because in the past there was a separate way to send player information to joiners that has since been removed. Meaning player information is always desynched for joiners during anything but levels.
This commit is contained in:
Sryder 2018-07-06 20:22:24 +01:00
parent 6b3f35813a
commit 6fc29ce37d
3 changed files with 19 additions and 15 deletions

View file

@ -3535,7 +3535,7 @@ static void HandleConnect(SINT8 node)
#ifdef JOININGAME
if (nodewaiting[node])
{
if ((gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_VOTING) && newnode)
if (newnode)
{
SV_SendSaveGame(node); // send a complete game state
DEBFILE("send savegame\n");
@ -3747,13 +3747,11 @@ static void HandlePacketFromAwayNode(SINT8 node)
/// \note Wait. What if a Lua script uses some global custom variables synched with the NetVars hook?
/// Shouldn't them be downloaded even at intermission time?
/// Also, according to HandleConnect, the server will send the savegame even during intermission...
if (netbuffer->u.servercfg.gamestate == GS_LEVEL
/*|| netbuffer->u.servercfg.gamestate == GS_INTERMISSION
|| netbuffer->u.servercfg.gamestate == GS_VOTING*/)
cl_mode = CL_DOWNLOADSAVEGAME;
else
/// Sryder 2018-07-05: If we don't want to send the player config another way we need to send the gamestate
/// At almost any gamestate there could be joiners... So just always send gamestate?
cl_mode = CL_DOWNLOADSAVEGAME;
#endif
cl_mode = CL_CONNECTED;
cl_mode = CL_CONNECTED;
break;
}

View file

@ -962,13 +962,16 @@ void LUA_Archive(void)
ArchiveExtVars(&players[i], "player");
}
for (th = thinkercap.next; th != &thinkercap; th = th->next)
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
{
// archive function will determine when to skip mobjs,
// and write mobjnum in otherwise.
ArchiveExtVars(th, "mobj");
}
if (gamestate == GS_LEVEL)
{
for (th = thinkercap.next; th != &thinkercap; th = th->next)
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
{
// archive function will determine when to skip mobjs,
// and write mobjnum in otherwise.
ArchiveExtVars(th, "mobj");
}
}
WRITEUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum.
LUAh_NetArchiveHook(NetArchive); // call the NetArchive hook in archive mode

View file

@ -3195,7 +3195,10 @@ static void P_NetArchiveMisc(void)
WRITEUINT32(save_p, ARCHIVEBLOCK_MISC);
WRITEINT16(save_p, gamemap);
WRITEINT16(save_p, gamestate);
if (gamestate != GS_LEVEL)
WRITEINT16(save_p, GS_WAITINGPLAYERS); // nice hack to put people back into waitingplayers
else
WRITEINT16(save_p, gamestate);
for (i = 0; i < MAXPLAYERS; i++)
pig |= (playeringame[i] != 0)<<i;