]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host.c
added -demo and -demolooponly options. -demo starts the wanted demo and then shuts...
[xonotic/darkplaces.git] / host.c
diff --git a/host.c b/host.c
index a7b9d2af807db245ec9e8a92325ce5c93a1d6941..c6b493c9bed114b7f2b71c90771d0642201c818f 100644 (file)
--- a/host.c
+++ b/host.c
@@ -1040,6 +1040,26 @@ void Host_Init (void)
                Cbuf_Execute();
        }
 
+       // check for special demo mode
+// COMMANDLINEOPTION: Client: -demo <demoname> runs a playdemo and quits
+       i = COM_CheckParm("-demo");
+       if (i && i + 1 < com_argc)
+       if (!sv.active && !cls.demoplayback && !cls.connect_trying)
+       {
+               Cbuf_AddText(va("playdemo %s\n", com_argv[i + 1]));
+               Cbuf_Execute();
+       }
+
+       // check for special demolooponly mode
+// COMMANDLINEOPTION: Client: -demolooponly <demoname> runs a playdemo and quits
+       i = COM_CheckParm("-demolooponly");
+       if (i && i + 1 < com_argc)
+       if (!sv.active && !cls.demoplayback && !cls.connect_trying)
+       {
+               Cbuf_AddText(va("playdemo %s\n", com_argv[i + 1]));
+               Cbuf_Execute();
+       }
+
        if (cls.state == ca_dedicated || COM_CheckParm("-listen"))
        if (!sv.active && !cls.demoplayback && !cls.connect_trying)
        {