#ifdef CSQC
void ItemDraw()
{
- if(self.move_flags & FL_ONGROUND)
- {
- self.oldorigin = self.move_origin;
- 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.move_angles += self.move_avelocity * frametime;
- //self.move_origin = '0 0 10' + self.oldorigin + '0 0 8' * sin(time * 2);
- }
-
- if(self.ItemStatus & ITS_ANIMATE2)
- {
- self.move_angles += self.move_avelocity * frametime;
- //self.move_origin = '0 0 8' + self.oldorigin + '0 0 4' * sin(time * 3);
- }
- }
-
- Movetype_Physics_NoMatchServer();
+ if(self.gravity)
+ {
+ Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
+ 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(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));
+ }
+
+ if(self.ItemStatus & ITS_ANIMATE2)
+ {
+ self.angles += self.move_avelocity * frametime;
+ setorigin(self, '0 0 8' + self.oldorigin + '0 0 4' * sin(time * 3));
+ }
+ }
}
void ItemDrawSimple()
{
- Movetype_Physics_NoMatchServer();
+ if(self.gravity)
+ {
+ Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
+
+ if(self.move_flags & FL_ONGROUND)
+ self.gravity = 0;
+ }
}
void Item_PreDraw()
else
alph = 1;
//printf("%v <-> %v\n", view_origin, self.origin + 0.5 * (self.mins + self.maxs));
- if(self.ItemStatus & ITS_AVAILABLE)
- self.alpha = alph;
if(alph <= 0)
self.drawmask = 0;
else
void ItemRead(float _IsNew)
{
- int sf = ReadByte();
-
- if(sf & ISF_LOCATION)
- {
- self.move_origin_x = ReadCoord();
- self.move_origin_y = ReadCoord();
- self.move_origin_z = ReadCoord();
- setorigin(self, self.move_origin);
- self.oldorigin = self.move_origin;
- }
-
- if(sf & ISF_ANGLES)
- {
- self.move_angles_x = ReadAngle();
- self.move_angles_y = ReadAngle();
- self.move_angles_z = ReadAngle();
- }
-
- if(sf & ISF_SIZE)
- {
- float use_bigsize = ReadByte();
- setsize(self, '-16 -16 0', (use_bigsize) ? '16 16 48' : '16 16 32');
- }
-
- 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.move_movetype = MOVETYPE_TOSS;
- self.solid = SOLID_TRIGGER;
+ int 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 = ReadAngle();
+ self.angles_y = ReadAngle();
+ self.angles_z = ReadAngle();
+ self.move_angles = self.angles;
+ }
+
+ if(sf & ISF_SIZE)
+ {
+ float use_bigsize = ReadByte();
+ setsize(self, '-16 -16 0', (use_bigsize) ? '16 16 48' : '16 16 32');
+ }
+
+ 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.move_movetype = self.movetype = MOVETYPE_TOSS;
//self.renderflags |= RF_DEPTHHACK;
- self.draw = ItemDraw;
-
- self.fade_end = ReadShort();
- self.fade_start = ReadShort();
- if(self.fade_start)
- self.predraw = Item_PreDraw;
-
- 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, autocvar_cl_simpleitems_postfix)))
- self.mdl = strzone(sprintf("%s%s.md3", _fn2, autocvar_cl_simpleitems_postfix));
- else if(fexists(sprintf("%s%s.dpm", _fn2, autocvar_cl_simpleitems_postfix)))
- self.mdl = strzone(sprintf("%s%s.dpm", _fn2, autocvar_cl_simpleitems_postfix));
- else if(fexists(sprintf("%s%s.iqm", _fn2, autocvar_cl_simpleitems_postfix)))
- self.mdl = strzone(sprintf("%s%s.iqm", _fn2, autocvar_cl_simpleitems_postfix));
- else if(fexists(sprintf("%s%s.mdl", _fn2, autocvar_cl_simpleitems_postfix)))
- self.mdl = strzone(sprintf("%s%s.mdl", _fn2, autocvar_cl_simpleitems_postfix));
- else
- {
- self.draw = ItemDraw;
- dprint("Simple item requested for ", _fn, " but no model exists 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.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';
- }*/
+ self.draw = ItemDraw;
+
+ self.fade_end = ReadShort();
+ self.fade_start = ReadShort();
+ if(self.fade_start)
+ self.predraw = Item_PreDraw;
+
+ 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, autocvar_cl_simpleitems_postfix)))
+ self.mdl = strzone(sprintf("%s%s.md3", _fn2, autocvar_cl_simpleitems_postfix));
+ else if(fexists(sprintf("%s%s.dpm", _fn2, autocvar_cl_simpleitems_postfix)))
+ self.mdl = strzone(sprintf("%s%s.dpm", _fn2, autocvar_cl_simpleitems_postfix));
+ else if(fexists(sprintf("%s%s.iqm", _fn2, autocvar_cl_simpleitems_postfix)))
+ self.mdl = strzone(sprintf("%s%s.iqm", _fn2, autocvar_cl_simpleitems_postfix));
+ else if(fexists(sprintf("%s%s.mdl", _fn2, autocvar_cl_simpleitems_postfix)))
+ self.mdl = strzone(sprintf("%s%s.mdl", _fn2, autocvar_cl_simpleitems_postfix));
+ else
+ {
+ self.draw = ItemDraw;
+ dprint("Simple item requested for ", _fn, " but no model exists 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