]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/projectile.qc
Merge branch 'master' of git://nl.git.xonotic.org/xonotic/xonotic-data.pk3dir
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / projectile.qc
index bdf633468df3bb34fb0c0da2225bc5155e0eeb0f..de45141a136c1bb71aba06fafa4de21ad7fa027b 100644 (file)
@@ -40,8 +40,8 @@ void Projectile_DrawTrail(vector to)
 
        if (self.traileffect)
        {
-               particles_alphamin = particles_alphamax = sqrt(self.alpha);
-               boxparticles(self.traileffect, self, from, to, self.velocity, self.velocity, sqrt(self.alpha), PARTICLES_USEALPHA);
+               particles_alphamin = particles_alphamax = particles_fade = sqrt(self.alpha);
+               boxparticles(self.traileffect, self, from, to, self.velocity, self.velocity, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE | PARTICLES_DRAWASTRAIL);
        }
 }
 
@@ -101,6 +101,18 @@ void Projectile_Draw()
                        case PROJECTILE_GRENADE_BOUNCING:
                                rot = '0 -1000 0'; // sideways
                                break;
+                       case PROJECTILE_NADE_RED_BURN:
+                       case PROJECTILE_NADE_RED:
+                       case PROJECTILE_NADE_BLUE_BURN:
+                       case PROJECTILE_NADE_BLUE:
+                       case PROJECTILE_NADE_YELLOW_BURN:
+                       case PROJECTILE_NADE_YELLOW:
+                       case PROJECTILE_NADE_PINK_BURN:
+                       case PROJECTILE_NADE_PINK:
+                       case PROJECTILE_NADE_BURN:
+                       case PROJECTILE_NADE:
+                               rot = self.avelocity; 
+                               break;
                        case PROJECTILE_HOOKBOMB:
                                rot = '1000 0 0'; // forward
                                break;
