From: tomaz Date: Mon, 13 Jun 2005 14:54:52 +0000 (+0000) Subject: added -demo and -demolooponly options. -demo starts the wanted demo and then shuts... X-Git-Tag: xonotic-v0.1.0preview~4751 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=838d1f2208ac272d6474eefdccba1c6021eaa9e8;p=xonotic%2Fdarkplaces.git added -demo and -demolooponly options. -demo starts the wanted demo and then shuts down the engine once done. -demolooponly does pretty mucht the same except it disables all keys but the escape key and makes escape key quit the engine. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5431 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_demo.c b/cl_demo.c index e9236ce8..cdf8209c 100644 --- 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 a7b9d2af..c6b493c9 100644 --- a/host.c +++ b/host.c @@ -1040,6 +1040,26 @@ void Host_Init (void) Cbuf_Execute(); } + // check for special demo mode +// COMMANDLINEOPTION: Client: -demo 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 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) { diff --git a/host_cmd.c b/host_cmd.c index 37b0dc9d..b88d27bc 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -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 0739ac71..8dffbe90 100644 --- 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; }