]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
added -demo and -demolooponly options. -demo starts the wanted demo and then shuts...
authortomaz <tomaz@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 13 Jun 2005 14:54:52 +0000 (14:54 +0000)
committertomaz <tomaz@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 13 Jun 2005 14:54:52 +0000 (14:54 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5431 d7cf8633-e32d-0410-b094-e92efae38249

cl_demo.c
host.c
host_cmd.c
keys.c

index e9236ce823bc63a974319013059b2f2b4cf9bc9d..cdf8209cfa086e15278ac48e504f4c034d3da167 100644 (file)
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -86,6 +86,10 @@ void CL_StopPlayback (void)
 
        if (cls.timedemo)
                CL_FinishTimeDemo ();
+
+       if (COM_CheckParm("-demo") || COM_CheckParm("-demolooponly"))
+               Host_Quit_f();
+
 }
 
 /*
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)
        {
index 37b0dc9dc00bef0829758f36d76f83c4d2f746fa..b88d27bcfd993d21693465b0e4a22ca5ce93ae2b 100644 (file)
@@ -1794,7 +1794,7 @@ void Host_Startdemos_f (void)
 {
        int             i, c;
 
-       if (cls.state == ca_dedicated || COM_CheckParm("-listen"))
+       if (cls.state == ca_dedicated || COM_CheckParm("-listen") || COM_CheckParm("-benchmark") || COM_CheckParm("-demo") || COM_CheckParm("-demolooponly"))
                return;
 
        c = Cmd_Argc() - 1;
diff --git a/keys.c b/keys.c
index 0739ac71ce090f5df6ca2a99e428f3351c5732bf..8dffbe90b6a692b587c027c4bc728f7ecfcb8a6c 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -882,6 +882,11 @@ Key_Event (int key, char ascii, qboolean down)
                                        MR_Keydown( key, ascii );
                                        break;
                                case key_game:
+                                       if (COM_CheckParm ("-demolooponly"))
+                                       {
+                                               CL_Disconnect ();
+                                               return;
+                                       }
                                        MR_ToggleMenu_f();
                                        break;
                                default:
@@ -899,7 +904,8 @@ Key_Event (int key, char ascii, qboolean down)
                } else {
                        // during demo playback, all keys ingame bring up the main menu
                        if( cls.demoplayback && !key_consoleactive && key_dest == key_game ) {
-                               MR_ToggleMenu_f ();
+                               if (!COM_CheckParm ("-demolooponly"))
+                                       MR_ToggleMenu_f ();
                                return;
                        }