diff options
-rw-r--r-- | src/jake2/client/CL_parse.java | 25 | ||||
-rw-r--r-- | src/jake2/qcommon/CM.java | 84 | ||||
-rw-r--r-- | src/jake2/qcommon/Netchan.java | 59 | ||||
-rw-r--r-- | src/jake2/sys/NET.java | 6 |
4 files changed, 68 insertions, 106 deletions
diff --git a/src/jake2/client/CL_parse.java b/src/jake2/client/CL_parse.java index f17813f..471efad 100644 --- a/src/jake2/client/CL_parse.java +++ b/src/jake2/client/CL_parse.java @@ -21,6 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +// $Id: CL_parse.java,v 1.23 2007-04-15 20:12:32 salomo Exp $ + package jake2.client; import jake2.Defines; @@ -57,11 +60,10 @@ public class CL_parse { return FS.Gamedir() + "/" + fn; } - /* - * =============== CL_CheckOrDownloadFile - * - * Returns true if the file exists, otherwise it attempts to start a - * download from the server. =============== + /** + * CL_CheckOrDownloadFile returns true if the file exists, + * otherwise it attempts to start a + * download from the server. */ public static boolean CheckOrDownloadFile(String filename) { RandomAccessFile fp; @@ -231,12 +233,12 @@ public class CL_parse { } } - //fwrite(net_message.data[net_message.readcount], 1, size, - // cls.download); + try { Globals.cls.download.write(Globals.net_message.data, Globals.net_message.readcount, size); - } catch (Exception e) { + } + catch (Exception e) { } Globals.net_message.readcount += size; @@ -248,14 +250,11 @@ public class CL_parse { SZ.Print(Globals.cls.netchan.message, "nextdl"); } else { String oldn, newn; - //char oldn[MAX_OSPATH]; - //char newn[MAX_OSPATH]; - - // Com.Printf ("100%%\n"); try { Globals.cls.download.close(); - } catch (IOException e) { + } + catch (IOException e) { } // rename the temp file to it's final name diff --git a/src/jake2/qcommon/CM.java b/src/jake2/qcommon/CM.java index e352844..a751723 100644 --- a/src/jake2/qcommon/CM.java +++ b/src/jake2/qcommon/CM.java @@ -20,7 +20,7 @@ // Created on 02.01.2004 by RST. -// $Id: CM.java,v 1.12 2005-12-04 21:00:17 cawe Exp $ +// $Id: CM.java,v 1.13 2007-04-15 20:12:33 salomo Exp $ package jake2.qcommon; @@ -207,7 +207,6 @@ public class CM { int checksum[]) { Com.DPrintf("CM_LoadMap(" + name + ")...\n"); byte buf[]; - int i; qfiles.dheader_t header; int length; @@ -330,15 +329,12 @@ public class CM { } out.headnode = in.headnode; if (debugloadmap) { - Com - .DPrintf( - "|%6i|%8.2f|%8.2f|%8.2f| %8.2f|%8.2f|%8.2f| %8.2f|%8.2f|%8.2f|\n", - new Vargs().add(out.headnode) - .add(out.origin[0]).add(out.origin[1]) - .add(out.origin[2]).add(out.mins[0]) - .add(out.mins[1]).add(out.mins[2]).add( - out.maxs[0]).add(out.maxs[1]) - .add(out.maxs[2])); + Com.DPrintf( + "|%6i|%8.2f|%8.2f|%8.2f| %8.2f|%8.2f|%8.2f| %8.2f|%8.2f|%8.2f|\n", + new Vargs().add(out.headnode) + .add(out.origin[0]).add(out.origin[1]).add(out.origin[2]) + .add(out.mins[0]).add(out.mins[1]).add(out.mins[2]) + .add(out.maxs[0]).add(out.maxs[1]).add(out.maxs[2])); } } } @@ -456,10 +452,9 @@ public class CM { out.contents = in.contents; if (debugloadmap) { - Com - .DPrintf("| %6i| %6i| %8X|\n", new Vargs().add( - out.firstbrushside).add(out.numsides).add( - out.contents)); + Com.DPrintf("| %6i| %6i| %8X|\n", new Vargs().add( + out.firstbrushside).add(out.numsides).add( + out.contents)); } } } @@ -1257,8 +1252,8 @@ public class CM { trace.contents = brush.contents; } - /* - * ================ CM_TraceToLeaf ================ + /** + * CM_TraceToLeaf. */ public static void CM_TraceToLeaf(int leafnum) { int k; @@ -1512,11 +1507,9 @@ public class CM { return trace_trace; } - /* - * ================== CM_TransformedBoxTrace - * - * Handles offseting and rotation of the end points for moving and rotating - * entities ================== + /** + * CM_TransformedBoxTrace handles offseting and rotation of the end points for moving and rotating + * entities. */ public static trace_t TransformedBoxTrace(float[] start, float[] end, float[] mins, float[] maxs, int headnode, int brushmask, @@ -1669,8 +1662,8 @@ public class CM { } } - /* - * ==================== FloodAreaConnections ==================== + /** + * FloodAreaConnections. */ public static void FloodAreaConnections() { Com.DPrintf("FloodAreaConnections...\n"); @@ -1695,8 +1688,8 @@ public class CM { } } - /* - * ================= CM_SetAreaPortalState ================= + /** + * CM_SetAreaPortalState. */ public static void CM_SetAreaPortalState(int portalnum, boolean open) { if (portalnum > numareaportals) @@ -1706,8 +1699,8 @@ public class CM { FloodAreaConnections(); } - /* - * ================= CM_AreasConnected ================= + /** + * CM_AreasConnected returns true, if two areas are connected. */ public static boolean CM_AreasConnected(int area1, int area2) { @@ -1723,13 +1716,11 @@ public class CM { return false; } - /* - * ================= CM_WriteAreaBits - * - * Writes a length byte followed by a bit vector of all the areas that area + /** + * CM_WriteAreaBits writes a length byte followed by a bit vector of all the areas that area * in the same flood as the area parameter * - * This is used by the client refreshes to cull visibility ================= + * This is used by the client refreshes to cull visibility. */ public static int CM_WriteAreaBits(byte buffer[], int area) { int i; @@ -1738,7 +1729,8 @@ public class CM { bytes = (numareas + 7) >> 3; - if (map_noareas.value != 0) { // for debugging, send everything + if (map_noareas.value != 0) { + // for debugging, send everything Arrays.fill(buffer, 0, bytes, (byte) 255); } else { Arrays.fill(buffer, 0, bytes, (byte) 0); @@ -1752,17 +1744,13 @@ public class CM { return bytes; } - /* - * =================== CM_WritePortalState - * - * Writes the portal state to a savegame file =================== + /** + * CM_WritePortalState writes the portal state to a savegame file. */ public static void CM_WritePortalState(RandomAccessFile os) { - //was: fwrite(portalopen, sizeof(portalopen), 1, f); try { - for (int n = 0; n < portalopen.length; n++) if (portalopen[n]) os.writeInt(1); @@ -1774,11 +1762,9 @@ public class CM { } } - /* - * =================== CM_ReadPortalState - * - * Reads the portal state from a savegame file and recalculates the area - * connections =================== + /** + * CM_ReadPortalState reads the portal state from a savegame file and recalculates the area + * connections. */ public static void CM_ReadPortalState(RandomAccessFile f) { @@ -1798,11 +1784,9 @@ public class CM { FloodAreaConnections(); } - /* - * ============= CM_HeadnodeVisible - * - * Returns true if any leaf under headnode has a cluster that is potentially - * visible ============= + /** + * CM_HeadnodeVisible returns true if any leaf under headnode has a cluster that is potentially + * visible. */ public static boolean CM_HeadnodeVisible(int nodenum, byte visbits[]) { int leafnum; diff --git a/src/jake2/qcommon/Netchan.java b/src/jake2/qcommon/Netchan.java index 2157d12..4c29433 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.7 2005-12-18 22:10:08 cawe Exp $ + * $Id: Netchan.java,v 1.8 2007-04-15 20:12:33 salomo Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -102,12 +102,10 @@ public final class Netchan extends SV_MAIN { public static byte net_message_buffer[] = new byte[Defines.MAX_MSGLEN]; - /* - * =============== Netchan_Init + /** + * Netchan_Init. * - * =============== */ - //ok. public static void Netchan_Init() { long port; @@ -121,12 +119,10 @@ public final class Netchan extends SV_MAIN { private static final byte send_buf[] = new byte[Defines.MAX_MSGLEN]; private static final sizebuf_t send = new sizebuf_t(); - /* - * =============== Netchan_OutOfBand - * - * Sends an out-of-band datagram ================ + + /** + * Netchan_OutOfBand. Sends an out-of-band datagram. */ - //ok. public static void Netchan_OutOfBand(int net_socket, netadr_t adr, int length, byte data[]) { @@ -144,14 +140,10 @@ public final class Netchan extends SV_MAIN { Netchan_OutOfBand(net_socket, adr, s.length(), Lib.stringToBytes(s)); } - /* - * ============== Netchan_Setup - * - * called to open a channel to a remote system ============== + /** + * Netchan_Setup is alled to open a channel to a remote system. */ public static void Setup(int sock, netchan_t chan, netadr_t adr, int qport) { - //memset (chan, 0, sizeof(*chan)); - chan.clear(); chan.sock = sock; chan.remote_address.set(adr); @@ -164,10 +156,8 @@ public final class Netchan extends SV_MAIN { chan.message.allowoverflow = true; } - /* - * =============== Netchan_CanReliable - * - * Returns true if the last reliable message has acked ================ + /** + * Netchan_CanReliable. Returns true if the last reliable message has acked. */ public static boolean Netchan_CanReliable(netchan_t chan) { if (chan.reliable_length != 0) @@ -175,7 +165,7 @@ public final class Netchan extends SV_MAIN { return true; } - // das ist richtig !!! + public static boolean Netchan_NeedReliable(netchan_t chan) { boolean send_reliable; @@ -195,16 +185,12 @@ public final class Netchan extends SV_MAIN { return send_reliable; } - // private static final byte send_buf[] = new byte[Defines.MAX_MSGLEN]; - // private static final sizebuf_t send = new sizebuf_t(); - /* - * =============== Netchan_Transmit - * - * tries to send an unreliable message to a connection, and handles the - * transmition / retransmition of the reliable messages. + /** + * Netchan_Transmit tries to send an unreliable message to a connection, + * and handles the transmition / retransmition of the reliable messages. * * A 0 length will still generate a packet and deal with the reliable - * messages. ================ + * messages. */ public static void Transmit(netchan_t chan, int length, byte data[]) { int send_reliable; @@ -263,7 +249,6 @@ public final class Netchan extends SV_MAIN { if (showpackets.value != 0) { if (send_reliable != 0) Com.Printf( - //"send %4i : s=%i reliable=%i ack=%i rack=%i\n" "send " + send.cursize + " : s=" + (chan.outgoing_sequence - 1) + " reliable=" + chan.reliable_sequence + " ack=" @@ -271,7 +256,6 @@ public final class Netchan extends SV_MAIN { + chan.incoming_reliable_sequence + "\n"); else Com.Printf( - //"send %4i : s=%i ack=%i rack=%i\n" "send " + send.cursize + " : s=" + (chan.outgoing_sequence - 1) + " ack=" + chan.incoming_sequence + " rack=" @@ -279,11 +263,9 @@ public final class Netchan extends SV_MAIN { } } - /* - * ================= Netchan_Process - * - * called when the current net_message is from remote_address modifies - * net_message so that it points to the packet payload ================= + /** + * Netchan_Process is called when the current net_message is from remote_address modifies + * net_message so that it points to the packet payload. */ public static boolean Process(netchan_t chan, sizebuf_t msg) { int sequence, sequence_ack; @@ -309,16 +291,13 @@ public final class Netchan extends SV_MAIN { if (showpackets.value != 0) { if (reliable_message != 0) Com.Printf( - //"recv %4i : s=%i reliable=%i ack=%i rack=%i\n" "recv " + msg.cursize + " : s=" + sequence + " reliable=" + (chan.incoming_reliable_sequence ^ 1) + " ack=" + sequence_ack + " rack=" + reliable_ack + "\n"); else - Com - .Printf( - //"recv %4i : s=%i ack=%i rack=%i\n" + Com.Printf( "recv " + msg.cursize + " : s=" + sequence + " ack=" + sequence_ack + " rack=" + reliable_ack + "\n"); } diff --git a/src/jake2/sys/NET.java b/src/jake2/sys/NET.java index 15968fe..9a1b78e 100644 --- a/src/jake2/sys/NET.java +++ b/src/jake2/sys/NET.java @@ -1,7 +1,7 @@ /* * NET.java Copyright (C) 2003 * - * $Id: NET.java,v 1.10 2006-01-11 22:04:42 hzi Exp $ + * $Id: NET.java,v 1.11 2007-04-15 20:12:33 salomo Exp $ */ /* * Copyright (C) 1997-2001 Id Software, Inc. @@ -167,8 +167,8 @@ public final class NET { */ public static boolean GetLoopPacket(int sock, netadr_t net_from, sizebuf_t net_message) { - loopback_t loop; - loop = loopbacks[sock]; + + loopback_t loop = loopbacks[sock]; if (loop.send - loop.get > MAX_LOOPBACK) loop.get = loop.send - MAX_LOOPBACK; |