#define ITS_POWERUP 64
#define ISF_COLORMAP 16
#define ISF_DROP 32
+#define ISF_ANGLES 64
.float ItemStatus;
#ifdef CSQC
-float autocvar_cl_ghost_items;
-vector autocvar_cl_ghost_items_color;
-float autocvar_cl_simple_items;
+var float autocvar_cl_animate_items = 1;
+var float autocvar_cl_ghost_items = 0.45;
+var vector autocvar_cl_ghost_items_color = '-1 -1 -1';
float autocvar_cl_fullbright_items;
-vector autocvar_cl_staywep_color;
-float autocvar_cl_staywep_alpha;
+vector autocvar_cl_weapon_stay_color = '2 0.5 0.5';
+float autocvar_cl_weapon_stay_alpha = 0.75;
+float autocvar_cl_simple_items;
+float cl_simple_items;
+float cl_ghost_items_alpha;
.float spawntime;
.float gravity;
.vector colormod;
void ItemDraw()
{
- if(self.ItemStatus & ITS_ANIMATE1)
- {
- self.angles += '0 180 0' * frametime;
- setorigin(self, '0 0 10' + self.oldorigin + '0 0 8' * sin(time * 2));
- }
-
- if(self.ItemStatus & ITS_ANIMATE2)
- {
- self.angles += '0 -90 0' * frametime;
- setorigin(self, '0 0 8' + self.oldorigin + '0 0 4' * sin(time * 3));
- }
-
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()
{
if(self.gravity)
+ {
Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
+
+ if(self.move_flags & FL_ONGROUND)
+ self.gravity = 0;
+ }
}
float csqcitems_started; // remove this after a release or two
void csqcitems_start()
{
- autocvar_cl_ghost_items = bound(0, autocvar_cl_ghost_items, 1);
if(autocvar_cl_ghost_items == 1)
- autocvar_cl_ghost_items = 0.55;
+ cl_ghost_items_alpha = 0.55;
+ else
+ cl_ghost_items_alpha = bound(0, autocvar_cl_ghost_items, 1);
- string _tmp = cvar_string("cl_ghost_items_color");
- if(_tmp == "")
- autocvar_cl_ghost_items_color = '-1 -1 -1';
-
csqcitems_started = TRUE;
}
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();
}
else
{
- if (autocvar_cl_ghost_items)
+ if (cl_ghost_items_alpha)
{
self.alpha = autocvar_cl_ghost_items;
self.colormod = self.glowmod = autocvar_cl_ghost_items_color;
if(self.ItemStatus & ITS_STAYWEP)
{
- self.colormod = self.glowmod = autocvar_cl_staywep_color;
- self.alpha = autocvar_cl_staywep_alpha;
+ self.colormod = self.glowmod = autocvar_cl_weapon_stay_color;
+ self.alpha = autocvar_cl_weapon_stay_alpha;
}
{
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))
+ if(cl_simple_items && (self.ItemStatus & ITS_ALLOWSI))
{
string _fn2 = substring(_fn, 0 , strlen(_fn) -4);
-
+ self.draw = ItemDrawSimple;
+
if(fexists(strcat(_fn2, "_simple.md3")))
self.mdl = strzone(strcat(_fn2, "_simple.md3"));
else if(fexists(strcat(_fn2, "_simple.dpm")))
self.mdl = strzone(strcat(_fn2, "_simple.obj"));
else
{
- self.mdl = "";
+ 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 == "")
- {
- self.mdl = strzone(_fn);
- self.draw = ItemDraw;
- }
- else
- self.draw = ItemDrawSimple;
+ 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_DROP)
{
- self.effects |= EF_FLAME;
self.gravity = 1;
+ self.move_angles = '0 0 0';
self.move_movetype = MOVETYPE_TOSS;
self.move_velocity_x = ReadCoord();
self.move_velocity_y = ReadCoord();
}
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
#ifdef SVQC
WriteByte(MSG_ENTITY, ENT_CLIENT_ITEM);
WriteByte(MSG_ENTITY, sf);
-
//WriteByte(MSG_ENTITY, self.cnt);
if(sf & ISF_LOCATION)
{
WriteCoord(MSG_ENTITY, self.origin_y);
WriteCoord(MSG_ENTITY, self.origin_z);
}
+
+ if(sf & ISF_ANGLES)
+ {
+ WriteCoord(MSG_ENTITY, self.angles_x);
+ WriteCoord(MSG_ENTITY, self.angles_y);
+ WriteCoord(MSG_ENTITY, self.angles_z);
+ }
if(sf & ISF_STATUS)
WriteByte(MSG_ENTITY, self.ItemStatus);
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);
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;
remove (self);
return;
}
+
+ if(self.angles != '0 0 0')
+ self.SendFlags |= ISF_ANGLES;
self.reset = Item_Reset;
// it's a level item