@@ -124,6 +136,18 @@ void Projectile_Draw()
        trailorigin = self.origin;
        switch(self.cnt)
        {
+           case PROJECTILE_NADE_RED_BURN:
+               case PROJECTILE_NADE_RED:
+               case PROJECTILE_NADE_BLUE_BURN:
+               case PROJECTILE_NADE_BLUE:
+               case PROJECTILE_NADE_YELLOW_BURN:
+               case PROJECTILE_NADE_YELLOW:
+               case PROJECTILE_NADE_PINK_BURN:
+               case PROJECTILE_NADE_PINK:
+               case PROJECTILE_NADE_BURN:
+               case PROJECTILE_NADE:
+                       trailorigin += v_up * 4;
+                       break;
                case PROJECTILE_GRENADE:
                case PROJECTILE_GRENADE_BOUNCING:
                        trailorigin += v_right * 1 + v_forward * -10;
@@ -160,14 +184,11 @@ void loopsound(entity e, float ch, string samp, float vol, float attn)
                return;
 
        sound(e, ch, samp, vol, attn);
-       e.snd_looping = 1;
+       e.snd_looping = ch;
 }
 
 void Ent_RemoveProjectile()
 {
-       if(self.snd_looping)
-               sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTN_NORM);
-
        if(self.count & 0x80)
        {
                tracebox(self.origin, self.mins, self.maxs, self.origin + self.velocity * 0.05, MOVE_NORMAL, self);
@@ -195,7 +216,7 @@ void Ent_Projectile()
 
        f = ReadByte();
        self.count = (f & 0x80);
-       self.iflags = (self.iflags & IFLAG_INTERNALMASK) | IFLAG_AUTOANGLES | IFLAG_ANGLES;
+       self.iflags = (self.iflags & IFLAG_INTERNALMASK) | IFLAG_AUTOANGLES | IFLAG_ANGLES | IFLAG_ORIGIN;
        self.solid = SOLID_TRIGGER;
        //self.effects = EF_NOMODELFLAGS;
 
@@ -225,6 +246,7 @@ void Ent_Projectile()
                self.origin_x = ReadCoord();
                self.origin_y = ReadCoord();
                self.origin_z = ReadCoord();
+               setorigin(self, self.origin);
                if(self.count & 0x80)
                {
                        self.velocity_x = ReadCoord();
@@ -302,6 +324,17 @@ void Ent_Projectile()
 
                        case PROJECTILE_BUMBLE_GUN: setmodel(self, "models/elaser.mdl");self.traileffect = particleeffectnum("TR_NEXUIZPLASMA"); break;
                        case PROJECTILE_BUMBLE_BEAM: setmodel(self, "models/elaser.mdl");self.traileffect = particleeffectnum("TR_NEXUIZPLASMA"); break;
+                       
+                       case PROJECTILE_NADE_RED: setmodel(self, "models/weapons/v_ok_grenade.md3");self.traileffect = particleeffectnum("nade_red"); break;
+                       case PROJECTILE_NADE_RED_BURN: setmodel(self, "models/weapons/v_ok_grenade.md3");self.traileffect = particleeffectnum("nade_red_burn"); break;
+                       case PROJECTILE_NADE_BLUE: setmodel(self, "models/weapons/v_ok_grenade.md3");self.traileffect = particleeffectnum("nade_blue"); break;
+                       case PROJECTILE_NADE_BLUE_BURN: setmodel(self, "models/weapons/v_ok_grenade.md3");self.traileffect = particleeffectnum("nade_blue_burn"); break;
+                       case PROJECTILE_NADE_YELLOW: setmodel(self, "models/weapons/v_ok_grenade.md3");self.traileffect = particleeffectnum("nade_yellow"); break;
+                       case PROJECTILE_NADE_YELLOW_BURN: setmodel(self, "models/weapons/v_ok_grenade.md3");self.traileffect = particleeffectnum("nade_yellow_burn"); break;
+                       case PROJECTILE_NADE_PINK: setmodel(self, "models/weapons/v_ok_grenade.md3");self.traileffect = particleeffectnum("nade_pink"); break;
+                       case PROJECTILE_NADE_PINK_BURN: setmodel(self, "models/weapons/v_ok_grenade.md3");self.traileffect = particleeffectnum("nade_pink_burn"); break;
+                       case PROJECTILE_NADE: setmodel(self, "models/weapons/v_ok_grenade.md3");self.traileffect = particleeffectnum("nade"); break;
+                       case PROJECTILE_NADE_BURN: setmodel(self, "models/weapons/v_ok_grenade.md3");self.traileffect = particleeffectnum("nade_burn"); break;
 
                        default:
                                error("Received invalid CSQC projectile, can't work with this!");
@@ -336,6 +369,17 @@ void Ent_Projectile()
                                self.mins = '-3 -3 -3';
                                self.maxs = '3 3 3';
                                break;
+                       case PROJECTILE_NADE_RED_BURN:
+                       case PROJECTILE_NADE_RED:
+                       case PROJECTILE_NADE_BLUE_BURN:
+                       case PROJECTILE_NADE_BLUE:
+                               self.mins = '-3 -3 -3';
+                               self.maxs = '3 3 3';
+                               self.move_movetype = MOVETYPE_BOUNCE;
+                               self.move_touch = func_null;
+                               self.scale = 1.5;
+                               self.avelocity = randomvec() * 720;
+                               break;
                        case PROJECTILE_GRENADE_BOUNCING:
                                self.mins = '-3 -3 -3';
                                self.maxs = '3 3 3';
@@ -344,6 +388,23 @@ void Ent_Projectile()
                                self.move_bounce_factor = g_balance_grenadelauncher_bouncefactor;
                                self.move_bounce_stopspeed = g_balance_grenadelauncher_bouncestop;
                                break;
+                       case PROJECTILE_NADE_RED_BURN:
+                       case PROJECTILE_NADE_RED:
+                       case PROJECTILE_NADE_BLUE_BURN:
+                       case PROJECTILE_NADE_BLUE:
+                       case PROJECTILE_NADE_YELLOW_BURN:
+                       case PROJECTILE_NADE_YELLOW:
+                       case PROJECTILE_NADE_PINK_BURN:
+                       case PROJECTILE_NADE_PINK:
+                       case PROJECTILE_NADE_BURN:
+                       case PROJECTILE_NADE:
+                               self.mins = '-16 -16 -16';
+                               self.maxs = '16 16 16';
+                               self.move_movetype = MOVETYPE_BOUNCE;
+                               self.move_touch = func_null;
+                               self.scale = 1.5;
+                               self.avelocity = randomvec() * 720;
+                               break;
                        case PROJECTILE_MINE:
                                self.mins = '-4 -4 -4';
                                self.maxs = '4 4 4';
@@ -424,6 +485,7 @@ void Ent_Projectile()
                        default:
                                break;
                }
+               setsize(self, self.mins, self.maxs);
        }
 
        if(self.gravity)
@@ -461,6 +523,8 @@ void Projectile_Precache()
        precache_model("models/rocket.md3");
        precache_model("models/tagrocket.md3");
        precache_model("models/tracer.mdl");
+       
+       precache_model("models/weapons/v_ok_grenade.md3");
 
        precache_sound("weapons/electro_fly.wav");
        precache_sound("weapons/rocket_fly.wav");