]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/generator.qc
Merge branch 'master' into terencehill/quickmenu
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / generator.qc
index fe19cc65caf572685cd15a81903d52f6cdd76c30..80ccc441bcf01cf0188f4be4cf7b0bd9a7d4205e 100644 (file)
@@ -4,16 +4,6 @@ bool generator_precached;
 .int count;
 .float max_health;
 
-vector randompos(vector m1, vector m2)
-{
-       vector v;
-       m2 = m2 - m1;
-       v_x = m2_x * random() + m1_x;
-       v_y = m2_y * random() + m1_y;
-       v_z = m2_z * random() + m1_z;
-       return  v;
-}
-
 void generator_precache()
 {
        if(generator_precached)
@@ -34,8 +24,8 @@ void generator_precache()
 
        precache_model("models/onslaught/ons_ray.md3");
        precache_sound("onslaught/shockwave.wav");
-       precache_sound("weapons/grenade_impact.wav");
-       precache_sound("weapons/rocket_impact.wav");
+       precache_sound(W_Sound("grenade_impact"));
+       precache_sound(W_Sound("rocket_impact"));
        precache_sound("onslaught/electricity_explode.wav");
 
        generator_precached = true;
@@ -45,7 +35,7 @@ void ons_generator_ray_draw()
 {
        if(time < self.move_time)
                return;
-       
+
        self.move_time = time + 0.05;
 
        if(self.count > 10)
@@ -91,14 +81,14 @@ void generator_draw()
                if(random() < 0.9 - self.health / self.max_health)
                if(random() < 0.01)
                {
-                       pointparticles(particleeffectnum("electro_ballexplode"), self.origin + randompos('-50 -50 -20', '50 50 50'), '0 0 0', 1);
+                       pointparticles(particleeffectnum(EFFECT_ELECTRO_BALLEXPLODE), self.origin + randompos('-50 -50 -20', '50 50 50'), '0 0 0', 1);
                        sound(self, CH_TRIGGER, "onslaught/electricity_explode.wav", VOL_BASE, ATTEN_NORM);
                }
                else
-                       pointparticles(particleeffectnum("torch_small"), self.origin + randompos('-60 -60 -20', '60 60 60'), '0 0 0', 1);
-       
+                       pointparticles(particleeffectnum(EFFECT_ONS_GENERATOR_DAMAGED), self.origin + randompos('-60 -60 -20', '60 60 60'), '0 0 0', 1);
+
                self.move_time = time + 0.1;
-               
+
                return;
        }
 
@@ -112,9 +102,9 @@ void generator_draw()
        if(self.count==40||self.count==20)
        {
                sound(self, CH_TRIGGER, "onslaught/shockwave.wav", VOL_BASE, ATTEN_NORM);
-               pointparticles(particleeffectnum("electro_combo"), self.origin, '0 0 0', 6);
+               pointparticles(particleeffectnum(EFFECT_ELECTRO_COMBO), self.origin, '0 0 0', 6);
        }
-       
+
        // rays
        if(random() > 0.25)
        {
@@ -125,27 +115,27 @@ void generator_draw()
        for(i=0;i < 10;++i)
        {
                org = self.origin + randompos('-30 -30 -30' * i + '0 0 -20', '30 30 30' * i + '0 0 20');
-               pointparticles(particleeffectnum("onslaught_generator_gib_explode"), org, '0 0 0', 1);
+               pointparticles(particleeffectnum(EFFECT_ONS_GENERATOR_GIB), org, '0 0 0', 1);
        }
 
        // Short explosion sound + small explosion
        if(random() < 0.25)
        {
                te_explosion(self.origin);
-               sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTEN_NORM);
+               sound(self, CH_TRIGGER, W_Sound("grenade_impact"), VOL_BASE, ATTEN_NORM);
        }
 
        // Particles
        org = self.origin + randompos(self.mins + '8 8 8', self.maxs + '-8 -8 -8');
-       pointparticles(particleeffectnum("onslaught_generator_smallexplosion"), org, '0 0 0', 1);
+       pointparticles(particleeffectnum(EFFECT_ONS_GENERATOR_EXPLODE), org, '0 0 0', 1);
 
        // Final explosion
        if(self.count==1)
        {
                org = self.origin;
                te_explosion(org);
-               pointparticles(particleeffectnum("onslaught_generator_finalexplosion"), org, '0 0 0', 1);
-               sound(self, CH_TRIGGER, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
+               pointparticles(particleeffectnum(EFFECT_ONS_GENERATOR_EXPLODE2), org, '0 0 0', 1);
+               sound(self, CH_TRIGGER, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM);
        }
 
        self.move_time = time + 0.05;