shithub: qk1

Download patch

ref: f53460241b611845164bc681092ac29a78c02a59
parent: 4f3df5a4769f0374cbffb485559c7796028361f1
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Wed Nov 1 05:42:29 EDT 2023

support "+map ad_tears"-style command-line arguments

--- a/host.c
+++ b/host.c
@@ -578,8 +578,10 @@
 Host_Init
 ====================
 */
-void Host_Init (void)
+void Host_Init (int argc, char **argv)
 {
+	int i;
+
 	Memory_Init();
 	Cbuf_Init ();
 	Cmd_Init ();	
@@ -625,7 +627,18 @@
 
 	host_hunklevel = Hunk_Mark ();
 
-	host_initialized = true;	
+	host_initialized = true;
+
+	if(argc < 1 || **argv != '+')
+		return;
+	for(i = 0; i < argc;){
+		Cbuf_AddText(argv[i++]+1);
+		while(i < argc && argv[i][0] != '+'){
+			Cbuf_AddText(" ");
+			Cbuf_AddText(argv[i++]);
+		}
+		Cbuf_AddText("\n");
+	}	
 }
 
 
--- a/qk1.c
+++ b/qk1.c
@@ -112,7 +112,7 @@
 	/* ignore fp exceptions: rendering shit assumes they are */
 	setfcr(getfcr() & ~(FPOVFL|FPUNFL|FPINVAL|FPZDIV));
 	notify(croak);
-	Host_Init();
+	Host_Init(argc, argv);
 	t = dtime() - 1.0 / Fpsmax;
 	for(;;){
 		t´ = dtime();
--- a/quakedef.h
+++ b/quakedef.h
@@ -182,7 +182,7 @@
 void Host_ClearMemory (void);
 void Host_ServerFrame (void);
 void Host_InitCommands (void);
-void Host_Init (void);
+void Host_Init (int argc, char **argv);
 void Host_Shutdown(void);
 void Host_Error (char *error, ...);
 void Host_EndGame (char *message, ...);