aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/server
diff options
context:
space:
mode:
authorHolger Zickner <[email protected]>2004-07-08 15:58:48 +0000
committerHolger Zickner <[email protected]>2004-07-08 15:58:48 +0000
commit4f13ea26c4f47e54e66926f0700cf631e7bb3352 (patch)
treea9d434fc462417bb981b1565fd64cea5e7c82c15 /src/jake2/server
parent76839da3568e20f51220584d1fc92841b216505a (diff)
import of Jake2 version hannover
Diffstat (limited to 'src/jake2/server')
-rw-r--r--src/jake2/server/SV.java4
-rw-r--r--src/jake2/server/SV_CCMDS.java10
-rw-r--r--src/jake2/server/SV_ENTS.java10
-rw-r--r--src/jake2/server/SV_GAME.java8
-rw-r--r--src/jake2/server/SV_INIT.java4
-rw-r--r--src/jake2/server/SV_MAIN.java23
-rw-r--r--src/jake2/server/SV_USER.java18
-rw-r--r--src/jake2/server/SV_WORLD.java159
8 files changed, 136 insertions, 100 deletions
diff --git a/src/jake2/server/SV.java b/src/jake2/server/SV.java
index d00b104..def4112 100644
--- a/src/jake2/server/SV.java
+++ b/src/jake2/server/SV.java
@@ -2,7 +2,7 @@
* SV.java
* Copyright (C) 2003
*
- * $Id: SV.java,v 1.1 2004-07-07 19:59:46 hzi Exp $
+ * $Id: SV.java,v 1.2 2004-07-08 15:58:45 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -119,7 +119,7 @@ public final class SV {
float[] dir = { 0.0f, 0.0f, 0.0f };
float d;
int numplanes;
- float[][] planes = new float[3][GameBase.MAX_CLIP_PLANES];
+ float[][] planes = new float[GameBase.MAX_CLIP_PLANES][3];
float[] primal_velocity = { 0.0f, 0.0f, 0.0f };
float[] original_velocity = { 0.0f, 0.0f, 0.0f };
float[] new_velocity = { 0.0f, 0.0f, 0.0f };
diff --git a/src/jake2/server/SV_CCMDS.java b/src/jake2/server/SV_CCMDS.java
index baa1478..6c71224 100644
--- a/src/jake2/server/SV_CCMDS.java
+++ b/src/jake2/server/SV_CCMDS.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 18.01.2004 by RST.
-// $Id: SV_CCMDS.java,v 1.1 2004-07-07 19:59:47 hzi Exp $
+// $Id: SV_CCMDS.java,v 1.2 2004-07-08 15:58:45 hzi Exp $
package jake2.server;
@@ -297,7 +297,7 @@ public class SV_CCMDS extends SV_ENTS {
CopyFile(name, name2);
String name1 = FS.Gamedir() + "/save/" + src + "/";
- len = strlen(name1);
+ len = name1.length();
name = FS.Gamedir() + "/save/" + src + "/*.sav";
found = Sys.FindFirst(name, 0, 0);
@@ -458,7 +458,7 @@ public class SV_CCMDS extends SV_ENTS {
for (var = Globals.cvar_vars; var != null; var = var.next) {
if (0 == (var.flags & CVAR_LATCH))
continue;
- if (strlen(var.name) >= MAX_OSPATH - 1 || strlen(var.string) >= 128 - 1) {
+ if (var.name.length() >= MAX_OSPATH - 1 || var.string.length() >= 128 - 1) {
Com.Printf("Cvar too long: " + var.name + " = " + var.string + "\n");
continue;
}
@@ -851,7 +851,7 @@ public class SV_CCMDS extends SV_ENTS {
}
Com.Printf("%s", new Vargs().add(cl.name));
- l = 16 - strlen(cl.name);
+ l = 16 - cl.name.length();
for (j = 0; j < l; j++)
Com.Printf(" ");
@@ -859,7 +859,7 @@ public class SV_CCMDS extends SV_ENTS {
s = NET.AdrToString(cl.netchan.remote_address);
Com.Printf(s);
- l = 22 - strlen(s);
+ l = 22 - s.length();
for (j = 0; j < l; j++)
Com.Printf(" ");
diff --git a/src/jake2/server/SV_ENTS.java b/src/jake2/server/SV_ENTS.java
index de27378..6437dff 100644
--- a/src/jake2/server/SV_ENTS.java
+++ b/src/jake2/server/SV_ENTS.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 17.01.2004 by RST.
-// $Id: SV_ENTS.java,v 1.1 2004-07-07 19:59:45 hzi Exp $
+// $Id: SV_ENTS.java,v 1.2 2004-07-08 15:58:45 hzi Exp $
package jake2.server;
@@ -129,7 +129,9 @@ public class SV_ENTS extends SV_USER {
static void SV_WritePlayerstateToClient(client_frame_t from, client_frame_t to, sizebuf_t msg) {
int i;
int pflags;
+ // ptr
player_state_t ps, ops;
+ // mem
player_state_t dummy;
int statbits;
@@ -301,13 +303,13 @@ public class SV_ENTS extends SV_USER {
==================
*/
public static void SV_WriteFrameToClient(client_t client, sizebuf_t msg) {
+ //ptr
client_frame_t frame, oldframe;
int lastframe;
//Com.Printf ("%i . %i\n", new Vargs().add(client.lastframe).add(sv.framenum));
// this is the frame we are creating
frame = client.frames[sv.framenum & UPDATE_MASK];
-
if (client.lastframe <= 0) { // client is asking for a retransmit
oldframe = null;
lastframe = -1;
@@ -447,7 +449,7 @@ public class SV_ENTS extends SV_USER {
frame.areabytes = CM.CM_WriteAreaBits(frame.areabits, clientarea);
// grab the current player_state_t
- frame.ps = clent.client.ps;
+ frame.ps.set(clent.client.ps);
SV_FatPVS(org);
clientphs = CM.CM_ClusterPHS(clientcluster);
@@ -529,7 +531,7 @@ public class SV_ENTS extends SV_USER {
}
//*state = ent.s;
- svs.client_entities[ix] = ent.s;
+ svs.client_entities[ix].set(ent.s);
// don't mark players missiles as solid
if (ent.owner == client.edict)
diff --git a/src/jake2/server/SV_GAME.java b/src/jake2/server/SV_GAME.java
index eba5a84..c6d433b 100644
--- a/src/jake2/server/SV_GAME.java
+++ b/src/jake2/server/SV_GAME.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 14.01.2004 by RST.
-// $Id: SV_GAME.java,v 1.1 2004-07-07 19:59:47 hzi Exp $
+// $Id: SV_GAME.java,v 1.2 2004-07-08 15:58:45 hzi Exp $
package jake2.server;
@@ -174,7 +174,7 @@ public class SV_GAME extends SV_INIT {
i = SV_ModelIndex(name);
- // ent.model = name;
+ //ent.model = name;
ent.s.modelindex = i;
// if it is an inline model, get the size information for it
@@ -262,7 +262,7 @@ public class SV_GAME extends SV_INIT {
cluster = CM.CM_LeafCluster(leafnum);
area2 = CM.CM_LeafArea(leafnum);
- if (mask != null && (0 == (mask[cluster >> 3] & (1 << (cluster & 7)))))
+ if (mask != null && (0 == (mask[cluster >>> 3] & (1 << (cluster & 7)))))
return false;
if (!CM.CM_AreasConnected(area1, area2))
@@ -293,7 +293,7 @@ public class SV_GAME extends SV_INIT {
cluster = CM.CM_LeafCluster(leafnum);
area2 = CM.CM_LeafArea(leafnum);
- if (mask != null && (0 == (mask[cluster >> 3] & (1 << (cluster & 7)))))
+ if (mask != null && (0 == (mask[cluster >>> 3] & (1 << (cluster & 7)))))
return false; // more than one bounce away
if (!CM.CM_AreasConnected(area1, area2))
return false; // a door blocks hearing
diff --git a/src/jake2/server/SV_INIT.java b/src/jake2/server/SV_INIT.java
index 021c60c..8fcfa37 100644
--- a/src/jake2/server/SV_INIT.java
+++ b/src/jake2/server/SV_INIT.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 14.01.2004 by RST.
-// $Id: SV_INIT.java,v 1.1 2004-07-07 19:59:47 hzi Exp $
+// $Id: SV_INIT.java,v 1.2 2004-07-08 15:58:45 hzi Exp $
package jake2.server;
@@ -469,7 +469,7 @@ public class SV_INIT extends Globals {
if (level.charAt(0) == '*')
level = level.substring(1);
- l = strlen(level);
+ l = level.length();
if (l > 4 && level.endsWith(".cin")) {
SCR.BeginLoadingPlaque(); // for local system
SV_SEND.SV_BroadcastCommand("changing\n");
diff --git a/src/jake2/server/SV_MAIN.java b/src/jake2/server/SV_MAIN.java
index e3059ec..464b056 100644
--- a/src/jake2/server/SV_MAIN.java
+++ b/src/jake2/server/SV_MAIN.java
@@ -19,22 +19,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 13.01.2004 by RST.
-// $Id: SV_MAIN.java,v 1.1 2004-07-07 19:59:49 hzi Exp $
+// $Id: SV_MAIN.java,v 1.2 2004-07-08 15:58:45 hzi Exp $
package jake2.server;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-import jake2.*;
-import jake2.client.*;
+import jake2.Defines;
+import jake2.Globals;
import jake2.game.*;
import jake2.qcommon.*;
-import jake2.render.*;
import jake2.sys.NET;
import jake2.sys.Sys;
import jake2.util.Lib;
+import java.io.IOException;
+
public class SV_MAIN extends SV_GAME {
static netadr_t master_adr[] = new netadr_t[MAX_MASTERS]; // address of group servers
@@ -401,7 +399,7 @@ public class SV_MAIN extends SV_GAME {
}
public static int Rcon_Validate() {
- if (0 == strlen(rcon_password.string))
+ if (0 == rcon_password.string.length())
return 0;
if (0 != strcmp(Cmd.Argv(1), rcon_password.string))
@@ -702,7 +700,7 @@ public class SV_MAIN extends SV_GAME {
// never get more than one tic behind
if (sv.time < svs.realtime) {
- //if (sv_showclamp.value != 0)
+ if (sv_showclamp.value != 0)
Com.Printf("sv highclamp\n");
svs.realtime = sv.time;
}
@@ -744,7 +742,7 @@ public class SV_MAIN extends SV_GAME {
if (0== sv_timedemo.value && svs.realtime < sv.time) {
// never let the time get too far off
if (sv.time - svs.realtime > 100) {
- //if (sv_showclamp.value != 0)
+ if (sv_showclamp.value != 0)
Com.Printf("sv lowclamp\n");
svs.realtime = sv.time - 100;
}
@@ -889,7 +887,7 @@ public class SV_MAIN extends SV_GAME {
// msg command
val = Info.Info_ValueForKey(cl.userinfo, "msg");
- if (strlen(val) > 0) {
+ if (val.length() > 0) {
cl.messagelevel = atoi(val);
}
@@ -914,7 +912,8 @@ public class SV_MAIN extends SV_GAME {
Cvar.Get("dmflags", "" + DF_INSTANT_ITEMS, CVAR_SERVERINFO);
Cvar.Get("fraglimit", "0", CVAR_SERVERINFO);
Cvar.Get("timelimit", "0", CVAR_SERVERINFO);
- Cvar.Get("cheats", "0", CVAR_SERVERINFO | CVAR_LATCH);
+ //TODO: set cheats 0
+ Cvar.Get("cheats", "1", CVAR_SERVERINFO | CVAR_LATCH);
Cvar.Get("protocol", "" + PROTOCOL_VERSION, CVAR_SERVERINFO | CVAR_NOSET);
SV_MAIN.maxclients = Cvar.Get("maxclients", "1", CVAR_SERVERINFO | CVAR_LATCH);
diff --git a/src/jake2/server/SV_USER.java b/src/jake2/server/SV_USER.java
index 7662c30..1136d20 100644
--- a/src/jake2/server/SV_USER.java
+++ b/src/jake2/server/SV_USER.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 17.01.2004 by RST.
-// $Id: SV_USER.java,v 1.1 2004-07-07 19:59:50 hzi Exp $
+// $Id: SV_USER.java,v 1.2 2004-07-08 15:58:45 hzi Exp $
package jake2.server;
@@ -331,7 +331,7 @@ public class SV_USER extends SV_SEND {
sv_client.downloadcount = sv_client.downloadsize;
if (sv_client.download == null // special check for maps, if it came from a pak file, don't allow
- // download ZOID
+ // download ZOID
|| (strncmp(name, "maps/", 5) == 0 && FS.file_from_pak != 0)) {
Com.DPrintf("Couldn't download " + name + " to " + sv_client.name + "\n");
if (sv_client.download != null) {
@@ -482,14 +482,16 @@ public class SV_USER extends SV_SEND {
// SV_BeginRedirect (RD_CLIENT);
- for (int i = 0; i < ucmds.length; i++) {
+ int i=0;
+ for (; i < ucmds.length; i++) {
u = ucmds[i];
if (0 == strcmp(Cmd.Argv(0), u.name)) {
u.r.run();
break;
}
}
- if (u.name == null && sv.state == ss_game)
+
+ if (i == ucmds.length && sv.state == ss_game)
SV_GAME.ge.ClientCommand(sv_player);
// SV_EndRedirect ();
@@ -526,8 +528,8 @@ public class SV_USER extends SV_SEND {
int c;
String s;
- usercmd_t nullcmd=new usercmd_t();
- usercmd_t oldest=new usercmd_t(), oldcmd=new usercmd_t(), newcmd=new usercmd_t();
+ usercmd_t nullcmd = new usercmd_t();
+ usercmd_t oldest = new usercmd_t(), oldcmd = new usercmd_t(), newcmd = new usercmd_t();
int net_drop;
int stringCmdCount;
int checksum, calculatedChecksum;
@@ -576,7 +578,7 @@ public class SV_USER extends SV_SEND {
checksumIndex = net_message.readcount;
checksum = MSG.ReadByte(net_message);
lastframe = MSG.ReadLong(net_message);
-
+
if (lastframe != cl.lastframe) {
cl.lastframe = lastframe;
if (cl.lastframe > 0) {
@@ -597,7 +599,7 @@ public class SV_USER extends SV_SEND {
}
// if the checksum fails, ignore the rest of the packet
-
+
calculatedChecksum = 0;
/*
= Com.BlockSequenceCRCByte(
diff --git a/src/jake2/server/SV_WORLD.java b/src/jake2/server/SV_WORLD.java
index 6df2512..a400959 100644
--- a/src/jake2/server/SV_WORLD.java
+++ b/src/jake2/server/SV_WORLD.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 07.01.2000 by RST.
-// $Id: SV_WORLD.java,v 1.1 2004-07-07 19:59:50 hzi Exp $
+// $Id: SV_WORLD.java,v 1.2 2004-07-08 15:58:45 hzi Exp $
package jake2.server;
@@ -33,31 +33,24 @@ import jake2.qcommon.*;
import jake2.render.*;
import jake2.util.Vargs;
-public class SV_WORLD extends SV_CCMDS {
+public class SV_WORLD extends SV_CCMDS
+{
// world.c -- world query functions
//
- ///*
+ //
//===============================================================================
//
//ENTITY AREA CHECKING
//
//FIXME: this use of "area" is different from the bsp file use
//===============================================================================
- //*/
-
- //// (type *)STRUCT_FROM_LINK(link_t *link, type, member)
- //// ent = STRUCT_FROM_LINK(link,entity_t,order)
-
- //// FIXME: remove this mess!
- //#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0).m)))
//
- //#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area)
- //
- public static void initNodes() {
+ public static void initNodes()
+ {
for (int n = 0; n < AREA_NODES; n++)
sv_areanodes[n] = new areanode_t();
}
@@ -75,16 +68,19 @@ public class SV_WORLD extends SV_CCMDS {
public static int area_type;
// ClearLink is used for new headnodes
- public static void ClearLink(link_t l) {
+ public static void ClearLink(link_t l)
+ {
l.prev = l.next = l;
}
- public static void RemoveLink(link_t l) {
+ public static void RemoveLink(link_t l)
+ {
l.next.prev = l.prev;
l.prev.next = l.next;
}
- public static void InsertLinkBefore(link_t l, link_t before) {
+ public static void InsertLinkBefore(link_t l, link_t before)
+ {
l.next = before;
l.prev = before.prev;
l.prev.next = l;
@@ -98,24 +94,25 @@ public class SV_WORLD extends SV_CCMDS {
Builds a uniformly subdivided tree for the given world size
===============
*/
- public static areanode_t SV_CreateAreaNode(int depth, float[] mins, float[] maxs) {
+ public static areanode_t SV_CreateAreaNode(int depth, float[] mins, float[] maxs)
+ {
areanode_t anode;
float[] size = { 0, 0, 0 };
float[] mins1 = { 0, 0, 0 }, maxs1 = { 0, 0, 0 }, mins2 = { 0, 0, 0 }, maxs2 = { 0, 0, 0 };
- Com.Printf("SV_CreateAreaNode " + depth + "\n");
anode = sv_areanodes[sv_numareanodes];
-
+
// just for debugging (rst)
VectorCopy(mins, anode.mins_rst);
VectorCopy(maxs, anode.maxs_rst);
-
+
sv_numareanodes++;
ClearLink(anode.trigger_edicts);
ClearLink(anode.solid_edicts);
- if (depth == AREA_DEPTH) {
+ if (depth == AREA_DEPTH)
+ {
anode.axis = -1;
anode.children[0] = anode.children[1] = null;
return anode;
@@ -147,12 +144,14 @@ public class SV_WORLD extends SV_CCMDS {
===============
*/
- public static void SV_ClearWorld() {
+ public static void SV_ClearWorld()
+ {
initNodes();
sv_numareanodes = 0;
SV_CreateAreaNode(0, sv.models[1].mins, sv.models[1].maxs);
- Com.Println("areanodes:" + sv_numareanodes + " (sollten 32 sein).");
+ /*
+ Com.p("areanodes:" + sv_numareanodes + " (sollten 32 sein).");
for (int n = 0; n < sv_numareanodes; n++) {
Com.Printf(
"|%3i|%2i|%8.2f |%8.2f|%8.2f|%8.2f| %8.2f|%8.2f|%8.2f|\n",
@@ -167,15 +166,15 @@ public class SV_WORLD extends SV_CCMDS {
.add(sv_areanodes[n].maxs_rst[1])
.add(sv_areanodes[n].maxs_rst[2]));
}
+ */
}
-
/*
===============
SV_UnlinkEdict
-
===============
*/
- public static void SV_UnlinkEdict(edict_t ent) {
+ public static void SV_UnlinkEdict(edict_t ent)
+ {
if (null == ent.area.prev)
return; // not linked in anywhere
RemoveLink(ent.area);
@@ -185,12 +184,12 @@ public class SV_WORLD extends SV_CCMDS {
/*
===============
SV_LinkEdict
-
===============
*/
public static final int MAX_TOTAL_ENT_LEAFS = 128;
- public static void SV_LinkEdict(edict_t ent) {
+ public static void SV_LinkEdict(edict_t ent)
+ {
areanode_t node;
// TODO: make static instead of new
int leafs[] = new int[MAX_TOTAL_ENT_LEAFS];
@@ -213,7 +212,8 @@ public class SV_WORLD extends SV_CCMDS {
VectorSubtract(ent.maxs, ent.mins, ent.size);
// encode the size into the entity_state for client prediction
- if (ent.solid == SOLID_BBOX && 0 == (ent.svflags & SVF_DEADMONSTER)) { // assume that x/y are equal and symetric
+ if (ent.solid == SOLID_BBOX && 0 == (ent.svflags & SVF_DEADMONSTER))
+ { // assume that x/y are equal and symetric
int i = (int) (ent.maxs[0] / 8);
if (i < 1)
i = 1;
@@ -236,18 +236,21 @@ public class SV_WORLD extends SV_CCMDS {
ent.s.solid = (k << 10) | (j << 5) | i;
}
- else if (ent.solid == SOLID_BSP) {
+ else if (ent.solid == SOLID_BSP)
+ {
ent.s.solid = 31; // a solid_bbox will never create this value
}
else
ent.s.solid = 0;
// set the abs box
- if (ent.solid == SOLID_BSP && (ent.s.angles[0] != 0 || ent.s.angles[1] != 0 || ent.s.angles[2] != 0)) { // expand for rotation
+ if (ent.solid == SOLID_BSP && (ent.s.angles[0] != 0 || ent.s.angles[1] != 0 || ent.s.angles[2] != 0))
+ { // expand for rotation
float max, v;
max = 0;
- for (int i = 0; i < 3; i++) {
+ for (int i = 0; i < 3; i++)
+ {
v = Math.abs(ent.mins[i]);
if (v > max)
max = v;
@@ -255,12 +258,14 @@ public class SV_WORLD extends SV_CCMDS {
if (v > max)
max = v;
}
- for (int i = 0; i < 3; i++) {
+ for (int i = 0; i < 3; i++)
+ {
ent.absmin[i] = ent.s.origin[i] - max;
ent.absmax[i] = ent.s.origin[i] + max;
}
}
- else { // normal
+ else
+ { // normal
VectorAdd(ent.s.origin, ent.mins, ent.absmin);
VectorAdd(ent.s.origin, ent.maxs, ent.absmax);
}
@@ -289,12 +294,15 @@ public class SV_WORLD extends SV_CCMDS {
topnode = iw.i;
// set areas
- for (int i = 0; i < num_leafs; i++) {
+ for (int i = 0; i < num_leafs; i++)
+ {
clusters[i] = CM.CM_LeafCluster(leafs[i]);
area = CM.CM_LeafArea(leafs[i]);
- if (area != 0) { // doors may legally straggle two areas,
+ if (area != 0)
+ { // doors may legally straggle two areas,
// but nothing should evern need more than that
- if (ent.areanum != 0 && ent.areanum != area) {
+ if (ent.areanum != 0 && ent.areanum != area)
+ {
if (ent.areanum2 != 0 && ent.areanum2 != area && sv.state == ss_loading)
Com.DPrintf("Object touching 3 areas at " + ent.absmin[0] + " " + ent.absmin[1] + " " + ent.absmin[2] + "\n");
ent.areanum2 = area;
@@ -304,20 +312,25 @@ public class SV_WORLD extends SV_CCMDS {
}
}
- if (num_leafs >= MAX_TOTAL_ENT_LEAFS) { // assume we missed some leafs, and mark by headnode
+ if (num_leafs >= MAX_TOTAL_ENT_LEAFS)
+ { // assume we missed some leafs, and mark by headnode
ent.num_clusters = -1;
ent.headnode = topnode;
}
- else {
+ else
+ {
ent.num_clusters = 0;
- for (int i = 0; i < num_leafs; i++) {
+ for (int i = 0; i < num_leafs; i++)
+ {
if (clusters[i] == -1)
continue; // not a visible leaf
for (j = 0; j < i; j++)
if (clusters[j] == clusters[i])
break;
- if (j == i) {
- if (ent.num_clusters == MAX_ENT_CLUSTERS) { // assume we missed some leafs, and mark by headnode
+ if (j == i)
+ {
+ if (ent.num_clusters == MAX_ENT_CLUSTERS)
+ { // assume we missed some leafs, and mark by headnode
ent.num_clusters = -1;
ent.headnode = topnode;
break;
@@ -329,7 +342,8 @@ public class SV_WORLD extends SV_CCMDS {
}
// if first time, make sure old_origin is valid
- if (0 == ent.linkcount) {
+ if (0 == ent.linkcount)
+ {
VectorCopy(ent.s.origin, ent.s.old_origin);
}
ent.linkcount++;
@@ -340,7 +354,8 @@ public class SV_WORLD extends SV_CCMDS {
// find the first node that the ent's box crosses
node = sv_areanodes[0];
- while (true) {
+ while (true)
+ {
if (node.axis == -1)
break;
if (ent.absmin[node.axis] > node.dist)
@@ -365,7 +380,8 @@ public class SV_WORLD extends SV_CCMDS {
====================
*/
- public static void SV_AreaEdicts_r(areanode_t node) {
+ public static void SV_AreaEdicts_r(areanode_t node)
+ {
link_t l, next, start;
edict_t check;
int count;
@@ -378,7 +394,8 @@ public class SV_WORLD extends SV_CCMDS {
else
start = node.trigger_edicts;
- for (l = start.next; l != start; l = next) {
+ for (l = start.next; l != start; l = next)
+ {
next = l.next;
check = //EDICT_FROM_AREA(l);
(edict_t) l.o;
@@ -393,7 +410,8 @@ public class SV_WORLD extends SV_CCMDS {
|| check.absmax[2] < area_mins[2])
continue; // not touching
- if (area_count == area_maxcount) {
+ if (area_count == area_maxcount)
+ {
Com.Printf("SV_AreaEdicts: MAXCOUNT\n");
return;
}
@@ -418,7 +436,8 @@ public class SV_WORLD extends SV_CCMDS {
SV_AreaEdicts
================
*/
- public static int SV_AreaEdicts(float[] mins, float[] maxs, edict_t list[], int maxcount, int areatype) {
+ public static int SV_AreaEdicts(float[] mins, float[] maxs, edict_t list[], int maxcount, int areatype)
+ {
area_mins = mins;
area_maxs = maxs;
area_list = list;
@@ -427,7 +446,7 @@ public class SV_WORLD extends SV_CCMDS {
area_type = areatype;
SV_AreaEdicts_r(sv_areanodes[0]);
-
+
/*
Com.Printf("found edicts in area:" + area_count + "\n");
for (int n = 0; n < area_count; n++) {
@@ -444,7 +463,8 @@ public class SV_WORLD extends SV_CCMDS {
SV_PointContents
=============
*/
- public static int SV_PointContents(float[] p) {
+ public static int SV_PointContents(float[] p)
+ {
// TODO: make static instead new
edict_t touch[] = new edict_t[MAX_EDICTS], hit;
int i, num;
@@ -458,7 +478,8 @@ public class SV_WORLD extends SV_CCMDS {
// or in contents from all the other entities
num = SV_AreaEdicts(p, p, touch, MAX_EDICTS, AREA_SOLID);
- for (i = 0; i < num; i++) {
+ for (i = 0; i < num; i++)
+ {
hit = touch[i];
// might intersect, so do an exact clip
@@ -485,12 +506,14 @@ public class SV_WORLD extends SV_CCMDS {
testing object's origin to get a point to use with the returned hull.
================
*/
- public static int SV_HullForEntity(edict_t ent) {
+ public static int SV_HullForEntity(edict_t ent)
+ {
cmodel_t model;
// decide which clipping hull to use, based on the size
- if (ent.solid == SOLID_BSP) { // explicit hulls in the BSP model
+ if (ent.solid == SOLID_BSP)
+ { // explicit hulls in the BSP model
model = sv.models[ent.s.modelindex];
if (null == model)
@@ -512,7 +535,8 @@ public class SV_WORLD extends SV_CCMDS {
====================
*/
- public static void SV_ClipMoveToEntities(moveclip_t clip) {
+ public static void SV_ClipMoveToEntities(moveclip_t clip)
+ {
int i, num;
// TODO: make static instead of new
edict_t touchlist[] = new edict_t[MAX_EDICTS];
@@ -525,7 +549,8 @@ public class SV_WORLD extends SV_CCMDS {
// be careful, it is possible to have an entity in this
// list removed before we get to it (killtriggered)
- for (i = 0; i < num; i++) {
+ for (i = 0; i < num; i++)
+ {
touch = touchlist[i];
if (touch.solid == SOLID_NOT)
continue;
@@ -533,7 +558,8 @@ public class SV_WORLD extends SV_CCMDS {
continue;
if (clip.trace.allsolid)
return;
- if (clip.passedict != null) {
+ if (clip.passedict != null)
+ {
if (touch.owner == clip.passedict)
continue; // don't clip against own missiles
if (clip.passedict.owner == touch)
@@ -572,9 +598,11 @@ public class SV_WORLD extends SV_CCMDS {
touch.s.origin,
angles);
- if (trace.allsolid || trace.startsolid || trace.fraction < clip.trace.fraction) {
+ if (trace.allsolid || trace.startsolid || trace.fraction < clip.trace.fraction)
+ {
trace.ent = touch;
- if (clip.trace.startsolid) {
+ if (clip.trace.startsolid)
+ {
clip.trace = trace;
clip.trace.startsolid = true;
}
@@ -591,15 +619,19 @@ public class SV_WORLD extends SV_CCMDS {
SV_TraceBounds
==================
*/
- public static void SV_TraceBounds(float[] start, float[] mins, float[] maxs, float[] end, float[] boxmins, float[] boxmaxs) {
+ public static void SV_TraceBounds(float[] start, float[] mins, float[] maxs, float[] end, float[] boxmins, float[] boxmaxs)
+ {
int i;
- for (i = 0; i < 3; i++) {
- if (end[i] > start[i]) {
+ for (i = 0; i < 3; i++)
+ {
+ if (end[i] > start[i])
+ {
boxmins[i] = start[i] + mins[i] - 1;
boxmaxs[i] = end[i] + maxs[i] + 1;
}
- else {
+ else
+ {
boxmins[i] = end[i] + mins[i] - 1;
boxmaxs[i] = start[i] + maxs[i] + 1;
}
@@ -617,7 +649,8 @@ public class SV_WORLD extends SV_CCMDS {
==================
*/
- public static trace_t SV_Trace(float[] start, float[] mins, float[] maxs, float[] end, edict_t passedict, int contentmask) {
+ public static trace_t SV_Trace(float[] start, float[] mins, float[] maxs, float[] end, edict_t passedict, int contentmask)
+ {
moveclip_t clip = new moveclip_t();
if (mins == null)