Merge branch 'delete-connection-screen-and-midgame-joins' into 'next'

Delete connection screen and midgame joins

See merge request STJr/SRB2!1021
This commit is contained in:
James R 2020-06-28 18:41:07 -04:00
commit e56fc08757
5 changed files with 25 additions and 39 deletions

View File

@ -45,7 +45,7 @@
#include "lua_hook.h"
#include "md5.h"
#ifdef CLIENT_LOADINGSCREEN
#ifndef NONET
// cl loading screen
#include "v_video.h"
#include "f_finale.h"
@ -1107,19 +1107,13 @@ static void SV_AcknowledgeResynchAck(INT32 node, UINT8 rsg)
static INT16 Consistancy(void);
#ifndef NONET
#define JOININGAME
#endif
typedef enum
{
CL_SEARCHING,
CL_DOWNLOADFILES,
CL_ASKJOIN,
CL_WAITJOINRESPONSE,
#ifdef JOININGAME
CL_DOWNLOADSAVEGAME,
#endif
CL_CONNECTED,
CL_ABORTED
} cl_mode_t;
@ -1162,7 +1156,7 @@ static void CV_LoadPlayerNames(UINT8 **p)
}
}
#ifdef CLIENT_LOADINGSCREEN
#ifndef NONET
#define SNAKE_SPEED 5
#define SNAKE_NUM_BLOCKS_X 20
@ -1684,7 +1678,6 @@ static inline void CL_DrawConnectionStatus(void)
switch (cl_mode)
{
#ifdef JOININGAME
case CL_DOWNLOADSAVEGAME:
if (lastfilenum != -1)
{
@ -1710,7 +1703,6 @@ static inline void CL_DrawConnectionStatus(void)
else
cltext = M_GetText("Waiting to download game state...");
break;
#endif
case CL_ASKJOIN:
case CL_WAITJOINRESPONSE:
cltext = M_GetText("Requesting to join...");
@ -2048,7 +2040,7 @@ static boolean SV_SendServerConfig(INT32 node)
return waspacketsent;
}
#ifdef JOININGAME
#ifndef NONET
#define SAVEGAMESIZE (768*1024)
static void SV_SendSaveGame(INT32 node)
@ -2494,7 +2486,9 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
if (CL_SendFileRequest())
{
cl_mode = CL_DOWNLOADFILES;
#ifndef NONET
Snake_Initialise();
#endif
}
}
}
@ -2559,18 +2553,20 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
if (waitmore)
break; // exit the case
#ifndef NONET
if (snake)
{
free(snake);
snake = NULL;
}
#endif
cl_mode = CL_ASKJOIN; // don't break case continue to cljoin request now
/* FALLTHRU */
case CL_ASKJOIN:
CL_LoadServerFiles();
#ifdef JOININGAME
#ifndef NONET
// prepare structures to save the file
// WARNING: this can be useless in case of server not in GS_LEVEL
// but since the network layer doesn't provide ordered packets...
@ -2580,7 +2576,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
cl_mode = CL_WAITJOINRESPONSE;
break;
#ifdef JOININGAME
#ifndef NONET
case CL_DOWNLOADSAVEGAME:
// At this state, the first (and only) needed file is the gamestate
if (fileneeded[0].status == FS_FOUND)
@ -2620,11 +2616,13 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
CONS_Printf(M_GetText("Network game synchronization aborted.\n"));
// M_StartMessage(M_GetText("Network game synchronization aborted.\n\nPress ESC\n"), NULL, MM_NOTHING);
#ifndef NONET
if (snake)
{
free(snake);
snake = NULL;
}
#endif
D_QuitNetGame();
CL_Reset();
@ -2632,8 +2630,10 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
memset(gamekeydown, 0, NUMKEYS);
return false;
}
#ifndef NONET
else if (cl_mode == CL_DOWNLOADFILES && snake)
Snake_Handle();
#endif
if (client && (cl_mode == CL_DOWNLOADFILES || cl_mode == CL_DOWNLOADSAVEGAME))
FileReceiveTicker();
@ -2644,7 +2644,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
//FileSendTicker();
*oldtic = I_GetTime();
#ifdef CLIENT_LOADINGSCREEN
#ifndef NONET
if (client && cl_mode != CL_CONNECTED && cl_mode != CL_ABORTED)
{
if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_DOWNLOADSAVEGAME)
@ -2683,20 +2683,16 @@ static void CL_ConnectToServer(boolean viams)
tic_t oldtic;
#ifndef NONET
tic_t asksent;
#endif
#ifdef JOININGAME
char tmpsave[256];
sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
lastfilenum = -1;
#endif
cl_mode = CL_SEARCHING;
#ifdef CLIENT_LOADINGSCREEN
lastfilenum = -1;
#endif
#ifdef JOININGAME
#ifndef NONET
// Don't get a corrupt savegame error because tmpsave already exists
if (FIL_FileExists(tmpsave) && unlink(tmpsave) == -1)
I_Error("Can't delete %s\n", tmpsave);
@ -4217,7 +4213,7 @@ static void HandleConnect(SINT8 node)
G_SetGamestate(backupstate);
DEBFILE("new node joined\n");
}
#ifdef JOININGAME
#ifndef NONET
if (nodewaiting[node])
{
if ((gamestate == GS_LEVEL || gamestate == GS_INTERMISSION) && newnode)
@ -4229,11 +4225,6 @@ static void HandleConnect(SINT8 node)
joindelay += cv_joindelay.value * TICRATE;
player_joining = true;
}
#else
#ifndef NONET
// I guess we have no use for this if we aren't doing mid-level joins?
(void)newnode;
#endif
#endif
}
}
@ -4415,7 +4406,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
playernode[(UINT8)serverplayer] = servernode;
if (netgame)
#ifdef JOININGAME
#ifndef NONET
CONS_Printf(M_GetText("Join accepted, waiting for complete game state...\n"));
#else
CONS_Printf(M_GetText("Join accepted, waiting for next level change...\n"));
@ -4439,7 +4430,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
scp = netbuffer->u.servercfg.varlengthinputs;
CV_LoadPlayerNames(&scp);
CV_LoadNetVars(&scp);
#ifdef JOININGAME
#ifndef NONET
/// \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...

