self.move_angles = self.angles;
}
+ if(sf & ISF_SIZE)
+ {
+ self.mins_x = ReadCoord();
+ self.mins_y = ReadCoord();
+ self.mins_z = ReadCoord();
+ self.maxs_x = ReadCoord();
+ self.maxs_y = ReadCoord();
+ self.maxs_z = ReadCoord();
+ setsize(self, self.mins, self.maxs);
+ }
+
if(sf & ISF_STATUS) // need to read/write status frist so model can handle simple, fb etc.
{
self.ItemStatus = ReadByte();
if(sf & ISF_MODEL)
{
self.drawmask = MASK_NORMAL;
- self.movetype = MOVETYPE_NOCLIP;
+ self.movetype = MOVETYPE_TOSS;
self.draw = ItemDraw;
if(self.mdl)
- 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));
+ 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.obj", _fn2, autocvar_cl_simpleitems_postfix)))
+ self.mdl = strzone(sprintf("%s%s.obj", _fn2, autocvar_cl_simpleitems_postfix));
else
{
self.draw = ItemDraw;
if(sf & ISF_DROP)
{
self.gravity = 1;
- self.move_angles = '0 0 0';
+ //self.move_angles = '0 0 0';
self.move_movetype = MOVETYPE_TOSS;
self.move_velocity_x = ReadCoord();
self.move_velocity_y = ReadCoord();
WriteCoord(MSG_ENTITY, self.angles_z);
}
+ if(sf & ISF_SIZE)
+ {
+ WriteCoord(MSG_ENTITY, self.mins_x);
+ WriteCoord(MSG_ENTITY, self.mins_y);
+ WriteCoord(MSG_ENTITY, self.mins_z);
+ WriteCoord(MSG_ENTITY, self.maxs_x);
+ WriteCoord(MSG_ENTITY, self.maxs_y);
+ WriteCoord(MSG_ENTITY, self.maxs_z);
+ }
+
if(sf & ISF_STATUS)
WriteByte(MSG_ENTITY, self.ItemStatus);
if(autocvar_g_pickup_items == 0)
return FALSE;
if(g_weaponarena)
- if(self.weapons || (self.items & IT_AMMO))
+ if(self.weapons || (self.items & IT_AMMO)) // no item or ammo pickups in weaponarena
return FALSE;
}
return TRUE;
}
-floatfield Item_CounterField(float it)
-{
- switch(it)
- {
- case IT_SHELLS: return ammo_shells;
- case IT_NAILS: return ammo_nails;
- case IT_ROCKETS: return ammo_rockets;
- case IT_CELLS: return ammo_cells;
- case IT_FUEL: return ammo_fuel;
- case IT_5HP: return health;
- case IT_25HP: return health;
- case IT_HEALTH: return health;
- case IT_ARMOR_SHARD: return armorvalue;
- case IT_ARMOR: return armorvalue;
- // add more things here (health, armor)
- default: error("requested item has no counter field");
- }
-#ifdef GMQCC
- // should never happen
- return health;
-#endif
-}
-
-string Item_CounterFieldName(float it)
-{
- switch(it)
- {
- case IT_SHELLS: return "shells";
- case IT_NAILS: return "nails";
- case IT_ROCKETS: return "rockets";
- case IT_CELLS: return "cells";
- case IT_FUEL: return "fuel";
-
- // add more things here (health, armor)
- default: error("requested item has no counter field name");
- }
-#ifdef GMQCC
- // should never happen
- return string_null;
-#endif
-}
-
/*
float Item_Customize()
{
e.SendFlags |= ISF_STATUS;
}
+void Item_Think()
+{
+ self.nextthink = time;
+ if(self.origin != self.oldorigin)
+ {
+ self.oldorigin = self.origin;
+ ItemUpdate(self);
+ }
+}
+
void Item_Respawn (void)
{
Item_Show(self, 1);
sound (self, CH_TRIGGER, "misc/itemrespawn.wav", VOL_BASE, ATTEN_NORM); // play respawn sound
setorigin (self, self.origin);
+ self.think = Item_Think;
+ self.nextthink = time;
+
//pointparticles(particleeffectnum("item_respawn"), self.origin + self.mins_z * '0 0 1' + '0 0 48', '0 0 0', 1);
pointparticles(particleeffectnum("item_respawn"), self.origin + 0.5 * (self.mins + self.maxs), '0 0 0', 1);
}
}
}
+void Item_RespawnThink()
+{
+ self.nextthink = time;
+ if(self.origin != self.oldorigin)
+ {
+ self.oldorigin = self.origin;
+ ItemUpdate(self);
+ }
+
+ if(time >= self.wait)
+ Item_Respawn();
+}
+
void Item_ScheduleRespawnIn(entity e, float t)
{
if((e.flags & FL_POWERUP) || (e.weapons & WEPSET_SUPERWEAPONS))
}
else
{
- e.think = Item_Respawn;
- e.nextthink = time + t;
+ e.think = Item_RespawnThink;
+ e.nextthink = time;
+ e.wait = time + t;
}
}
Item_ScheduleRespawnIn(e, game_starttime - time + ITEM_RESPAWNTIME_INITIAL(e));
}
-float Item_GiveAmmoTo(entity item, entity player, .float ammofield, float ammomax, float mode)
+float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode)
{
- if (!item.ammofield)
+ if (!item.ammotype)
return FALSE;
if (item.spawnshieldtime)
{
- if ((player.ammofield < ammomax) || item.pickup_anyway)
+ if ((player.ammotype < ammomax) || item.pickup_anyway)
{
- player.ammofield = bound(player.ammofield, ammomax, player.ammofield + item.ammofield);
+ player.ammotype = bound(player.ammotype, ammomax, player.ammotype + item.ammotype);
goto YEAH;
}
}
else if(g_weapon_stay == 2)
{
- float mi = min(item.ammofield, ammomax);
- if (player.ammofield < mi)
+ float mi = min(item.ammotype, ammomax);
+ if (player.ammotype < mi)
{
- player.ammofield = mi;
+ player.ammotype = mi;
goto YEAH;
}
}
return;
if (self.owner == other)
return;
+ if (time < self.item_spawnshieldtime)
+ return;
switch(MUTATOR_CALLHOOK(ItemTouch))
{
if(self.classname != "droppedweapon")
{
- self.think = func_null;
- self.nextthink = 0;
+ self.think = Item_Think;
+ self.nextthink = time;
if(self.waypointsprite_attached)
WaypointSprite_Kill(self.waypointsprite_attached);
return;
}
- if(self.angles != '0 0 0')
- self.SendFlags |= ISF_ANGLES;
-
self.reset = Item_Reset;
// it's a level item
if(self.spawnflags & 1)
setsize (self, '-16 -16 0', '16 16 48');
else
setsize (self, '-16 -16 0', '16 16 32');
+
// note droptofloor returns FALSE if stuck/or would fall too far
droptofloor();
waypoint_spawnforitem(self);
Item_Reset();
Net_LinkEntity(self, FALSE, 0, ItemSend);
+
+ self.SendFlags |= ISF_SIZE;
+ if(self.angles)
+ self.SendFlags |= ISF_ANGLES;
// call this hook after everything else has been done
if(MUTATOR_CALLHOOK(Item_Spawn))