]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/weapons/projectile.qc
Fix projectile glowmod support
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / weapons / projectile.qc
index 4015828e555fc6a41db87329254197072e3d9d58..f31bef7a37bcb166f3840188d82b69835d1d67f0 100644 (file)
@@ -6,6 +6,7 @@
 #include "../mutators/events.qh"
 
 #include <common/constants.qh>
+#include <common/net_linked.qh>
 #include <common/physics/movetypes/movetypes.qh>
 
 #include <lib/csqcmodel/interpolate.qh>
@@ -19,7 +20,7 @@
 void SUB_Stop(entity this, entity toucher)
 {
        this.velocity = this.avelocity = '0 0 0';
-       this.move_movetype = MOVETYPE_NONE;
+       set_movetype(this, MOVETYPE_NONE);
 }
 
 void Projectile_ResetTrail(entity this, vector to)
@@ -263,7 +264,26 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
                        this.fade_rate = 0;
                }
 
-               this.team = ReadByte() - 1;
+               int myteam = ReadByte();
+               this.team = myteam - 1;
+
+               if(teamplay)
+               {
+                       if(myteam)
+                               this.colormap = (this.team) * 0x11; // note: team - 1 on server (client uses different numbers)
+                       else
+                               this.colormap = 0x00;
+                       this.colormap |= BIT(10); // RENDER_COLORMAPPED
+               }
+               else
+                       this.colormap = myteam;
+               // TODO: projectiles use glowmaps for their color, not teams
+               #if 0
+               if(this.colormap > 0)
+                       this.glowmod = colormapPaletteColor(this.colormap & 0x0F, true) * 2;
+               else
+                       this.glowmod = '1 1 1';
+               #endif
        }
 
        if (f & 2)
@@ -330,7 +350,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
                this.maxs = '0 0 0';
                this.colormod = '0 0 0';
                settouch(this, SUB_Stop);
-               this.move_movetype = MOVETYPE_TOSS;
+               set_movetype(this, MOVETYPE_TOSS);
                this.alphamod = 1;
 
                switch (this.cnt)
@@ -340,7 +360,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
                                loopsound(this, CH_SHOTS_SINGLE, SND(ELECTRO_FLY), VOL_BASE, ATTEN_NORM);
                                this.mins = '-4 -4 -4';
                                this.maxs = '4 4 4';
-                               this.move_movetype = MOVETYPE_BOUNCE;
+                               set_movetype(this, MOVETYPE_BOUNCE);
                                settouch(this, func_null);
                                this.bouncefactor = WEP_CVAR_SEC(electro, bouncefactor);
                                this.bouncestop = WEP_CVAR_SEC(electro, bouncestop);
@@ -358,7 +378,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
                        case PROJECTILE_GRENADE_BOUNCING:
                                this.mins = '-3 -3 -3';
                                this.maxs = '3 3 3';
-                               this.move_movetype = MOVETYPE_BOUNCE;
+                               set_movetype(this, MOVETYPE_BOUNCE);
                                settouch(this, func_null);
                                this.bouncefactor = WEP_CVAR(mortar, bouncefactor);
                                this.bouncestop = WEP_CVAR(mortar, bouncestop);
@@ -376,21 +396,21 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
                        case PROJECTILE_PORTO_RED:
                                this.colormod = '2 1 1';
                                this.alphamod = 0.5;
-                               this.move_movetype = MOVETYPE_BOUNCE;
+                               set_movetype(this, MOVETYPE_BOUNCE);
                                settouch(this, func_null);
                                break;
                        case PROJECTILE_PORTO_BLUE:
                                this.colormod = '1 1 2';
                                this.alphamod = 0.5;
-                               this.move_movetype = MOVETYPE_BOUNCE;
+                               set_movetype(this, MOVETYPE_BOUNCE);
                                settouch(this, func_null);
                                break;
                        case PROJECTILE_HAGAR_BOUNCING:
-                               this.move_movetype = MOVETYPE_BOUNCE;
+                               set_movetype(this, MOVETYPE_BOUNCE);
                                settouch(this, func_null);
                                break;
                        case PROJECTILE_CRYLINK_BOUNCING:
-                               this.move_movetype = MOVETYPE_BOUNCE;
+                               set_movetype(this, MOVETYPE_BOUNCE);
                                settouch(this, func_null);
                                break;
                        case PROJECTILE_FIREBALL:
@@ -400,7 +420,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
                                break;
                        case PROJECTILE_FIREMINE:
                                loopsound(this, CH_SHOTS_SINGLE, SND(FIREBALL_FLY), VOL_BASE, ATTEN_NORM);
-                               this.move_movetype = MOVETYPE_BOUNCE;
+                               set_movetype(this, MOVETYPE_BOUNCE);
                                settouch(this, func_null);
                                this.mins = '-4 -4 -4';
                                this.maxs = '4 4 4';
@@ -460,16 +480,16 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
        if (this.gravity)
        {
                if (this.move_movetype == MOVETYPE_FLY)
-                       this.move_movetype = MOVETYPE_TOSS;
+                       set_movetype(this, MOVETYPE_TOSS);
                if (this.move_movetype == MOVETYPE_BOUNCEMISSILE)
-                       this.move_movetype = MOVETYPE_BOUNCE;
+                       set_movetype(this, MOVETYPE_BOUNCE);
        }
        else
        {
                if (this.move_movetype == MOVETYPE_TOSS)
-                       this.move_movetype = MOVETYPE_FLY;
+                       set_movetype(this, MOVETYPE_FLY);
                if (this.move_movetype == MOVETYPE_BOUNCE)
-                       this.move_movetype = MOVETYPE_BOUNCEMISSILE;
+                       set_movetype(this, MOVETYPE_BOUNCEMISSILE);
        }
 
        if (!(this.count & 0x80))