View File

@ -106,7 +106,7 @@ typedef struct
} pauseddownload_t;
static pauseddownload_t *pauseddownload = NULL;
#ifdef CLIENT_LOADINGSCREEN
#ifndef NONET
// for cl loading screen
INT32 lastfilenum = -1;
#endif
@ -188,7 +188,7 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr)
void CL_PrepareDownloadSaveGame(const char *tmpsave)
{
#ifdef CLIENT_LOADINGSCREEN
#ifndef NONET
lastfilenum = -1;
#endif
@ -1360,7 +1360,7 @@ void PT_FileFragment(void)
I_Error("Received a file not requested (file id: %d, file status: %s)\n", filenum, s);
}
#ifdef CLIENT_LOADINGSCREEN
#ifndef NONET
lastfilenum = filenum;
#endif
}

View File

@ -58,7 +58,7 @@ extern INT32 fileneedednum;
extern fileneeded_t fileneeded[MAX_WADFILES];
extern char downloaddir[512];
#ifdef CLIENT_LOADINGSCREEN
#ifndef NONET
extern INT32 lastfilenum;
#endif

View File

@ -617,11 +617,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// memory that never gets touched.
#define ALLOW_RESETDATA
#ifndef NONET
/// Display a connection screen on join attempts.
#define CLIENT_LOADINGSCREEN
#endif
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
//#define REDSANALOG

View File

@ -326,7 +326,7 @@ static inline boolean I_SkipFrame(void)
if (!paused)
return false;
//case GS_TIMEATTACK: -- sorry optimisation but now we have a cool level platter and that being laggardly looks terrible
#ifndef CLIENT_LOADINGSCREEN
#ifndef NONET
/* FALLTHRU */
case GS_WAITINGPLAYERS:
#endif