aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/game/entity_state_t.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jake2/game/entity_state_t.java')
-rw-r--r--src/jake2/game/entity_state_t.java80
1 files changed, 71 insertions, 9 deletions
diff --git a/src/jake2/game/entity_state_t.java b/src/jake2/game/entity_state_t.java
index 25c3162..e4e7b68 100644
--- a/src/jake2/game/entity_state_t.java
+++ b/src/jake2/game/entity_state_t.java
@@ -19,33 +19,41 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 08.11.2003 by RST.
-// $Id: entity_state_t.java,v 1.2 2004-07-08 15:58:43 hzi Exp $
+// $Id: entity_state_t.java,v 1.3 2004-08-20 21:29:58 salomo Exp $
package jake2.game;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
import jake2.util.Math3D;
+import jake2.util.QuakeFile;
public class entity_state_t implements Cloneable
{
- // entity_state_t is the information conveyed from the server
- // in an update message about entities that the client will
- // need to render in some way
-
+ /** entity_state_t is the information conveyed from the server
+ in an update message about entities that the client will
+ need to render in some way. */
public entity_state_t(edict_t ent)
{
this.surrounding_ent = ent;
}
- public int number = -99999; // edict index
+ /** edict index. */
+ public int number = -99999;
public edict_t surrounding_ent = null;
public float[] origin = { 0, 0, 0 };
public float[] angles = { 0, 0, 0 };
- public float[] old_origin = { 0, 0, 0 }; // for lerping
+
+ /** for lerping. */
+ public float[] old_origin = { 0, 0, 0 };
public int modelindex;
- public int modelindex2, modelindex3, modelindex4; // weapons, CTF flags, etc.
+ /** weapons, CTF flags, etc. */
+ public int modelindex2, modelindex3, modelindex4;
public int frame;
public int skinnum;
- public int effects; // PGM - we're filling it, so it needs to be unsigned
+ /** PGM - we're filling it, so it needs to be unsigned. */
+ public int effects;
public int renderfx;
public int solid;
// for client side prediction, 8*(bits 0-4) is x/y radius
@@ -56,6 +64,60 @@ public class entity_state_t implements Cloneable
// events only go out for a single frame, they
// are automatically cleared each frame
+ /** Writes the entity state to the file. */
+ public void write(QuakeFile f) throws IOException
+ {
+ f.writeEdictRef(surrounding_ent);
+ f.writeVector(origin);
+ f.writeVector(angles);
+ f.writeVector(old_origin);
+
+ f.writeInt(modelindex);
+
+ f.writeInt(modelindex2);
+ f.writeInt(modelindex3);
+ f.writeInt(modelindex4);
+
+ f.writeInt(frame);
+ f.writeInt(skinnum);
+
+ f.writeInt(effects);
+ f.writeInt(renderfx);
+ f.writeInt(solid);
+
+ f.writeInt(sound);
+ f.writeInt(event);
+
+ }
+
+ /** Reads the entity state from the file. */
+ public void read(QuakeFile f) throws IOException
+ {
+ surrounding_ent = f.readEdictRef();
+ origin = f.readVector();
+ angles = f.readVector();
+ old_origin = f.readVector();
+
+ modelindex = f.readInt();
+
+ modelindex2= f.readInt();
+ modelindex3= f.readInt();
+ modelindex4= f.readInt();
+
+ frame = f.readInt();
+ skinnum = f.readInt();
+
+ effects = f.readInt();
+ renderfx = f.readInt();
+ solid = f.readInt();
+
+ sound = f.readInt();
+ event = f.readInt();
+
+
+ }
+
+
public entity_state_t getClone()
{
entity_state_t out = new entity_state_t(this.surrounding_ent);