From: Mario Date: Mon, 8 Aug 2016 13:47:02 +0000 (+1000) Subject: Allow setting item's glow colour from server X-Git-Tag: xonotic-v0.8.2~732 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b6d22ea672a1e0b7924a8ac804933a90ea7baabd;p=xonotic%2Fxonotic-data.pk3dir.git Allow setting item's glow colour from server --- diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index d180e1c1b..e53963e2f 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -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; diff --git a/qcsrc/server/weapons/throwing.qc b/qcsrc/server/weapons/throwing.qc index c69b8e9a9..ed9f2be4e 100644 --- a/qcsrc/server/weapons/throwing.qc +++ b/qcsrc/server/weapons/throwing.qc @@ -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);