]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow setting item's glow colour from server
authorMario <mario@smbclan.net>
Mon, 8 Aug 2016 13:47:02 +0000 (23:47 +1000)
committerMario <mario@smbclan.net>
Mon, 8 Aug 2016 13:47:02 +0000 (23:47 +1000)
qcsrc/common/t_items.qc
qcsrc/server/weapons/throwing.qc

index d180e1c1b91c0af5809269198153ff57e7bd1a92..e53963e2f0bf40a839c47027849bd5370eb86e80 100644 (file)
@@ -34,6 +34,7 @@ REGISTER_NET_LINKED(ENT_CLIENT_ITEM)
 
 #ifdef CSQC
 bool autocvar_cl_ghost_items_vehicle = true;
+.vector item_glowmod;
 void Item_SetAlpha(entity this)
 {
        bool veh_hud = (hud && autocvar_cl_ghost_items_vehicle);
@@ -41,7 +42,8 @@ void Item_SetAlpha(entity this)
        if(!veh_hud && (this.ItemStatus & ITS_AVAILABLE))
        {
                this.alpha = 1;
-               this.colormod = this.glowmod = '1 1 1';
+               this.colormod = '1 1 1';
+               this.glowmod = this.item_glowmod;
        }
        else
        {
@@ -246,7 +248,12 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
     }
 
     if(sf & ISF_COLORMAP)
+    {
         this.colormap = ReadShort();
+        this.item_glowmod_x = ReadByte() / 255.0;
+        this.item_glowmod_y = ReadByte() / 255.0;
+        this.item_glowmod_z = ReadByte() / 255.0;
+    }
 
     if(sf & ISF_DROP)
     {
@@ -327,14 +334,19 @@ bool ItemSend(entity this, entity to, int sf)
                WriteShort(MSG_ENTITY, this.fade_start);
 
                if(this.mdl == "")
-                       LOG_TRACE("^1WARNING!^7 this.mdl is unset for item ", this.classname, "exspect a crash just aboute now\n");
+                       LOG_TRACE("^1WARNING!^7 this.mdl is unset for item ", this.classname, "expect a crash just about now\n");
 
                WriteString(MSG_ENTITY, this.mdl);
        }
 
 
        if(sf & ISF_COLORMAP)
+       {
                WriteShort(MSG_ENTITY, this.colormap);
+               WriteByte(MSG_ENTITY, this.glowmod.x * 255.0);
+        WriteByte(MSG_ENTITY, this.glowmod.y * 255.0);
+        WriteByte(MSG_ENTITY, this.glowmod.z * 255.0);
+       }
 
        if(sf & ISF_DROP)
        {
@@ -446,7 +458,7 @@ void Item_Show (entity e, float mode)
                //setmodel(e, "null");
                e.solid = SOLID_NOT;
                e.colormod = '0 0 0';
-               e.glowmod = e.colormod;
+               //e.glowmod = e.colormod;
                e.spawnshieldtime = 1;
                e.ItemStatus &= ~ITS_AVAILABLE;
        }}
@@ -1204,7 +1216,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                        this.gravity = 1;
                if (!(this.spawnflags & 1024))
                        this.ItemStatus |= ITS_ANIMATE1;
-               this.ItemStatus |= ISF_COLORMAP;
+               this.SendFlags |= ISF_COLORMAP;
        }
 
        this.state = 0;
index c69b8e9a9ce1c2ebb70e2c8799f84535a3a2b606..ed9f2be4e0ef51fda59183c60b5a320005b24b81 100644 (file)
@@ -45,6 +45,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
        wep.owner = wep.enemy = own;
        wep.flags |= FL_TOSSED;
        wep.colormap = own.colormap;
+       wep.glowmod = weaponentity_glowmod(info, own.clientcolors);
 
        W_DropEvent(wr_drop,own,wpn,wep);
 
@@ -79,7 +80,6 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
        weapon_defaultspawnfunc(wep, info);
        if(startitem_failed)
                return string_null;
-       wep.glowmod = weaponentity_glowmod(info, own.clientcolors);
        setthink(wep, thrown_wep_think);
        wep.savenextthink = wep.nextthink;
        wep.nextthink = min(wep.nextthink, time + 0.5);