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 e9236ce..cdf8209 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 a7b9d2a..c6b493c 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 37b0dc9..b88d27b 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 0739ac7..8dffbe9 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;
                        }