]> 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)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 27 Oct 2011 19:59:02 +0000 (19:59 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11483 d7cf8633-e32d-0410-b094-e92efae38249

cl_demo.c
client.h

index 6c2b36d4ea1ae2e38adde76499576a925cbf36d3..6a0f194c5b88834e522cc9b667a501aa5c7a825d 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)
 {
@@ -406,6 +407,7 @@ void CL_PlayDemo_f (void)
        char    name[MAX_QPATH];
        int c;
        qboolean neg = false;
+       qfile_t *f;
 
        if (Cmd_Argc() != 2)
        {
@@ -413,6 +415,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 ();
@@ -420,19 +435,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;
@@ -447,6 +453,8 @@ void CL_PlayDemo_f (void)
 
        if (neg)
                cls.forcetrack = -cls.forcetrack;
+
+       cls.demostarting = false;
 }
 
 /*
index cd780e62e9b70d15db82f685c358c21488850eb2..a7555e86a3a4f0623a98a924d73630d219da9928 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;