aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2
diff options
context:
space:
mode:
authorCarsten Weisse <[email protected]>2005-01-17 21:50:42 +0000
committerCarsten Weisse <[email protected]>2005-01-17 21:50:42 +0000
commit1cb80475c53ba7e595dd65c3a32ff797b9a019b0 (patch)
tree1b62c802cba9e1cca96b5550958f05a4961d7617 /src/jake2
parent1d4a1ce927618b7ffec4282038e34ad98e3d25fa (diff)
garbage optimized (float[])
Diffstat (limited to 'src/jake2')
-rw-r--r--src/jake2/client/CL_fx.java116
-rw-r--r--src/jake2/client/CL_newfx.java86
2 files changed, 100 insertions, 102 deletions
diff --git a/src/jake2/client/CL_fx.java b/src/jake2/client/CL_fx.java
index b3926e1..3349d12 100644
--- a/src/jake2/client/CL_fx.java
+++ b/src/jake2/client/CL_fx.java
@@ -2,7 +2,7 @@
* java
* Copyright (C) 2004
*
- * $Id: CL_fx.java,v 1.7 2004-10-11 14:04:16 hzi Exp $
+ * $Id: CL_fx.java,v 1.8 2005-01-17 21:50:42 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -250,14 +250,15 @@ public class CL_fx {
}
}
+ // stack variable
+ private static final float[] fv = {0, 0, 0};
+ private static final float[] rv = {0, 0, 0};
/*
* ==============
* CL_ParseMuzzleFlash
* ==============
*/
static void ParseMuzzleFlash() {
- float[] fv = new float[3];
- float[] rv = new float[3];
float volume;
String soundname;
@@ -504,13 +505,14 @@ public class CL_fx {
}
}
+ // stack variable
+ private static final float[] origin = {0, 0, 0};
+ private static final float[] forward = {0, 0, 0};
+ private static final float[] right = {0, 0, 0};
/*
* ============== CL_ParseMuzzleFlash2 ==============
*/
static void ParseMuzzleFlash2() {
- float[] origin = new float[3];
- float[] forward = new float[3];
- float[] right = new float[3];
String soundname;
int ent = MSG.ReadShort(Globals.net_message);
@@ -980,12 +982,10 @@ public class CL_fx {
* =============== CL_ClearParticles ===============
*/
static void ClearParticles() {
- int i;
-
free_particles = particles[0];
active_particles = null;
- for (i = 0; i < particles.length - 1; i++)
+ for (int i = 0; i < particles.length - 1; i++)
particles[i].next = particles[i + 1];
particles[particles.length - 1].next = null;
}
@@ -996,11 +996,11 @@ public class CL_fx {
* Wall impact puffs ===============
*/
static void ParticleEffect(float[] org, float[] dir, int color, int count) {
- int i, j;
+ int j;
cparticle_t p;
float d;
-
- for (i = 0; i < count; i++) {
+
+ for (int i = 0; i < count; i++) {
if (free_particles == null)
return;
p = free_particles;
@@ -1029,11 +1029,11 @@ public class CL_fx {
* =============== CL_ParticleEffect2 ===============
*/
static void ParticleEffect2(float[] org, float[] dir, int color, int count) {
- int i, j;
+ int j;
cparticle_t p;
float d;
- for (i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
if (free_particles == null)
return;
p = free_particles;
@@ -1063,11 +1063,11 @@ public class CL_fx {
* =============== CL_ParticleEffect3 ===============
*/
static void ParticleEffect3(float[] org, float[] dir, int color, int count) {
- int i, j;
+ int j;
cparticle_t p;
float d;
- for (i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
if (free_particles == null)
return;
p = free_particles;
@@ -1096,10 +1096,10 @@ public class CL_fx {
* =============== CL_TeleporterParticles ===============
*/
static void TeleporterParticles(entity_state_t ent) {
- int i, j;
+ int j;
cparticle_t p;
- for (i = 0; i < 8; i++) {
+ for (int i = 0; i < 8; i++) {
if (free_particles == null)
return;
p = free_particles;
@@ -1132,10 +1132,10 @@ public class CL_fx {
* ===============
*/
static void LogoutEffect(float[] org, int type) {
- int i, j;
+ int j;
cparticle_t p;
- for (i = 0; i < 500; i++) {
+ for (int i = 0; i < 500; i++) {
if (free_particles == null)
return;
p = free_particles;
@@ -1173,10 +1173,10 @@ public class CL_fx {
* ===============
*/
static void ItemRespawnParticles(float[] org) {
- int i, j;
+ int j;
cparticle_t p;
- for (i = 0; i < 64; i++) {
+ for (int i = 0; i < 64; i++) {
if (free_particles == null)
return;
p = free_particles;
@@ -1207,10 +1207,10 @@ public class CL_fx {
* =============== CL_ExplosionParticles ===============
*/
static void ExplosionParticles(float[] org) {
- int i, j;
+ int j;
cparticle_t p;
- for (i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; i++) {
if (free_particles == null)
return;
p = free_particles;
@@ -1235,11 +1235,10 @@ public class CL_fx {
}
static void BigTeleportParticles(float[] org) {
- int i;
cparticle_t p;
float angle, dist;
- for (i = 0; i < 4096; i++) {
+ for (int i = 0; i < 4096; i++) {
if (free_particles == null)
return;
p = free_particles;
@@ -1276,13 +1275,12 @@ public class CL_fx {
* Wall impact puffs ===============
*/
static void BlasterParticles(float[] org, float[] dir) {
- int i, j;
+ int j;
cparticle_t p;
float d;
- int count;
- count = 40;
- for (i = 0; i < count; i++) {
+ int count = 40;
+ for (int i = 0; i < count; i++) {
if (free_particles == null)
return;
p = free_particles;
@@ -1307,14 +1305,15 @@ public class CL_fx {
}
}
+ // stack variable
+ private static final float[] move = {0, 0, 0};
+ private static final float[] vec = {0, 0, 0};
/*
* =============== CL_BlasterTrail
*
* ===============
*/
static void BlasterTrail(float[] start, float[] end) {
- float[] move = new float[3];
- float[] vec = new float[3];
float len;
int j;
cparticle_t p;
@@ -1354,15 +1353,14 @@ public class CL_fx {
}
}
-
+ // stack variable
+ // move, vec
/*
* ===============
* CL_FlagTrail
* ===============
*/
static void FlagTrail(float[] start, float[] end, float color) {
- float[] move = new float[3];
- float[] vec = new float[3];
float len;
int j;
cparticle_t p;
@@ -1401,14 +1399,14 @@ public class CL_fx {
}
}
+ // stack variable
+ // move, vec
/*
* =============== CL_DiminishingTrail
*
* ===============
*/
static void DiminishingTrail(float[] start, float[] end, centity_t old, int flags) {
- float[] move = new float[3];
- float[] vec = new float[3];
cparticle_t p;
float orgscale;
float velscale;
@@ -1486,14 +1484,14 @@ public class CL_fx {
}
}
+ // stack variable
+ // move, vec
/*
* =============== CL_RocketTrail
*
* ===============
*/
static void RocketTrail(float[] start, float[] end, centity_t old) {
- float[] move = new float[3];
- float[] vec = new float[3];
float len;
int j;
cparticle_t p;
@@ -1538,14 +1536,14 @@ public class CL_fx {
}
}
+ // stack variable
+ // move, vec
/*
* =============== CL_RailTrail
*
* ===============
*/
static void RailTrail(float[] start, float[] end) {
- float[] move = new float[3];
- float[] vec = new float[3];
float len;
int j;
cparticle_t p;
@@ -1624,13 +1622,12 @@ public class CL_fx {
}
}
- // RAFAEL
+ // stack variable
+ // move, vec
/*
* =============== CL_IonripperTrail ===============
*/
static void IonripperTrail(float[] start, float[] ent) {
- float[] move = new float[3];
- float[] vec = new float[3];
float len;
int j;
cparticle_t p;
@@ -1679,14 +1676,14 @@ public class CL_fx {
}
}
+ // stack variable
+ // move, vec
/*
* =============== CL_BubbleTrail
*
* ===============
*/
static void BubbleTrail(float[] start, float[] end) {
- float[] move = new float[3];
- float[] vec = new float[3];
float len;
int i, j;
cparticle_t p;
@@ -1724,6 +1721,8 @@ public class CL_fx {
}
}
+ // stack variable
+ // forward
/*
* =============== CL_FlyParticles ===============
*/
@@ -1732,7 +1731,6 @@ public class CL_fx {
cparticle_t p;
float angle;
float sp, sy, cp, cy;
- float[] forward = new float[3];
float dist = 64;
float ltime;
@@ -1812,6 +1810,9 @@ public class CL_fx {
FlyParticles(origin, count);
}
+ // stack variable
+ private static final float[] v = {0, 0, 0};
+ // forward
/*
* =============== CL_BfgParticles ===============
*/
@@ -1821,9 +1822,7 @@ public class CL_fx {
cparticle_t p;
float angle;
float sp, sy, cp, cy;
- float[] forward = new float[3];
float dist = 64;
- float[] v = new float[3];
float ltime;
if (avelocities[0][0] == 0.0f) {
@@ -1875,15 +1874,15 @@ public class CL_fx {
}
}
+ // stack variable
+ // move, vec
+ private static final float[] start = {0, 0, 0};
+ private static final float[] end = {0, 0, 0};
/*
* =============== CL_TrapParticles ===============
*/
// RAFAEL
static void TrapParticles(entity_t ent) {
- float[] move = new float[3];
- float[] vec = new float[3];
- float[] start = new float[3];
- float[] end = new float[3];
float len;
int j;
cparticle_t p;
@@ -1976,10 +1975,10 @@ public class CL_fx {
*/
// FIXME combined with CL_ExplosionParticles
static void BFGExplosionParticles(float[] org) {
- int i, j;
+ int j;
cparticle_t p;
- for (i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; i++) {
if (free_particles == null)
return;
p = free_particles;
@@ -2003,16 +2002,16 @@ public class CL_fx {
}
}
+ // stack variable
+ private static final float[] dir = {0, 0, 0};
/*
* =============== CL_TeleportParticles
*
* ===============
*/
static void TeleportParticles(float[] org) {
-
cparticle_t p;
float vel;
- float[] dir = new float[3];
for (int i = -16; i <= 16; i += 4)
for (int j = -16; j <= 16; j += 4)
@@ -2047,6 +2046,8 @@ public class CL_fx {
}
}
+ // stack variable
+ private static final float[] org = {0, 0, 0};
/*
* =============== CL_AddParticles ===============
*/
@@ -2055,7 +2056,6 @@ public class CL_fx {
float alpha;
float time = 0.0f;
float time2;
- float[] org = new float[3];
int color;
cparticle_t active, tail;
diff --git a/src/jake2/client/CL_newfx.java b/src/jake2/client/CL_newfx.java
index 1808751..3e90a27 100644
--- a/src/jake2/client/CL_newfx.java
+++ b/src/jake2/client/CL_newfx.java
@@ -2,7 +2,7 @@
* CL_newfx.java
* Copyright (C) 2004
*
- * $Id: CL_newfx.java,v 1.6 2004-10-11 14:04:16 hzi Exp $
+ * $Id: CL_newfx.java,v 1.7 2005-01-17 21:50:42 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -75,19 +75,19 @@ public class CL_newfx {
dl.color[2] = b;
}
+ // stack variable
+ private static final float[] move = {0, 0, 0};
+ private static final float[] vec = {0, 0, 0};
+ private static final float[] right = {0, 0, 0};
+ private static final float[] up = {0, 0, 0};
/*
* ====== CL_DebugTrail ======
*/
static void DebugTrail(float[] start, float[] end) {
- float[] move = new float[3];
- float[] vec = new float[3];
-
float len;
// int j;
cparticle_t p;
float dec;
- float[] right = new float[3];
- float[] up = new float[3];
// int i;
// float d, c, s;
// float[] dir;
@@ -133,10 +133,9 @@ public class CL_newfx {
}
+ // stack variable
+ // move, vec
static void ForceWall(float[] start, float[] end, int color) {
- float[] move = new float[3];
- float[] vec = new float[3];
- ;
float len;
int j;
cparticle_t p;
@@ -179,6 +178,8 @@ public class CL_newfx {
}
}
+ // stack variable
+ // move, vec
/*
* =============== CL_BubbleTrail2 (lets you control the # of bubbles by
* setting the distance between the spawns)
@@ -186,9 +187,6 @@ public class CL_newfx {
* ===============
*/
static void BubbleTrail2(float[] start, float[] end, int dist) {
- float[] move = new float[3];
- float[] vec = new float[3];
- ;
float len;
int i, j;
cparticle_t p;
@@ -228,23 +226,22 @@ public class CL_newfx {
}
}
+ // stack variable
+ // move, vec, right, up
+ private static final float[] dir = {0, 0, 0};
+ private static final float[] end = {0, 0, 0};
+
static void Heatbeam(float[] start, float[] forward) {
- float[] move = new float[3];
- float[] vec = new float[3];
float len;
int j;
cparticle_t p;
- float[] right = new float[3];
- float[] up = new float[3];
int i;
float c, s;
- float[] dir = new float[3];
float ltime;
float step = 32.0f, rstep;
float start_pt;
float rot;
float variance;
- float[] end = new float[3];
Math3D.VectorMA(start, 4096, forward, end);
@@ -319,6 +316,9 @@ public class CL_newfx {
}
}
+ // stack variable
+ private static final float[] r = {0, 0, 0};
+ private static final float[] u = {0, 0, 0};
/*
* =============== CL_ParticleSteamEffect
*
@@ -330,8 +330,6 @@ public class CL_newfx {
int i, j;
cparticle_t p;
float d;
- float[] r = new float[3];
- float[] u = new float[3];
// vectoangles2 (dir, angle_dir);
// AngleVectors (angle_dir, f, r, u);
@@ -367,15 +365,14 @@ public class CL_newfx {
}
}
+ // stack variable
+ // r, u, dir
static void ParticleSteamEffect2(cl_sustain_t self)
// float[] org, float[] dir, int color, int count, int magnitude)
{
int i, j;
cparticle_t p;
float d;
- float[] r = new float[3];
- float[] u = new float[3];
- float[] dir = new float[3];
// vectoangles2 (dir, angle_dir);
// AngleVectors (angle_dir, f, r, u);
@@ -413,16 +410,14 @@ public class CL_newfx {
self.nextthink += self.thinkinterval;
}
+ // stack variable
+ // move, vec, right, up
+ private static final float[] forward = {0, 0, 0};
+ private static final float[] angle_dir = {0, 0, 0};
/*
* =============== CL_TrackerTrail ===============
*/
static void TrackerTrail(float[] start, float[] end, int particleColor) {
- float[] move = new float[3];
- float[] vec = new float[3];
- float[] forward = new float[3];
- float[] right = new float[3];
- float[] up = new float[3];
- float[] angle_dir = new float[3];
float len;
cparticle_t p;
int dec;
@@ -468,12 +463,12 @@ public class CL_newfx {
}
}
+ // stack variable
+ // dir
static void Tracker_Shell(float[] origin) {
- float[] dir = new float[3];
- int i;
cparticle_t p;
- for (i = 0; i < 300; i++) {
+ for (int i = 0; i < 300; i++) {
if (CL_fx.free_particles == null)
return;
p = CL_fx.free_particles;
@@ -497,12 +492,12 @@ public class CL_newfx {
}
}
+ // stack variable
+ // dir
static void MonsterPlasma_Shell(float[] origin) {
- float[] dir = new float[3];
- int i;
cparticle_t p;
- for (i = 0; i < 40; i++) {
+ for (int i = 0; i < 40; i++) {
if (CL_fx.free_particles == null)
return;
p = CL_fx.free_particles;
@@ -530,8 +525,9 @@ public class CL_newfx {
private static int[] wb_colortable = { 2 * 8, 13 * 8, 21 * 8, 18 * 8 };
+ // stack variable
+ // dir
static void Widowbeamout(cl_sustain_t self) {
- float[] dir = new float[3];
int i;
cparticle_t p;
@@ -567,8 +563,9 @@ public class CL_newfx {
private static int[] nb_colortable = { 110, 112, 114, 116 };
+ // stack variable
+ // dir
static void Nukeblast(cl_sustain_t self) {
- float[] dir = new float[3];
int i;
cparticle_t p;
@@ -604,10 +601,11 @@ public class CL_newfx {
private static int[] ws_colortable = { 2 * 8, 13 * 8, 21 * 8, 18 * 8 };
+ // stack variable
+ // dir
static void WidowSplash(float[] org) {
int i;
cparticle_t p;
- float[] dir = new float[3];
for (i = 0; i < 256; i++) {
if (CL_fx.free_particles == null)
@@ -635,14 +633,14 @@ public class CL_newfx {
}
+ // stack variable
+ // move, vec
/*
* ===============
* CL_TagTrail
* ===============
*/
static void TagTrail(float[] start, float[] end, float color) {
- float[] move = new float[3];
- float[] vec = new float[3];
float len;
int j;
cparticle_t p;
@@ -712,6 +710,8 @@ public class CL_newfx {
}
}
+ // stack variable
+ // r, u
/*
* =============== CL_ParticleSmokeEffect - like the steam effect, but
* unaffected by gravity ===============
@@ -721,8 +721,6 @@ public class CL_newfx {
int i, j;
cparticle_t p;
float d;
- float[] r = new float[3];
- float[] u = new float[3];
Math3D.MakeNormalVectors(dir, r, u);
@@ -791,14 +789,14 @@ public class CL_newfx {
}
}
+ // stack variable
+ // move, vec
/*
* =============== CL_BlasterTrail2
*
* Green! ===============
*/
static void BlasterTrail2(float[] start, float[] end) {
- float[] move = new float[3];
- float[] vec = new float[3];
float len;
int j;
cparticle_t p;