From: Carsten W. <ca...@us...> - 2005-01-17 21:51:04
|
Update of /cvsroot/jake2/jake2/src/jake2/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21475/src/jake2/client Modified Files: CL_newfx.java CL_fx.java Log Message: garbage optimized (float[]) Index: CL_fx.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL_fx.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CL_fx.java 11 Oct 2004 14:04:16 -0000 1.7 --- CL_fx.java 17 Jan 2005 21:50:42 -0000 1.8 *************** *** 251,254 **** --- 251,257 ---- } + // stack variable + private static final float[] fv = {0, 0, 0}; + private static final float[] rv = {0, 0, 0}; /* * ============== *************** *** 257,262 **** */ static void ParseMuzzleFlash() { - float[] fv = new float[3]; - float[] rv = new float[3]; float volume; String soundname; --- 260,263 ---- *************** *** 505,515 **** } /* * ============== CL_ParseMuzzleFlash2 ============== */ static void ParseMuzzleFlash2() { - float[] origin = new float[3]; - float[] forward = new float[3]; - float[] right = new float[3]; String soundname; --- 506,517 ---- } + // 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() { String soundname; *************** *** 981,990 **** */ static void ClearParticles() { - int i; - free_particles = particles[0]; active_particles = null; ! for (i = 0; i < particles.length - 1; i++) particles[i].next = particles[i + 1]; particles[particles.length - 1].next = null; --- 983,990 ---- */ static void ClearParticles() { free_particles = particles[0]; active_particles = null; ! for (int i = 0; i < particles.length - 1; i++) particles[i].next = particles[i + 1]; particles[particles.length - 1].next = null; *************** *** 997,1005 **** */ static void ParticleEffect(float[] org, float[] dir, int color, int count) { ! int i, j; cparticle_t p; float d; ! ! for (i = 0; i < count; i++) { if (free_particles == null) return; --- 997,1005 ---- */ static void ParticleEffect(float[] org, float[] dir, int color, int count) { ! int j; cparticle_t p; float d; ! ! for (int i = 0; i < count; i++) { if (free_particles == null) return; *************** *** 1030,1038 **** */ static void ParticleEffect2(float[] org, float[] dir, int color, int count) { ! int i, j; cparticle_t p; float d; ! for (i = 0; i < count; i++) { if (free_particles == null) return; --- 1030,1038 ---- */ static void ParticleEffect2(float[] org, float[] dir, int color, int count) { ! int j; cparticle_t p; float d; ! for (int i = 0; i < count; i++) { if (free_particles == null) return; *************** *** 1064,1072 **** */ static void ParticleEffect3(float[] org, float[] dir, int color, int count) { ! int i, j; cparticle_t p; float d; ! for (i = 0; i < count; i++) { if (free_particles == null) return; --- 1064,1072 ---- */ static void ParticleEffect3(float[] org, float[] dir, int color, int count) { ! int j; cparticle_t p; float d; ! for (int i = 0; i < count; i++) { if (free_particles == null) return; *************** *** 1097,1104 **** */ static void TeleporterParticles(entity_state_t ent) { ! int i, j; cparticle_t p; ! for (i = 0; i < 8; i++) { if (free_particles == null) return; --- 1097,1104 ---- */ static void TeleporterParticles(entity_state_t ent) { ! int j; cparticle_t p; ! for (int i = 0; i < 8; i++) { if (free_particles == null) return; *************** *** 1133,1140 **** */ static void LogoutEffect(float[] org, int type) { ! int i, j; cparticle_t p; ! for (i = 0; i < 500; i++) { if (free_particles == null) return; --- 1133,1140 ---- */ static void LogoutEffect(float[] org, int type) { ! int j; cparticle_t p; ! for (int i = 0; i < 500; i++) { if (free_particles == null) return; *************** *** 1174,1181 **** */ static void ItemRespawnParticles(float[] org) { ! int i, j; cparticle_t p; ! for (i = 0; i < 64; i++) { if (free_particles == null) return; --- 1174,1181 ---- */ static void ItemRespawnParticles(float[] org) { ! int j; cparticle_t p; ! for (int i = 0; i < 64; i++) { if (free_particles == null) return; *************** *** 1208,1215 **** */ static void ExplosionParticles(float[] org) { ! int i, j; cparticle_t p; ! for (i = 0; i < 256; i++) { if (free_particles == null) return; --- 1208,1215 ---- */ static void ExplosionParticles(float[] org) { ! int j; cparticle_t p; ! for (int i = 0; i < 256; i++) { if (free_particles == null) return; *************** *** 1236,1244 **** static void BigTeleportParticles(float[] org) { - int i; cparticle_t p; float angle, dist; ! for (i = 0; i < 4096; i++) { if (free_particles == null) return; --- 1236,1243 ---- static void BigTeleportParticles(float[] org) { cparticle_t p; float angle, dist; ! for (int i = 0; i < 4096; i++) { if (free_particles == null) return; *************** *** 1277,1287 **** */ static void BlasterParticles(float[] org, float[] dir) { ! int i, j; cparticle_t p; float d; - int count; ! count = 40; ! for (i = 0; i < count; i++) { if (free_particles == null) return; --- 1276,1285 ---- */ static void BlasterParticles(float[] org, float[] dir) { ! int j; cparticle_t p; float d; ! int count = 40; ! for (int i = 0; i < count; i++) { if (free_particles == null) return; *************** *** 1308,1311 **** --- 1306,1312 ---- } + // stack variable + private static final float[] move = {0, 0, 0}; + private static final float[] vec = {0, 0, 0}; /* * =============== CL_BlasterTrail *************** *** 1314,1319 **** */ static void BlasterTrail(float[] start, float[] end) { - float[] move = new float[3]; - float[] vec = new float[3]; float len; int j; --- 1315,1318 ---- *************** *** 1355,1359 **** } ! /* * =============== --- 1354,1359 ---- } ! // stack variable ! // move, vec /* * =============== *************** *** 1362,1367 **** */ static void FlagTrail(float[] start, float[] end, float color) { - float[] move = new float[3]; - float[] vec = new float[3]; float len; int j; --- 1362,1365 ---- *************** *** 1402,1405 **** --- 1400,1405 ---- } + // stack variable + // move, vec /* * =============== CL_DiminishingTrail *************** *** 1408,1413 **** */ 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; --- 1408,1411 ---- *************** *** 1487,1490 **** --- 1485,1490 ---- } + // stack variable + // move, vec /* * =============== CL_RocketTrail *************** *** 1493,1498 **** */ static void RocketTrail(float[] start, float[] end, centity_t old) { - float[] move = new float[3]; - float[] vec = new float[3]; float len; int j; --- 1493,1496 ---- *************** *** 1539,1542 **** --- 1537,1542 ---- } + // stack variable + // move, vec /* * =============== CL_RailTrail *************** *** 1545,1550 **** */ static void RailTrail(float[] start, float[] end) { - float[] move = new float[3]; - float[] vec = new float[3]; float len; int j; --- 1545,1548 ---- *************** *** 1625,1635 **** } ! // RAFAEL /* * =============== CL_IonripperTrail =============== */ static void IonripperTrail(float[] start, float[] ent) { - float[] move = new float[3]; - float[] vec = new float[3]; float len; int j; --- 1623,1632 ---- } ! // stack variable ! // move, vec /* * =============== CL_IonripperTrail =============== */ static void IonripperTrail(float[] start, float[] ent) { float len; int j; *************** *** 1680,1683 **** --- 1677,1682 ---- } + // stack variable + // move, vec /* * =============== CL_BubbleTrail *************** *** 1686,1691 **** */ static void BubbleTrail(float[] start, float[] end) { - float[] move = new float[3]; - float[] vec = new float[3]; float len; int i, j; --- 1685,1688 ---- *************** *** 1725,1728 **** --- 1722,1727 ---- } + // stack variable + // forward /* * =============== CL_FlyParticles =============== *************** *** 1733,1737 **** float angle; float sp, sy, cp, cy; - float[] forward = new float[3]; float dist = 64; float ltime; --- 1732,1735 ---- *************** *** 1813,1816 **** --- 1811,1817 ---- } + // stack variable + private static final float[] v = {0, 0, 0}; + // forward /* * =============== CL_BfgParticles =============== *************** *** 1822,1828 **** float angle; float sp, sy, cp, cy; - float[] forward = new float[3]; float dist = 64; - float[] v = new float[3]; float ltime; --- 1823,1827 ---- *************** *** 1876,1879 **** --- 1875,1882 ---- } + // stack variable + // move, vec + private static final float[] start = {0, 0, 0}; + private static final float[] end = {0, 0, 0}; /* * =============== CL_TrapParticles =============== *************** *** 1881,1888 **** // 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; --- 1884,1887 ---- *************** *** 1977,1984 **** // FIXME combined with CL_ExplosionParticles static void BFGExplosionParticles(float[] org) { ! int i, j; cparticle_t p; ! for (i = 0; i < 256; i++) { if (free_particles == null) return; --- 1976,1983 ---- // FIXME combined with CL_ExplosionParticles static void BFGExplosionParticles(float[] org) { ! int j; cparticle_t p; ! for (int i = 0; i < 256; i++) { if (free_particles == null) return; *************** *** 2004,2007 **** --- 2003,2008 ---- } + // stack variable + private static final float[] dir = {0, 0, 0}; /* * =============== CL_TeleportParticles *************** *** 2010,2017 **** */ static void TeleportParticles(float[] org) { - cparticle_t p; float vel; - float[] dir = new float[3]; for (int i = -16; i <= 16; i += 4) --- 2011,2016 ---- *************** *** 2048,2051 **** --- 2047,2052 ---- } + // stack variable + private static final float[] org = {0, 0, 0}; /* * =============== CL_AddParticles =============== *************** *** 2056,2060 **** float time = 0.0f; float time2; - float[] org = new float[3]; int color; cparticle_t active, tail; --- 2057,2060 ---- Index: CL_newfx.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/CL_newfx.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CL_newfx.java 11 Oct 2004 14:04:16 -0000 1.6 --- CL_newfx.java 17 Jan 2005 21:50:42 -0000 1.7 *************** *** 76,92 **** } /* * ====== 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; --- 76,92 ---- } + // 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 len; // int j; cparticle_t p; float dec; // int i; // float d, c, s; *************** *** 134,141 **** } static void ForceWall(float[] start, float[] end, int color) { - float[] move = new float[3]; - float[] vec = new float[3]; - ; float len; int j; --- 134,140 ---- } + // stack variable + // move, vec static void ForceWall(float[] start, float[] end, int color) { float len; int j; *************** *** 180,183 **** --- 179,184 ---- } + // stack variable + // move, vec /* * =============== CL_BubbleTrail2 (lets you control the # of bubbles by *************** *** 187,193 **** */ static void BubbleTrail2(float[] start, float[] end, int dist) { - float[] move = new float[3]; - float[] vec = new float[3]; - ; float len; int i, j; --- 188,191 ---- *************** *** 229,243 **** } 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; --- 227,241 ---- } + // 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 len; int j; cparticle_t p; int i; float c, s; float ltime; float step = 32.0f, rstep; *************** *** 245,249 **** float rot; float variance; - float[] end = new float[3]; Math3D.VectorMA(start, 4096, forward, end); --- 243,246 ---- *************** *** 320,323 **** --- 317,323 ---- } + // stack variable + private static final float[] r = {0, 0, 0}; + private static final float[] u = {0, 0, 0}; /* * =============== CL_ParticleSteamEffect *************** *** 331,336 **** cparticle_t p; float d; - float[] r = new float[3]; - float[] u = new float[3]; // vectoangles2 (dir, angle_dir); --- 331,334 ---- *************** *** 368,371 **** --- 366,371 ---- } + // stack variable + // r, u, dir static void ParticleSteamEffect2(cl_sustain_t self) // float[] org, float[] dir, int color, int count, int magnitude) *************** *** 374,380 **** cparticle_t p; float d; - float[] r = new float[3]; - float[] u = new float[3]; - float[] dir = new float[3]; // vectoangles2 (dir, angle_dir); --- 374,377 ---- *************** *** 414,427 **** } /* * =============== 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; --- 411,422 ---- } + // 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 len; cparticle_t p; *************** *** 469,478 **** } static void Tracker_Shell(float[] origin) { - float[] dir = new float[3]; - int i; cparticle_t p; ! for (i = 0; i < 300; i++) { if (CL_fx.free_particles == null) return; --- 464,473 ---- } + // stack variable + // dir static void Tracker_Shell(float[] origin) { cparticle_t p; ! for (int i = 0; i < 300; i++) { if (CL_fx.free_particles == null) return; *************** *** 498,507 **** } static void MonsterPlasma_Shell(float[] origin) { - float[] dir = new float[3]; - int i; cparticle_t p; ! for (i = 0; i < 40; i++) { if (CL_fx.free_particles == null) return; --- 493,502 ---- } + // stack variable + // dir static void MonsterPlasma_Shell(float[] origin) { cparticle_t p; ! for (int i = 0; i < 40; i++) { if (CL_fx.free_particles == null) return; *************** *** 531,536 **** private static int[] wb_colortable = { 2 * 8, 13 * 8, 21 * 8, 18 * 8 }; static void Widowbeamout(cl_sustain_t self) { - float[] dir = new float[3]; int i; cparticle_t p; --- 526,532 ---- private static int[] wb_colortable = { 2 * 8, 13 * 8, 21 * 8, 18 * 8 }; + // stack variable + // dir static void Widowbeamout(cl_sustain_t self) { int i; cparticle_t p; *************** *** 568,573 **** private static int[] nb_colortable = { 110, 112, 114, 116 }; static void Nukeblast(cl_sustain_t self) { - float[] dir = new float[3]; int i; cparticle_t p; --- 564,570 ---- private static int[] nb_colortable = { 110, 112, 114, 116 }; + // stack variable + // dir static void Nukeblast(cl_sustain_t self) { int i; cparticle_t p; *************** *** 605,612 **** private static int[] ws_colortable = { 2 * 8, 13 * 8, 21 * 8, 18 * 8 }; static void WidowSplash(float[] org) { int i; cparticle_t p; - float[] dir = new float[3]; for (i = 0; i < 256; i++) { --- 602,610 ---- 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; for (i = 0; i < 256; i++) { *************** *** 636,639 **** --- 634,639 ---- } + // stack variable + // move, vec /* * =============== *************** *** 642,647 **** */ static void TagTrail(float[] start, float[] end, float color) { - float[] move = new float[3]; - float[] vec = new float[3]; float len; int j; --- 642,645 ---- *************** *** 713,716 **** --- 711,716 ---- } + // stack variable + // r, u /* * =============== CL_ParticleSmokeEffect - like the steam effect, but *************** *** 722,727 **** cparticle_t p; float d; - float[] r = new float[3]; - float[] u = new float[3]; Math3D.MakeNormalVectors(dir, r, u); --- 722,725 ---- *************** *** 792,795 **** --- 790,795 ---- } + // stack variable + // move, vec /* * =============== CL_BlasterTrail2 *************** *** 798,803 **** */ static void BlasterTrail2(float[] start, float[] end) { - float[] move = new float[3]; - float[] vec = new float[3]; float len; int j; --- 798,801 ---- |