]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/particles.qc
Merge branch 'master' into Mario/showspecs
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / particles.qc
index 857e182f6604c4aeb5f13df02dae2df954211c0d..6d2ddf87d5a431b3cf4c901b60881d868fb0e25b 100644 (file)
@@ -1,15 +1,4 @@
-.float dphitcontentsmask;
-
-.float cnt; // effect number
-.vector velocity; // particle velocity
-.float waterlevel; // direction jitter
-.float count; // count multiplier
-.float impulse; // density
-.string noise; // sound
-.float atten;
-.float volume;
-.float absolute; // 1 = count per second is absolute, 2 = only spawn at toggle
-.vector movedir; // trace direction
+#include "particles.qh"
 
 void Draw_PointParticles()
 {
@@ -40,9 +29,9 @@ void Draw_PointParticles()
        for(i = random(); i <= n && fail <= 64*n; ++i)
        {
                p = o + self.mins;
-               p_x += random() * sz_x;
-               p_y += random() * sz_y;
-               p_z += random() * sz_z;
+               p.x += random() * sz.x;
+               p.y += random() * sz.y;
+               p.z += random() * sz.z;
                if(WarpZoneLib_BoxTouchesBrush(p, p, self, world))
                {
                        if(self.movedir != '0 0 0')
@@ -83,9 +72,9 @@ void Ent_PointParticles_Remove()
 
 void Ent_PointParticles()
 {
-       float f, i;
+       float i;
        vector v;
-       f = ReadByte();
+       int f = ReadByte();
        if(f & 2)
        {
                i = ReadCoord(); // density (<0: point, >0: volume)
@@ -174,7 +163,7 @@ void Ent_PointParticles()
                if(!self.absolute)
                {
                        v = self.maxs - self.mins;
-                       self.impulse *= -v_x * v_y * v_z / 262144; // relative: particles per 64^3 cube
+                       self.impulse *= -v.x * v.y * v.z / 262144; // relative: particles per 64^3 cube
                }
        }
 
@@ -188,7 +177,6 @@ void Ent_PointParticles()
        self.entremove = Ent_PointParticles_Remove;
 }
 
-.float glow_color; // palette index
 void Draw_Rain()
 {
     te_particlerain(self.origin + self.mins, self.origin + self.maxs, self.velocity, floor(self.count * drawframetime + random()), self.glow_color);
@@ -229,8 +217,8 @@ void Net_ReadVortexBeamParticle()
 {
        vector shotorg, endpos;
        float charge;
-       shotorg_x = ReadCoord(); shotorg_y = ReadCoord(); shotorg_z = ReadCoord();
-       endpos_x = ReadCoord(); endpos_y = ReadCoord(); endpos_z = ReadCoord();
+       shotorg.x = ReadCoord(); shotorg.y = ReadCoord(); shotorg.z = ReadCoord();
+       endpos.x = ReadCoord(); endpos.y = ReadCoord(); endpos.z = ReadCoord();
        charge = ReadByte() / 255.0;
 
        pointparticles(particleeffectnum("nex_muzzleflash"), shotorg, normalize(endpos - shotorg) * 1000, 1);
@@ -239,126 +227,8 @@ void Net_ReadVortexBeamParticle()
        charge = sqrt(charge); // divide evenly among trail spacing and alpha
        particles_alphamin = particles_alphamax = particles_fade = charge;
 
-       if (autocvar_cl_particles_oldnexbeam && (getstati(STAT_ALLOW_OLDNEXBEAM) || isdemo()))
+       if (autocvar_cl_particles_oldvortexbeam && (getstati(STAT_ALLOW_OLDVORTEXBEAM) || isdemo()))
                WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum("TE_TEI_G3"), shotorg, endpos, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
        else
                WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum("nex_beam"), shotorg, endpos, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
 }
-
-.vector sw_shotorg;
-.vector sw_endpos;
-.float sw_spread_max;
-.float sw_spread_min;
-.float sw_time;
-
-void Draw_Shockwave()
-{
-       float a = bound(0, (0.5 - ((time - self.sw_time) / 0.4)), 0.5);
-
-       if(!a) { remove(self); }
-       
-       vector deviation, angle;
-
-       vector sw_color = getcsqcplayercolor(self.sv_entnum); // GetTeamRGB(GetPlayerColor(self.sv_entnum));
-
-       vector first_min_end = '0 0 0', prev_min_end = '0 0 0', new_min_end = '0 0 0';
-       vector first_max_end = '0 0 0', prev_max_end = '0 0 0', new_max_end = '0 0 0';
-
-       float new_max_dist, new_min_dist;
-       
-       vector shotdir = normalize(self.sw_endpos - self.sw_shotorg);
-       vectorvectors(shotdir);
-       vector right = v_right;
-       vector up = v_up;
-       
-       float counter, dist_before_normal = 200, shots = 20;
-       
-       vector min_end = ((self.sw_shotorg + (shotdir * dist_before_normal)) + (up * self.sw_spread_min));
-       vector max_end = (self.sw_endpos + (up * self.sw_spread_max));
-       
-       float spread_to_min = vlen(normalize(min_end - self.sw_shotorg) - shotdir);
-       float spread_to_max = vlen(normalize(max_end - min_end) - shotdir);
-       
-       for(counter = 0; counter < shots; ++counter)
-       {
-               // perfect circle effect lines
-               angle = '0 0 0';
-               makevectors('0 360 0' * (0.75 + (counter - 0.5) / shots));
-               angle_y = v_forward_x;
-               angle_z = v_forward_y;
-
-               // first do the spread_to_min effect
-               deviation = angle * spread_to_min;
-               deviation = ((shotdir + (right * deviation_y) + (up * deviation_z)));
-               new_min_dist = dist_before_normal;
-               new_min_end = (self.sw_shotorg + (deviation * new_min_dist));
-               //te_lightning2(world, new_min_end, self.sw_shotorg);
-
-               // then calculate spread_to_max effect
-               deviation = angle * spread_to_max;
-               deviation = ((shotdir + (right * deviation_y) + (up * deviation_z)));
-               new_max_dist = vlen(new_min_end - self.sw_endpos);
-               new_max_end = (new_min_end + (deviation * new_max_dist));
-               //te_lightning2(world, new_end, prev_min_end);
-               
-
-               if(counter == 0)
-               {
-                       first_min_end = new_min_end;
-                       first_max_end = new_max_end;
-               }
-
-               if(counter >= 1)
-               {
-                       R_BeginPolygon("", DRAWFLAG_NORMAL);
-                       R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
-                       R_PolygonVertex(new_min_end, '0 0 0', sw_color, a);
-                       R_PolygonVertex(self.sw_shotorg, '0 0 0', sw_color, a);
-                       R_EndPolygon();
-
-                       R_BeginPolygon("", DRAWFLAG_NORMAL);
-                       R_PolygonVertex(new_min_end, '0 0 0', sw_color, a);
-                       R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
-                       R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a);
-                       R_PolygonVertex(new_max_end, '0 0 0', sw_color, a);
-                       R_EndPolygon();
-               }
-
-               prev_min_end = new_min_end;
-               prev_max_end = new_max_end;
-
-               if((counter + 1) == shots)
-               {
-                       R_BeginPolygon("", DRAWFLAG_NORMAL);
-                       R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
-                       R_PolygonVertex(first_min_end, '0 0 0', sw_color, a);
-                       R_PolygonVertex(self.sw_shotorg, '0 0 0', sw_color, a);
-                       R_EndPolygon();
-
-                       R_BeginPolygon("", DRAWFLAG_NORMAL);
-                       R_PolygonVertex(first_min_end, '0 0 0', sw_color, a);
-                       R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
-                       R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a);
-                       R_PolygonVertex(first_max_end, '0 0 0', sw_color, a);
-                       R_EndPolygon();
-               }
-       }
-}
-
-void Net_ReadShockwaveParticle()
-{
-       entity shockwave;
-       shockwave = spawn();
-       shockwave.draw = Draw_Shockwave;
-       
-       shockwave.sw_shotorg_x = ReadCoord(); shockwave.sw_shotorg_y = ReadCoord(); shockwave.sw_shotorg_z = ReadCoord();
-       shockwave.sw_endpos_x  = ReadCoord(); shockwave.sw_endpos_y  = ReadCoord(); shockwave.sw_endpos_z  = ReadCoord();
-       
-       shockwave.sw_spread_max = ReadByte();
-       shockwave.sw_spread_min = ReadByte();
-
-       shockwave.sv_entnum = ReadByte();
-
-       shockwave.sw_time = time;
-}
-