MUTATOR_CALLHOOK(Item_RespawnCountdown, string_null, '0 0 0');
do {
{
- entity wi = get_weaponinfo(self.weapon);
+ entity wi = Weapons_from(self.weapon);
if (wi.m_id) {
entity wp = WaypointSprite_Spawn(WP_Weapon, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Weapon);
wp.wp_extra = wi.m_id;
// if the player is using their best weapon before items are given, they
// probably want to switch to an even better weapon after items are given
if (player.autoswitch)
- if (player.switchweapon == w_getbestweapon(player))
+ if (PS(player).m_switchweapon == w_getbestweapon(player))
_switchweapon = true;
- if (!(player.weapons & WepSet_FromWeapon(player.switchweapon)))
+ if (!(player.weapons & WepSet_FromWeapon(PS(player).m_switchweapon)))
_switchweapon = true;
pickedup |= Item_GiveAmmoTo(item, player, ammo_fuel, g_pickup_fuel_max, ITEM_MODE_FUEL);
{
pickedup = true;
for(i = WEP_FIRST; i <= WEP_LAST; ++i)
- if(it & WepSet_FromWeapon(i))
+ if(it & WepSet_FromWeapon(Weapons_from(i)))
{
W_DropEvent(wr_pickup, player, i, item);
W_GiveWeapon(player, i);
// crude hack to enforce switching weapons
if(g_cts && item.itemdef.instanceOfWeaponPickup)
{
- W_SwitchWeapon_Force(player, item.weapon);
+ W_SwitchWeapon_Force(player, Weapons_from(item.weapon));
return 1;
}
if (_switchweapon)
- if (player.switchweapon != w_getbestweapon(player))
+ if (PS(player).m_switchweapon != w_getbestweapon(player))
W_SwitchWeapon_Force(player, w_getbestweapon(player));
return 1;
// Detect needed ammo
for(i = WEP_FIRST; i <= WEP_LAST ; ++i)
{
- wi = get_weaponinfo(i);
+ wi = Weapons_from(i);
if (!(player.weapons & (wi.m_wepset)))
continue;
}
if(weaponid)
- this.weapons = WepSet_FromWeapon(weaponid);
+ this.weapons = WepSet_FromWeapon(Weapons_from(weaponid));
this.flags = FL_ITEM | itemflags;
this.is_item = true;
}
- weaponsInMap |= WepSet_FromWeapon(weaponid);
+ weaponsInMap |= WepSet_FromWeapon(Weapons_from(weaponid));
precache_model(this.model);
precache_sound(this.item_pickupsound);
spawnfunc(item_rockets)
{
- if(!self.ammo_rockets)
- self.ammo_rockets = g_pickup_rockets;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_ammo_anyway;
+ if(!this.ammo_rockets)
+ this.ammo_rockets = g_pickup_rockets;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_ammo_anyway;
StartItem(this, ITEM_Rockets);
}
{
if(!weaponswapping)
if(autocvar_sv_q3acompat_machineshotgunswap)
- if(self.classname != "droppedweapon")
+ if(this.classname != "droppedweapon")
{
weaponswapping = true;
spawnfunc_item_shells(this);
return;
}
- if(!self.ammo_nails)
- self.ammo_nails = g_pickup_nails;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_ammo_anyway;
+ if(!this.ammo_nails)
+ this.ammo_nails = g_pickup_nails;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_ammo_anyway;
StartItem(this, ITEM_Bullets);
}
spawnfunc(item_cells)
{
- if(!self.ammo_cells)
- self.ammo_cells = g_pickup_cells;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_ammo_anyway;
+ if(!this.ammo_cells)
+ this.ammo_cells = g_pickup_cells;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_ammo_anyway;
StartItem(this, ITEM_Cells);
}
spawnfunc(item_plasma)
{
- if(!self.ammo_plasma)
- self.ammo_plasma = g_pickup_plasma;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_ammo_anyway;
+ if(!this.ammo_plasma)
+ this.ammo_plasma = g_pickup_plasma;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_ammo_anyway;
StartItem(this, ITEM_Plasma);
}
{
if(!weaponswapping)
if(autocvar_sv_q3acompat_machineshotgunswap)
- if(self.classname != "droppedweapon")
+ if(this.classname != "droppedweapon")
{
weaponswapping = true;
spawnfunc_item_bullets(this);
return;
}
- if(!self.ammo_shells)
- self.ammo_shells = g_pickup_shells;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_ammo_anyway;
+ if(!this.ammo_shells)
+ this.ammo_shells = g_pickup_shells;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_ammo_anyway;
StartItem(this, ITEM_Shells);
}
spawnfunc(item_armor_small)
{
- if(!self.armorvalue)
- self.armorvalue = g_pickup_armorsmall;
- if(!self.max_armorvalue)
- self.max_armorvalue = g_pickup_armorsmall_max;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_armorsmall_anyway;
+ if(!this.armorvalue)
+ this.armorvalue = g_pickup_armorsmall;
+ if(!this.max_armorvalue)
+ this.max_armorvalue = g_pickup_armorsmall_max;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_armorsmall_anyway;
StartItem(this, ITEM_ArmorSmall);
}
spawnfunc(item_armor_medium)
{
- if(!self.armorvalue)
- self.armorvalue = g_pickup_armormedium;
- if(!self.max_armorvalue)
- self.max_armorvalue = g_pickup_armormedium_max;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_armormedium_anyway;
+ if(!this.armorvalue)
+ this.armorvalue = g_pickup_armormedium;
+ if(!this.max_armorvalue)
+ this.max_armorvalue = g_pickup_armormedium_max;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_armormedium_anyway;
StartItem(this, ITEM_ArmorMedium);
}
spawnfunc(item_armor_big)
{
- if(!self.armorvalue)
- self.armorvalue = g_pickup_armorbig;
- if(!self.max_armorvalue)
- self.max_armorvalue = g_pickup_armorbig_max;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_armorbig_anyway;
+ if(!this.armorvalue)
+ this.armorvalue = g_pickup_armorbig;
+ if(!this.max_armorvalue)
+ this.max_armorvalue = g_pickup_armorbig_max;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_armorbig_anyway;
StartItem(this, ITEM_ArmorLarge);
}
spawnfunc(item_armor_large)
{
- if(!self.armorvalue)
- self.armorvalue = g_pickup_armorlarge;
- if(!self.max_armorvalue)
- self.max_armorvalue = g_pickup_armorlarge_max;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_armorlarge_anyway;
+ if(!this.armorvalue)
+ this.armorvalue = g_pickup_armorlarge;
+ if(!this.max_armorvalue)
+ this.max_armorvalue = g_pickup_armorlarge_max;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_armorlarge_anyway;
StartItem(this, ITEM_ArmorMega);
}
spawnfunc(item_health_small)
{
- if(!self.max_health)
- self.max_health = g_pickup_healthsmall_max;
- if(!self.health)
- self.health = g_pickup_healthsmall;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_healthsmall_anyway;
+ if(!this.max_health)
+ this.max_health = g_pickup_healthsmall_max;
+ if(!this.health)
+ this.health = g_pickup_healthsmall;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_healthsmall_anyway;
StartItem(this, ITEM_HealthSmall);
}
spawnfunc(item_health_medium)
{
- if(!self.max_health)
- self.max_health = g_pickup_healthmedium_max;
- if(!self.health)
- self.health = g_pickup_healthmedium;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_healthmedium_anyway;
+ if(!this.max_health)
+ this.max_health = g_pickup_healthmedium_max;
+ if(!this.health)
+ this.health = g_pickup_healthmedium;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_healthmedium_anyway;
StartItem(this, ITEM_HealthMedium);
}
spawnfunc(item_health_large)
{
- if(!self.max_health)
- self.max_health = g_pickup_healthlarge_max;
- if(!self.health)
- self.health = g_pickup_healthlarge;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_healthlarge_anyway;
+ if(!this.max_health)
+ this.max_health = g_pickup_healthlarge_max;
+ if(!this.health)
+ this.health = g_pickup_healthlarge;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_healthlarge_anyway;
StartItem(this, ITEM_HealthLarge);
}
spawnfunc(item_health_mega)
{
- if(!self.max_health)
- self.max_health = g_pickup_healthmega_max;
- if(!self.health)
- self.health = g_pickup_healthmega;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_healthmega_anyway;
+ if(!this.max_health)
+ this.max_health = g_pickup_healthmega_max;
+ if(!this.health)
+ this.health = g_pickup_healthmega;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_healthmega_anyway;
StartItem(this, ITEM_HealthMega);
}
spawnfunc(item_strength)
{
- if(!self.strength_finished)
- self.strength_finished = autocvar_g_balance_powerup_strength_time;
+ if(!this.strength_finished)
+ this.strength_finished = autocvar_g_balance_powerup_strength_time;
StartItem(this, ITEM_Strength);
}
spawnfunc(item_invincible)
{
- if(!self.invincible_finished)
- self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
+ if(!this.invincible_finished)
+ this.invincible_finished = autocvar_g_balance_powerup_invincible_time;
StartItem(this, ITEM_Shield);
}
// compatibility:
-spawnfunc(item_quad) { self.classname = "item_strength";spawnfunc_item_strength(this);}
+spawnfunc(item_quad) { this.classname = "item_strength";spawnfunc_item_strength(this);}
void target_items_use()
{SELFPARAM();
{
for(j = WEP_FIRST; j <= WEP_LAST; ++j)
{
- e = get_weaponinfo(j);
+ e = Weapons_from(j);
s = W_UndeprecateName(argv(i));
if(s == e.netname)
{
self.weapons |= (e.m_wepset);
if(self.spawnflags == 0 || self.spawnflags == 2) {
- Weapon w = get_weaponinfo(e.weapon);
+ Weapon w = Weapons_from(e.weapon);
w.wr_init(w);
}
break;
if(self.armorvalue != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.health), "armor");
for(j = WEP_FIRST; j <= WEP_LAST; ++j)
{
- e = get_weaponinfo(j);
+ e = Weapons_from(j);
if(e.weapon)
self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.weapons & (e.m_wepset)), e.netname);
}
{
for(j = WEP_FIRST; j <= WEP_LAST; ++j)
{
- e = get_weaponinfo(j);
+ e = Weapons_from(j);
if(argv(i) == e.netname)
{
- Weapon w = get_weaponinfo(e.weapon);
+ Weapon w = Weapons_from(e.weapon);
w.wr_init(w);
break;
}
spawnfunc(item_fuel)
{
- if(!self.ammo_fuel)
- self.ammo_fuel = g_pickup_fuel;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_ammo_anyway;
+ if(!this.ammo_fuel)
+ this.ammo_fuel = g_pickup_fuel;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_ammo_anyway;
StartItem(this, ITEM_JetpackFuel);
}
spawnfunc(item_jetpack)
{
- if(!self.ammo_fuel)
- self.ammo_fuel = g_pickup_fuel_jetpack;
+ if(!this.ammo_fuel)
+ this.ammo_fuel = g_pickup_fuel_jetpack;
if(start_items & ITEM_Jetpack.m_itemid)
{
spawnfunc_item_fuel(this);
float GiveWeapon(entity e, float wpn, float op, float val)
{
WepSet v0, v1;
- WepSet s = WepSet_FromWeapon(wpn);
+ WepSet s = WepSet_FromWeapon(Weapons_from(wpn));
v0 = (e.weapons & s);
switch(op)
{
_switchweapon = false;
if (e.autoswitch)
- if (e.switchweapon == w_getbestweapon(e))
+ if (PS(e).m_switchweapon == w_getbestweapon(e))
_switchweapon = true;
e.strength_finished = max(0, e.strength_finished - time);
case "allweapons":
for(j = WEP_FIRST; j <= WEP_LAST; ++j)
{
- wi = get_weaponinfo(j);
+ wi = Weapons_from(j);
if(wi.weapon)
if (!(wi.spawnflags & WEP_FLAG_MUTATORBLOCKED))
got += GiveWeapon(e, j, op, val);
default:
for(j = WEP_FIRST; j <= WEP_LAST; ++j)
{
- wi = get_weaponinfo(j);
+ wi = Weapons_from(j);
if(cmd == wi.netname)
{
got += GiveWeapon(e, j, op, val);
POSTGIVE_BIT(e, items, ITEM_Jetpack.m_itemid, SND(ITEMPICKUP), string_null);
for(j = WEP_FIRST; j <= WEP_LAST; ++j)
{
- wi = get_weaponinfo(j);
+ wi = Weapons_from(j);
if(wi.weapon)
{
- POSTGIVE_WEAPON(e, j, SND(WEAPONPICKUP), string_null);
+ POSTGIVE_WEAPON(e, Weapons_from(j), SND(WEAPONPICKUP), string_null);
if (!(save_weapons & (wi.m_wepset)))
if(e.weapons & (wi.m_wepset)) {
- Weapon w = get_weaponinfo(wi.weapon);
+ Weapon w = Weapons_from(wi.weapon);
w.wr_init(w);
}
}
else
e.superweapons_finished += time;
- if (!(e.weapons & WepSet_FromWeapon(e.switchweapon)))
+ if (!(e.weapons & WepSet_FromWeapon(PS(e).m_switchweapon)))
_switchweapon = true;
if(_switchweapon)
W_SwitchWeapon_Force(e, w_getbestweapon(e));