float W_AmmoItemCode(float wpn)
{
- return (get_weaponinfo(wpn)).items;
+ float f = (get_weaponinfo(wpn)).items;
+ f &~= IT_SUPERWEAPON;
+ return f;
}
void thrown_wep_think()
wep.colormap = own.colormap;
wa = W_AmmoItemCode(wpn);
- if(wa == IT_SUPERWEAPON || wa == 0)
+ if(wa == 0)
{
oldself = self;
self = wep;
self = oldself;
if(startitem_failed)
return string_null;
- if(doreduce)
+ if(doreduce && g_weapon_stay == 2)
+ {
+ for(i = 0, j = 1; i < 24; ++i, j *= 2)
+ {
+ if(wa & j)
+ {
+ ammofield = Item_CounterField(j);
+ wep.ammofield = 0;
+
+ // if our weapon is loaded, give its load back to the player
+ if(self.(weapon_load[self.weapon]) > 0)
+ {
+ own.ammofield += self.(weapon_load[self.weapon]);
+ self.(weapon_load[self.weapon]) = -1; // schedule the weapon for reloading
+ }
+ }
+ }
+ }
+ else if(doreduce)
{
for(i = 0, j = 1; i < 24; ++i, j *= 2)
{
wep.glowmod = own.weaponentity_glowmod;
wep.think = thrown_wep_think;
wep.nextthink = time + 0.5;
+ wep.pickup_anyway = TRUE; // these are ALWAYS pickable
return s;
}
}
wb = W_WeaponBit(w);
if(!wb)
return 0;
+ if(wb & WEPBIT_SUPERWEAPONS) // can't throw a superweapon, they don't work
+ return 0;
wa = W_AmmoItemCode(w);
if(start_weapons & wb)
{
- if(wa == IT_SUPERWEAPON && start_items & IT_UNLIMITED_SUPERWEAPONS)
- return 0;
- if(wa != IT_SUPERWEAPON && start_items & IT_UNLIMITED_WEAPON_AMMO)
- return 0;
// start weapons that take no ammo can't be dropped (this prevents dropping the laser, as long as it continues to use no ammo)
+ if(start_items & IT_UNLIMITED_WEAPON_AMMO)
+ return 0;
if(wa == 0)
return 0;
}
return;
if(!autocvar_g_weapon_throwable)
return;
- if(autocvar_g_weapon_stay == 1)
- return;
if(self.weaponentity.state != WS_READY)
return;
if(!W_IsWeaponThrowable(w))