diff options
Diffstat (limited to 'src/jake2/qcommon')
-rw-r--r-- | src/jake2/qcommon/Com.java | 87 | ||||
-rw-r--r-- | src/jake2/qcommon/PMove.java | 15 |
2 files changed, 52 insertions, 50 deletions
diff --git a/src/jake2/qcommon/Com.java b/src/jake2/qcommon/Com.java index b7ae3b4..cc6907c 100644 --- a/src/jake2/qcommon/Com.java +++ b/src/jake2/qcommon/Com.java @@ -2,7 +2,7 @@ * Com.java * Copyright (C) 2003 * - * $Id: Com.java,v 1.6 2004-08-22 18:30:15 hzi Exp $ + * $Id: Com.java,v 1.7 2005-01-12 12:14:16 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -91,10 +91,12 @@ public final class Com if (in == null) { data= null; + length = 0; } else { data= in.toCharArray(); + length = data.length; } index= 0; } @@ -108,39 +110,50 @@ public final class Com { data= in; index= offset; + if (data != null) length = data.length; + else length = 0; } public char getchar() { - // faster than if - try - { - return data[index]; - } - catch (Exception e) - { - data= null; - // last char - return 0; - } + if (index < length) { + return data[index]; + } + return 0; +// // faster than if +// try +// { +// return data[index]; +// } +// catch (Exception e) +// { +// data= null; +// // last char +// return 0; +// } } public char nextchar() { // faster than if - try - { - index++; - return data[index]; - } - catch (Exception e) - { - data= null; - // avoid int wraps; - index--; - // last char - return 0; - } + index++; + if (index < length) { + return data[index]; + } + return 0; +// try +// { +// index++; +// return data[index]; +// } +// catch (Exception e) +// { +// data= null; +// // avoid int wraps; +// index--; +// // last char +// return 0; +// } } public char prevchar() { @@ -154,32 +167,33 @@ public final class Com public boolean isEof() { - return data == null; + return index >= length; } public int index; public char data[]; + private int length; public char skipwhites() { - char c; - while (((c= getchar()) <= ' ') && c != 0) + char c = 0; + while ( index < length && ((c= data[index]) <= ' ') && c != 0) index++; return c; } public char skipwhitestoeol() { - char c; - while (((c= getchar()) <= ' ') && c != '\n' && c != 0) + char c = 0; + while ( index < length &&((c= data[index]) <= ' ') && c != '\n' && c != 0) index++; return c; } public char skiptoeol() { - char c; - while ((c= getchar()) != '\n' && c != 0) + char c = 0; + while ( index < length &&(c= data[index]) != '\n' && c != 0) index++; return c; } @@ -407,14 +421,7 @@ public final class Com public static void Println(String fmt) { - Printf(fmt); - Printf("\n"); - } - - public static void p(String fmt) - { - Printf(fmt); - Printf("\n"); + Printf(fmt + "\n"); } public static String sprintf(String fmt, Vargs vargs) diff --git a/src/jake2/qcommon/PMove.java b/src/jake2/qcommon/PMove.java index f4e92c3..3a35523 100644 --- a/src/jake2/qcommon/PMove.java +++ b/src/jake2/qcommon/PMove.java @@ -19,14 +19,12 @@ */ // Created on 25.01.2004 by RST. -// $Id: PMove.java,v 1.5 2004-09-22 19:22:09 salomo Exp $ +// $Id: PMove.java,v 1.6 2005-01-12 12:14:16 hzi Exp $ package jake2.qcommon; -import jake2.*; -import jake2.client.*; +import jake2.Defines; +import jake2.Globals; import jake2.game.*; -import jake2.render.*; -import jake2.server.*; import jake2.util.Math3D; public class PMove { @@ -47,8 +45,6 @@ public class PMove { public csurface_t groundsurface; - public cplane_t groundplane = new cplane_t(); - public int groundcontents; public float[] previous_origin = { 0, 0, 0 }; @@ -618,7 +614,6 @@ public class PMove { } else { trace = PMove.pm.trace.trace(PMove.pml.origin, PMove.pm.mins, PMove.pm.maxs, point); - PMove.pml.groundplane = trace.plane; PMove.pml.groundsurface = trace.surface; PMove.pml.groundcontents = trace.contents; @@ -1069,8 +1064,8 @@ public class PMove { PMove.pm.watertype = 0; PMove.pm.waterlevel = 0; - // clear all pmove local vars - PMove.pml = new PMove.pml_t(); + PMove.pml.groundsurface = null; + PMove.pml.groundcontents = 0; // convert origin and velocity to float values PMove.pml.origin[0] = PMove.pm.s.origin[0] * 0.125f; |