diff options
Diffstat (limited to 'src/jake2')
-rw-r--r-- | src/jake2/Jake2.java | 16 | ||||
-rw-r--r-- | src/jake2/client/CL.java | 8 | ||||
-rw-r--r-- | src/jake2/client/Menu.java | 11 | ||||
-rw-r--r-- | src/jake2/client/SCR.java | 14 | ||||
-rw-r--r-- | src/jake2/client/V.java | 6 | ||||
-rw-r--r-- | src/jake2/qcommon/Netchan.java | 6 | ||||
-rw-r--r-- | src/jake2/qcommon/Qcommon.java | 9 | ||||
-rw-r--r-- | src/jake2/server/SV_MAIN.java | 23 | ||||
-rw-r--r-- | src/jake2/sys/JOGLKBD.java | 2 | ||||
-rw-r--r-- | src/jake2/sys/LWJGLKBD.java | 4 | ||||
-rw-r--r-- | src/jake2/sys/Sys.java | 9 | ||||
-rw-r--r-- | src/jake2/sys/Timer.java | 5 |
12 files changed, 46 insertions, 67 deletions
diff --git a/src/jake2/Jake2.java b/src/jake2/Jake2.java index 2155a19..737c88b 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.7 2005-05-12 12:52:50 hzi Exp $ + * $Id: Jake2.java,v 1.8 2005-07-01 14:20:53 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -25,9 +25,8 @@ */ package jake2; -import jake2.client.SCR; import jake2.qcommon.*; -import jake2.sys.Sys; +import jake2.sys.Timer; import java.util.Locale; @@ -61,21 +60,14 @@ public final class Jake2 { Globals.nostdout = Cvar.Get("nostdout", "0", 0); - int oldtime = Sys.Milliseconds(); + int oldtime = Timer.Milliseconds(); int newtime; int time; while (true) { // find time spending rendering last frame - newtime = Sys.Milliseconds(); + newtime = Timer.Milliseconds(); time = newtime - oldtime; - // TODO this is a timer hack for Win2000 - // System.currentTimeMillis() resolution bug - if (time == 0 - && (Globals.cl_timedemo.value != 0 || SCR.fps.value != 0)) { - time++; - } - if (time > 0) Qcommon.Frame(time); oldtime = newtime; diff --git a/src/jake2/client/CL.java b/src/jake2/client/CL.java index 83a1191..7266668 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.22 2005-06-07 12:57:21 hzi Exp $ + * $Id: CL.java,v 1.23 2005-07-01 14:20:48 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -732,7 +732,7 @@ public final class CL { if (Globals.cl_timedemo != null && Globals.cl_timedemo.value != 0.0f) { int time; - time = (int) (Sys.Milliseconds() - Globals.cl.timedemo_start); + time = (int) (Timer.Milliseconds() - Globals.cl.timedemo_start); if (time > 0) Com.Printf("%i frames, %3.1f seconds: %3.1f fps\n", new Vargs(3).add(Globals.cl.timedemo_frames).add( @@ -1276,7 +1276,7 @@ public final class CL { */ public static void InitLocal() { Globals.cls.state = Defines.ca_disconnected; - Globals.cls.realtime = Sys.Milliseconds(); + Globals.cls.realtime = Timer.Milliseconds(); CL_input.InitInput(); @@ -1542,7 +1542,7 @@ public final class CL { // if in the debugger last frame, don't timeout if (msec > 5000) - Globals.cls.netchan.last_received = Sys.Milliseconds(); + Globals.cls.netchan.last_received = Timer.Milliseconds(); // fetch results from server ReadPackets(); diff --git a/src/jake2/client/Menu.java b/src/jake2/client/Menu.java index c6b2923..4e582dd 100644 --- a/src/jake2/client/Menu.java +++ b/src/jake2/client/Menu.java @@ -2,7 +2,7 @@ * Menu.java * Copyright (C) 2004 * - * $Id: Menu.java,v 1.18 2005-02-09 20:47:30 cawe Exp $ + * $Id: Menu.java,v 1.19 2005-07-01 14:20:50 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -30,6 +30,7 @@ import jake2.game.Cmd; import jake2.game.cvar_t; import jake2.qcommon.*; import jake2.sound.S; +import jake2.sys.*; import jake2.sys.NET; import jake2.sys.Sys; import jake2.util.*; @@ -776,7 +777,7 @@ public final class Menu extends Key { if (bind_grab) re.DrawChar(menu.x, menu.y + menu.cursor * 9, '='); else - re.DrawChar(menu.x, menu.y + menu.cursor * 9, 12 + ((int) (Sys + re.DrawChar(menu.x, menu.y + menu.cursor * 9, 12 + ((int) (Timer .Milliseconds() / 250) & 1)); } @@ -4405,7 +4406,7 @@ public final class Menu extends Key { else offset = f.cursor; - if ((((int) (Sys.Milliseconds() / 250)) & 1) != 0) { + if ((((int) (Timer.Milliseconds() / 250)) & 1) != 0) { re.DrawChar(f.x + f.parent.x + (offset + 2) * 8 + 8, f.y + f.parent.y, 11); } else { @@ -4648,10 +4649,10 @@ public final class Menu extends Key { } else if (item != null && item.type != MTYPE_FIELD) { if ((item.flags & QMF_LEFT_JUSTIFY) != 0) { re.DrawChar(menu.x + item.x - 24 + item.cursor_offset, menu.y - + item.y, 12 + ((int) (Sys.Milliseconds() / 250) & 1)); + + item.y, 12 + ((int) (Timer.Milliseconds() / 250) & 1)); } else { re.DrawChar(menu.x + item.cursor_offset, menu.y + item.y, - 12 + ((int) (Sys.Milliseconds() / 250) & 1)); + 12 + ((int) (Timer.Milliseconds() / 250) & 1)); } } diff --git a/src/jake2/client/SCR.java b/src/jake2/client/SCR.java index df685e7..67aaf3c 100644 --- a/src/jake2/client/SCR.java +++ b/src/jake2/client/SCR.java @@ -2,7 +2,7 @@ * SCR.java * Copyright (C) 2003 * - * $Id: SCR.java,v 1.14 2005-02-08 20:33:33 cawe Exp $ + * $Id: SCR.java,v 1.15 2005-07-01 14:20:52 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -31,8 +31,8 @@ import jake2.Globals; import jake2.game.Cmd; import jake2.game.cvar_t; import jake2.qcommon.*; -import jake2.sound.*; -import jake2.sys.Sys; +import jake2.sound.S; +import jake2.sys.Timer; import jake2.util.Lib; import jake2.util.Vargs; @@ -588,7 +588,7 @@ public final class SCR extends Globals { scr_draw_loading = 1; UpdateScreen(); - cls.disable_screen = Sys.Milliseconds(); + cls.disable_screen = Timer.Milliseconds(); cls.disable_servercount = cl.servercount; } @@ -618,7 +618,7 @@ public final class SCR extends Globals { if (cls.state != ca_active) return; - start = Sys.Milliseconds(); + start = Timer.Milliseconds(); if (Cmd.Argc() == 2) { // run without page flipping re.BeginFrame(0); @@ -637,7 +637,7 @@ public final class SCR extends Globals { } } - stop = Sys.Milliseconds(); + stop = Timer.Milliseconds(); time = (stop - start) / 1000.0f; Com.Printf("%f seconds (%f fps)\n", new Vargs(2).add(time).add( 128.0f / time)); @@ -1178,7 +1178,7 @@ public final class SCR extends Globals { // changing) // do nothing at all if (cls.disable_screen != 0) { - if (Sys.Milliseconds() - cls.disable_screen > 120000) { + if (Timer.Milliseconds() - cls.disable_screen > 120000) { cls.disable_screen = 0; Com.Printf("Loading plaque timed out.\n"); } diff --git a/src/jake2/client/V.java b/src/jake2/client/V.java index 329613c..01eb171 100644 --- a/src/jake2/client/V.java +++ b/src/jake2/client/V.java @@ -2,7 +2,7 @@ * V.java * Copyright (C) 2003 * - * $Id: V.java,v 1.4 2005-01-20 23:15:23 cawe Exp $ + * $Id: V.java,v 1.5 2005-07-01 14:20:50 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -29,7 +29,7 @@ import jake2.Globals; import jake2.game.Cmd; import jake2.game.cvar_t; import jake2.qcommon.*; -import jake2.sys.Sys; +import jake2.sys.Timer; import jake2.util.Math3D; import jake2.util.Vargs; @@ -283,7 +283,7 @@ public final class V extends Globals { if (cl_timedemo.value != 0.0f) { if (cl.timedemo_start == 0) - cl.timedemo_start = Sys.Milliseconds(); + cl.timedemo_start = Timer.Milliseconds(); cl.timedemo_frames++; } diff --git a/src/jake2/qcommon/Netchan.java b/src/jake2/qcommon/Netchan.java index 9f594ef..202a499 100644 --- a/src/jake2/qcommon/Netchan.java +++ b/src/jake2/qcommon/Netchan.java @@ -2,7 +2,7 @@ * NetChannel.java * Copyright (C) 2003 * - * $Id: Netchan.java,v 1.5 2005-01-17 21:55:45 cawe Exp $ + * $Id: Netchan.java,v 1.6 2005-07-01 14:20:56 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -30,7 +30,7 @@ import jake2.Globals; import jake2.game.cvar_t; import jake2.server.SV_MAIN; import jake2.sys.NET; -import jake2.sys.Sys; +import jake2.sys.Timer; /** * Netchan @@ -111,7 +111,7 @@ public final class Netchan extends SV_MAIN { long port; // pick a port value that should be nice and random - port = Sys.Milliseconds() & 0xffff; + port = Timer.Milliseconds() & 0xffff; showpackets = Cvar.Get("showpackets", "0", 0); showdrop = Cvar.Get("showdrop", "0", 0); diff --git a/src/jake2/qcommon/Qcommon.java b/src/jake2/qcommon/Qcommon.java index 9041a04..9ff8177 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.18 2005-06-28 08:41:19 hzi Exp $ + * $Id: Qcommon.java,v 1.19 2005-07-01 14:20:56 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -30,6 +30,7 @@ import jake2.Jake2; import jake2.client.*; import jake2.game.Cmd; import jake2.server.SV_MAIN; +import jake2.sys.*; import jake2.sys.NET; import jake2.sys.Sys; import jake2.util.Vargs; @@ -212,19 +213,19 @@ public final class Qcommon extends Globals { int time_after= 0; if (Globals.host_speeds.value != 0.0f) - time_before= Sys.Milliseconds(); + time_before= Timer.Milliseconds(); Com.debugContext = "SV:"; SV_MAIN.SV_Frame(msec); if (Globals.host_speeds.value != 0.0f) - time_between= Sys.Milliseconds(); + time_between= Timer.Milliseconds(); Com.debugContext = "CL:"; CL.Frame(msec); if (Globals.host_speeds.value != 0.0f) { - time_after= Sys.Milliseconds(); + time_after= Timer.Milliseconds(); int all= time_after - time_before; int sv= time_between - time_before; diff --git a/src/jake2/server/SV_MAIN.java b/src/jake2/server/SV_MAIN.java index ef3bef2..679ab73 100644 --- a/src/jake2/server/SV_MAIN.java +++ b/src/jake2/server/SV_MAIN.java @@ -19,26 +19,15 @@ */ // Created on 13.01.2004 by RST. -// $Id: SV_MAIN.java,v 1.10 2005-02-19 21:22:34 salomo Exp $ +// $Id: SV_MAIN.java,v 1.11 2005-07-01 14:20:55 hzi Exp $ package jake2.server; import jake2.Defines; import jake2.Globals; -import jake2.game.Cmd; -import jake2.game.GameBase; -import jake2.game.Info; -import jake2.game.PlayerClient; -import jake2.game.cvar_t; -import jake2.game.edict_t; -import jake2.qcommon.Com; -import jake2.qcommon.Cvar; -import jake2.qcommon.FS; -import jake2.qcommon.MSG; -import jake2.qcommon.Netchan; -import jake2.qcommon.SZ; -import jake2.qcommon.netadr_t; +import jake2.game.*; +import jake2.qcommon.*; import jake2.sys.NET; -import jake2.sys.Sys; +import jake2.sys.Timer; import jake2.util.Lib; import java.io.IOException; @@ -715,7 +704,7 @@ public class SV_MAIN { */ public static void SV_RunGameFrame() { if (Globals.host_speeds.value != 0) - Globals.time_before_game = Sys.Milliseconds(); + Globals.time_before_game = Timer.Milliseconds(); // we always need to bump framenum, even if we // don't run the world, otherwise the delta @@ -737,7 +726,7 @@ public class SV_MAIN { } if (Globals.host_speeds.value != 0) - Globals.time_after_game = Sys.Milliseconds(); + Globals.time_after_game = Timer.Milliseconds(); } diff --git a/src/jake2/sys/JOGLKBD.java b/src/jake2/sys/JOGLKBD.java index 5f08133..59b3361 100644 --- a/src/jake2/sys/JOGLKBD.java +++ b/src/jake2/sys/JOGLKBD.java @@ -209,7 +209,7 @@ final public class JOGLKBD extends KBD } public void Do_Key_Event(int key, boolean down) { - Key.Event(key, down, Sys.Milliseconds()); + Key.Event(key, down, Timer.Milliseconds()); } public void centerMouse() { diff --git a/src/jake2/sys/LWJGLKBD.java b/src/jake2/sys/LWJGLKBD.java index cdcfcca..071a212 100644 --- a/src/jake2/sys/LWJGLKBD.java +++ b/src/jake2/sys/LWJGLKBD.java @@ -35,7 +35,7 @@ public class LWJGLKBD extends KBD { mouseHasTwoButtons = (Mouse.getButtonCount() == 2); - lastRepeat = Sys.Milliseconds(); + lastRepeat = Timer.Milliseconds(); } catch (Exception e) {;} } @@ -207,7 +207,7 @@ public class LWJGLKBD extends KBD { } public void Do_Key_Event(int key, boolean down) { - Key.Event(key, down, Sys.Milliseconds()); + Key.Event(key, down, Timer.Milliseconds()); } public void installGrabs() diff --git a/src/jake2/sys/Sys.java b/src/jake2/sys/Sys.java index aeb30fc..498750a 100644 --- a/src/jake2/sys/Sys.java +++ b/src/jake2/sys/Sys.java @@ -2,7 +2,7 @@ * Sys.java * Copyright (C) 2003 * - * $Id: Sys.java,v 1.10 2004-12-14 00:11:01 hzi Exp $ + * $Id: Sys.java,v 1.11 2005-07-01 14:20:54 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -181,11 +181,6 @@ public final class Sys extends Defines { } - private static long secbase = System.currentTimeMillis(); - - public static int Milliseconds() { - return Globals.curtime = (int) (System.currentTimeMillis() - secbase); - } //============================================ @@ -230,7 +225,7 @@ public final class Sys extends Defines { Globals.re.getKeyboardHandler().Update(); // grab frame time - Globals.sys_frame_time = Sys.Milliseconds(); + Globals.sys_frame_time = Timer.Milliseconds(); } public static String GetClipboardData() { diff --git a/src/jake2/sys/Timer.java b/src/jake2/sys/Timer.java index 4eede1f..683e6b6 100644 --- a/src/jake2/sys/Timer.java +++ b/src/jake2/sys/Timer.java @@ -2,11 +2,12 @@ * Timer.java * Copyright (C) 2005 * - * $Id: Timer.java,v 1.1 2005-07-01 14:11:01 hzi Exp $ + * $Id: Timer.java,v 1.2 2005-07-01 14:20:54 hzi Exp $ */ package jake2.sys; import jake2.Globals; +import jake2.qcommon.Com; public abstract class Timer { @@ -26,7 +27,7 @@ public abstract class Timer { t = new StandardTimer(); } } - System.out.println("using " + t.getClass().getName()); + Com.Println("using " + t.getClass().getName()); } public static int Milliseconds() { |