]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
-demo and -capturedemo: don't quit if loading another demo, only quit when no more...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 27 Oct 2011 19:59:02 +0000 (19:59 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Fri, 28 Oct 2011 22:48:41 +0000 (00:48 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11483 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=90a46021b3d3abf8077b34c0af0a587ff579c5c1

cl_demo.c
client.h

index ea10bff641738fdbcc909187d2d6e5a828c5a58b..a25be3d130971f9d6fc79a498ec4a9fca4176298 100644 (file)
--- 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;
 }
 
 /*
index f8acbcdd7c8b97151cf42c52cd2e866219d099dc..41656fe4b21f429e5d359946793dce0108597054 100644 (file)
--- 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;