+ if(self.gravity)
+ {
+ Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
+
+ if(self.move_flags & FL_ONGROUND)
+ self.gravity = 0;
+ }
+}
+
+void ItemRead(float _IsNew)
+{
+ float sf = ReadByte();
+
+ if(sf & ISF_LOCATION)
+ {
+ self.origin_x = ReadCoord();
+ self.origin_y = ReadCoord();
+ self.origin_z = ReadCoord();
+ setorigin(self, self.origin);
+ self.oldorigin = self.origin;
+ }
+
+ if(sf & ISF_ANGLES)
+ {
+ self.angles_x = ReadCoord();
+ self.angles_y = 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();
+
+ if(self.ItemStatus & ITS_AVAILABLE)
+ {
+ self.alpha = 1;
+ self.colormod = self.glowmod = '1 1 1';
+ }
+ else
+ {
+ if (autocvar_cl_ghost_items_color)
+ {
+ self.alpha = autocvar_cl_ghost_items;
+ self.colormod = self.glowmod = autocvar_cl_ghost_items_color;
+ }
+ 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);
+ else
+ 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)))
+ self.mdl = strzone(sprintf("%s%s.dpm", _fn2, autocvr_cl_simpleitems_postfix));
+ else if(fexists(sprintf("%s%s.iqm", _fn2, autocvr_cl_simpleitems_postfix)))
+ self.mdl = strzone(sprintf("%s%s.iqm", _fn2, autocvr_cl_simpleitems_postfix));
+ else if(fexists(sprintf("%s%s.obj", _fn2, autocvr_cl_simpleitems_postfix)))
+ self.mdl = strzone(sprintf("%s%s.obj", _fn2, autocvr_cl_simpleitems_postfix));
+ else
+ {
+ self.draw = ItemDraw;
+ dprint("Simple item requested for ", _fn, " but no model exsist for it\n");
+ }
+ }
+
+ 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_angles = '0 0 0';
+ self.move_movetype = MOVETYPE_TOSS;
+ self.move_velocity_x = ReadCoord();
+ self.move_velocity_y = ReadCoord();
+ self.move_velocity_z = ReadCoord();
+ self.velocity = self.move_velocity;
+ self.move_origin = self.oldorigin;
+
+ if(!self.move_time)
+ {
+ self.move_time = time;
+ self.spawntime = 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';
+ }
+}
+
+#endif