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

View file

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

View file

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

View file

@ -617,11 +617,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// memory that never gets touched. /// memory that never gets touched.
#define ALLOW_RESETDATA #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.) /// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
//#define REDSANALOG //#define REDSANALOG

View file

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