}
float alph;
vector org = getpropertyvec(VF_ORIGIN);
- if(!checkpvs(org, this)) // this makes sense as long as we don't support recursive warpzones
- alph = 0;
- else if(this.fade_start)
- alph = bound(0, (this.fade_end - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.fade_end - this.fade_start), 1);
+ //if(!checkpvs(org, this)) // this makes sense as long as we don't support recursive warpzones
+ //alph = 0; // this shouldn't be needed, since items behind walls are culled anyway
+ if(this.fade_start)
+ {
+ if(vdist(org - this.origin, >, this.fade_end))
+ alph = 0; // save on some processing
+ else if(vdist(org - this.origin, <, this.fade_start))
+ alph = 1; // more processing saved
+ else
+ alph = bound(0, (this.fade_end - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.fade_end - this.fade_start), 1);
+ }
else
alph = 1;
//printf("%v <-> %v\n", view_origin, this.origin + 0.5 * (this.mins + this.maxs));
Item_ScheduleRespawnIn(e, max(0, game_starttime - time) + ((e.respawntimestart) ? e.respawntimestart : ITEM_RESPAWNTIME_INITIAL(e)));
}
+void GivePlayerHealth(entity player, float amount)
+{
+ if (amount == 0)
+ {
+ return;
+ }
+ player.health = bound(player.health, player.health + amount,
+ g_pickup_healthmega_max);
+ player.pauserothealth_finished = max(player.pauserothealth_finished, time +
+ autocvar_g_balance_pause_health_rot);
+}
+
+void GivePlayerArmor(entity player, float amount)
+{
+ if (amount == 0)
+ {
+ return;
+ }
+ player.armorvalue = bound(player.armorvalue, player.armorvalue + amount,
+ g_pickup_armormega_max);
+ player.pauserotarmor_finished = max(player.pauserotarmor_finished, time +
+ autocvar_g_balance_pause_armor_rot);
+}
+
+void GivePlayerAmmo(entity player, .float ammotype, float amount)
+{
+ float maxvalue = 999;
+ switch (ammotype)
+ {
+ case ammo_shells:
+ {
+ maxvalue = g_pickup_shells_max;
+ break;
+ }
+ case ammo_cells:
+ {
+ maxvalue = g_pickup_cells_max;
+ break;
+ }
+ case ammo_rockets:
+ {
+ maxvalue = g_pickup_rockets_max;
+ break;
+ }
+ case ammo_plasma:
+ {
+ maxvalue = g_pickup_plasma_max;
+ break;
+ }
+ case ammo_nails:
+ {
+ maxvalue = g_pickup_nails_max;
+ break;
+ }
+ case ammo_fuel:
+ {
+ maxvalue = g_pickup_fuel_max;
+ break;
+ }
+ }
+ player.(ammotype) = min(player.(ammotype) + amount, maxvalue);
+}
+
float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode)
{
if (!item.(ammotype))
_sound (toucher, (this.itemdef.instanceOfPowerup ? CH_TRIGGER_SINGLE : CH_TRIGGER), (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
if (this.classname == "droppedweapon")
- delete (this);
+ delete(this);
else if (this.spawnshieldtime)
{
entity e;
if(!have_pickup_item(this))
{
startitem_failed = true;
- delete (this);
+ delete(this);
return;
}
// target_give not yet supported; maybe later
print("removed targeted ", this.classname, "\n");
startitem_failed = true;
- remove (this);
+ delete(this);
return;
}
*/
spawnfunc(item_bullets)
{
- if(!weaponswapping && autocvar_sv_q3acompat_machineshotgunswap &&
+ if(!weaponswapping && autocvar_sv_q3acompat_machineshotgunswap &&
(this.classname != "droppedweapon"))
{
weaponswapping = true;