aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jake2/Jake2.java48
-rw-r--r--src/jake2/qcommon/Qcommon.java32
2 files changed, 66 insertions, 14 deletions
diff --git a/src/jake2/Jake2.java b/src/jake2/Jake2.java
index 737c88b..454e5df 100644
--- a/src/jake2/Jake2.java
+++ b/src/jake2/Jake2.java
@@ -2,7 +2,7 @@
* Jake2.java
* Copyright (C) 2003
*
- * $Id: Jake2.java,v 1.8 2005-07-01 14:20:53 hzi Exp $
+ * $Id: Jake2.java,v 1.9 2005-12-03 19:43:15 salomo Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -35,8 +35,7 @@ import java.util.Locale;
*/
public final class Jake2 {
-
- public static Q2DataDialog Q2Dialog = new Q2DataDialog();
+ public static Q2DataDialog Q2Dialog;
/**
* main is used to start the game. Quake2 for Java supports the following
@@ -45,9 +44,46 @@ public final class Jake2 {
* @param args
*/
public static void main(String[] args) {
-
- Locale.setDefault(Locale.US);
- Q2Dialog.setVisible(true);
+
+ boolean dedicated = false;
+
+ // check if we are in dedicated mode to hide the java dialog.
+ for (int n = 0; n < args.length; n++)
+ {
+ if (args[n].equals("+set"))
+ {
+ if (n++ >= args.length)
+ break;
+
+ if (!args[n].equals("dedicated"))
+ continue;
+
+ if (n++ >= args.length)
+ break;
+
+ if (args[n].equals("1") || args[n].equals("\"1\""))
+ {
+ Com.Printf("Starting in dedicated mode.\n");
+ dedicated = true;
+ }
+ }
+ }
+
+ // TODO: check if dedicated is set in config file
+
+ Globals.dedicated= Cvar.Get("dedicated", "0", Qcommon.CVAR_NOSET);
+
+ if (dedicated)
+ Globals.dedicated.value = 1.0f;
+
+
+ // open the q2dialog, if we are not in dedicated mode.
+ if (Globals.dedicated.value != 1.0f)
+ {
+ Q2Dialog = new Q2DataDialog();
+ Locale.setDefault(Locale.US);
+ Q2Dialog.setVisible(true);
+ }
// in C the first arg is the filename
int argc = (args == null) ? 1 : args.length + 1;
diff --git a/src/jake2/qcommon/Qcommon.java b/src/jake2/qcommon/Qcommon.java
index 9ff8177..6705d80 100644
--- a/src/jake2/qcommon/Qcommon.java
+++ b/src/jake2/qcommon/Qcommon.java
@@ -2,7 +2,7 @@
* Qcommon.java
* Copyright 2003
*
- * $Id: Qcommon.java,v 1.19 2005-07-01 14:20:56 hzi Exp $
+ * $Id: Qcommon.java,v 1.20 2005-12-03 19:43:41 salomo Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -74,15 +74,22 @@ public final class Qcommon extends Globals {
Cbuf.AddEarlyCommands(false);
Cbuf.Execute();
- Jake2.Q2Dialog.setStatus("initializing filesystem...");
+ if (Globals.dedicated.value != 1.0f)
+ Jake2.Q2Dialog.setStatus("initializing filesystem...");
+
FS.InitFilesystem();
- Jake2.Q2Dialog.setStatus("loading config...");
+ if (Globals.dedicated.value != 1.0f)
+ Jake2.Q2Dialog.setStatus("loading config...");
+
reconfigure(false);
FS.setCDDir(); // use cddir from config.cfg
FS.markBaseSearchPaths(); // mark the default search paths
- Jake2.Q2Dialog.testQ2Data(); // test for valid baseq2
+
+ if (Globals.dedicated.value != 1.0f)
+ Jake2.Q2Dialog.testQ2Data(); // test for valid baseq2
+
reconfigure(true); // reload default.cfg and config.cfg
// save config when we have a valid baseq2
@@ -110,13 +117,19 @@ public final class Qcommon extends Globals {
Cvar.Get("version", s, CVAR_SERVERINFO | CVAR_NOSET);
- Jake2.Q2Dialog.setStatus("initializing network subsystem...");
+ if (Globals.dedicated.value != 1.0f)
+ Jake2.Q2Dialog.setStatus("initializing network subsystem...");
+
NET.Init(); //ok
Netchan.Netchan_Init(); //ok
- Jake2.Q2Dialog.setStatus("initializing server subsystem...");
+ if (Globals.dedicated.value != 1.0f)
+ Jake2.Q2Dialog.setStatus("initializing server subsystem...");
SV_MAIN.SV_Init(); //ok
- Jake2.Q2Dialog.setStatus("initializing client subsystem...");
+
+ if (Globals.dedicated.value != 1.0f)
+ Jake2.Q2Dialog.setStatus("initializing client subsystem...");
+
CL.Init();
// add + commands from command line
@@ -135,7 +148,9 @@ public final class Qcommon extends Globals {
}
Com.Printf("====== Quake2 Initialized ======\n\n");
- Jake2.Q2Dialog.dispose();
+
+ if (Globals.dedicated.value != 1.0f)
+ Jake2.Q2Dialog.dispose();
} catch (longjmpException e) {
Sys.Error("Error during initialization");
@@ -240,6 +255,7 @@ public final class Qcommon extends Globals {
}
} catch (longjmpException e) {
+ Com.DPrintf("lonjmp exception:" + e);
}
}