]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add support for skinned, coloured item models (intended for powerups)
authorbones_was_here <bones_was_here@xa.org.au>
Mon, 19 Jul 2021 20:49:38 +0000 (06:49 +1000)
committerbones_was_here <bones_was_here@xa.org.au>
Mon, 19 Jul 2021 20:49:38 +0000 (06:49 +1000)
qcsrc/client/items/items.qc
qcsrc/common/items/item/pickup.qh
qcsrc/server/items/items.qc

index 064be587e78fc46087e2d4eabad563d84f25885c..f94d36cf6712f2b1022f1940de5ec41d6d60930f 100644 (file)
@@ -229,6 +229,8 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
         precache_model(this.mdl);
         _setmodel(this, this.mdl);
 
+       this.skin = ReadByte();
+
         setsize(this, '-16 -16 0', '16 16 48');
     }
 
index 7e31994075c244277201a4d02799825c89346f44..d21923e258dc196ef15e80209e3fbfb230b9de63 100644 (file)
@@ -22,6 +22,8 @@ PROPERTY(float, g_pickup_respawntimejitter_powerup)
 CLASS(Pickup, GameItem)
 #ifdef GAMEQC
     ATTRIB(Pickup, m_model, Model);
+    ATTRIB(Pickup, m_skin, int);
+    ATTRIB(Pickup, m_color, vector);
     ATTRIB(Pickup, m_sound, Sound, SND_ITEMPICKUP);
 #endif
     ATTRIB(Pickup, netname, string);
index 610c864b121e30b52e449e99a4eb3ab4a1c90505..faea9449eae93880bb51f08c258ad6e086a66ac5 100644 (file)
@@ -63,9 +63,9 @@ bool ItemSend(entity this, entity to, int sf)
                        LOG_TRACE("^1WARNING!^7 this.mdl is unset for item ", this.classname, "expect a crash just about now");
 
                WriteString(MSG_ENTITY, this.mdl);
+               WriteByte(MSG_ENTITY, bound(0, this.skin, 255));
        }
 
-
        if(sf & ISF_COLORMAP)
        {
                WriteShort(MSG_ENTITY, this.colormap);
@@ -1071,6 +1071,10 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
        setmodel(this, MDL_Null); // precision set below
        //this.effects |= EF_LOWPRECISION;
 
+       // support skinned models for powerups
+       this.skin = def.m_skin;
+       this.glowmod = def.m_color;
+
        setsize (this, this.pos1 =  def.m_mins, this.pos2 = def.m_maxs);
 
        this.SendFlags |= ISF_SIZE;