diff options
author | Holger Zickner <[email protected]> | 2004-07-08 15:58:48 +0000 |
---|---|---|
committer | Holger Zickner <[email protected]> | 2004-07-08 15:58:48 +0000 |
commit | 4f13ea26c4f47e54e66926f0700cf631e7bb3352 (patch) | |
tree | a9d434fc462417bb981b1565fd64cea5e7c82c15 /src/jake2/client/CL.java | |
parent | 76839da3568e20f51220584d1fc92841b216505a (diff) |
import of Jake2 version hannover
Diffstat (limited to 'src/jake2/client/CL.java')
-rw-r--r-- | src/jake2/client/CL.java | 63 |
1 files changed, 36 insertions, 27 deletions
diff --git a/src/jake2/client/CL.java b/src/jake2/client/CL.java index 58ce048..3522aa2 100644 --- a/src/jake2/client/CL.java +++ b/src/jake2/client/CL.java @@ -2,7 +2,7 @@ * CL.java * Copyright (C) 2004 * - * $Id: CL.java,v 1.1 2004-07-07 19:58:33 hzi Exp $ + * $Id: CL.java,v 1.2 2004-07-08 15:58:42 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -42,7 +42,16 @@ import java.nio.ByteBuffer; */ public final class CL extends CL_pred { - //// cl_main.c -- client main loop + +// static cvar_t adr0; +// static cvar_t adr1; +// static cvar_t adr2; +// static cvar_t adr3; +// static cvar_t adr4; +// static cvar_t adr5; +// static cvar_t adr6; +// static cvar_t adr7; +// static cvar_t adr8; /* ==================== @@ -91,7 +100,6 @@ public final class CL extends CL_pred { cls.demofile = null; cls.demorecording = false; Com.Printf("Stopped demo.\n"); - } catch (IOException e) { } @@ -107,7 +115,8 @@ public final class CL extends CL_pred { Begins recording a demo from the current position ==================== */ - private static entity_state_t nullstate = new entity_state_t(null); + static entity_state_t nullstate = new entity_state_t(null); + static xcommand_t Record_f = new xcommand_t() { public void execute() { try { @@ -115,7 +124,6 @@ public final class CL extends CL_pred { byte buf_data[] = new byte[MAX_MSGLEN]; sizebuf_t buf = new sizebuf_t(); int i; - int len; entity_state_t ent; if (Cmd.Argc() != 2) { @@ -425,7 +433,7 @@ public final class CL extends CL_pred { if (cls.state >= ca_connected) to = cls.netchan.remote_address; else { - if (strlen(rcon_address.string) == 0) { + if (rcon_address.string.length() == 0) { Com.Printf( "You must either be connected,\nor set the 'rcon_address' cvar\nto issue rcon commands\n"); @@ -1033,7 +1041,7 @@ public final class CL extends CL_pred { int i, n; //char model[MAX_QPATH], skin[MAX_QPATH], * p; - String model, skin, p; + String model, skin; i = (precache_check - CS_PLAYERSKINS) / PLAYER_MULT; n = (precache_check - CS_PLAYERSKINS) % PLAYER_MULT; @@ -1195,7 +1203,7 @@ public final class CL extends CL_pred { CM.intwrap iw = new CM.intwrap(0); // for detecting cheater maps CM.CM_LoadMap(cl.configstrings[CS_MODELS + 1], true, iw); - int mapchecksum = iw.i ; +// int mapchecksum = iw.i ; CL.RegisterSounds(); CL.PrepRefresh(); return; @@ -1221,15 +1229,16 @@ public final class CL extends CL_pred { InitInput(); - adr0 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr1 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr2 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr3 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr4 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr5 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr6 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr7 = Cvar.Get("adr0", "", CVAR_ARCHIVE); - adr8 = Cvar.Get("adr0", "", CVAR_ARCHIVE); + // never used !! +// adr0 = Cvar.Get("adr0", "", CVAR_ARCHIVE); +// adr1 = Cvar.Get("adr1", "", CVAR_ARCHIVE); +// adr2 = Cvar.Get("adr2", "", CVAR_ARCHIVE); +// adr3 = Cvar.Get("adr3", "", CVAR_ARCHIVE); +// adr4 = Cvar.Get("adr4", "", CVAR_ARCHIVE); +// adr5 = Cvar.Get("adr5", "", CVAR_ARCHIVE); +// adr6 = Cvar.Get("adr6", "", CVAR_ARCHIVE); +// adr7 = Cvar.Get("adr7", "", CVAR_ARCHIVE); +// adr8 = Cvar.Get("adr8", "", CVAR_ARCHIVE); // // register our variables @@ -1367,6 +1376,10 @@ public final class CL extends CL_pred { path = FS.Gamedir() + "/config.cfg"; f = fopen(path, "rw"); + if (f == null) { + Com.Printf("Couldn't write config.cfg.\n"); + return; + } try { f.seek(0); @@ -1374,15 +1387,11 @@ public final class CL extends CL_pred { } catch (IOException e1) {} - if (f == null) { - Com.Printf("Couldn't write config.cfg.\n"); - return; - } try { f.writeBytes("// generated by quake, do not modify\n"); } catch (IOException e) {} - //fprintf (f, "// generated by quake, do not modify\n"); + Key.WriteBindings(f); fclose(f); Cvar.WriteVariables(path); @@ -1430,7 +1439,7 @@ public final class CL extends CL_pred { int i; cheatvar_t var; - if (0 == strcmp(cl.configstrings[CS_MAXCLIENTS], "1") || 0 == cl.configstrings[CS_MAXCLIENTS].length()) + if ("1".equals(cl.configstrings[CS_MAXCLIENTS]) || 0 == cl.configstrings[CS_MAXCLIENTS].length()) return; // single player can cheat // find all the cvars if we haven't done it yet @@ -1444,7 +1453,7 @@ public final class CL extends CL_pred { // make sure they are all set to the proper values for (i = 0; i < numcheatvars; i++) { var = cheatvars[i]; - if (0 != strcmp(var.var.string, var.value)) { + if (!var.var.string.equals(var.value)) { Cvar.Set(var.name, var.value); } } @@ -1485,7 +1494,7 @@ public final class CL extends CL_pred { ================== */ private static int extratime; - private static int lasttimecalled; +// private static int lasttimecalled; public static void Frame(int msec) { @@ -1531,8 +1540,8 @@ public final class CL extends CL_pred { if (!cl.refresh_prepped && cls.state == ca_active) { CL.PrepRefresh(); // TODO force GC after level loading - System.gc(); - System.gc(); + //System.gc(); + //System.gc(); } SCR.UpdateScreen(); |