diff options
author | Carsten Weisse <[email protected]> | 2005-01-20 23:15:23 +0000 |
---|---|---|
committer | Carsten Weisse <[email protected]> | 2005-01-20 23:15:23 +0000 |
commit | d08bda0a87e7416db8ae72946693baa85b6e57dd (patch) | |
tree | 96e757c005aa975f8306252982ab1c6429430d79 /src/jake2 | |
parent | 1a0c8b25b6f8a51506845818671013fddd62c0a2 (diff) |
new entity_t() removed; ent.clear() is used (see C source)
the class V contains the only valid entity_t structures; see r_entities[] and V.AddEntity();
dynamic garbage reduced
Diffstat (limited to 'src/jake2')
-rw-r--r-- | src/jake2/client/CL_ents.java | 14 | ||||
-rw-r--r-- | src/jake2/client/CL_tent.java | 15 | ||||
-rw-r--r-- | src/jake2/client/Menu.java | 7 | ||||
-rw-r--r-- | src/jake2/client/V.java | 8 |
4 files changed, 23 insertions, 21 deletions
diff --git a/src/jake2/client/CL_ents.java b/src/jake2/client/CL_ents.java index 4bf1807..4cc0bec 100644 --- a/src/jake2/client/CL_ents.java +++ b/src/jake2/client/CL_ents.java @@ -2,7 +2,7 @@ * java * Copyright (C) 2004 * - * $Id: CL_ents.java,v 1.8 2005-01-17 21:43:13 cawe Exp $ + * $Id: CL_ents.java,v 1.9 2005-01-20 23:15:22 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -586,13 +586,14 @@ public class CL_ents { * ========================================================================== */ + // stack variable + private static final entity_t ent = new entity_t(); /* * =============== * CL_AddPacketEntities * =============== */ static void AddPacketEntities(frame_t frame) { - entity_t ent; entity_state_t s1; float autorotate; int i; @@ -609,7 +610,7 @@ public class CL_ents { autoanim = 2 * Globals.cl.time / 1000; //memset( ent, 0, sizeof(ent)); - ent = new entity_t(); + ent.clear(); for (pnum = 0; pnum < frame.num_entities; pnum++) { s1 = Globals.cl_parse_entities[(frame.parse_entities + pnum) & (Defines.MAX_PARSE_ENTITIES - 1)]; @@ -1019,12 +1020,13 @@ public class CL_ents { Math3D.VectorCopy(ent.origin, cent.lerp_origin); } } - + + // stack variable + private static final entity_t gun = new entity_t(); /* * ============== CL_AddViewWeapon ============== */ static void AddViewWeapon(player_state_t ps, player_state_t ops) { - entity_t gun; // view model int i; // allow the gun to be completely removed @@ -1036,7 +1038,7 @@ public class CL_ents { return; //memset( gun, 0, sizeof(gun)); - gun = new entity_t(); + gun.clear(); if (Globals.gun_model != null) gun.model = Globals.gun_model; // development tool diff --git a/src/jake2/client/CL_tent.java b/src/jake2/client/CL_tent.java index f6d9bec..d1832e6 100644 --- a/src/jake2/client/CL_tent.java +++ b/src/jake2/client/CL_tent.java @@ -2,7 +2,7 @@ * java * Copyright (C) 2004 * - * $Id: CL_tent.java,v 1.7 2004-10-11 14:04:16 hzi Exp $ + * $Id: CL_tent.java,v 1.8 2005-01-20 23:15:23 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -58,7 +58,7 @@ public class CL_tent { void clear() { lightcolor[0] = lightcolor[1] = lightcolor[2] = light = start = type = frames = baseframe = 0; - ent = new entity_t(); + ent.clear(); } } @@ -122,7 +122,7 @@ public class CL_tent { void clear() { endtime = 0; - ent = new entity_t(); + ent.clear(); } } @@ -1293,6 +1293,7 @@ public class CL_tent { } } + private static final entity_t ent = new entity_t(); /* * ================= CL_AddBeams ================= */ @@ -1302,7 +1303,6 @@ public class CL_tent { float[] dist = new float[3]; float[] org = new float[3]; float d; - entity_t ent = new entity_t(); float yaw, pitch; float forward; float len, steps; @@ -1354,7 +1354,7 @@ public class CL_tent { d = Math3D.VectorNormalize(dist); //memset (&ent, 0, sizeof(ent)); - ent = new entity_t(); + ent.clear(); if (b[i].model == cl_mod_lightning) { model_length = 35.0f; d -= 20.0; // correction so it doesn't end in middle of tesla @@ -1419,7 +1419,7 @@ public class CL_tent { float[] dist = new float[3]; float[] org = new float[3]; float d; - entity_t ent = new entity_t(); + //entity_t ent = new entity_t(); float yaw, pitch; float forward; float len, steps; @@ -1582,8 +1582,7 @@ public class CL_tent { d = Math3D.VectorNormalize(dist); //memset (&ent, 0, sizeof(ent)); - //ent = new entity_t(); - // this is not required. hoz + ent.clear(); if (b[i].model == cl_mod_heatbeam) { model_length = 32.0f; diff --git a/src/jake2/client/Menu.java b/src/jake2/client/Menu.java index 8f3d9bf..add2651 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.16 2005-01-12 08:47:42 hzi Exp $ + * $Id: Menu.java,v 1.17 2005-01-20 23:15:23 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -4094,6 +4094,8 @@ public final class Menu extends Key { } static int yaw; + + private static final entity_t entity = new entity_t(); static void PlayerConfig_MenuDraw() { @@ -4115,9 +4117,8 @@ public final class Menu extends Key { if (s_pmi[s_player_model_box.curvalue].skindisplaynames != null) { int maxframe = 29; - entity_t entity = new entity_t(); - //memset(entity, 0, sizeof(entity)); + entity.clear(); scratch = "players/" + s_pmi[s_player_model_box.curvalue].directory + "/tris.md2"; diff --git a/src/jake2/client/V.java b/src/jake2/client/V.java index 402d16c..329613c 100644 --- a/src/jake2/client/V.java +++ b/src/jake2/client/V.java @@ -2,7 +2,7 @@ * V.java * Copyright (C) 2003 * - * $Id: V.java,v 1.3 2004-09-22 19:22:08 salomo Exp $ + * $Id: V.java,v 1.4 2005-01-20 23:15:23 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -153,6 +153,8 @@ public final class V extends Globals { ls.rgb[2] = b; } + // stack variable + private static final float[] origin = { 0, 0, 0 }; /* * ================ V_TestParticles * @@ -163,8 +165,6 @@ public final class V extends Globals { int i, j; float d, r, u; - float[] origin = { 0, 0, 0 }; - r_numparticles = 0; for (i = 0; i < MAX_PARTICLES; i++) { d = i * 0.25f; @@ -192,7 +192,7 @@ public final class V extends Globals { r_numentities = 32; //memset (r_entities, 0, sizeof(r_entities)); for (i = 0; i < r_entities.length; i++) - r_entities[i] = new entity_t(); + r_entities[i].clear(); for (i = 0; i < r_numentities; i++) { ent = r_entities[i]; |