aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/client/CL_fx.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jake2/client/CL_fx.java')
-rw-r--r--src/jake2/client/CL_fx.java2324
1 files changed, 1140 insertions, 1184 deletions
diff --git a/src/jake2/client/CL_fx.java b/src/jake2/client/CL_fx.java
index 529101b..3032f81 100644
--- a/src/jake2/client/CL_fx.java
+++ b/src/jake2/client/CL_fx.java
@@ -1,92 +1,136 @@
/*
- * CL_fx.java
+ * java
* Copyright (C) 2004
*
- * $Id: CL_fx.java,v 1.5 2004-07-13 11:09:55 hzi Exp $
+ * $Id: CL_fx.java,v 1.6 2004-09-22 19:22:08 salomo Exp $
*/
/*
-Copyright (C) 1997-2001 Id Software, Inc.
+ Copyright (C) 1997-2001 Id Software, Inc.
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-See the GNU General Public License for more details.
+ See the GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ */
package jake2.client;
+import jake2.Defines;
import jake2.Globals;
import jake2.game.M_Flash;
import jake2.game.entity_state_t;
import jake2.qcommon.Com;
import jake2.qcommon.MSG;
-import jake2.sound.*;
+import jake2.sound.S;
+import jake2.util.Lib;
+import jake2.util.Math3D;
/**
- * CL_fx
+ * Client Graphics Effects.
*/
-public class CL_fx extends CL_tent {
-
- static final float INSTANT_PARTICLE = -10000.0f;
-
+public class CL_fx {
+
static class cdlight_t {
int key; // so entities can reuse same entry
+
float[] color = { 0, 0, 0 };
+
float[] origin = { 0, 0, 0 };
+
float radius;
+
float die; // stop lighting after this time
+
//float decay; // drop this each second
float minlight; // don't add when contributing less
+
void clear() {
radius = minlight = color[0] = color[1] = color[2] = 0;
}
}
- static float[][] avelocities = new float[NUMVERTEXNORMALS][3];
+ static cparticle_t[] particles = new cparticle_t[Defines.MAX_PARTICLES];
+ static {
+ for (int i = 0; i < particles.length; i++)
+ particles[i] = new cparticle_t();
+ }
+
+ static int cl_numparticles = Defines.MAX_PARTICLES;
- /*
- ==============================================================
+ static final float INSTANT_PARTICLE = -10000.0f;
- LIGHT STYLE MANAGEMENT
+ static float[][] avelocities = new float[Defines.NUMVERTEXNORMALS][3];
- ==============================================================
- */
+ static clightstyle_t[] cl_lightstyle = new clightstyle_t[Defines.MAX_LIGHTSTYLES];
+
+ static int lastofs;
+
+ /*
+ * ==============================================================
+ *
+ * LIGHT STYLE MANAGEMENT
+ *
+ * ==============================================================
+ */
static class clightstyle_t {
int length;
+
float[] value = new float[3];
- float[] map = new float[MAX_QPATH];
+
+ float[] map = new float[Defines.MAX_QPATH];
+
void clear() {
value[0] = value[1] = value[2] = length = 0;
for (int i = 0; i < map.length; i++)
map[i] = 0.0f;
}
}
- static clightstyle_t[] cl_lightstyle = new clightstyle_t[MAX_LIGHTSTYLES];
+
static {
- for(int i=0; i<cl_lightstyle.length; i++) {
+ for (int i = 0; i < cl_lightstyle.length; i++) {
cl_lightstyle[i] = new clightstyle_t();
}
}
- static int lastofs;
/*
- ================
- CL_ClearLightStyles
- ================
- */
- static void ClearLightStyles ()
- {
+ * ==============================================================
+ *
+ * DLIGHT MANAGEMENT
+ *
+ * ==============================================================
+ */
+
+ static cdlight_t[] cl_dlights = new cdlight_t[Defines.MAX_DLIGHTS];
+ static {
+ for (int i = 0; i < cl_dlights.length; i++)
+ cl_dlights[i] = new cdlight_t();
+ }
+
+ /*
+ * ================ CL_ClearDlights ================
+ */
+ static void ClearDlights() {
+ // memset (cl_dlights, 0, sizeof(cl_dlights));
+ for (int i = 0; i < cl_dlights.length; i++) {
+ cl_dlights[i].clear();
+ }
+ }
+
+ /*
+ * ================ CL_ClearLightStyles ================
+ */
+ static void ClearLightStyles() {
//memset (cl_lightstyle, 0, sizeof(cl_lightstyle));
for (int i = 0; i < cl_lightstyle.length; i++)
cl_lightstyle[i].clear();
@@ -94,18 +138,16 @@ public class CL_fx extends CL_tent {
}
/*
- ================
- CL_RunLightStyles
- ================
- */
+ * ================ CL_RunLightStyles ================
+ */
static void RunLightStyles() {
clightstyle_t ls;
- int ofs = cl.time / 100;
+ int ofs = Globals.cl.time / 100;
if (ofs == lastofs)
return;
lastofs = ofs;
-
+
for (int i = 0; i < cl_lightstyle.length; i++) {
ls = cl_lightstyle[i];
if (ls.length == 0) {
@@ -123,11 +165,11 @@ public class CL_fx extends CL_tent {
String s;
int j, k;
- s = cl.configstrings[i + CS_LIGHTS];
+ s = Globals.cl.configstrings[i + Defines.CS_LIGHTS];
j = s.length();
- if (j >= MAX_QPATH)
- Com.Error(ERR_DROP, "svc_lightstyle length=" + j);
+ if (j >= Defines.MAX_QPATH)
+ Com.Error(Defines.ERR_DROP, "svc_lightstyle length=" + j);
cl_lightstyle[i].length = j;
@@ -136,10 +178,8 @@ public class CL_fx extends CL_tent {
}
/*
- ================
- CL_AddLightStyles
- ================
- */
+ * ================ CL_AddLightStyles ================
+ */
static void AddLightStyles() {
clightstyle_t ls;
@@ -150,44 +190,17 @@ public class CL_fx extends CL_tent {
}
/*
- ==============================================================
-
- DLIGHT MANAGEMENT
-
- ==============================================================
- */
-
- static cdlight_t[] cl_dlights = new cdlight_t[MAX_DLIGHTS];
- static {
- for (int i = 0; i < cl_dlights.length; i++)
- cl_dlights[i] = new cdlight_t();
- }
-
- /*
- ================
- CL_ClearDlights
- ================
- */
- static void ClearDlights() {
- // memset (cl_dlights, 0, sizeof(cl_dlights));
- for (int i = 0; i < cl_dlights.length; i++) {
- cl_dlights[i].clear();
- }
- }
-
- /*
- ===============
- CL_AllocDlight
-
- ===============
- */
+ * =============== CL_AllocDlight
+ *
+ * ===============
+ */
static cdlight_t AllocDlight(int key) {
int i;
cdlight_t dl;
// first look for an exact key match
- if (key != 0) {
- for (i = 0; i < MAX_DLIGHTS; i++) {
+ if (key != 0) {
+ for (i = 0; i < Defines.MAX_DLIGHTS; i++) {
dl = cl_dlights[i];
if (dl.key == key) {
//memset (dl, 0, sizeof(*dl));
@@ -199,9 +212,9 @@ public class CL_fx extends CL_tent {
}
// then look for anything else
- for (i = 0; i < MAX_DLIGHTS; i++) {
+ for (i = 0; i < Defines.MAX_DLIGHTS; i++) {
dl = cl_dlights[i];
- if (dl.die < cl.time) {
+ if (dl.die < Globals.cl.time) {
//memset (dl, 0, sizeof(*dl));
dl.clear();
dl.key = key;
@@ -218,36 +231,33 @@ public class CL_fx extends CL_tent {
}
/*
- ===============
- CL_NewDlight
- ===============
- */
+ * =============== CL_NewDlight ===============
+ */
static void NewDlight(int key, float x, float y, float z, float radius, float time) {
cdlight_t dl;
- dl = CL.AllocDlight(key);
+ dl = AllocDlight(key);
dl.origin[0] = x;
dl.origin[1] = y;
dl.origin[2] = z;
dl.radius = radius;
- dl.die = cl.time + time;
+ dl.die = Globals.cl.time + time;
}
/*
- ===============
- CL_RunDLights
-
- ===============
- */
+ * =============== CL_RunDLights
+ *
+ * ===============
+ */
static void RunDLights() {
cdlight_t dl;
- for (int i = 0; i < MAX_DLIGHTS; i++) {
+ for (int i = 0; i < Defines.MAX_DLIGHTS; i++) {
dl = cl_dlights[i];
if (dl.radius == 0.0f)
continue;
- if (dl.die < cl.time) {
+ if (dl.die < Globals.cl.time) {
dl.radius = 0.0f;
return;
}
@@ -258,37 +268,35 @@ public class CL_fx extends CL_tent {
}
/*
- ==============
- CL_ParseMuzzleFlash
- ==============
- */
+ * ============== CL_ParseMuzzleFlash ==============
+ */
static void ParseMuzzleFlash() {
float[] fv = new float[3];
float[] rv = new float[3];
float volume;
String soundname;
- int i = MSG.ReadShort(net_message);
- if (i < 1 || i >= MAX_EDICTS)
- Com.Error(ERR_DROP, "CL_ParseMuzzleFlash: bad entity");
+ int i = MSG.ReadShort(Globals.net_message);
+ if (i < 1 || i >= Defines.MAX_EDICTS)
+ Com.Error(Defines.ERR_DROP, "CL_ParseMuzzleFlash: bad entity");
- int weapon = MSG.ReadByte(net_message);
- int silenced = weapon & MZ_SILENCED;
- weapon &= ~MZ_SILENCED;
+ int weapon = MSG.ReadByte(Globals.net_message);
+ int silenced = weapon & Defines.MZ_SILENCED;
+ weapon &= ~Defines.MZ_SILENCED;
- centity_t pl = cl_entities[i];
+ centity_t pl = Globals.cl_entities[i];
- cdlight_t dl = CL.AllocDlight(i);
- VectorCopy(pl.current.origin, dl.origin);
- AngleVectors(pl.current.angles, fv, rv, null);
- VectorMA(dl.origin, 18, fv, dl.origin);
- VectorMA(dl.origin, 16, rv, dl.origin);
+ cdlight_t dl = AllocDlight(i);
+ Math3D.VectorCopy(pl.current.origin, dl.origin);
+ Math3D.AngleVectors(pl.current.angles, fv, rv, null);
+ Math3D.VectorMA(dl.origin, 18, fv, dl.origin);
+ Math3D.VectorMA(dl.origin, 16, rv, dl.origin);
if (silenced != 0)
- dl.radius = 100 + (rnd.nextInt() & 31);
+ dl.radius = 100 + (Globals.rnd.nextInt() & 31);
else
- dl.radius = 200 + (rnd.nextInt() & 31);
+ dl.radius = 200 + (Globals.rnd.nextInt() & 31);
dl.minlight = 32;
- dl.die = cl.time; // + 0.1;
+ dl.die = Globals.cl.time; // + 0.1;
if (silenced != 0)
volume = 0.2f;
@@ -296,682 +304,682 @@ public class CL_fx extends CL_tent {
volume = 1;
switch (weapon) {
- case MZ_BLASTER :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/blastf1a.wav"), volume, ATTN_NORM, 0);
- break;
- case MZ_BLUEHYPERBLASTER :
- dl.color[0] = 0;
- dl.color[1] = 0;
- dl.color[2] = 1;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/hyprbf1a.wav"), volume, ATTN_NORM, 0);
- break;
- case MZ_HYPERBLASTER :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/hyprbf1a.wav"), volume, ATTN_NORM, 0);
- break;
- case MZ_MACHINEGUN :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- //Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
- soundname = "weapons/machgf" + ((rnd.nextInt(5)) + 1) + "b.wav";
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound(soundname), volume, ATTN_NORM, 0);
- break;
- case MZ_SHOTGUN :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/shotgf1b.wav"), volume, ATTN_NORM, 0);
- S.StartSound(null, i, CHAN_AUTO, S.RegisterSound("weapons/shotgr1b.wav"), volume, ATTN_NORM, 0.1f);
- break;
- case MZ_SSHOTGUN :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/sshotf1b.wav"), volume, ATTN_NORM, 0);
- break;
- case MZ_CHAINGUN1 :
- dl.radius = 200 + (rnd.nextInt() & 31);
- dl.color[0] = 1;
- dl.color[1] = 0.25f;
- dl.color[2] = 0;
- //Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
- soundname = "weapons/machgf" + ((rnd.nextInt(5)) + 1) + "b.wav";
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound(soundname), volume, ATTN_NORM, 0);
- break;
- case MZ_CHAINGUN2 :
- dl.radius = 225 + (rnd.nextInt() & 31);
- dl.color[0] = 1;
- dl.color[1] = 0.5f;
- dl.color[2] = 0;
- dl.die = cl.time + 0.1f; // long delay
- //Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
- soundname = "weapons/machgf" + ((rnd.nextInt(5)) + 1) + "b.wav";
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound(soundname), volume, ATTN_NORM, 0);
- //Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
- soundname = "weapons/machgf" + ((rnd.nextInt(5)) + 1) + "b.wav";
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound(soundname), volume, ATTN_NORM, 0.05f);
- break;
- case MZ_CHAINGUN3 :
- dl.radius = 250 + (rnd.nextInt() & 31);
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- dl.die = cl.time + 0.1f; // long delay
- //Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
- soundname = "weapons/machgf" + ((rnd.nextInt(5)) + 1) + "b.wav";
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound(soundname), volume, ATTN_NORM, 0);
- //Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
- soundname = "weapons/machgf" + ((rnd.nextInt(5)) + 1) + "b.wav";
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound(soundname), volume, ATTN_NORM, 0.033f);
- //Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
- soundname = "weapons/machgf" + ((rnd.nextInt(5)) + 1) + "b.wav";
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound(soundname), volume, ATTN_NORM, 0.066f);
- break;
- case MZ_RAILGUN :
- dl.color[0] = 0.5f;
- dl.color[1] = 0.5f;
- dl.color[2] = 1.0f;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/railgf1a.wav"), volume, ATTN_NORM, 0);
- break;
- case MZ_ROCKET :
- dl.color[0] = 1;
- dl.color[1] = 0.5f;
- dl.color[2] = 0.2f;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/rocklf1a.wav"), volume, ATTN_NORM, 0);
- S.StartSound(null, i, CHAN_AUTO, S.RegisterSound("weapons/rocklr1b.wav"), volume, ATTN_NORM, 0.1f);
- break;
- case MZ_GRENADE :
- dl.color[0] = 1;
- dl.color[1] = 0.5f;
- dl.color[2] = 0;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/grenlf1a.wav"), volume, ATTN_NORM, 0);
- S.StartSound(null, i, CHAN_AUTO, S.RegisterSound("weapons/grenlr1b.wav"), volume, ATTN_NORM, 0.1f);
- break;
- case MZ_BFG :
- dl.color[0] = 0;
- dl.color[1] = 1;
- dl.color[2] = 0;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/bfg__f1y.wav"), volume, ATTN_NORM, 0);
- break;
-
- case MZ_LOGIN :
- dl.color[0] = 0;
- dl.color[1] = 1;
- dl.color[2] = 0;
- dl.die = cl.time + 1.0f;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0);
- CL.LogoutEffect(pl.current.origin, weapon);
- break;
- case MZ_LOGOUT :
- dl.color[0] = 1;
- dl.color[1] = 0;
- dl.color[2] = 0;
- dl.die = cl.time + 1.0f;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0);
- CL.LogoutEffect(pl.current.origin, weapon);
- break;
- case MZ_RESPAWN :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- dl.die = cl.time + 1.0f;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0);
- CL.LogoutEffect(pl.current.origin, weapon);
- break;
- // RAFAEL
- case MZ_PHALANX :
- dl.color[0] = 1;
- dl.color[1] = 0.5f;
- dl.color[2] = 0.5f;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/plasshot.wav"), volume, ATTN_NORM, 0);
- break;
- // RAFAEL
- case MZ_IONRIPPER :
- dl.color[0] = 1;
- dl.color[1] = 0.5f;
- dl.color[2] = 0.5f;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/rippfire.wav"), volume, ATTN_NORM, 0);
- break;
-
- // ======================
- // PGM
- case MZ_ETF_RIFLE :
- dl.color[0] = 0.9f;
- dl.color[1] = 0.7f;
- dl.color[2] = 0;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/nail1.wav"), volume, ATTN_NORM, 0);
- break;
- case MZ_SHOTGUN2 :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/shotg2.wav"), volume, ATTN_NORM, 0);
- break;
- case MZ_HEATBEAM :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- dl.die = cl.time + 100;
- // S.StartSound (null, i, CHAN_WEAPON, S.RegisterSound("weapons/bfg__l1a.wav"), volume, ATTN_NORM, 0);
- break;
- case MZ_BLASTER2 :
- dl.color[0] = 0;
- dl.color[1] = 1;
- dl.color[2] = 0;
- // FIXME - different sound for blaster2 ??
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/blastf1a.wav"), volume, ATTN_NORM, 0);
- break;
- case MZ_TRACKER :
- // negative flashes handled the same in gl/soft until CL_AddDLights
- dl.color[0] = -1;
- dl.color[1] = -1;
- dl.color[2] = -1;
- S.StartSound(null, i, CHAN_WEAPON, S.RegisterSound("weapons/disint2.wav"), volume, ATTN_NORM, 0);
- break;
- case MZ_NUKE1 :
- dl.color[0] = 1;
- dl.color[1] = 0;
- dl.color[2] = 0;
- dl.die = cl.time + 100;
- break;
- case MZ_NUKE2 :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- dl.die = cl.time + 100;
- break;
- case MZ_NUKE4 :
- dl.color[0] = 0;
- dl.color[1] = 0;
- dl.color[2] = 1;
- dl.die = cl.time + 100;
- break;
- case MZ_NUKE8 :
- dl.color[0] = 0;
- dl.color[1] = 1;
- dl.color[2] = 1;
- dl.die = cl.time + 100;
- break;
- // PGM
- // ======================
+ case Defines.MZ_BLASTER:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/blastf1a.wav"), volume, Defines.ATTN_NORM, 0);
+ break;
+ case Defines.MZ_BLUEHYPERBLASTER:
+ dl.color[0] = 0;
+ dl.color[1] = 0;
+ dl.color[2] = 1;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/hyprbf1a.wav"), volume, Defines.ATTN_NORM, 0);
+ break;
+ case Defines.MZ_HYPERBLASTER:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/hyprbf1a.wav"), volume, Defines.ATTN_NORM, 0);
+ break;
+ case Defines.MZ_MACHINEGUN:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ //Com_sprintf(soundname, sizeof(soundname),
+ // "weapons/machgf%ib.wav", (rand() % 5) + 1);
+ soundname = "weapons/machgf" + ((Globals.rnd.nextInt(5)) + 1) + "b.wav";
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound(soundname), volume, Defines.ATTN_NORM, 0);
+ break;
+ case Defines.MZ_SHOTGUN:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/shotgf1b.wav"), volume, Defines.ATTN_NORM, 0);
+ S.StartSound(null, i, Defines.CHAN_AUTO, S.RegisterSound("weapons/shotgr1b.wav"), volume, Defines.ATTN_NORM, 0.1f);
+ break;
+ case Defines.MZ_SSHOTGUN:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/sshotf1b.wav"), volume, Defines.ATTN_NORM, 0);
+ break;
+ case Defines.MZ_CHAINGUN1:
+ dl.radius = 200 + (Globals.rnd.nextInt() & 31);
+ dl.color[0] = 1;
+ dl.color[1] = 0.25f;
+ dl.color[2] = 0;
+ //Com_sprintf(soundname, sizeof(soundname),
+ // "weapons/machgf%ib.wav", (rand() % 5) + 1);
+ soundname = "weapons/machgf" + ((Globals.rnd.nextInt(5)) + 1) + "b.wav";
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound(soundname), volume, Defines.ATTN_NORM, 0);
+ break;
+ case Defines.MZ_CHAINGUN2:
+ dl.radius = 225 + (Globals.rnd.nextInt() & 31);
+ dl.color[0] = 1;
+ dl.color[1] = 0.5f;
+ dl.color[2] = 0;
+ dl.die = Globals.cl.time + 0.1f; // long delay
+ //Com_sprintf(soundname, sizeof(soundname),
+ // "weapons/machgf%ib.wav", (rand() % 5) + 1);
+ soundname = "weapons/machgf" + ((Globals.rnd.nextInt(5)) + 1) + "b.wav";
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound(soundname), volume, Defines.ATTN_NORM, 0);
+ //Com_sprintf(soundname, sizeof(soundname),
+ // "weapons/machgf%ib.wav", (rand() % 5) + 1);
+ soundname = "weapons/machgf" + ((Globals.rnd.nextInt(5)) + 1) + "b.wav";
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound(soundname), volume, Defines.ATTN_NORM, 0.05f);
+ break;
+ case Defines.MZ_CHAINGUN3:
+ dl.radius = 250 + (Globals.rnd.nextInt() & 31);
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ dl.die = Globals.cl.time + 0.1f; // long delay
+ //Com_sprintf(soundname, sizeof(soundname),
+ // "weapons/machgf%ib.wav", (rand() % 5) + 1);
+ soundname = "weapons/machgf" + ((Globals.rnd.nextInt(5)) + 1) + "b.wav";
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound(soundname), volume, Defines.ATTN_NORM, 0);
+ //Com_sprintf(soundname, sizeof(soundname),
+ // "weapons/machgf%ib.wav", (rand() % 5) + 1);
+ soundname = "weapons/machgf" + ((Globals.rnd.nextInt(5)) + 1) + "b.wav";
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound(soundname), volume, Defines.ATTN_NORM, 0.033f);
+ //Com_sprintf(soundname, sizeof(soundname),
+ // "weapons/machgf%ib.wav", (rand() % 5) + 1);
+ soundname = "weapons/machgf" + ((Globals.rnd.nextInt(5)) + 1) + "b.wav";
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound(soundname), volume, Defines.ATTN_NORM, 0.066f);
+ break;
+ case Defines.MZ_RAILGUN:
+ dl.color[0] = 0.5f;
+ dl.color[1] = 0.5f;
+ dl.color[2] = 1.0f;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/railgf1a.wav"), volume, Defines.ATTN_NORM, 0);
+ break;
+ case Defines.MZ_ROCKET:
+ dl.color[0] = 1;
+ dl.color[1] = 0.5f;
+ dl.color[2] = 0.2f;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/rocklf1a.wav"), volume, Defines.ATTN_NORM, 0);
+ S.StartSound(null, i, Defines.CHAN_AUTO, S.RegisterSound("weapons/rocklr1b.wav"), volume, Defines.ATTN_NORM, 0.1f);
+ break;
+ case Defines.MZ_GRENADE:
+ dl.color[0] = 1;
+ dl.color[1] = 0.5f;
+ dl.color[2] = 0;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/grenlf1a.wav"), volume, Defines.ATTN_NORM, 0);
+ S.StartSound(null, i, Defines.CHAN_AUTO, S.RegisterSound("weapons/grenlr1b.wav"), volume, Defines.ATTN_NORM, 0.1f);
+ break;
+ case Defines.MZ_BFG:
+ dl.color[0] = 0;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/bfg__f1y.wav"), volume, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ_LOGIN:
+ dl.color[0] = 0;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ dl.die = Globals.cl.time + 1.0f;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/grenlf1a.wav"), 1, Defines.ATTN_NORM, 0);
+ LogoutEffect(pl.current.origin, weapon);
+ break;
+ case Defines.MZ_LOGOUT:
+ dl.color[0] = 1;
+ dl.color[1] = 0;
+ dl.color[2] = 0;
+ dl.die = Globals.cl.time + 1.0f;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/grenlf1a.wav"), 1, Defines.ATTN_NORM, 0);
+ LogoutEffect(pl.current.origin, weapon);
+ break;
+ case Defines.MZ_RESPAWN:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ dl.die = Globals.cl.time + 1.0f;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/grenlf1a.wav"), 1, Defines.ATTN_NORM, 0);
+ LogoutEffect(pl.current.origin, weapon);
+ break;
+ // RAFAEL
+ case Defines.MZ_PHALANX:
+ dl.color[0] = 1;
+ dl.color[1] = 0.5f;
+ dl.color[2] = 0.5f;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/plasshot.wav"), volume, Defines.ATTN_NORM, 0);
+ break;
+ // RAFAEL
+ case Defines.MZ_IONRIPPER:
+ dl.color[0] = 1;
+ dl.color[1] = 0.5f;
+ dl.color[2] = 0.5f;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/rippfire.wav"), volume, Defines.ATTN_NORM, 0);
+ break;
+
+ // ======================
+ // PGM
+ case Defines.MZ_ETF_RIFLE:
+ dl.color[0] = 0.9f;
+ dl.color[1] = 0.7f;
+ dl.color[2] = 0;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/nail1.wav"), volume, Defines.ATTN_NORM, 0);
+ break;
+ case Defines.MZ_SHOTGUN2:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/shotg2.wav"), volume, Defines.ATTN_NORM, 0);
+ break;
+ case Defines.MZ_HEATBEAM:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ dl.die = Globals.cl.time + 100;
+ // S.StartSound (null, i, CHAN_WEAPON,
+ // S.RegisterSound("weapons/bfg__l1a.wav"), volume, ATTN_NORM, 0);
+ break;
+ case Defines.MZ_BLASTER2:
+ dl.color[0] = 0;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ // FIXME - different sound for blaster2 ??
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/blastf1a.wav"), volume, Defines.ATTN_NORM, 0);
+ break;
+ case Defines.MZ_TRACKER:
+ // negative flashes handled the same in gl/soft until CL_AddDLights
+ dl.color[0] = -1;
+ dl.color[1] = -1;
+ dl.color[2] = -1;
+ S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/disint2.wav"), volume, Defines.ATTN_NORM, 0);
+ break;
+ case Defines.MZ_NUKE1:
+ dl.color[0] = 1;
+ dl.color[1] = 0;
+ dl.color[2] = 0;
+ dl.die = Globals.cl.time + 100;
+ break;
+ case Defines.MZ_NUKE2:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ dl.die = Globals.cl.time + 100;
+ break;
+ case Defines.MZ_NUKE4:
+ dl.color[0] = 0;
+ dl.color[1] = 0;
+ dl.color[2] = 1;
+ dl.die = Globals.cl.time + 100;
+ break;
+ case Defines.MZ_NUKE8:
+ dl.color[0] = 0;
+ dl.color[1] = 1;
+ dl.color[2] = 1;
+ dl.die = Globals.cl.time + 100;
+ break;
+ // PGM
+ // ======================
}
}
/*
- ==============
- CL_ParseMuzzleFlash2
- ==============
- */
+ * ============== 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(net_message);
- if (ent < 1 || ent >= MAX_EDICTS)
- Com.Error(ERR_DROP, "CL_ParseMuzzleFlash2: bad entity");
+ int ent = MSG.ReadShort(Globals.net_message);
+ if (ent < 1 || ent >= Defines.MAX_EDICTS)
+ Com.Error(Defines.ERR_DROP, "CL_ParseMuzzleFlash2: bad entity");
- int flash_number = MSG.ReadByte(net_message);
+ int flash_number = MSG.ReadByte(Globals.net_message);
// locate the origin
- AngleVectors(cl_entities[ent].current.angles, forward, right, null);
- origin[0] =
- cl_entities[ent].current.origin[0]
- + forward[0] * M_Flash.monster_flash_offset[flash_number][0]
- + right[0] * M_Flash.monster_flash_offset[flash_number][1];
- origin[1] =
- cl_entities[ent].current.origin[1]
- + forward[1] * M_Flash.monster_flash_offset[flash_number][0]
- + right[1] * M_Flash.monster_flash_offset[flash_number][1];
- origin[2] =
- cl_entities[ent].current.origin[2]
- + forward[2] * M_Flash.monster_flash_offset[flash_number][0]
- + right[2] * M_Flash.monster_flash_offset[flash_number][1]
- + M_Flash.monster_flash_offset[flash_number][2];
-
- cdlight_t dl = CL.AllocDlight(ent);
- VectorCopy(origin, dl.origin);
- dl.radius = 200 + (rnd.nextInt() & 31);
+ Math3D.AngleVectors(Globals.cl_entities[ent].current.angles, forward, right, null);
+ origin[0] = Globals.cl_entities[ent].current.origin[0] + forward[0] * M_Flash.monster_flash_offset[flash_number][0] + right[0]
+ * M_Flash.monster_flash_offset[flash_number][1];
+ origin[1] = Globals.cl_entities[ent].current.origin[1] + forward[1] * M_Flash.monster_flash_offset[flash_number][0] + right[1]
+ * M_Flash.monster_flash_offset[flash_number][1];
+ origin[2] = Globals.cl_entities[ent].current.origin[2] + forward[2] * M_Flash.monster_flash_offset[flash_number][0] + right[2]
+ * M_Flash.monster_flash_offset[flash_number][1] + M_Flash.monster_flash_offset[flash_number][2];
+
+ cdlight_t dl = AllocDlight(ent);
+ Math3D.VectorCopy(origin, dl.origin);
+ dl.radius = 200 + (Globals.rnd.nextInt() & 31);
dl.minlight = 32;
- dl.die = cl.time; // + 0.1;
+ dl.die = Globals.cl.time; // + 0.1;
switch (flash_number) {
- case MZ2_INFANTRY_MACHINEGUN_1 :
- case MZ2_INFANTRY_MACHINEGUN_2 :
- case MZ2_INFANTRY_MACHINEGUN_3 :
- case MZ2_INFANTRY_MACHINEGUN_4 :
- case MZ2_INFANTRY_MACHINEGUN_5 :
- case MZ2_INFANTRY_MACHINEGUN_6 :
- case MZ2_INFANTRY_MACHINEGUN_7 :
- case MZ2_INFANTRY_MACHINEGUN_8 :
- case MZ2_INFANTRY_MACHINEGUN_9 :
- case MZ2_INFANTRY_MACHINEGUN_10 :
- case MZ2_INFANTRY_MACHINEGUN_11 :
- case MZ2_INFANTRY_MACHINEGUN_12 :
- case MZ2_INFANTRY_MACHINEGUN_13 :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- CL.ParticleEffect(origin, vec3_origin, 0, 40);
- CL.SmokeAndFlash(origin);
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_SOLDIER_MACHINEGUN_1 :
- case MZ2_SOLDIER_MACHINEGUN_2 :
- case MZ2_SOLDIER_MACHINEGUN_3 :
- case MZ2_SOLDIER_MACHINEGUN_4 :
- case MZ2_SOLDIER_MACHINEGUN_5 :
- case MZ2_SOLDIER_MACHINEGUN_6 :
- case MZ2_SOLDIER_MACHINEGUN_7 :
- case MZ2_SOLDIER_MACHINEGUN_8 :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- CL.ParticleEffect(origin, vec3_origin, 0, 40);
- CL.SmokeAndFlash(origin);
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("soldier/solatck3.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_GUNNER_MACHINEGUN_1 :
- case MZ2_GUNNER_MACHINEGUN_2 :
- case MZ2_GUNNER_MACHINEGUN_3 :
- case MZ2_GUNNER_MACHINEGUN_4 :
- case MZ2_GUNNER_MACHINEGUN_5 :
- case MZ2_GUNNER_MACHINEGUN_6 :
- case MZ2_GUNNER_MACHINEGUN_7 :
- case MZ2_GUNNER_MACHINEGUN_8 :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- CL.ParticleEffect(origin, vec3_origin, 0, 40);
- CL.SmokeAndFlash(origin);
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("gunner/gunatck2.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_ACTOR_MACHINEGUN_1 :
- case MZ2_SUPERTANK_MACHINEGUN_1 :
- case MZ2_SUPERTANK_MACHINEGUN_2 :
- case MZ2_SUPERTANK_MACHINEGUN_3 :
- case MZ2_SUPERTANK_MACHINEGUN_4 :
- case MZ2_SUPERTANK_MACHINEGUN_5 :
- case MZ2_SUPERTANK_MACHINEGUN_6 :
- case MZ2_TURRET_MACHINEGUN : // PGM
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
-
- CL.ParticleEffect(origin, vec3_origin, 0, 40);
- CL.SmokeAndFlash(origin);
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_BOSS2_MACHINEGUN_L1 :
- case MZ2_BOSS2_MACHINEGUN_L2 :
- case MZ2_BOSS2_MACHINEGUN_L3 :
- case MZ2_BOSS2_MACHINEGUN_L4 :
- case MZ2_BOSS2_MACHINEGUN_L5 :
- case MZ2_CARRIER_MACHINEGUN_L1 : // PMM
- case MZ2_CARRIER_MACHINEGUN_L2 : // PMM
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
-
- CL.ParticleEffect(origin, vec3_origin, 0, 40);
- CL.SmokeAndFlash(origin);
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("infantry/infatck1.wav"), 1, ATTN_NONE, 0);
- break;
-
- case MZ2_SOLDIER_BLASTER_1 :
- case MZ2_SOLDIER_BLASTER_2 :
- case MZ2_SOLDIER_BLASTER_3 :
- case MZ2_SOLDIER_BLASTER_4 :
- case MZ2_SOLDIER_BLASTER_5 :
- case MZ2_SOLDIER_BLASTER_6 :
- case MZ2_SOLDIER_BLASTER_7 :
- case MZ2_SOLDIER_BLASTER_8 :
- case MZ2_TURRET_BLASTER : // PGM
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("soldier/solatck2.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_FLYER_BLASTER_1 :
- case MZ2_FLYER_BLASTER_2 :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("flyer/flyatck3.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_MEDIC_BLASTER_1 :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("medic/medatck1.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_HOVER_BLASTER_1 :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("hover/hovatck1.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_FLOAT_BLASTER_1 :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("floater/fltatck1.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_SOLDIER_SHOTGUN_1 :
- case MZ2_SOLDIER_SHOTGUN_2 :
- case MZ2_SOLDIER_SHOTGUN_3 :
- case MZ2_SOLDIER_SHOTGUN_4 :
- case MZ2_SOLDIER_SHOTGUN_5 :
- case MZ2_SOLDIER_SHOTGUN_6 :
- case MZ2_SOLDIER_SHOTGUN_7 :
- case MZ2_SOLDIER_SHOTGUN_8 :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- CL.SmokeAndFlash(origin);
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("soldier/solatck1.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_TANK_BLASTER_1 :
- case MZ2_TANK_BLASTER_2 :
- case MZ2_TANK_BLASTER_3 :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("tank/tnkatck3.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_TANK_MACHINEGUN_1 :
- case MZ2_TANK_MACHINEGUN_2 :
- case MZ2_TANK_MACHINEGUN_3 :
- case MZ2_TANK_MACHINEGUN_4 :
- case MZ2_TANK_MACHINEGUN_5 :
- case MZ2_TANK_MACHINEGUN_6 :
- case MZ2_TANK_MACHINEGUN_7 :
- case MZ2_TANK_MACHINEGUN_8 :
- case MZ2_TANK_MACHINEGUN_9 :
- case MZ2_TANK_MACHINEGUN_10 :
- case MZ2_TANK_MACHINEGUN_11 :
- case MZ2_TANK_MACHINEGUN_12 :
- case MZ2_TANK_MACHINEGUN_13 :
- case MZ2_TANK_MACHINEGUN_14 :
- case MZ2_TANK_MACHINEGUN_15 :
- case MZ2_TANK_MACHINEGUN_16 :
- case MZ2_TANK_MACHINEGUN_17 :
- case MZ2_TANK_MACHINEGUN_18 :
- case MZ2_TANK_MACHINEGUN_19 :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- CL.ParticleEffect(origin, vec3_origin, 0, 40);
- CL.SmokeAndFlash(origin);
- //Com_sprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav", 'a' + rand() % 5);
- soundname = "tank/tnkatk2" + (char) ('a' + rnd.nextInt(5)) + ".wav";
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound(soundname), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_CHICK_ROCKET_1 :
- case MZ2_TURRET_ROCKET : // PGM
- dl.color[0] = 1;
- dl.color[1] = 0.5f;
- dl.color[2] = 0.2f;
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("chick/chkatck2.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_TANK_ROCKET_1 :
- case MZ2_TANK_ROCKET_2 :
- case MZ2_TANK_ROCKET_3 :
- dl.color[0] = 1;
- dl.color[1] = 0.5f;
- dl.color[2] = 0.2f;
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("tank/tnkatck1.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_SUPERTANK_ROCKET_1 :
- case MZ2_SUPERTANK_ROCKET_2 :
- case MZ2_SUPERTANK_ROCKET_3 :
- case MZ2_BOSS2_ROCKET_1 :
- case MZ2_BOSS2_ROCKET_2 :
- case MZ2_BOSS2_ROCKET_3 :
- case MZ2_BOSS2_ROCKET_4 :
- case MZ2_CARRIER_ROCKET_1 :
- // case MZ2_CARRIER_ROCKET_2:
- // case MZ2_CARRIER_ROCKET_3:
- // case MZ2_CARRIER_ROCKET_4:
- dl.color[0] = 1;
- dl.color[1] = 0.5f;
- dl.color[2] = 0.2f;
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("tank/rocket.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_GUNNER_GRENADE_1 :
- case MZ2_GUNNER_GRENADE_2 :
- case MZ2_GUNNER_GRENADE_3 :
- case MZ2_GUNNER_GRENADE_4 :
- dl.color[0] = 1;
- dl.color[1] = 0.5f;
- dl.color[2] = 0;
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("gunner/gunatck3.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_GLADIATOR_RAILGUN_1 :
- // PMM
- case MZ2_CARRIER_RAILGUN :
- case MZ2_WIDOW_RAIL :
- // pmm
- dl.color[0] = 0.5f;
- dl.color[1] = 0.5f;
- dl.color[2] = 1.0f;
- break;
-
- // --- Xian's shit starts ---
- case MZ2_MAKRON_BFG :
- dl.color[0] = 0.5f;
- dl.color[1] = 1;
- dl.color[2] = 0.5f;
- //S.StartSound (null, ent, CHAN_WEAPON, S.RegisterSound("makron/bfg_fire.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_MAKRON_BLASTER_1 :
- case MZ2_MAKRON_BLASTER_2 :
- case MZ2_MAKRON_BLASTER_3 :
- case MZ2_MAKRON_BLASTER_4 :
- case MZ2_MAKRON_BLASTER_5 :
- case MZ2_MAKRON_BLASTER_6 :
- case MZ2_MAKRON_BLASTER_7 :
- case MZ2_MAKRON_BLASTER_8 :
- case MZ2_MAKRON_BLASTER_9 :
- case MZ2_MAKRON_BLASTER_10 :
- case MZ2_MAKRON_BLASTER_11 :
- case MZ2_MAKRON_BLASTER_12 :
- case MZ2_MAKRON_BLASTER_13 :
- case MZ2_MAKRON_BLASTER_14 :
- case MZ2_MAKRON_BLASTER_15 :
- case MZ2_MAKRON_BLASTER_16 :
- case MZ2_MAKRON_BLASTER_17 :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("makron/blaster.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_JORG_MACHINEGUN_L1 :
- case MZ2_JORG_MACHINEGUN_L2 :
- case MZ2_JORG_MACHINEGUN_L3 :
- case MZ2_JORG_MACHINEGUN_L4 :
- case MZ2_JORG_MACHINEGUN_L5 :
- case MZ2_JORG_MACHINEGUN_L6 :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- CL.ParticleEffect(origin, vec3_origin, 0, 40);
- CL.SmokeAndFlash(origin);
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("boss3/xfire.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_JORG_MACHINEGUN_R1 :
- case MZ2_JORG_MACHINEGUN_R2 :
- case MZ2_JORG_MACHINEGUN_R3 :
- case MZ2_JORG_MACHINEGUN_R4 :
- case MZ2_JORG_MACHINEGUN_R5 :
- case MZ2_JORG_MACHINEGUN_R6 :
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- CL.ParticleEffect(origin, vec3_origin, 0, 40);
- CL.SmokeAndFlash(origin);
- break;
-
- case MZ2_JORG_BFG_1 :
- dl.color[0] = 0.5f;
- dl.color[1] = 1;
- dl.color[2] = 0.5f;
- break;
-
- case MZ2_BOSS2_MACHINEGUN_R1 :
- case MZ2_BOSS2_MACHINEGUN_R2 :
- case MZ2_BOSS2_MACHINEGUN_R3 :
- case MZ2_BOSS2_MACHINEGUN_R4 :
- case MZ2_BOSS2_MACHINEGUN_R5 :
- case MZ2_CARRIER_MACHINEGUN_R1 : // PMM
- case MZ2_CARRIER_MACHINEGUN_R2 : // PMM
-
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
-
- CL.ParticleEffect(origin, vec3_origin, 0, 40);
- CL.SmokeAndFlash(origin);
- break;
-
- // ======
- // ROGUE
- case MZ2_STALKER_BLASTER :
- case MZ2_DAEDALUS_BLASTER :
- case MZ2_MEDIC_BLASTER_2 :
- case MZ2_WIDOW_BLASTER :
- case MZ2_WIDOW_BLASTER_SWEEP1 :
- case MZ2_WIDOW_BLASTER_SWEEP2 :
- case MZ2_WIDOW_BLASTER_SWEEP3 :
- case MZ2_WIDOW_BLASTER_SWEEP4 :
- case MZ2_WIDOW_BLASTER_SWEEP5 :
- case MZ2_WIDOW_BLASTER_SWEEP6 :
- case MZ2_WIDOW_BLASTER_SWEEP7 :
- case MZ2_WIDOW_BLASTER_SWEEP8 :
- case MZ2_WIDOW_BLASTER_SWEEP9 :
- case MZ2_WIDOW_BLASTER_100 :
- case MZ2_WIDOW_BLASTER_90 :
- case MZ2_WIDOW_BLASTER_80 :
- case MZ2_WIDOW_BLASTER_70 :
- case MZ2_WIDOW_BLASTER_60 :
- case MZ2_WIDOW_BLASTER_50 :
- case MZ2_WIDOW_BLASTER_40 :
- case MZ2_WIDOW_BLASTER_30 :
- case MZ2_WIDOW_BLASTER_20 :
- case MZ2_WIDOW_BLASTER_10 :
- case MZ2_WIDOW_BLASTER_0 :
- case MZ2_WIDOW_BLASTER_10L :
- case MZ2_WIDOW_BLASTER_20L :
- case MZ2_WIDOW_BLASTER_30L :
- case MZ2_WIDOW_BLASTER_40L :
- case MZ2_WIDOW_BLASTER_50L :
- case MZ2_WIDOW_BLASTER_60L :
- case MZ2_WIDOW_BLASTER_70L :
- case MZ2_WIDOW_RUN_1 :
- case MZ2_WIDOW_RUN_2 :
- case MZ2_WIDOW_RUN_3 :
- case MZ2_WIDOW_RUN_4 :
- case MZ2_WIDOW_RUN_5 :
- case MZ2_WIDOW_RUN_6 :
- case MZ2_WIDOW_RUN_7 :
- case MZ2_WIDOW_RUN_8 :
- dl.color[0] = 0;
- dl.color[1] = 1;
- dl.color[2] = 0;
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("tank/tnkatck3.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_WIDOW_DISRUPTOR :
- dl.color[0] = -1;
- dl.color[1] = -1;
- dl.color[2] = -1;
- S.StartSound(null, ent, CHAN_WEAPON, S.RegisterSound("weapons/disint2.wav"), 1, ATTN_NORM, 0);
- break;
-
- case MZ2_WIDOW_PLASMABEAM :
- case MZ2_WIDOW2_BEAMER_1 :
- case MZ2_WIDOW2_BEAMER_2 :
- case MZ2_WIDOW2_BEAMER_3 :
- case MZ2_WIDOW2_BEAMER_4 :
- case MZ2_WIDOW2_BEAMER_5 :
- case MZ2_WIDOW2_BEAM_SWEEP_1 :
- case MZ2_WIDOW2_BEAM_SWEEP_2 :
- case MZ2_WIDOW2_BEAM_SWEEP_3 :
- case MZ2_WIDOW2_BEAM_SWEEP_4 :
- case MZ2_WIDOW2_BEAM_SWEEP_5 :
- case MZ2_WIDOW2_BEAM_SWEEP_6 :
- case MZ2_WIDOW2_BEAM_SWEEP_7 :
- case MZ2_WIDOW2_BEAM_SWEEP_8 :
- case MZ2_WIDOW2_BEAM_SWEEP_9 :
- case MZ2_WIDOW2_BEAM_SWEEP_10 :
- case MZ2_WIDOW2_BEAM_SWEEP_11 :
- dl.radius = 300 + (rnd.nextInt() & 100);
- dl.color[0] = 1;
- dl.color[1] = 1;
- dl.color[2] = 0;
- dl.die = cl.time + 200;
- break;
- // ROGUE
- // ======
-
- // --- Xian's shit ends ---
+ case Defines.MZ2_INFANTRY_MACHINEGUN_1:
+ case Defines.MZ2_INFANTRY_MACHINEGUN_2:
+ case Defines.MZ2_INFANTRY_MACHINEGUN_3:
+ case Defines.MZ2_INFANTRY_MACHINEGUN_4:
+ case Defines.MZ2_INFANTRY_MACHINEGUN_5:
+ case Defines.MZ2_INFANTRY_MACHINEGUN_6:
+ case Defines.MZ2_INFANTRY_MACHINEGUN_7:
+ case Defines.MZ2_INFANTRY_MACHINEGUN_8:
+ case Defines.MZ2_INFANTRY_MACHINEGUN_9:
+ case Defines.MZ2_INFANTRY_MACHINEGUN_10:
+ case Defines.MZ2_INFANTRY_MACHINEGUN_11:
+ case Defines.MZ2_INFANTRY_MACHINEGUN_12:
+ case Defines.MZ2_INFANTRY_MACHINEGUN_13:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ ParticleEffect(origin, Globals.vec3_origin, 0, 40);
+ CL_tent.SmokeAndFlash(origin);
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("infantry/infatck1.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_SOLDIER_MACHINEGUN_1:
+ case Defines.MZ2_SOLDIER_MACHINEGUN_2:
+ case Defines.MZ2_SOLDIER_MACHINEGUN_3:
+ case Defines.MZ2_SOLDIER_MACHINEGUN_4:
+ case Defines.MZ2_SOLDIER_MACHINEGUN_5:
+ case Defines.MZ2_SOLDIER_MACHINEGUN_6:
+ case Defines.MZ2_SOLDIER_MACHINEGUN_7:
+ case Defines.MZ2_SOLDIER_MACHINEGUN_8:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ ParticleEffect(origin, Globals.vec3_origin, 0, 40);
+ CL_tent.SmokeAndFlash(origin);
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("soldier/solatck3.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_GUNNER_MACHINEGUN_1:
+ case Defines.MZ2_GUNNER_MACHINEGUN_2:
+ case Defines.MZ2_GUNNER_MACHINEGUN_3:
+ case Defines.MZ2_GUNNER_MACHINEGUN_4:
+ case Defines.MZ2_GUNNER_MACHINEGUN_5:
+ case Defines.MZ2_GUNNER_MACHINEGUN_6:
+ case Defines.MZ2_GUNNER_MACHINEGUN_7:
+ case Defines.MZ2_GUNNER_MACHINEGUN_8:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ ParticleEffect(origin, Globals.vec3_origin, 0, 40);
+ CL_tent.SmokeAndFlash(origin);
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("gunner/gunatck2.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_ACTOR_MACHINEGUN_1:
+ case Defines.MZ2_SUPERTANK_MACHINEGUN_1:
+ case Defines.MZ2_SUPERTANK_MACHINEGUN_2:
+ case Defines.MZ2_SUPERTANK_MACHINEGUN_3:
+ case Defines.MZ2_SUPERTANK_MACHINEGUN_4:
+ case Defines.MZ2_SUPERTANK_MACHINEGUN_5:
+ case Defines.MZ2_SUPERTANK_MACHINEGUN_6:
+ case Defines.MZ2_TURRET_MACHINEGUN: // PGM
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+
+ ParticleEffect(origin, Globals.vec3_origin, 0, 40);
+ CL_tent.SmokeAndFlash(origin);
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("infantry/infatck1.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_BOSS2_MACHINEGUN_L1:
+ case Defines.MZ2_BOSS2_MACHINEGUN_L2:
+ case Defines.MZ2_BOSS2_MACHINEGUN_L3:
+ case Defines.MZ2_BOSS2_MACHINEGUN_L4:
+ case Defines.MZ2_BOSS2_MACHINEGUN_L5:
+ case Defines.MZ2_CARRIER_MACHINEGUN_L1: // PMM
+ case Defines.MZ2_CARRIER_MACHINEGUN_L2: // PMM
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+
+ ParticleEffect(origin, Globals.vec3_origin, 0, 40);
+ CL_tent.SmokeAndFlash(origin);
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("infantry/infatck1.wav"), 1, Defines.ATTN_NONE, 0);
+ break;
+
+ case Defines.MZ2_SOLDIER_BLASTER_1:
+ case Defines.MZ2_SOLDIER_BLASTER_2:
+ case Defines.MZ2_SOLDIER_BLASTER_3:
+ case Defines.MZ2_SOLDIER_BLASTER_4:
+ case Defines.MZ2_SOLDIER_BLASTER_5:
+ case Defines.MZ2_SOLDIER_BLASTER_6:
+ case Defines.MZ2_SOLDIER_BLASTER_7:
+ case Defines.MZ2_SOLDIER_BLASTER_8:
+ case Defines.MZ2_TURRET_BLASTER: // PGM
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("soldier/solatck2.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_FLYER_BLASTER_1:
+ case Defines.MZ2_FLYER_BLASTER_2:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("flyer/flyatck3.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_MEDIC_BLASTER_1:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("medic/medatck1.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_HOVER_BLASTER_1:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("hover/hovatck1.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_FLOAT_BLASTER_1:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("floater/fltatck1.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_SOLDIER_SHOTGUN_1:
+ case Defines.MZ2_SOLDIER_SHOTGUN_2:
+ case Defines.MZ2_SOLDIER_SHOTGUN_3:
+ case Defines.MZ2_SOLDIER_SHOTGUN_4:
+ case Defines.MZ2_SOLDIER_SHOTGUN_5:
+ case Defines.MZ2_SOLDIER_SHOTGUN_6:
+ case Defines.MZ2_SOLDIER_SHOTGUN_7:
+ case Defines.MZ2_SOLDIER_SHOTGUN_8:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ CL_tent.SmokeAndFlash(origin);
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("soldier/solatck1.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_TANK_BLASTER_1:
+ case Defines.MZ2_TANK_BLASTER_2:
+ case Defines.MZ2_TANK_BLASTER_3:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("tank/tnkatck3.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_TANK_MACHINEGUN_1:
+ case Defines.MZ2_TANK_MACHINEGUN_2:
+ case Defines.MZ2_TANK_MACHINEGUN_3:
+ case Defines.MZ2_TANK_MACHINEGUN_4:
+ case Defines.MZ2_TANK_MACHINEGUN_5:
+ case Defines.MZ2_TANK_MACHINEGUN_6:
+ case Defines.MZ2_TANK_MACHINEGUN_7:
+ case Defines.MZ2_TANK_MACHINEGUN_8:
+ case Defines.MZ2_TANK_MACHINEGUN_9:
+ case Defines.MZ2_TANK_MACHINEGUN_10:
+ case Defines.MZ2_TANK_MACHINEGUN_11:
+ case Defines.MZ2_TANK_MACHINEGUN_12:
+ case Defines.MZ2_TANK_MACHINEGUN_13:
+ case Defines.MZ2_TANK_MACHINEGUN_14:
+ case Defines.MZ2_TANK_MACHINEGUN_15:
+ case Defines.MZ2_TANK_MACHINEGUN_16:
+ case Defines.MZ2_TANK_MACHINEGUN_17:
+ case Defines.MZ2_TANK_MACHINEGUN_18:
+ case Defines.MZ2_TANK_MACHINEGUN_19:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ ParticleEffect(origin, Globals.vec3_origin, 0, 40);
+ CL_tent.SmokeAndFlash(origin);
+ //Com_sprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav",
+ // 'a' + rand() % 5);
+ soundname = "tank/tnkatk2" + (char) ('a' + Globals.rnd.nextInt(5)) + ".wav";
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound(soundname), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_CHICK_ROCKET_1:
+ case Defines.MZ2_TURRET_ROCKET: // PGM
+ dl.color[0] = 1;
+ dl.color[1] = 0.5f;
+ dl.color[2] = 0.2f;
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("chick/chkatck2.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_TANK_ROCKET_1:
+ case Defines.MZ2_TANK_ROCKET_2:
+ case Defines.MZ2_TANK_ROCKET_3:
+ dl.color[0] = 1;
+ dl.color[1] = 0.5f;
+ dl.color[2] = 0.2f;
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("tank/tnkatck1.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_SUPERTANK_ROCKET_1:
+ case Defines.MZ2_SUPERTANK_ROCKET_2:
+ case Defines.MZ2_SUPERTANK_ROCKET_3:
+ case Defines.MZ2_BOSS2_ROCKET_1:
+ case Defines.MZ2_BOSS2_ROCKET_2:
+ case Defines.MZ2_BOSS2_ROCKET_3:
+ case Defines.MZ2_BOSS2_ROCKET_4:
+ case Defines.MZ2_CARRIER_ROCKET_1:
+ // case MZ2_CARRIER_ROCKET_2:
+ // case MZ2_CARRIER_ROCKET_3:
+ // case MZ2_CARRIER_ROCKET_4:
+ dl.color[0] = 1;
+ dl.color[1] = 0.5f;
+ dl.color[2] = 0.2f;
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("tank/rocket.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_GUNNER_GRENADE_1:
+ case Defines.MZ2_GUNNER_GRENADE_2:
+ case Defines.MZ2_GUNNER_GRENADE_3:
+ case Defines.MZ2_GUNNER_GRENADE_4:
+ dl.color[0] = 1;
+ dl.color[1] = 0.5f;
+ dl.color[2] = 0;
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("gunner/gunatck3.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_GLADIATOR_RAILGUN_1:
+ // PMM
+ case Defines.MZ2_CARRIER_RAILGUN:
+ case Defines.MZ2_WIDOW_RAIL:
+ // pmm
+ dl.color[0] = 0.5f;
+ dl.color[1] = 0.5f;
+ dl.color[2] = 1.0f;
+ break;
+
+ // --- Xian's shit starts ---
+ case Defines.MZ2_MAKRON_BFG:
+ dl.color[0] = 0.5f;
+ dl.color[1] = 1;
+ dl.color[2] = 0.5f;
+ //S.StartSound (null, ent, CHAN_WEAPON,
+ // S.RegisterSound("makron/bfg_fire.wav"), 1, ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_MAKRON_BLASTER_1:
+ case Defines.MZ2_MAKRON_BLASTER_2:
+ case Defines.MZ2_MAKRON_BLASTER_3:
+ case Defines.MZ2_MAKRON_BLASTER_4:
+ case Defines.MZ2_MAKRON_BLASTER_5:
+ case Defines.MZ2_MAKRON_BLASTER_6:
+ case Defines.MZ2_MAKRON_BLASTER_7:
+ case Defines.MZ2_MAKRON_BLASTER_8:
+ case Defines.MZ2_MAKRON_BLASTER_9:
+ case Defines.MZ2_MAKRON_BLASTER_10:
+ case Defines.MZ2_MAKRON_BLASTER_11:
+ case Defines.MZ2_MAKRON_BLASTER_12:
+ case Defines.MZ2_MAKRON_BLASTER_13:
+ case Defines.MZ2_MAKRON_BLASTER_14:
+ case Defines.MZ2_MAKRON_BLASTER_15:
+ case Defines.MZ2_MAKRON_BLASTER_16:
+ case Defines.MZ2_MAKRON_BLASTER_17:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("makron/blaster.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_JORG_MACHINEGUN_L1:
+ case Defines.MZ2_JORG_MACHINEGUN_L2:
+ case Defines.MZ2_JORG_MACHINEGUN_L3:
+ case Defines.MZ2_JORG_MACHINEGUN_L4:
+ case Defines.MZ2_JORG_MACHINEGUN_L5:
+ case Defines.MZ2_JORG_MACHINEGUN_L6:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ ParticleEffect(origin, Globals.vec3_origin, 0, 40);
+ CL_tent.SmokeAndFlash(origin);
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("boss3/xfire.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_JORG_MACHINEGUN_R1:
+ case Defines.MZ2_JORG_MACHINEGUN_R2:
+ case Defines.MZ2_JORG_MACHINEGUN_R3:
+ case Defines.MZ2_JORG_MACHINEGUN_R4:
+ case Defines.MZ2_JORG_MACHINEGUN_R5:
+ case Defines.MZ2_JORG_MACHINEGUN_R6:
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ ParticleEffect(origin, Globals.vec3_origin, 0, 40);
+ CL_tent.SmokeAndFlash(origin);
+ break;
+
+ case Defines.MZ2_JORG_BFG_1:
+ dl.color[0] = 0.5f;
+ dl.color[1] = 1;
+ dl.color[2] = 0.5f;
+ break;
+
+ case Defines.MZ2_BOSS2_MACHINEGUN_R1:
+ case Defines.MZ2_BOSS2_MACHINEGUN_R2:
+ case Defines.MZ2_BOSS2_MACHINEGUN_R3:
+ case Defines.MZ2_BOSS2_MACHINEGUN_R4:
+ case Defines.MZ2_BOSS2_MACHINEGUN_R5:
+ case Defines.MZ2_CARRIER_MACHINEGUN_R1: // PMM
+ case Defines.MZ2_CARRIER_MACHINEGUN_R2: // PMM
+
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+
+ ParticleEffect(origin, Globals.vec3_origin, 0, 40);
+ CL_tent.SmokeAndFlash(origin);
+ break;
+
+ // ======
+ // ROGUE
+ case Defines.MZ2_STALKER_BLASTER:
+ case Defines.MZ2_DAEDALUS_BLASTER:
+ case Defines.MZ2_MEDIC_BLASTER_2:
+ case Defines.MZ2_WIDOW_BLASTER:
+ case Defines.MZ2_WIDOW_BLASTER_SWEEP1:
+ case Defines.MZ2_WIDOW_BLASTER_SWEEP2:
+ case Defines.MZ2_WIDOW_BLASTER_SWEEP3:
+ case Defines.MZ2_WIDOW_BLASTER_SWEEP4:
+ case Defines.MZ2_WIDOW_BLASTER_SWEEP5:
+ case Defines.MZ2_WIDOW_BLASTER_SWEEP6:
+ case Defines.MZ2_WIDOW_BLASTER_SWEEP7:
+ case Defines.MZ2_WIDOW_BLASTER_SWEEP8:
+ case Defines.MZ2_WIDOW_BLASTER_SWEEP9:
+ case Defines.MZ2_WIDOW_BLASTER_100:
+ case Defines.MZ2_WIDOW_BLASTER_90:
+ case Defines.MZ2_WIDOW_BLASTER_80:
+ case Defines.MZ2_WIDOW_BLASTER_70:
+ case Defines.MZ2_WIDOW_BLASTER_60:
+ case Defines.MZ2_WIDOW_BLASTER_50:
+ case Defines.MZ2_WIDOW_BLASTER_40:
+ case Defines.MZ2_WIDOW_BLASTER_30:
+ case Defines.MZ2_WIDOW_BLASTER_20:
+ case Defines.MZ2_WIDOW_BLASTER_10:
+ case Defines.MZ2_WIDOW_BLASTER_0:
+ case Defines.MZ2_WIDOW_BLASTER_10L:
+ case Defines.MZ2_WIDOW_BLASTER_20L:
+ case Defines.MZ2_WIDOW_BLASTER_30L:
+ case Defines.MZ2_WIDOW_BLASTER_40L:
+ case Defines.MZ2_WIDOW_BLASTER_50L:
+ case Defines.MZ2_WIDOW_BLASTER_60L:
+ case Defines.MZ2_WIDOW_BLASTER_70L:
+ case Defines.MZ2_WIDOW_RUN_1:
+ case Defines.MZ2_WIDOW_RUN_2:
+ case Defines.MZ2_WIDOW_RUN_3:
+ case Defines.MZ2_WIDOW_RUN_4:
+ case Defines.MZ2_WIDOW_RUN_5:
+ case Defines.MZ2_WIDOW_RUN_6:
+ case Defines.MZ2_WIDOW_RUN_7:
+ case Defines.MZ2_WIDOW_RUN_8:
+ dl.color[0] = 0;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("tank/tnkatck3.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_WIDOW_DISRUPTOR:
+ dl.color[0] = -1;
+ dl.color[1] = -1;
+ dl.color[2] = -1;
+ S.StartSound(null, ent, Defines.CHAN_WEAPON, S.RegisterSound("weapons/disint2.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+
+ case Defines.MZ2_WIDOW_PLASMABEAM:
+ case Defines.MZ2_WIDOW2_BEAMER_1:
+ case Defines.MZ2_WIDOW2_BEAMER_2:
+ case Defines.MZ2_WIDOW2_BEAMER_3:
+ case Defines.MZ2_WIDOW2_BEAMER_4:
+ case Defines.MZ2_WIDOW2_BEAMER_5:
+ case Defines.MZ2_WIDOW2_BEAM_SWEEP_1:
+ case Defines.MZ2_WIDOW2_BEAM_SWEEP_2:
+ case Defines.MZ2_WIDOW2_BEAM_SWEEP_3:
+ case Defines.MZ2_WIDOW2_BEAM_SWEEP_4:
+ case Defines.MZ2_WIDOW2_BEAM_SWEEP_5:
+ case Defines.MZ2_WIDOW2_BEAM_SWEEP_6:
+ case Defines.MZ2_WIDOW2_BEAM_SWEEP_7:
+ case Defines.MZ2_WIDOW2_BEAM_SWEEP_8:
+ case Defines.MZ2_WIDOW2_BEAM_SWEEP_9:
+ case Defines.MZ2_WIDOW2_BEAM_SWEEP_10:
+ case Defines.MZ2_WIDOW2_BEAM_SWEEP_11:
+ dl.radius = 300 + (Globals.rnd.nextInt() & 100);
+ dl.color[0] = 1;
+ dl.color[1] = 1;
+ dl.color[2] = 0;
+ dl.die = Globals.cl.time + 200;
+ break;
+ // ROGUE
+ // ======
+
+ // --- Xian's shit ends ---
}
}
/*
- ===============
- CL_AddDLights
-
- ===============
- */
+ * =============== CL_AddDLights
+ *
+ * ===============
+ */
static void AddDLights() {
cdlight_t dl;
// =====
// PGM
- if (vidref_val == VIDREF_GL) {
- for (int i = 0; i < MAX_DLIGHTS; i++) {
+ if (Globals.vidref_val == Defines.VIDREF_GL) {
+ for (int i = 0; i < Defines.MAX_DLIGHTS; i++) {
dl = cl_dlights[i];
if (dl.radius == 0.0f)
continue;
V.AddLight(dl.origin, dl.radius, dl.color[0], dl.color[1], dl.color[2]);
}
} else {
- for (int i = 0; i < MAX_DLIGHTS; i++) {
+ for (int i = 0; i < Defines.MAX_DLIGHTS; i++) {
dl = cl_dlights[i];
if (dl.radius == 0.0f)
continue;
// negative light in software. only black allowed
if ((dl.color[0] < 0) || (dl.color[1] < 0) || (dl.color[2] < 0)) {
- dl.radius = - (dl.radius);
+ dl.radius = -(dl.radius);
dl.color[0] = 1;
dl.color[1] = 1;
dl.color[2] = 1;
@@ -984,47 +992,24 @@ public class CL_fx extends CL_tent {
}
/*
- ==============================================================
-
- PARTICLE MANAGEMENT
-
- ==============================================================
- */
-
- static final int PARTICLE_GRAVITY = 40;
- static cparticle_t active_particles, free_particles;
-
- static cparticle_t[] particles = new cparticle_t[MAX_PARTICLES];
- static {
- for (int i = 0; i < particles.length; i++)
- particles[i] = new cparticle_t();
- }
- static int cl_numparticles = MAX_PARTICLES;
+ * =============== CL_ClearParticles ===============
+ */
+ static void ClearParticles() {
+ int i;
- /*
- ===============
- CL_ClearParticles
- ===============
- */
- 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];
+ for (i = 0; i < particles.length - 1; i++)
+ particles[i].next = particles[i + 1];
particles[particles.length - 1].next = null;
}
/*
- ===============
- CL_ParticleEffect
-
- Wall impact puffs
- ===============
- */
+ * =============== CL_ParticleEffect
+ *
+ * Wall impact puffs ===============
+ */
static void ParticleEffect(float[] org, float[] dir, int color, int count) {
int i, j;
cparticle_t p;
@@ -1038,13 +1023,13 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
- p.color = color + (rand() & 7);
+ p.time = Globals.cl.time;
+ p.color = color + (Lib.rand() & 7);
- d = rand() & 31;
+ d = Lib.rand() & 31;
for (j = 0; j < 3; j++) {
- p.org[j] = org[j] + ((rand() & 7) - 4) + d * dir[j];
- p.vel[j] = crand() * 20;
+ p.org[j] = org[j] + ((Lib.rand() & 7) - 4) + d * dir[j];
+ p.vel[j] = Lib.crand() * 20;
}
p.accel[0] = p.accel[1] = 0;
@@ -1056,10 +1041,8 @@ public class CL_fx extends CL_tent {
}
/*
- ===============
- CL_ParticleEffect2
- ===============
- */
+ * =============== CL_ParticleEffect2 ===============
+ */
static void ParticleEffect2(float[] org, float[] dir, int color, int count) {
int i, j;
cparticle_t p;
@@ -1073,13 +1056,13 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
+ p.time = Globals.cl.time;
p.color = color;
- d = rand() & 7;
+ d = Lib.rand() & 7;
for (j = 0; j < 3; j++) {
- p.org[j] = org[j] + ((rand() & 7) - 4) + d * dir[j];
- p.vel[j] = crand() * 20;
+ p.org[j] = org[j] + ((Lib.rand() & 7) - 4) + d * dir[j];
+ p.vel[j] = Lib.crand() * 20;
}
p.accel[0] = p.accel[1] = 0;
@@ -1092,10 +1075,8 @@ public class CL_fx extends CL_tent {
// RAFAEL
/*
- ===============
- CL_ParticleEffect3
- ===============
- */
+ * =============== CL_ParticleEffect3 ===============
+ */
static void ParticleEffect3(float[] org, float[] dir, int color, int count) {
int i, j;
cparticle_t p;
@@ -1109,13 +1090,13 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
+ p.time = Globals.cl.time;
p.color = color;
- d = rand() & 7;
+ d = Lib.rand() & 7;
for (j = 0; j < 3; j++) {
- p.org[j] = org[j] + ((rand() & 7) - 4) + d * dir[j];
- p.vel[j] = crand() * 20;
+ p.org[j] = org[j] + ((Lib.rand() & 7) - 4) + d * dir[j];
+ p.vel[j] = Lib.crand() * 20;
}
p.accel[0] = p.accel[1] = 0;
@@ -1127,10 +1108,8 @@ public class CL_fx extends CL_tent {
}
/*
- ===============
- CL_TeleporterParticles
- ===============
- */
+ * =============== CL_TeleporterParticles ===============
+ */
static void TeleporterParticles(entity_state_t ent) {
int i, j;
cparticle_t p;
@@ -1143,16 +1122,16 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
+ p.time = Globals.cl.time;
p.color = 0xdb;
for (j = 0; j < 2; j++) {
- p.org[j] = ent.origin[j] - 16 + (rand() & 31);
- p.vel[j] = crand() * 14;
+ p.org[j] = ent.origin[j] - 16 + (Lib.rand() & 31);
+ p.vel[j] = Lib.crand() * 14;
}
- p.org[2] = ent.origin[2] - 8 + (rand() & 7);
- p.vel[2] = 80 + (rand() & 7);
+ p.org[2] = ent.origin[2] - 8 + (Lib.rand() & 7);
+ p.vel[2] = 80 + (Lib.rand() & 7);
p.accel[0] = p.accel[1] = 0;
p.accel[2] = -PARTICLE_GRAVITY;
@@ -1163,11 +1142,10 @@ public class CL_fx extends CL_tent {
}
/*
- ===============
- CL_LogoutEffect
-
- ===============
- */
+ * =============== CL_LogoutEffect
+ *
+ * ===============
+ */
static void LogoutEffect(float[] org, int type) {
int i, j;
cparticle_t p;
@@ -1180,21 +1158,21 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
+ p.time = Globals.cl.time;
- if (type == MZ_LOGIN)
- p.color = 0xd0 + (rand() & 7); // green
- else if (type == MZ_LOGOUT)
- p.color = 0x40 + (rand() & 7); // red
+ if (type == Defines.MZ_LOGIN)
+ p.color = 0xd0 + (Lib.rand() & 7); // green
+ else if (type == Defines.MZ_LOGOUT)
+ p.color = 0x40 + (Lib.rand() & 7); // red
else
- p.color = 0xe0 + (rand() & 7); // yellow
+ p.color = 0xe0 + (Lib.rand() & 7); // yellow
p.org[0] = org[0] - 16 + Globals.rnd.nextFloat() * 32;
p.org[1] = org[1] - 16 + Globals.rnd.nextFloat() * 32;
p.org[2] = org[2] - 24 + Globals.rnd.nextFloat() * 56;
for (j = 0; j < 3; j++)
- p.vel[j] = crand() * 20;
+ p.vel[j] = Lib.crand() * 20;
p.accel[0] = p.accel[1] = 0;
p.accel[2] = -PARTICLE_GRAVITY;
@@ -1205,11 +1183,10 @@ public class CL_fx extends CL_tent {
}
/*
- ===============
- CL_ItemRespawnParticles
-
- ===============
- */
+ * =============== CL_ItemRespawnParticles
+ *
+ * ===============
+ */
static void ItemRespawnParticles(float[] org) {
int i, j;
cparticle_t p;
@@ -1222,16 +1199,16 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
+ p.time = Globals.cl.time;
- p.color = 0xd4 + (rand() & 3); // green
+ p.color = 0xd4 + (Lib.rand() & 3); // green
- p.org[0] = org[0] + crand() * 8;
- p.org[1] = org[1] + crand() * 8;
- p.org[2] = org[2] + crand() * 8;
+ p.org[0] = org[0] + Lib.crand() * 8;
+ p.org[1] = org[1] + Lib.crand() * 8;
+ p.org[2] = org[2] + Lib.crand() * 8;
for (j = 0; j < 3; j++)
- p.vel[j] = crand() * 8;
+ p.vel[j] = Lib.crand() * 8;
p.accel[0] = p.accel[1] = 0;
p.accel[2] = -PARTICLE_GRAVITY * 0.2f;
@@ -1242,10 +1219,8 @@ public class CL_fx extends CL_tent {
}
/*
- ===============
- CL_ExplosionParticles
- ===============
- */
+ * =============== CL_ExplosionParticles ===============
+ */
static void ExplosionParticles(float[] org) {
int i, j;
cparticle_t p;
@@ -1258,12 +1233,12 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
- p.color = 0xe0 + (rand() & 7);
+ p.time = Globals.cl.time;
+ p.color = 0xe0 + (Lib.rand() & 7);
for (j = 0; j < 3; j++) {
- p.org[j] = org[j] + ((rand() % 32) - 16);
- p.vel[j] = (rand() % 384) - 192;
+ p.org[j] = org[j] + ((Lib.rand() % 32) - 16);
+ p.vel[j] = (Lib.rand() % 384) - 192;
}
p.accel[0] = p.accel[1] = 0.0f;
@@ -1274,12 +1249,6 @@ public class CL_fx extends CL_tent {
}
}
- /*
- ===============
- CL_BigTeleportParticles
- ===============
- */
- private static int[] colortable = { 2 * 8, 13 * 8, 21 * 8, 18 * 8 };
static void BigTeleportParticles(float[] org) {
int i;
cparticle_t p;
@@ -1293,22 +1262,22 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
+ p.time = Globals.cl.time;
- p.color = colortable[rand() & 3];
+ p.color = colortable[Lib.rand() & 3];
- angle = (float) (Math.PI * 2 * (rand() & 1023) / 1023.0);
- dist = rand() & 31;
+ angle = (float) (Math.PI * 2 * (Lib.rand() & 1023) / 1023.0);
+ dist = Lib.rand() & 31;
p.org[0] = (float) (org[0] + Math.cos(angle) * dist);
- p.vel[0] = (float) (Math.cos(angle) * (70 + (rand() & 63)));
+ p.vel[0] = (float) (Math.cos(angle) * (70 + (Lib.rand() & 63)));
p.accel[0] = (float) (-Math.cos(angle) * 100);
p.org[1] = (float) (org[1] + Math.sin(angle) * dist);
- p.vel[1] = (float) (Math.sin(angle) * (70 + (rand() & 63)));
+ p.vel[1] = (float) (Math.sin(angle) * (70 + (Lib.rand() & 63)));
p.accel[1] = (float) (-Math.sin(angle) * 100);
- p.org[2] = org[2] + 8 + (rand() % 90);
- p.vel[2] = -100 + (rand() & 31);
+ p.org[2] = org[2] + 8 + (Lib.rand() % 90);
+ p.vel[2] = -100 + (Lib.rand() & 31);
p.accel[2] = PARTICLE_GRAVITY * 4;
p.alpha = 1.0f;
@@ -1317,12 +1286,10 @@ public class CL_fx extends CL_tent {
}
/*
- ===============
- CL_BlasterParticles
-
- Wall impact puffs
- ===============
- */
+ * =============== CL_BlasterParticles
+ *
+ * Wall impact puffs ===============
+ */
static void BlasterParticles(float[] org, float[] dir) {
int i, j;
cparticle_t p;
@@ -1338,13 +1305,13 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
- p.color = 0xe0 + (rand() & 7);
+ p.time = Globals.cl.time;
+ p.color = 0xe0 + (Lib.rand() & 7);
- d = rand() & 15;
+ d = Lib.rand() & 15;
for (j = 0; j < 3; j++) {
- p.org[j] = org[j] + ((rand() & 7) - 4) + d * dir[j];
- p.vel[j] = dir[j] * 30 + crand() * 40;
+ p.org[j] = org[j] + ((Lib.rand() & 7) - 4) + d * dir[j];
+ p.vel[j] = dir[j] * 30 + Lib.crand() * 40;
}
p.accel[0] = p.accel[1] = 0;
@@ -1356,11 +1323,10 @@ public class CL_fx extends CL_tent {
}
/*
- ===============
- CL_BlasterTrail
-
- ===============
- */
+ * =============== CL_BlasterTrail
+ *
+ * ===============
+ */
static void BlasterTrail(float[] start, float[] end) {
float[] move = new float[3];
float[] vec = new float[3];
@@ -1369,12 +1335,12 @@ public class CL_fx extends CL_tent {
cparticle_t p;
int dec;
- VectorCopy(start, move);
- VectorSubtract(end, start, vec);
- len = VectorNormalize(vec);
+ Math3D.VectorCopy(start, move);
+ Math3D.VectorSubtract(end, start, vec);
+ len = Math3D.VectorNormalize(vec);
dec = 5;
- VectorScale(vec, 5, vec);
+ Math3D.VectorScale(vec, 5, vec);
// FIXME: this is a really silly way to have a loop
while (len > 0) {
@@ -1386,29 +1352,28 @@ public class CL_fx extends CL_tent {
free_particles = p.next;
p.next = active_particles;
active_particles = p;
- VectorClear(p.accel);
+ Math3D.VectorClear(p.accel);
- p.time = cl.time;
+ p.time = Globals.cl.time;
p.alpha = 1.0f;
p.alphavel = -1.0f / (0.3f + Globals.rnd.nextFloat() * 0.2f);
p.color = 0xe0;
for (j = 0; j < 3; j++) {
- p.org[j] = move[j] + crand();
- p.vel[j] = crand() * 5;
+ p.org[j] = move[j] + Lib.crand();
+ p.vel[j] = Lib.crand() * 5;
p.accel[j] = 0;
}
- VectorAdd(move, vec, move);
+ Math3D.VectorAdd(move, vec, move);
}
}
/*
- ===============
- CL_QuadTrail
-
- ===============
- */
+ * =============== CL_QuadTrail
+ *
+ * ===============
+ */
static void QuadTrail(float[] start, float[] end) {
float[] move = new float[3];
float[] vec = new float[3];
@@ -1417,12 +1382,12 @@ public class CL_fx extends CL_tent {
cparticle_t p;
int dec;
- VectorCopy(start, move);
- VectorSubtract(end, start, vec);
- len = VectorNormalize(vec);
+ Math3D.VectorCopy(start, move);
+ Math3D.VectorSubtract(end, start, vec);
+ len = Math3D.VectorNormalize(vec);
dec = 5;
- VectorScale(vec, 5, vec);
+ Math3D.VectorScale(vec, 5, vec);
while (len > 0) {
len -= dec;
@@ -1433,29 +1398,28 @@ public class CL_fx extends CL_tent {
free_particles = p.next;
p.next = active_particles;
active_particles = p;
- VectorClear(p.accel);
+ Math3D.VectorClear(p.accel);
- p.time = cl.time;
+ p.time = Globals.cl.time;
p.alpha = 1.0f;
p.alphavel = -1.0f / (0.8f + Globals.rnd.nextFloat() * 0.2f);
p.color = 115;
for (j = 0; j < 3; j++) {
- p.org[j] = move[j] + crand() * 16;
- p.vel[j] = crand() * 5;
+ p.org[j] = move[j] + Lib.crand() * 16;
+ p.vel[j] = Lib.crand() * 5;
p.accel[j] = 0;
}
- VectorAdd(move, vec, move);
+ Math3D.VectorAdd(move, vec, move);
}
}
/*
- ===============
- CL_FlagTrail
-
- ===============
- */
+ * =============== CL_FlagTrail
+ *
+ * ===============
+ */
static void FlagTrail(float[] start, float[] end, float color) {
float[] move = new float[3];
float[] vec = new float[3];
@@ -1464,12 +1428,12 @@ public class CL_fx extends CL_tent {
cparticle_t p;
int dec;
- VectorCopy(start, move);
- VectorSubtract(end, start, vec);
- len = VectorNormalize(vec);
+ Math3D.VectorCopy(start, move);
+ Math3D.VectorSubtract(end, start, vec);
+ len = Math3D.VectorNormalize(vec);
dec = 5;
- VectorScale(vec, 5, vec);
+ Math3D.VectorScale(vec, 5, vec);
while (len > 0) {
len -= dec;
@@ -1480,29 +1444,28 @@ public class CL_fx extends CL_tent {
free_particles = p.next;
p.next = active_particles;
active_particles = p;
- VectorClear(p.accel);
+ Math3D.VectorClear(p.accel);
- p.time = cl.time;
+ p.time = Globals.cl.time;
p.alpha = 1.0f;
p.alphavel = -1.0f / (0.8f + Globals.rnd.nextFloat() * 0.2f);
p.color = color;
for (j = 0; j < 3; j++) {
- p.org[j] = move[j] + crand() * 16;
- p.vel[j] = crand() * 5;
+ p.org[j] = move[j] + Lib.crand() * 16;
+ p.vel[j] = Lib.crand() * 5;
p.accel[j] = 0;
}
- VectorAdd(move, vec, move);
+ Math3D.VectorAdd(move, vec, move);
}
}
/*
- ===============
- CL_DiminishingTrail
-
- ===============
- */
+ * =============== CL_DiminishingTrail
+ *
+ * ===============
+ */
static void DiminishingTrail(float[] start, float[] end, centity_t old, int flags) {
float[] move = new float[3];
float[] vec = new float[3];
@@ -1510,12 +1473,12 @@ public class CL_fx extends CL_tent {
float orgscale;
float velscale;
- VectorCopy(start, move);
- VectorSubtract(end, start, vec);
- float len = VectorNormalize(vec);
+ Math3D.VectorCopy(start, move);
+ Math3D.VectorSubtract(end, start, vec);
+ float len = Math3D.VectorNormalize(vec);
float dec = 0.5f;
- VectorScale(vec, dec, vec);
+ Math3D.VectorScale(vec, dec, vec);
if (old.trailcount > 900) {
orgscale = 4;
@@ -1535,42 +1498,42 @@ public class CL_fx extends CL_tent {
return;
// drop less particles as it flies
- if ((rand() & 1023) < old.trailcount) {
+ if ((Lib.rand() & 1023) < old.trailcount) {
p = free_particles;
free_particles = p.next;
p.next = active_particles;
active_particles = p;
- VectorClear(p.accel);
+ Math3D.VectorClear(p.accel);
- p.time = cl.time;
+ p.time = Globals.cl.time;
- if ((flags & EF_GIB) != 0) {
+ if ((flags & Defines.EF_GIB) != 0) {
p.alpha = 1.0f;
p.alphavel = -1.0f / (1.0f + Globals.rnd.nextFloat() * 0.4f);
- p.color = 0xe8 + (rand() & 7);
+ p.color = 0xe8 + (Lib.rand() & 7);
for (int j = 0; j < 3; j++) {
- p.org[j] = move[j] + crand() * orgscale;
- p.vel[j] = crand() * velscale;
+ p.org[j] = move[j] + Lib.crand() * orgscale;
+ p.vel[j] = Lib.crand() * velscale;
p.accel[j] = 0;
}
p.vel[2] -= PARTICLE_GRAVITY;
- } else if ((flags & EF_GREENGIB) != 0) {
+ } else if ((flags & Defines.EF_GREENGIB) != 0) {
p.alpha = 1.0f;
p.alphavel = -1.0f / (1.0f + Globals.rnd.nextFloat() * 0.4f);
- p.color = 0xdb + (rand() & 7);
+ p.color = 0xdb + (Lib.rand() & 7);
for (int j = 0; j < 3; j++) {
- p.org[j] = move[j] + crand() * orgscale;
- p.vel[j] = crand() * velscale;
+ p.org[j] = move[j] + Lib.crand() * orgscale;
+ p.vel[j] = Lib.crand() * velscale;
p.accel[j] = 0;
}
p.vel[2] -= PARTICLE_GRAVITY;
} else {
p.alpha = 1.0f;
p.alphavel = -1.0f / (1.0f + Globals.rnd.nextFloat() * 0.2f);
- p.color = 4 + (rand() & 7);
+ p.color = 4 + (Lib.rand() & 7);
for (int j = 0; j < 3; j++) {
- p.org[j] = move[j] + crand() * orgscale;
- p.vel[j] = crand() * velscale;
+ p.org[j] = move[j] + Lib.crand() * orgscale;
+ p.vel[j] = Lib.crand() * velscale;
}
p.accel[2] = 20;
}
@@ -1579,16 +1542,15 @@ public class CL_fx extends CL_tent {
old.trailcount -= 5;
if (old.trailcount < 100)
old.trailcount = 100;
- VectorAdd(move, vec, move);
+ Math3D.VectorAdd(move, vec, move);
}
}
/*
- ===============
- CL_RocketTrail
-
- ===============
- */
+ * =============== CL_RocketTrail
+ *
+ * ===============
+ */
static void RocketTrail(float[] start, float[] end, centity_t old) {
float[] move = new float[3];
float[] vec = new float[3];
@@ -1598,15 +1560,15 @@ public class CL_fx extends CL_tent {
float dec;
// smoke
- CL.DiminishingTrail(start, end, old, EF_ROCKET);
+ DiminishingTrail(start, end, old, Defines.EF_ROCKET);
// fire
- VectorCopy(start, move);
- VectorSubtract(end, start, vec);
- len = VectorNormalize(vec);
+ Math3D.VectorCopy(start, move);
+ Math3D.VectorSubtract(end, start, vec);
+ len = Math3D.VectorNormalize(vec);
dec = 1;
- VectorScale(vec, dec, vec);
+ Math3D.VectorScale(vec, dec, vec);
while (len > 0) {
len -= dec;
@@ -1614,34 +1576,33 @@ public class CL_fx extends CL_tent {
if (free_particles == null)
return;
- if ((rand() & 7) == 0) {
+ if ((Lib.rand() & 7) == 0) {
p = free_particles;
free_particles = p.next;
p.next = active_particles;
active_particles = p;
- VectorClear(p.accel);
- p.time = cl.time;
+ Math3D.VectorClear(p.accel);
+ p.time = Globals.cl.time;
p.alpha = 1.0f;
p.alphavel = -1.0f / (1.0f + Globals.rnd.nextFloat() * 0.2f);
- p.color = 0xdc + (rand() & 3);
+ p.color = 0xdc + (Lib.rand() & 3);
for (j = 0; j < 3; j++) {
- p.org[j] = move[j] + crand() * 5;
- p.vel[j] = crand() * 20;
+ p.org[j] = move[j] + Lib.crand() * 5;
+ p.vel[j] = Lib.crand() * 20;
}
p.accel[2] = -PARTICLE_GRAVITY;
}
- VectorAdd(move, vec, move);
+ Math3D.VectorAdd(move, vec, move);
}
}
/*
- ===============
- CL_RailTrail
-
- ===============
- */
+ * =============== CL_RailTrail
+ *
+ * ===============
+ */
static void RailTrail(float[] start, float[] end) {
float[] move = new float[3];
float[] vec = new float[3];
@@ -1656,11 +1617,11 @@ public class CL_fx extends CL_tent {
float[] dir = new float[3];
byte clr = 0x74;
- VectorCopy(start, move);
- VectorSubtract(end, start, vec);
- len = VectorNormalize(vec);
+ Math3D.VectorCopy(start, move);
+ Math3D.VectorSubtract(end, start, vec);
+ len = Math3D.VectorNormalize(vec);
- MakeNormalVectors(vec, right, up);
+ Math3D.MakeNormalVectors(vec, right, up);
for (i = 0; i < len; i++) {
if (free_particles == null)
@@ -1671,30 +1632,30 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
- VectorClear(p.accel);
+ p.time = Globals.cl.time;
+ Math3D.VectorClear(p.accel);
d = i * 0.1f;
- c = (float)Math.cos(d);
- s = (float)Math.sin(d);
+ c = (float) Math.cos(d);
+ s = (float) Math.sin(d);
- VectorScale(right, c, dir);
- VectorMA(dir, s, up, dir);
+ Math3D.VectorScale(right, c, dir);
+ Math3D.VectorMA(dir, s, up, dir);
p.alpha = 1.0f;
p.alphavel = -1.0f / (1.0f + Globals.rnd.nextFloat() * 0.2f);
- p.color = clr + (rand() & 7);
+ p.color = clr + (Lib.rand() & 7);
for (j = 0; j < 3; j++) {
p.org[j] = move[j] + dir[j] * 3;
p.vel[j] = dir[j] * 6;
}
- VectorAdd(move, vec, move);
+ Math3D.VectorAdd(move, vec, move);
}
dec = 0.75f;
- VectorScale(vec, dec, vec);
- VectorCopy(start, move);
+ Math3D.VectorScale(vec, dec, vec);
+ Math3D.VectorCopy(start, move);
while (len > 0) {
len -= dec;
@@ -1706,29 +1667,27 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
- VectorClear(p.accel);
+ p.time = Globals.cl.time;
+ Math3D.VectorClear(p.accel);
p.alpha = 1.0f;
p.alphavel = -1.0f / (0.6f + Globals.rnd.nextFloat() * 0.2f);
- p.color = 0x0 + rand() & 15;
+ p.color = 0x0 + Lib.rand() & 15;
for (j = 0; j < 3; j++) {
- p.org[j] = move[j] + crand() * 3;
- p.vel[j] = crand() * 3;
+ p.org[j] = move[j] + Lib.crand() * 3;
+ p.vel[j] = Lib.crand() * 3;
p.accel[j] = 0;
}
- VectorAdd(move, vec, move);
+ Math3D.VectorAdd(move, vec, move);
}
}
// RAFAEL
/*
- ===============
- CL_IonripperTrail
- ===============
- */
+ * =============== CL_IonripperTrail ===============
+ */
static void IonripperTrail(float[] start, float[] ent) {
float[] move = new float[3];
float[] vec = new float[3];
@@ -1737,30 +1696,30 @@ public class CL_fx extends CL_tent {
cparticle_t p;
int dec;
int left = 0;
-
- VectorCopy(start, move);
- VectorSubtract(ent, start, vec);
- len = VectorNormalize(vec);
-
+
+ Math3D.VectorCopy(start, move);
+ Math3D.VectorSubtract(ent, start, vec);
+ len = Math3D.VectorNormalize(vec);
+
dec = 5;
- VectorScale(vec, 5, vec);
-
+ Math3D.VectorScale(vec, 5, vec);
+
while (len > 0) {
len -= dec;
-
+
if (free_particles == null)
return;
p = free_particles;
free_particles = p.next;
p.next = active_particles;
active_particles = p;
- VectorClear(p.accel);
-
- p.time = cl.time;
+ Math3D.VectorClear(p.accel);
+
+ p.time = Globals.cl.time;
p.alpha = 0.5f;
p.alphavel = -1.0f / (0.3f + Globals.rnd.nextFloat() * 0.2f);
- p.color = 0xe4 + (rand() & 3);
-
+ p.color = 0xe4 + (Lib.rand() & 3);
+
for (j = 0; j < 3; j++) {
p.org[j] = move[j];
p.accel[j] = 0;
@@ -1772,20 +1731,19 @@ public class CL_fx extends CL_tent {
left = 1;
p.vel[0] = -10;
}
-
+
p.vel[1] = 0;
p.vel[2] = 0;
-
- VectorAdd(move, vec, move);
+
+ Math3D.VectorAdd(move, vec, move);
}
}
/*
- ===============
- CL_BubbleTrail
-
- ===============
- */
+ * =============== CL_BubbleTrail
+ *
+ * ===============
+ */
static void BubbleTrail(float[] start, float[] end) {
float[] move = new float[3];
float[] vec = new float[3];
@@ -1794,12 +1752,12 @@ public class CL_fx extends CL_tent {
cparticle_t p;
float dec;
- VectorCopy(start, move);
- VectorSubtract(end, start, vec);
- len = VectorNormalize(vec);
+ Math3D.VectorCopy(start, move);
+ Math3D.VectorSubtract(end, start, vec);
+ len = Math3D.VectorNormalize(vec);
dec = 32;
- VectorScale(vec, dec, vec);
+ Math3D.VectorScale(vec, dec, vec);
for (i = 0; i < len; i += dec) {
if (free_particles == null)
@@ -1810,65 +1768,57 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- VectorClear(p.accel);
- p.time = cl.time;
+ Math3D.VectorClear(p.accel);
+ p.time = Globals.cl.time;
p.alpha = 1.0f;
p.alphavel = -1.0f / (1.0f + Globals.rnd.nextFloat() * 0.2f);
- p.color = 4 + (rand() & 7);
+ p.color = 4 + (Lib.rand() & 7);
for (j = 0; j < 3; j++) {
- p.org[j] = move[j] + crand() * 2;
- p.vel[j] = crand() * 5;
+ p.org[j] = move[j] + Lib.crand() * 2;
+ p.vel[j] = Lib.crand() * 5;
}
p.vel[2] += 6;
- VectorAdd(move, vec, move);
+ Math3D.VectorAdd(move, vec, move);
}
}
/*
- ===============
- CL_FlyParticles
- ===============
- */
- private static final int BEAMLENGTH = 16;
- static void FlyParticles (float [] origin, int count)
- {
- int i;
- cparticle_t p;
- float angle;
- float sp, sy, cp, cy;
- float [] forward= new float[3];
- float dist = 64;
- float ltime;
-
-
- if (count > NUMVERTEXNORMALS)
- count = NUMVERTEXNORMALS;
-
- if (avelocities[0][0] == 0.0f)
- {
- for (i=0 ; i<NUMVERTEXNORMALS ; i++) {
- avelocities[i][0] = (rand()&255) * 0.01f;
- avelocities[i][1] = (rand()&255) * 0.01f;
- avelocities[i][2] = (rand()&255) * 0.01f;
+ * =============== CL_FlyParticles ===============
+ */
+ static void FlyParticles(float[] origin, int count) {
+ int i;
+ cparticle_t p;
+ float angle;
+ float sp, sy, cp, cy;
+ float[] forward = new float[3];
+ float dist = 64;
+ float ltime;
+
+ if (count > Defines.NUMVERTEXNORMALS)
+ count = Defines.NUMVERTEXNORMALS;
+
+ if (avelocities[0][0] == 0.0f) {
+ for (i = 0; i < Defines.NUMVERTEXNORMALS; i++) {
+ avelocities[i][0] = (Lib.rand() & 255) * 0.01f;
+ avelocities[i][1] = (Lib.rand() & 255) * 0.01f;
+ avelocities[i][2] = (Lib.rand() & 255) * 0.01f;
}
}
-
- ltime = cl.time / 1000.0f;
- for (i=0 ; i<count ; i+=2)
- {
+ ltime = Globals.cl.time / 1000.0f;
+ for (i = 0; i < count; i += 2) {
angle = ltime * avelocities[i][0];
- sy = (float)Math.sin(angle);
- cy = (float)Math.cos(angle);
+ sy = (float) Math.sin(angle);
+ cy = (float) Math.cos(angle);
angle = ltime * avelocities[i][1];
- sp = (float)Math.sin(angle);
- cp = (float)Math.cos(angle);
+ sp = (float) Math.sin(angle);
+ cp = (float) Math.cos(angle);
angle = ltime * avelocities[i][2];
-
- forward[0] = cp*cy;
- forward[1] = cp*sy;
+
+ forward[0] = cp * cy;
+ forward[1] = cp * sy;
forward[2] = -sp;
if (free_particles == null)
@@ -1878,15 +1828,15 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
+ p.time = Globals.cl.time;
- dist = (float)Math.sin(ltime + i)*64;
- p.org[0] = origin[0] + bytedirs[i][0]*dist + forward[0]*BEAMLENGTH;
- p.org[1] = origin[1] + bytedirs[i][1]*dist + forward[1]*BEAMLENGTH;
- p.org[2] = origin[2] + bytedirs[i][2]*dist + forward[2]*BEAMLENGTH;
+ dist = (float) Math.sin(ltime + i) * 64;
+ p.org[0] = origin[0] + Globals.bytedirs[i][0] * dist + forward[0] * BEAMLENGTH;
+ p.org[1] = origin[1] + Globals.bytedirs[i][1] * dist + forward[1] * BEAMLENGTH;
+ p.org[2] = origin[2] + Globals.bytedirs[i][2] * dist + forward[2] * BEAMLENGTH;
- VectorClear (p.vel);
- VectorClear (p.accel);
+ Math3D.VectorClear(p.vel);
+ Math3D.VectorClear(p.accel);
p.color = 0;
//p.colorvel = 0;
@@ -1901,33 +1851,31 @@ public class CL_fx extends CL_tent {
int count;
int starttime;
- if (ent.fly_stoptime < cl.time) {
- starttime = cl.time;
- ent.fly_stoptime = cl.time + 60000;
+ if (ent.fly_stoptime < Globals.cl.time) {
+ starttime = Globals.cl.time;
+ ent.fly_stoptime = Globals.cl.time + 60000;
} else {
starttime = ent.fly_stoptime - 60000;
}
- n = cl.time - starttime;
+ n = Globals.cl.time - starttime;
if (n < 20000)
count = (int) ((n * 162) / 20000.0);
else {
- n = ent.fly_stoptime - cl.time;
+ n = ent.fly_stoptime - Globals.cl.time;
if (n < 20000)
count = (int) ((n * 162) / 20000.0);
else
count = 162;
}
- CL.FlyParticles(origin, count);
+ FlyParticles(origin, count);
}
/*
- ===============
- CL_BfgParticles
- ===============
- */
- //#define BEAMLENGTH 16
+ * =============== CL_BfgParticles ===============
+ */
+ //#define BEAMLENGTH 16
static void BfgParticles(entity_t ent) {
int i;
cparticle_t p;
@@ -1939,21 +1887,21 @@ public class CL_fx extends CL_tent {
float ltime;
if (avelocities[0][0] == 0.0f) {
- for (i = 0; i < NUMVERTEXNORMALS; i++) {
- avelocities[i][0] = (rand() & 255) * 0.01f;
- avelocities[i][1] = (rand() & 255) * 0.01f;
- avelocities[i][2] = (rand() & 255) * 0.01f;
+ for (i = 0; i < Defines.NUMVERTEXNORMALS; i++) {
+ avelocities[i][0] = (Lib.rand() & 255) * 0.01f;
+ avelocities[i][1] = (Lib.rand() & 255) * 0.01f;
+ avelocities[i][2] = (Lib.rand() & 255) * 0.01f;
}
}
- ltime = cl.time / 1000.0f;
- for (i = 0; i < NUMVERTEXNORMALS; i++) {
+ ltime = Globals.cl.time / 1000.0f;
+ for (i = 0; i < Defines.NUMVERTEXNORMALS; i++) {
angle = ltime * avelocities[i][0];
- sy = (float)Math.sin(angle);
- cy = (float)Math.cos(angle);
+ sy = (float) Math.sin(angle);
+ cy = (float) Math.cos(angle);
angle = ltime * avelocities[i][1];
- sp = (float)Math.sin(angle);
- cp = (float)Math.cos(angle);
+ sp = (float) Math.sin(angle);
+ cp = (float) Math.cos(angle);
angle = ltime * avelocities[i][2];
forward[0] = cp * cy;
@@ -1967,19 +1915,19 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
+ p.time = Globals.cl.time;
dist = (float) (Math.sin(ltime + i) * 64);
- p.org[0] = ent.origin[0] + bytedirs[i][0] * dist + forward[0] * BEAMLENGTH;
- p.org[1] = ent.origin[1] + bytedirs[i][1] * dist + forward[1] * BEAMLENGTH;
- p.org[2] = ent.origin[2] + bytedirs[i][2] * dist + forward[2] * BEAMLENGTH;
+ p.org[0] = ent.origin[0] + Globals.bytedirs[i][0] * dist + forward[0] * BEAMLENGTH;
+ p.org[1] = ent.origin[1] + Globals.bytedirs[i][1] * dist + forward[1] * BEAMLENGTH;
+ p.org[2] = ent.origin[2] + Globals.bytedirs[i][2] * dist + forward[2] * BEAMLENGTH;
- VectorClear(p.vel);
- VectorClear(p.accel);
+ Math3D.VectorClear(p.vel);
+ Math3D.VectorClear(p.accel);
- VectorSubtract(p.org, ent.origin, v);
- dist = VectorLength(v) / 90.0f;
- p.color = (float)Math.floor(0xd0 + dist * 7);
+ Math3D.VectorSubtract(p.org, ent.origin, v);
+ dist = Math3D.VectorLength(v) / 90.0f;
+ p.color = (float) Math.floor(0xd0 + dist * 7);
//p.colorvel = 0;
p.alpha = 1.0f - dist;
@@ -1988,10 +1936,8 @@ public class CL_fx extends CL_tent {
}
/*
- ===============
- CL_TrapParticles
- ===============
- */
+ * =============== CL_TrapParticles ===============
+ */
// RAFAEL
static void TrapParticles(entity_t ent) {
float[] move = new float[3];
@@ -2004,16 +1950,16 @@ public class CL_fx extends CL_tent {
int dec;
ent.origin[2] -= 14;
- VectorCopy(ent.origin, start);
- VectorCopy(ent.origin, end);
+ Math3D.VectorCopy(ent.origin, start);
+ Math3D.VectorCopy(ent.origin, end);
end[2] += 64;
- VectorCopy(start, move);
- VectorSubtract(end, start, vec);
- len = VectorNormalize(vec);
+ Math3D.VectorCopy(start, move);
+ Math3D.VectorSubtract(end, start, vec);
+ len = Math3D.VectorNormalize(vec);
dec = 5;
- VectorScale(vec, 5, vec);
+ Math3D.VectorScale(vec, 5, vec);
// FIXME: this is a really silly way to have a loop
while (len > 0) {
@@ -2025,31 +1971,31 @@ public class CL_fx extends CL_tent {
free_particles = p.next;
p.next = active_particles;
active_particles = p;
- VectorClear(p.accel);
+ Math3D.VectorClear(p.accel);
- p.time = cl.time;
+ p.time = Globals.cl.time;
p.alpha = 1.0f;
p.alphavel = -1.0f / (0.3f + Globals.rnd.nextFloat() * 0.2f);
p.color = 0xe0;
for (j = 0; j < 3; j++) {
- p.org[j] = move[j] + crand();
- p.vel[j] = crand() * 15;
+ p.org[j] = move[j] + Lib.crand();
+ p.vel[j] = Lib.crand() * 15;
p.accel[j] = 0;
}
p.accel[2] = PARTICLE_GRAVITY;
- VectorAdd(move, vec, move);
+ Math3D.VectorAdd(move, vec, move);
}
int i, k;
- //cparticle_t p;
+ //cparticle_t p;
float vel;
float[] dir = new float[3];
float[] org = new float[3];
ent.origin[2] += 14;
- VectorCopy(ent.origin, org);
+ Math3D.VectorCopy(ent.origin, org);
for (i = -2; i <= 2; i += 4)
for (j = -2; j <= 2; j += 4)
@@ -2061,23 +2007,23 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
- p.color = 0xe0 + (rand() & 3);
+ p.time = Globals.cl.time;
+ p.color = 0xe0 + (Lib.rand() & 3);
p.alpha = 1.0f;
- p.alphavel = -1.0f / (0.3f + (rand() & 7) * 0.02f);
+ p.alphavel = -1.0f / (0.3f + (Lib.rand() & 7) * 0.02f);
- p.org[0] = org[0] + i + ((rand() & 23) * crand());
- p.org[1] = org[1] + j + ((rand() & 23) * crand());
- p.org[2] = org[2] + k + ((rand() & 23) * crand());
+ p.org[0] = org[0] + i + ((Lib.rand() & 23) * Lib.crand());
+ p.org[1] = org[1] + j + ((Lib.rand() & 23) * Lib.crand());
+ p.org[2] = org[2] + k + ((Lib.rand() & 23) * Lib.crand());
dir[0] = j * 8;
dir[1] = i * 8;
dir[2] = k * 8;
- VectorNormalize(dir);
- vel = 50 + rand() & 63;
- VectorScale(dir, vel, p.vel);
+ Math3D.VectorNormalize(dir);
+ vel = 50 + Lib.rand() & 63;
+ Math3D.VectorScale(dir, vel, p.vel);
p.accel[0] = p.accel[1] = 0;
p.accel[2] = -PARTICLE_GRAVITY;
@@ -2085,12 +2031,9 @@ public class CL_fx extends CL_tent {
}
-
/*
- ===============
- CL_BFGExplosionParticles
- ===============
- */
+ * =============== CL_BFGExplosionParticles ===============
+ */
// FIXME combined with CL_ExplosionParticles
static void BFGExplosionParticles(float[] org) {
int i, j;
@@ -2104,12 +2047,12 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
- p.color = 0xd0 + (rand() & 7);
+ p.time = Globals.cl.time;
+ p.color = 0xd0 + (Lib.rand() & 7);
for (j = 0; j < 3; j++) {
- p.org[j] = org[j] + ((rand() % 32) - 16);
- p.vel[j] = (rand() % 384) - 192;
+ p.org[j] = org[j] + ((Lib.rand() % 32) - 16);
+ p.vel[j] = (Lib.rand() % 384) - 192;
}
p.accel[0] = p.accel[1] = 0;
@@ -2121,11 +2064,10 @@ public class CL_fx extends CL_tent {
}
/*
- ===============
- CL_TeleportParticles
-
- ===============
- */
+ * =============== CL_TeleportParticles
+ *
+ * ===============
+ */
static void TeleportParticles(float[] org) {
cparticle_t p;
@@ -2142,23 +2084,23 @@ public class CL_fx extends CL_tent {
p.next = active_particles;
active_particles = p;
- p.time = cl.time;
- p.color = 7 + (rand() & 7);
+ p.time = Globals.cl.time;
+ p.color = 7 + (Lib.rand() & 7);
p.alpha = 1.0f;
- p.alphavel = -1.0f / (0.3f + (rand() & 7) * 0.02f);
+ p.alphavel = -1.0f / (0.3f + (Lib.rand() & 7) * 0.02f);
- p.org[0] = org[0] + i + (rand() & 3);
- p.org[1] = org[1] + j + (rand() & 3);
- p.org[2] = org[2] + k + (rand() & 3);
+ p.org[0] = org[0] + i + (Lib.rand() & 3);
+ p.org[1] = org[1] + j + (Lib.rand() & 3);
+ p.org[2] = org[2] + k + (Lib.rand() & 3);
dir[0] = j * 8;
dir[1] = i * 8;
dir[2] = k * 8;
- VectorNormalize(dir);
- vel = 50 + (rand() & 63);
- VectorScale(dir, vel, p.vel);
+ Math3D.VectorNormalize(dir);
+ vel = 50 + (Lib.rand() & 63);
+ Math3D.VectorScale(dir, vel, p.vel);
p.accel[0] = p.accel[1] = 0;
p.accel[2] = -PARTICLE_GRAVITY;
@@ -2166,10 +2108,8 @@ public class CL_fx extends CL_tent {
}
/*
- ===============
- CL_AddParticles
- ===============
- */
+ * =============== CL_AddParticles ===============
+ */
static void AddParticles() {
cparticle_t p, next;
float alpha;
@@ -2187,7 +2127,7 @@ public class CL_fx extends CL_tent {
// PMM - added INSTANT_PARTICLE handling for heat beam
if (p.alphavel != INSTANT_PARTICLE) {
- time = (cl.time - p.time) * 0.001f;
+ time = (Globals.cl.time - p.time) * 0.001f;
alpha = p.alpha + time * p.alphavel;
if (alpha <= 0) { // faded out
p.next = free_particles;
@@ -2208,7 +2148,7 @@ public class CL_fx extends CL_tent {
if (alpha > 1.0)
alpha = 1;
- color = (int)p.color;
+ color = (int) p.color;
time2 = time * time;
@@ -2226,52 +2166,68 @@ public class CL_fx extends CL_tent {
active_particles = active;
}
-
- /*
- ==============
- CL_EntityEvent
-
- An entity has just been parsed that has an event value
- the female events are there for backwards compatability
- ==============
- */
+ /*
+ * ============== CL_EntityEvent
+ *
+ * An entity has just been parsed that has an event value
+ *
+ * the female events are there for backwards compatability ==============
+ */
static void EntityEvent(entity_state_t ent) {
switch (ent.event) {
- case EV_ITEM_RESPAWN :
- S.StartSound(null, ent.number, CHAN_WEAPON, S.RegisterSound("items/respawn1.wav"), 1, ATTN_IDLE, 0);
- CL.ItemRespawnParticles(ent.origin);
- break;
- case EV_PLAYER_TELEPORT :
- S.StartSound(null, ent.number, CHAN_WEAPON, S.RegisterSound("misc/tele1.wav"), 1, ATTN_IDLE, 0);
- CL.TeleportParticles(ent.origin);
- break;
- case EV_FOOTSTEP :
- if (cl_footsteps.value != 0.0f)
- S.StartSound(null, ent.number, CHAN_BODY, cl_sfx_footsteps[rand() & 3], 1, ATTN_NORM, 0);
- break;
- case EV_FALLSHORT :
- S.StartSound(null, ent.number, CHAN_AUTO, S.RegisterSound("player/land1.wav"), 1, ATTN_NORM, 0);
- break;
- case EV_FALL :
- S.StartSound(null, ent.number, CHAN_AUTO, S.RegisterSound("*fall2.wav"), 1, ATTN_NORM, 0);
- break;
- case EV_FALLFAR :
- S.StartSound(null, ent.number, CHAN_AUTO, S.RegisterSound("*fall1.wav"), 1, ATTN_NORM, 0);
- break;
+ case Defines.EV_ITEM_RESPAWN:
+ S.StartSound(null, ent.number, Defines.CHAN_WEAPON, S.RegisterSound("items/respawn1.wav"), 1, Defines.ATTN_IDLE, 0);
+ ItemRespawnParticles(ent.origin);
+ break;
+ case Defines.EV_PLAYER_TELEPORT:
+ S.StartSound(null, ent.number, Defines.CHAN_WEAPON, S.RegisterSound("misc/tele1.wav"), 1, Defines.ATTN_IDLE, 0);
+ TeleportParticles(ent.origin);
+ break;
+ case Defines.EV_FOOTSTEP:
+ if (Globals.cl_footsteps.value != 0.0f)
+ S.StartSound(null, ent.number, Defines.CHAN_BODY, CL_tent.cl_sfx_footsteps[Lib.rand() & 3], 1, Defines.ATTN_NORM, 0);
+ break;
+ case Defines.EV_FALLSHORT:
+ S.StartSound(null, ent.number, Defines.CHAN_AUTO, S.RegisterSound("player/land1.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+ case Defines.EV_FALL:
+ S.StartSound(null, ent.number, Defines.CHAN_AUTO, S.RegisterSound("*fall2.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
+ case Defines.EV_FALLFAR:
+ S.StartSound(null, ent.number, Defines.CHAN_AUTO, S.RegisterSound("*fall1.wav"), 1, Defines.ATTN_NORM, 0);
+ break;
}
}
/*
- ==============
- CL_ClearEffects
-
- ==============
- */
+ * ============== CL_ClearEffects
+ *
+ * ==============
+ */
static void ClearEffects() {
- CL.ClearParticles();
- CL.ClearDlights();
- CL.ClearLightStyles();
+ ClearParticles();
+ ClearDlights();
+ ClearLightStyles();
}
-}
+ /*
+ * ==============================================================
+ *
+ * PARTICLE MANAGEMENT
+ *
+ * ==============================================================
+ */
+
+ static final int PARTICLE_GRAVITY = 40;
+
+ static cparticle_t active_particles, free_particles;
+
+ /*
+ * =============== CL_BigTeleportParticles ===============
+ */
+ private static int[] colortable = { 2 * 8, 13 * 8, 21 * 8, 18 * 8 };
+
+ private static final int BEAMLENGTH = 16;
+
+} \ No newline at end of file