.float gravity;
.vector colormod;
void ItemDraw()
-{
+{
if(self.gravity)
- {
+ {
Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
- if(self.move_flags & FL_ONGROUND)
+ if(self.move_flags & FL_ONGROUND)
{ // For some reason move_avelocity gets set to '0 0 0' here ...
self.oldorigin = self.origin;
self.gravity = 0;
- if(autocvar_cl_animate_items)
- { // ... so reset it if animations are requested.
+ if(autocvar_cl_animate_items)
+ { // ... so reset it if animations are requested.
if(self.ItemStatus & ITS_ANIMATE1)
self.move_avelocity = '0 180 0';
-
+
if(self.ItemStatus & ITS_ANIMATE2)
self.move_avelocity = '0 -90 0';
}
}
}
else if (autocvar_cl_animate_items)
- {
+ {
if(self.ItemStatus & ITS_ANIMATE1)
{
self.angles += self.move_avelocity * frametime;
- setorigin(self, '0 0 10' + self.oldorigin + '0 0 8' * sin(time * 2));
- }
-
+ setorigin(self, '0 0 10' + self.oldorigin + '0 0 8' * sin(time * 2));
+ }
+
if(self.ItemStatus & ITS_ANIMATE2)
{
self.angles += self.move_avelocity * frametime;
- setorigin(self, '0 0 8' + self.oldorigin + '0 0 4' * sin(time * 3));
+ setorigin(self, '0 0 8' + self.oldorigin + '0 0 4' * sin(time * 3));
}
}
}
void ItemDrawSimple()
{
if(self.gravity)
- {
- Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
-
+ {
+ Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
+
if(self.move_flags & FL_ONGROUND)
self.gravity = 0;
}
setorigin(self, self.origin);
self.oldorigin = self.origin;
}
-
- if(sf & ISF_ANGLES)
+
+ if(sf & ISF_ANGLES)
{
self.angles_x = ReadCoord();
self.angles_y = ReadCoord();
- self.angles_z = ReadCoord();
+ self.angles_z = ReadCoord();
self.move_angles = self.angles;
}
-
+
if(sf & ISF_STATUS) // need to read/write status frist so model can handle simple, fb etc.
{
- self.ItemStatus = ReadByte();
-
+ self.ItemStatus = ReadByte();
+
if(self.ItemStatus & ITS_AVAILABLE)
{
self.alpha = 1;
}
else
self.alpha = -1;
- }
-
+ }
+
if(autocvar_cl_fullbright_items)
if(self.ItemStatus & ITS_ALLOWFB)
self.effects |= EF_FULLBRIGHT;
-
+
if(self.ItemStatus & ITS_STAYWEP)
{
self.colormod = self.glowmod = autocvar_cl_weapon_stay_color;
self.alpha = autocvar_cl_weapon_stay_alpha;
-
+
}
-
+
if(self.ItemStatus & ITS_POWERUP)
{
if(self.ItemStatus & ITS_AVAILABLE)
self.effects &= ~(EF_ADDITIVE | EF_FULLBRIGHT);
}
}
-
+
if(sf & ISF_MODEL)
{
self.drawmask = MASK_NORMAL;
self.movetype = MOVETYPE_NOCLIP;
self.draw = ItemDraw;
-
+
if(self.mdl)
strunzone(self.mdl);
-
+
self.mdl = "";
string _fn = ReadString();
-
+
if(autocvar_cl_simple_items && (self.ItemStatus & ITS_ALLOWSI))
{
string _fn2 = substring(_fn, 0 , strlen(_fn) -4);
self.draw = ItemDrawSimple;
-
-
-
+
+
+
if(fexists(sprintf("%s%s.md3", _fn2, autocvr_cl_simpleitems_postfix)))
self.mdl = strzone(sprintf("%s%s.md3", _fn2, autocvr_cl_simpleitems_postfix));
else if(fexists(sprintf("%s%s.dpm", _fn2, autocvr_cl_simpleitems_postfix)))
dprint("Simple item requested for ", _fn, " but no model exsist for it\n");
}
}
-
- if(self.draw != ItemDrawSimple)
- self.mdl = strzone(_fn);
-
-
+
+ if(self.draw != ItemDrawSimple)
+ self.mdl = strzone(_fn);
+
+
if(self.mdl == "")
dprint("^1WARNING!^7 self.mdl is unset for item ", self.classname, " tell tZork aboute this!\n");
-
+
precache_model(self.mdl);
setmodel(self, self.mdl);
}
-
+
if(sf & ISF_COLORMAP)
self.colormap = ReadShort();
-
+
if(sf & ISF_DROP)
{
self.gravity = 1;
self.move_velocity_z = ReadCoord();
self.velocity = self.move_velocity;
self.move_origin = self.oldorigin;
-
+
if(!self.move_time)
{
self.move_time = time;
else
self.move_time = max(self.move_time, time);
}
-
+
if(autocvar_cl_animate_items)
- {
+ {
if(self.ItemStatus & ITS_ANIMATE1)
self.move_avelocity = '0 180 0';
-
+
if(self.ItemStatus & ITS_ANIMATE2)
self.move_avelocity = '0 -90 0';
}
sf |= ISF_DROP;
else
sf &= ~ISF_DROP;
-
- WriteByte(MSG_ENTITY, ENT_CLIENT_ITEM);
+
+ WriteByte(MSG_ENTITY, ENT_CLIENT_ITEM);
WriteByte(MSG_ENTITY, sf);
//WriteByte(MSG_ENTITY, self.cnt);
WriteCoord(MSG_ENTITY, self.origin_y);
WriteCoord(MSG_ENTITY, self.origin_z);
}
-
+
if(sf & ISF_ANGLES)
{
WriteCoord(MSG_ENTITY, self.angles_x);
if(sf & ISF_MODEL)
{
-
+
if(self.mdl == "")
dprint("^1WARNING!^7 self.mdl is unset for item ", self.classname, "exspect a crash just aboute now\n");
-
+
WriteString(MSG_ENTITY, self.mdl);
}
-
-
+
+
if(sf & ISF_COLORMAP)
WriteShort(MSG_ENTITY, self.colormap);
WriteCoord(MSG_ENTITY, self.velocity_y);
WriteCoord(MSG_ENTITY, self.velocity_z);
}
-
+
return TRUE;
}
*/
void Item_Show (entity e, float mode)
-{
+{
e.effects &= ~(EF_ADDITIVE | EF_STARDUST | EF_FULLBRIGHT | EF_NODEPTHTEST);
e.ItemStatus &= ~ITS_STAYWEP;
if (mode > 0)
e.spawnshieldtime = 1;
e.ItemStatus &= ~ITS_AVAILABLE;
}
-
+
if (e.items & IT_STRENGTH || e.items & IT_INVINCIBLE)
- e.ItemStatus |= ITS_POWERUP;
-
+ e.ItemStatus |= ITS_POWERUP;
+
if (autocvar_g_nodepthtestitems)
e.effects |= EF_NODEPTHTEST;
-
-
+
+
if (autocvar_g_fullbrightitems)
e.ItemStatus |= ITS_ALLOWFB;
-
+
if (autocvar_sv_simple_items)
e.ItemStatus |= ITS_ALLOWSI;
}
:skip
-
+
// always eat teamed entities
if(item.team)
pickedup = TRUE;
void Item_Touch (void)
{
entity e, head;
-
+
// remove the item if it's currnetly in a NODROP brush or hits a NOIMPACT surface (such as sky)
if(self.classname == "droppedweapon")
{
if(self.model == "")
self.model = itemmodel;
-
+
if(self.model == "")
{
error(strcat("^1Tried to spawn ", itemname, " with no model!\n"));
return;
}
-
+
if(self.item_pickupsound == "")
self.item_pickupsound = pickupsound;
-
+
if(!self.respawntime) // both need to be set
{
self.respawntime = defaultrespawntime;
if(weaponid)
self.weapons = WepSet_FromWeapon(weaponid);
-
+
self.flags = FL_ITEM | itemflags;
if(MUTATOR_CALLHOOK(FilterItem)) // error means we do not want the item
remove (self);
return;
}
-
+
if(self.angles != '0 0 0')
self.SendFlags |= ISF_ANGLES;
self.netname = itemname;
self.touch = Item_Touch;
setmodel(self, "null"); // precision set below
- //self.effects |= EF_LOWPRECISION;
-
+ //self.effects |= EF_LOWPRECISION;
+
if((itemflags & FL_POWERUP) || self.health || self.armorvalue)
{
self.pos1 = '-16 -16 0';
self.pos2 = '16 16 32';
}
setsize (self, self.pos1, self.pos2);
-
- if(itemflags & FL_POWERUP)
+
+ if(itemflags & FL_POWERUP)
self.ItemStatus |= ITS_ANIMATE1;
-
+
if(self.armorvalue || self.health)
self.ItemStatus |= ITS_ANIMATE2;
-
+
if(itemflags & FL_WEAPON)
{
if (self.classname != "droppedweapon") // if dropped, colormap is already set up nicely
self.colormap = 1024; // color shirt=0 pants=0 grey
else
self.gravity = 1;
-
+
self.ItemStatus |= ITS_ANIMATE1;
self.ItemStatus |= ISF_COLORMAP;
}
{
if(!self.cnt)
self.cnt = 1; // item probability weight
-
+
self.effects |= EF_NODRAW; // marker for item team search
InitializeEntity(self, Item_FindTeam, INITPRIO_FINDTARGET);
}
else
Item_Reset();
-
+
Net_LinkEntity(self, FALSE, 0, ItemSend);
// call this hook after everything else has been done
e.strength_finished = max(0, e.strength_finished - time);
e.invincible_finished = max(0, e.invincible_finished - time);
e.superweapons_finished = max(0, e.superweapons_finished - time);
-
+
PREGIVE(e, items);
PREGIVE_WEAPONS(e);
PREGIVE(e, strength_finished);