- added a new dmflag for allowing switching to weapons without ammo.

SVN r2346 (trunk)
This commit is contained in:
Christoph Oelckers 2010-05-30 07:47:08 +00:00
commit bdd2ebfe14
6 changed files with 17 additions and 7 deletions

View file

@ -753,7 +753,7 @@ int FWeaponSlot::LocateWeapon(const PClass *type)
//
//===========================================================================
AWeapon *FWeaponSlot::PickWeapon(player_t *player)
AWeapon *FWeaponSlot::PickWeapon(player_t *player, bool checkammo)
{
int i, j;
@ -777,9 +777,12 @@ AWeapon *FWeaponSlot::PickWeapon(player_t *player)
{
AWeapon *weap = static_cast<AWeapon *> (player->mo->FindInventory(Weapons[j].Type));
if (weap != NULL && weap->IsKindOf(RUNTIME_CLASS(AWeapon)) && weap->CheckAmmo(AWeapon::EitherFire, false))
if (weap != NULL && weap->IsKindOf(RUNTIME_CLASS(AWeapon)))
{
return weap;
if (!checkammo || weap->CheckAmmo(AWeapon::EitherFire, false))
{
return weap;
}
}
}
}
@ -789,9 +792,12 @@ AWeapon *FWeaponSlot::PickWeapon(player_t *player)
{
AWeapon *weap = static_cast<AWeapon *> (player->mo->FindInventory(Weapons[i].Type));
if (weap != NULL && weap->IsKindOf(RUNTIME_CLASS(AWeapon)) && weap->CheckAmmo(AWeapon::EitherFire, false))
if (weap != NULL && weap->IsKindOf(RUNTIME_CLASS(AWeapon)))
{
return weap;
if (!checkammo || weap->CheckAmmo(AWeapon::EitherFire, false))
{
return weap;
}
}
}
return player->ReadyWeapon;