-#if defined(CSQC)
- #include "../dpdefs/csprogsdefs.qh"
- #include "../common/util.qh"
- #include "../common/buffs.qh"
- #include "../common/weapons/weapons.qh"
- #include "../client/autocvars.qh"
- #include "../client/movetypes.qh"
- #include "../client/main.qh"
- #include "../csqcmodellib/common.qh"
- #include "../csqcmodellib/cl_model.qh"
- #include "t_items.qh"
-#elif defined(MENUQC)
-#elif defined(SVQC)
- #include "../dpdefs/progsdefs.qh"
- #include "../dpdefs/dpextensions.qh"
- #include "../warpzonelib/util_server.qh"
+#include "t_items.qh"
+
+#if defined(SVQC)
+ #include "_all.qh"
+
+ #include "g_subs.qh"
+ #include "waypointsprites.qh"
+
+ #include "bot/bot.qh"
+ #include "bot/waypoints.qh"
+
+ #include "mutators/mutators_include.qh"
+
+ #include "weapons/common.qh"
+ #include "weapons/selection.qh"
+ #include "weapons/weaponsystem.qh"
+
#include "../common/constants.qh"
+ #include "../common/deathtypes.qh"
+ #include "../common/notifications.qh"
#include "../common/util.qh"
+
#include "../common/monsters/monsters.qh"
+
#include "../common/weapons/weapons.qh"
- #include "weapons/weaponsystem.qh"
- #include "t_items.qh"
- #include "autocvars.qh"
- #include "constants.qh"
- #include "defs.qh"
- #include "../common/notifications.qh"
- #include "../common/deathtypes.qh"
- #include "mutators/mutators_include.qh"
+
+ #include "../warpzonelib/util_server.qh"
#endif
#ifdef CSQC
#endif
#ifdef SVQC
-float ItemSend(entity to, float sf)
+bool ItemSend(entity to, int sf)
{
if(self.gravity)
sf |= ISF_DROP;
}
}
+float it_armor_large_time;
+float it_health_mega_time;
+float it_invisible_time;
+float it_speed_time;
+float it_extralife_time;
+float it_strength_time;
+float it_shield_time;
+float it_fuelregen_time;
+float it_jetpack_time;
+float it_superweapons_time;
+
+void Item_ItemsTime_Init()
+{
+ it_armor_large_time = -1;
+ it_health_mega_time = -1;
+ it_invisible_time = -1;
+ it_speed_time = -1;
+ it_extralife_time = -1;
+ it_strength_time = -1;
+ it_shield_time = -1;
+ it_fuelregen_time = -1;
+ it_jetpack_time = -1;
+ it_superweapons_time = -1;
+}
+void Item_ItemsTime_Reset()
+{
+ it_armor_large_time = (it_armor_large_time == -1) ? -1 : 0;
+ it_health_mega_time = (it_health_mega_time == -1) ? -1 : 0;
+ it_invisible_time = (it_invisible_time == -1) ? -1 : 0;
+ it_speed_time = (it_speed_time == -1) ? -1 : 0;
+ it_extralife_time = (it_extralife_time == -1) ? -1 : 0;
+ it_strength_time = (it_strength_time == -1) ? -1 : 0;
+ it_shield_time = (it_shield_time == -1) ? -1 : 0;
+ it_fuelregen_time = (it_fuelregen_time == -1) ? -1 : 0;
+ it_jetpack_time = (it_jetpack_time == -1) ? -1 : 0;
+ it_superweapons_time= (it_superweapons_time== -1) ? -1 : 0;
+}
+void Item_ItemsTime_ResetForPlayer(entity e)
+{
+ e.item_armor_large_time = (it_armor_large_time == -1) ? -1 : 0;
+ e.item_health_mega_time = (it_health_mega_time == -1) ? -1 : 0;
+ e.item_invisible_time = (it_invisible_time == -1) ? -1 : 0;
+ e.item_speed_time = (it_speed_time == -1) ? -1 : 0;
+ e.item_extralife_time = (it_extralife_time == -1) ? -1 : 0;
+ e.item_strength_time = (it_strength_time == -1) ? -1 : 0;
+ e.item_shield_time = (it_shield_time == -1) ? -1 : 0;
+ e.item_fuelregen_time = (it_fuelregen_time == -1) ? -1 : 0;
+ e.item_jetpack_time = (it_jetpack_time == -1) ? -1 : 0;
+ e.item_superweapons_time= (it_superweapons_time== -1) ? -1 : 0;
+}
+void Item_ItemsTime_Get(entity e)
+{
+ e.item_armor_large_time = it_armor_large_time;
+ e.item_health_mega_time = it_health_mega_time;
+ e.item_invisible_time = it_invisible_time;
+ e.item_speed_time = it_speed_time;
+ e.item_extralife_time = it_extralife_time;
+ e.item_strength_time = it_strength_time;
+ e.item_shield_time = it_shield_time;
+ e.item_fuelregen_time = it_fuelregen_time;
+ e.item_jetpack_time = it_jetpack_time;
+ e.item_superweapons_time = it_superweapons_time;
+}
+float Item_ItemsTime_UpdateTime_Check(float item_time, float t)
+{
+ if(t == 0 && item_time == -1)
+ return TRUE;
+ if(time < t && (item_time <= time || t < item_time))
+ return TRUE;
+ return FALSE;
+}
+void Item_ItemsTime_UpdateTime(entity e, float t)
+{
+ if(g_instagib)
+ {
+ switch(e.items)
+ {
+ case IT_STRENGTH://"item-invis"
+ if(Item_ItemsTime_UpdateTime_Check(it_invisible_time, t))
+ it_invisible_time = t;
+ break;
+ case IT_NAILS://"item-extralife"
+ if(Item_ItemsTime_UpdateTime_Check(it_extralife_time, t))
+ it_extralife_time = t;
+ break;
+ case IT_INVINCIBLE://"item-speed"
+ if(Item_ItemsTime_UpdateTime_Check(it_speed_time, t))
+ it_speed_time = t;
+ break;
+ }
+ }
+ else
+ {
+ switch(e.items)
+ {
+ case IT_HEALTH:
+ if(!autocvar_sv_itemstime)
+ break;
+ //if (e.classname == "item_health_mega")
+ if(Item_ItemsTime_UpdateTime_Check(it_health_mega_time, t))
+ it_health_mega_time = t;
+ break;
+ case IT_ARMOR:
+ if(!autocvar_sv_itemstime)
+ break;
+ if (e.classname == "item_armor_large")
+ if(Item_ItemsTime_UpdateTime_Check(it_armor_large_time, t))
+ it_armor_large_time = t;
+ break;
+ case IT_STRENGTH://"item-strength"
+ if(Item_ItemsTime_UpdateTime_Check(it_strength_time, t))
+ it_strength_time = t;
+ break;
+ case IT_INVINCIBLE://"item-shield"
+ if(Item_ItemsTime_UpdateTime_Check(it_shield_time, t))
+ it_shield_time = t;
+ break;
+ default:
+ if(e.weapons & WEPSET_SUPERWEAPONS)
+ if(Item_ItemsTime_UpdateTime_Check(it_superweapons_time, t))
+ it_superweapons_time = t;
+ }
+ }
+ switch(e.items)
+ {
+ case IT_FUEL_REGEN://"item-fuelregen"
+ if(Item_ItemsTime_UpdateTime_Check(it_fuelregen_time, t))
+ it_fuelregen_time = t;
+ break;
+ case IT_JETPACK://"item-jetpack"
+ if(Item_ItemsTime_UpdateTime_Check(it_jetpack_time, t))
+ it_jetpack_time = t;
+ break;
+ }
+}
+void Item_ItemsTime_GetForAll()
+{
+ entity e;
+ if(warmup_stage)
+ {
+ FOR_EACH_REALCLIENT(e)
+ Item_ItemsTime_Get(e);
+ }
+ else
+ {
+ FOR_EACH_REALCLIENT(e)
+ {
+ if (e.classname != "player")
+ Item_ItemsTime_Get(e);
+ }
+ }
+}
+
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);
+ if(self.flags & FL_POWERUP || self.classname == "item_armor_large" || self.items == IT_HEALTH || (self.weapons & WEPSET_SUPERWEAPONS))
+ {
+ Item_ItemsTime_UpdateTime(self, 0);
+ Item_ItemsTime_GetForAll();
+ }
+
self.think = Item_Think;
self.nextthink = time;
case IT_JETPACK: name = "item-jetpack"; rgb = '0.5 0.5 0.5'; break;
case IT_STRENGTH: name = "item-strength"; rgb = '0 0 1'; break;
case IT_INVINCIBLE: name = "item-shield"; rgb = '1 0 1'; break;
+ case IT_HEALTH:
+ //if (self.classname == "item_health_mega")
+ {name = "item_health_mega"; rgb = '1 0 0';}
+ break;
+ case IT_ARMOR:
+ if (self.classname == "item_armor_large")
+ {name = "item_armor_large"; rgb = '0 1 0';}
+ break;
}
item_name = name;
item_color = rgb;
{
WaypointSprite_Spawn(name, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_POWERUP, rgb);
if(self.waypointsprite_attached)
+ {
+ if (self.items == IT_HEALTH || self.items == IT_ARMOR)
+ WaypointSprite_UpdateRule(self.waypointsprite_attached, 0, SPRITERULE_SPECTATOR);
WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, time + ITEM_RESPAWN_TICKS);
+ }
}
else
{
void Item_ScheduleRespawnIn(entity e, float t)
{
- if((e.flags & FL_POWERUP) || (e.weapons & WEPSET_SUPERWEAPONS))
+ if((e.flags & FL_POWERUP) || (e.weapons & WEPSET_SUPERWEAPONS) || e.classname == "item_armor_large" || e.items == IT_HEALTH)
{
+ entity head;
e.think = Item_RespawnCountdown;
e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);
+ e.scheduledrespawntime = e.nextthink + ITEM_RESPAWN_TICKS;
e.count = 0;
+ if(e.weapons & WEPSET_SUPERWEAPONS)
+ {
+ for(t = e.scheduledrespawntime, head = world; (head = nextent(head)); )
+ {
+ if(e == head)
+ continue;
+ if(clienttype(head) == CLIENTTYPE_NOTACLIENT)
+ if(head.weapons & WEPSET_SUPERWEAPONS)
+ if(head.classname != "weapon_info")
+ {
+ if(head.scheduledrespawntime <= time)
+ {
+ t = 0;
+ break;
+ }
+ if(head.scheduledrespawntime < t)
+ t = head.scheduledrespawntime;
+ }
+ }
+ }
+ else
+ {
+ for(t = e.scheduledrespawntime, head = world; (head = find(head, classname, e.classname)); )
+ {
+ // in instagib .classname is "instagib" for every item
+ if(e == head || (g_instagib && e.items != head.items))
+ continue;
+ if(head.scheduledrespawntime <= time)
+ {
+ t = 0;
+ break;
+ }
+ if(head.scheduledrespawntime < t)
+ t = head.scheduledrespawntime;
+ }
+ }
+ Item_ItemsTime_UpdateTime(e, t);
+ Item_ItemsTime_GetForAll();
}
else
{
e.think = Item_RespawnThink;
e.nextthink = time;
+ e.scheduledrespawntime = time + t;
e.wait = time + t;
}
}
float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode)
{
- if (!item.ammotype)
+ if (!item.(ammotype))
return false;
if (item.spawnshieldtime)
{
- if ((player.ammotype < ammomax) || item.pickup_anyway)
+ if ((player.(ammotype) < ammomax) || item.pickup_anyway)
{
- player.ammotype = bound(player.ammotype, ammomax, player.ammotype + item.ammotype);
+ player.(ammotype) = bound(player.(ammotype), ammomax, player.(ammotype) + item.(ammotype));
goto YEAH;
}
}
else if(g_weapon_stay == 2)
{
- float mi = min(item.ammotype, ammomax);
- if (player.ammotype < mi)
+ float mi = min(item.(ammotype), ammomax);
+ if (player.(ammotype) < mi)
{
- player.ammotype = mi;
+ player.(ammotype) = mi;
goto YEAH;
}
}
float weapon_pickupevalfunc(entity player, entity item)
{
- float c, j, position;
+ float c;
// See if I have it already
if(item.weapons & ~player.weapons)
if( bot_custom_weapon && c )
{
// Find the highest position on any range
- position = -1;
- for(j = 0; j < WEP_LAST ; ++j){
+ int position = -1;
+ for (int j = 0; j < WEP_LAST ; ++j){
if(
bot_weapons_far[j] == item.weapon ||
bot_weapons_mid[j] == item.weapon ||
if((itemflags & (FL_POWERUP | FL_WEAPON)) || (itemid & (IT_HEALTH | IT_ARMOR | IT_KEY1 | IT_KEY2)))
self.target = "###item###"; // for finding the nearest item using find()
+
+ Item_ItemsTime_UpdateTime(self, 0);
}
self.bot_pickup = true;
StartItem ("models/items/a_rockets.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "rockets", IT_ROCKETS, 0, 0, commodity_pickupevalfunc, 3000);
}
-void spawnfunc_item_shells (void);
void spawnfunc_item_bullets (void) {
if(!weaponswapping)
if(autocvar_sv_q3acompat_machineshotgunswap)
float GiveBit(entity e, .float fld, float bit, float op, float val)
{
float v0, v1;
- v0 = (e.fld & bit);
+ v0 = (e.(fld) & bit);
switch(op)
{
case OP_SET:
if(val > 0)
- e.fld |= bit;
+ e.(fld) |= bit;
else
- e.fld &= ~bit;
+ e.(fld) &= ~bit;
break;
case OP_MIN:
case OP_PLUS:
if(val > 0)
- e.fld |= bit;
+ e.(fld) |= bit;
break;
case OP_MAX:
if(val <= 0)
- e.fld &= ~bit;
+ e.(fld) &= ~bit;
break;
case OP_MINUS:
if(val > 0)
- e.fld &= ~bit;
+ e.(fld) &= ~bit;
break;
}
- v1 = (e.fld & bit);
+ v1 = (e.(fld) & bit);
return (v0 != v1);
}
float GiveValue(entity e, .float fld, float op, float val)
{
float v0, v1;
- v0 = e.fld;
+ v0 = e.(fld);
switch(op)
{
case OP_SET:
- e.fld = val;
+ e.(fld) = val;
break;
case OP_MIN:
- e.fld = max(e.fld, val); // min 100 cells = at least 100 cells
+ e.(fld) = max(e.(fld), val); // min 100 cells = at least 100 cells
break;
case OP_MAX:
- e.fld = min(e.fld, val);
+ e.(fld) = min(e.(fld), val);
break;
case OP_PLUS:
- e.fld += val;
+ e.(fld) += val;
break;
case OP_MINUS:
- e.fld -= val;
+ e.(fld) -= val;
break;
}
- v1 = e.fld;
+ v1 = e.(fld);
return (v0 != v1);
}
void GiveRot(entity e, float v0, float v1, .float rotfield, float rottime, .float regenfield, float regentime)
{
if(v0 < v1)
- e.rotfield = max(e.rotfield, time + rottime);
+ e.(rotfield) = max(e.(rotfield), time + rottime);
else if(v0 > v1)
- e.regenfield = max(e.regenfield, time + regentime);
+ e.(regenfield) = max(e.(regenfield), time + regentime);
}
float GiveItems(entity e, float beginarg, float endarg)
{