diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jake2/client/M.java | 12 | ||||
-rw-r--r-- | src/jake2/client/Menu.java | 19 | ||||
-rw-r--r-- | src/jake2/game/game_import_t.java | 50 | ||||
-rw-r--r-- | src/jake2/server/SV_CCMDS.java | 8 | ||||
-rw-r--r-- | src/jake2/util/Lib.java | 13 |
5 files changed, 25 insertions, 77 deletions
diff --git a/src/jake2/client/M.java b/src/jake2/client/M.java index 2ea0d01..602b222 100644 --- a/src/jake2/client/M.java +++ b/src/jake2/client/M.java @@ -2,7 +2,7 @@ * M.java * Copyright (C) 2003 * - * $Id: M.java,v 1.5 2004-09-22 19:22:07 salomo Exp $ + * $Id: M.java,v 1.6 2004-10-07 14:13:07 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -491,11 +491,11 @@ public final class M { // it's not a tank // (they spray too much), get mad at them if (((targ.flags & (Defines.FL_FLY | Defines.FL_SWIM)) == (attacker.flags & (Defines.FL_FLY | Defines.FL_SWIM))) - && (Lib.strcmp(targ.classname, attacker.classname) != 0) - && (Lib.strcmp(attacker.classname, "monster_tank") != 0) - && (Lib.strcmp(attacker.classname, "monster_supertank") != 0) - && (Lib.strcmp(attacker.classname, "monster_makron") != 0) - && (Lib.strcmp(attacker.classname, "monster_jorg") != 0)) { + && (!(targ.classname.equals(attacker.classname))) + && (!(attacker.classname.equals("monster_tank"))) + && (!(attacker.classname.equals("monster_supertank"))) + && (!(attacker.classname.equals("monster_makron"))) + && (!(attacker.classname.equals("monster_jorg")))) { if (targ.enemy != null && targ.enemy.client != null) targ.oldenemy = targ.enemy; targ.enemy = attacker; diff --git a/src/jake2/client/Menu.java b/src/jake2/client/Menu.java index ab3199f..761b5d8 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.11 2004-10-04 12:50:37 hzi Exp $ + * $Id: Menu.java,v 1.12 2004-10-07 14:13:00 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -3729,8 +3729,7 @@ public final class Menu extends Key { static boolean IconOfSkinExists(String skin, String pcxfiles[], int npcxfiles) { - int i; - //char scratch[1024]; + String scratch; //strcpy(scratch, skin); @@ -3742,8 +3741,8 @@ public final class Menu extends Key { else scratch += "_i.pcx"; - for (i = 0; i < npcxfiles; i++) { - if (Lib.strcmp(pcxfiles[i], scratch) == 0) + for (int i = 0; i < npcxfiles; i++) { + if (pcxfiles[i].equals(scratch)) return true; } @@ -3899,17 +3898,17 @@ public final class Menu extends Key { /* * * sort by male, female, then alphabetical */ - if (Lib.strcmp(a.directory, "male") == 0) + if (a.directory.equals("male")) return -1; - else if (Lib.strcmp(b.directory, "male") == 0) + else if (b.directory.equals("male")) return 1; - if (Lib.strcmp(a.directory, "female") == 0) + if (a.directory.equals("female")) return -1; - else if (Lib.strcmp(b.directory, "female") == 0) + else if (b.directory.equals("female")) return 1; - return Lib.strcmp(a.directory, b.directory); + return a.directory.compareTo(b.directory); } static String handedness[] = { "right", "left", "center", null }; diff --git a/src/jake2/game/game_import_t.java b/src/jake2/game/game_import_t.java index 2fcadbe..dfb9121 100644 --- a/src/jake2/game/game_import_t.java +++ b/src/jake2/game/game_import_t.java @@ -19,20 +19,12 @@ */ // Created on 31.10.2003 by RST. -// $Id: game_import_t.java,v 1.4 2004-09-22 19:22:00 salomo Exp $ +// $Id: game_import_t.java,v 1.5 2004-10-07 14:13:07 hzi Exp $ package jake2.game; import jake2.Defines; -import jake2.client.SCR; -import jake2.qcommon.CM; -import jake2.qcommon.Cbuf; -import jake2.qcommon.Com; -import jake2.qcommon.Cvar; -import jake2.qcommon.PMove; -import jake2.server.SV_GAME; -import jake2.server.SV_INIT; -import jake2.server.SV_SEND; -import jake2.server.SV_WORLD; +import jake2.qcommon.*; +import jake2.server.*; // // collection of functions provided by the main engine @@ -110,10 +102,6 @@ public class game_import_t { public pmove_t.PointContentsAdapter pointcontents; - public boolean inPVS(float[] p1, float[] p2) { - return SV_GAME.PF_inPVS(p1, p2); - } - public boolean inPHS(float[] p1, float[] p2) { return SV_GAME.PF_inPHS(p1, p2); } @@ -157,9 +145,6 @@ public class game_import_t { SV_GAME.PF_Unicast(ent, reliable); } - public void WriteChar(int c) { - SV_GAME.PF_WriteChar(c); - } public void WriteByte(int c) { SV_GAME.PF_WriteByte(c); @@ -169,14 +154,6 @@ public class game_import_t { SV_GAME.PF_WriteShort(c); } - public void WriteLong(int c) { - SV_GAME.PF_WriteLong(c); - } - - public void WriteFloat(float f) { - SV_GAME.PF_WriteFloat(f); - } - public void WriteString(String s) { SV_GAME.PF_WriteString(s); } @@ -190,24 +167,6 @@ public class game_import_t { SV_GAME.PF_WriteDir(pos); } - // single byte encoded, very coarse - public void WriteAngle(float f) { - Com.Error(Defines.ERR_FATAL, "method is not implemented!"); - } - - // managed memory allocation - public void TagMalloc(int size, int tag) { - Com.Error(Defines.ERR_FATAL, "method is not implemented!"); - } - - public void TagFree(Object block) { - Com.Error(Defines.ERR_FATAL, "method is not implemented!"); - } - - public void FreeTags(int tag) { - Com.Error(Defines.ERR_FATAL, "method is not implemented!"); - } - // console variable interaction public cvar_t cvar(String var_name, String value, int flags) { return Cvar.Get(var_name, value, flags); @@ -243,7 +202,4 @@ public class game_import_t { Cbuf.AddText(text); } - public void DebugGraph(float value, int color) { - SCR.DebugGraph(value, color); - } }
\ No newline at end of file diff --git a/src/jake2/server/SV_CCMDS.java b/src/jake2/server/SV_CCMDS.java index 38e296e..18a7f91 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.12 2004-09-22 19:22:12 salomo Exp $ +// $Id: SV_CCMDS.java,v 1.13 2004-10-07 14:13:07 hzi Exp $ package jake2.server; @@ -655,7 +655,7 @@ public class SV_CCMDS { Com.Printf("Loading game...\n"); dir = Cmd.Argv(1); - if (Lib.strstr(dir, "..") || Lib.strstr(dir, "/") || Lib.strstr(dir, "\\")) { + if ( (dir.indexOf("..") > -1) || (dir.indexOf("/") > -1) || (dir.indexOf("\\") > -1)) { Com.Printf("Bad savedir.\n"); } @@ -718,10 +718,10 @@ public class SV_CCMDS { } dir = Cmd.Argv(1); - if (Lib.strstr(dir, "..") || Lib.strstr(dir, "/") || Lib.strstr(dir, "\\")) { + if ( (dir.indexOf("..") > -1) || (dir.indexOf("/") > -1) || (dir.indexOf("\\") > -1)) { Com.Printf("Bad savedir.\n"); } - + Com.Printf("Saving game...\n"); // archive current level, including all client edicts. diff --git a/src/jake2/util/Lib.java b/src/jake2/util/Lib.java index ab0d4ae..c31d161 100644 --- a/src/jake2/util/Lib.java +++ b/src/jake2/util/Lib.java @@ -19,11 +19,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 09.12.2003 by RST. -// $Id: Lib.java,v 1.7 2004-10-04 12:50:38 hzi Exp $ +// $Id: Lib.java,v 1.8 2004-10-07 14:12:59 hzi Exp $ package jake2.util; -import jake2.Defines; import jake2.Globals; import jake2.qcommon.Com; import jake2.qcommon.FS; @@ -70,9 +69,7 @@ public class Lib { public static int strcmp(String in1, String in2) { return in1.compareTo(in2); } - public static boolean strstr(String i1, String i2) { - return (i1.indexOf(i2) != -1); - } + public static float atof(String in) { float res = 0; @@ -121,11 +118,7 @@ public class Lib { return i; return in.length; } - static byte[] buffer = new byte[Defines.MAX_INFO_STRING]; - public static String readString(ByteBuffer bb, int len) { - bb.get(buffer, 0, len); - return new String(buffer, 0, len); - } + public static String hexdumpfile(ByteBuffer bb, int len) throws IOException { ByteBuffer bb1 = bb.slice(); |