From: divverent Date: Thu, 27 Oct 2011 19:59:02 +0000 (+0000) Subject: -demo and -capturedemo: don't quit if loading another demo, only quit when no more... X-Git-Tag: xonotic-v0.6.0~216 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5193c14694fed35216fd7e012ca11c82e7d81b13;p=xonotic%2Fdarkplaces.git -demo and -capturedemo: don't quit if loading another demo, only quit when no more demos are started git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11483 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=90a46021b3d3abf8077b34c0af0a587ff579c5c1 --- diff --git a/cl_demo.c b/cl_demo.c index ea10bff6..a25be3d1 100644 --- a/cl_demo.c +++ b/cl_demo.c @@ -88,8 +88,9 @@ void CL_StopPlayback (void) if (cls.timedemo) CL_FinishTimeDemo (); - if (COM_CheckParm("-demo") || COM_CheckParm("-capturedemo")) - Host_Quit_f(); + if (!cls.demostarting) // only quit if not starting another demo + if (COM_CheckParm("-demo") || COM_CheckParm("-capturedemo")) + Host_Quit_f(); } @@ -98,7 +99,7 @@ void CL_StopPlayback (void) CL_WriteDemoMessage Dumps the current net message, prefixed by the length and view angles -==================== +#==================== */ void CL_WriteDemoMessage (sizebuf_t *message) { @@ -400,6 +401,7 @@ void CL_PlayDemo_f (void) char name[MAX_QPATH]; int c; qboolean neg = false; + qfile_t *f; if (Cmd_Argc() != 2) { @@ -407,6 +409,19 @@ void CL_PlayDemo_f (void) return; } + // open the demo file + strlcpy (name, Cmd_Argv(1), sizeof (name)); + FS_DefaultExtension (name, ".dem", sizeof (name)); + f = FS_OpenVirtualFile(name, false); + if (!f) + { + Con_Printf("ERROR: couldn't open %s.\n", name); + cls.demonum = -1; // stop demo loop + return; + } + + cls.demostarting = true; + // disconnect from server CL_Disconnect (); Host_ShutdownServer (); @@ -414,19 +429,10 @@ void CL_PlayDemo_f (void) // update networking ports (this is mainly just needed at startup) NetConn_UpdateSockets(); - // open the demo file - strlcpy (name, Cmd_Argv(1), sizeof (name)); - FS_DefaultExtension (name, ".dem", sizeof (name)); cls.protocol = PROTOCOL_QUAKE; Con_Printf("Playing demo %s.\n", name); - cls.demofile = FS_OpenVirtualFile(name, false); - if (!cls.demofile) - { - Con_Print("ERROR: couldn't open.\n"); - cls.demonum = -1; // stop demo loop - return; - } + cls.demofile = f; strlcpy(cls.demoname, name, sizeof(cls.demoname)); cls.demoplayback = true; @@ -441,6 +447,8 @@ void CL_PlayDemo_f (void) if (neg) cls.forcetrack = -cls.forcetrack; + + cls.demostarting = false; } /* diff --git a/client.h b/client.h index f8acbcdd..41656fe4 100644 --- a/client.h +++ b/client.h @@ -632,6 +632,7 @@ typedef struct client_static_s fs_offset_t demo_lastcsprogssize; int demo_lastcsprogscrc; qboolean demoplayback; + qboolean demostarting; // set if currently starting a demo, to stop -demo from quitting when switching to another demo qboolean timedemo; // -1 = use normal cd track int forcetrack;