- Added the item flag IF_RESTRICTABSOLUTELY. When this is set, players of the wrong class cannot

pickup an item at all. (For instance, normally players in Hexen can still pick up other players'
  weapons for ammo. With this flag set, they cannot do that either.)

SVN r3751 (trunk)
This commit is contained in:
Randy Heit 2012-07-08 02:45:46 +00:00
parent 0c8e4c37d9
commit 8a925757f5
4 changed files with 6 additions and 5 deletions

View File

@ -1333,9 +1333,10 @@ bool AInventory::CallTryPickup (AActor *toucher, AActor **toucher_return)
bool res;
if (CanPickup(toucher))
res = TryPickup(toucher);
else
else if (!(ItemFlags & IF_RESTRICTABSOLUTELY))
res = TryPickupRestricted(toucher); // let an item decide for itself how it will handle this
else
return false;
// Morph items can change the toucher so we need an option to return this info.
if (toucher_return != NULL) *toucher_return = toucher;

View File

@ -131,6 +131,7 @@ enum
IF_INITEFFECTFAILED = 1<<16, // CreateCopy tried to activate a powerup and activation failed (can happen with PowerMorph)
IF_NOATTENPICKUPSOUND = 1<<17, // Play pickup sound with ATTN_NONE
IF_PERSISTENTPOWER = 1<<18, // Powerup is kept when travelling between levels
IF_RESTRICTABSOLUTELY = 1<<19, // RestrictedTo and ForbiddenTo do not allow pickup in any form by other classes
};
@ -343,7 +344,6 @@ enum
WIF_MELEEWEAPON = 0x00008000, // melee weapon. Used by bots and monster AI.
WIF_DEHAMMO = 0x00010000, // Uses Doom's original amount of ammo for the respective attack functions so that old DEHACKED patches work as intended.
// AmmoUse1 will be set to the first attack's ammo use so that checking for empty weapons still works
WIF_CHEATNOTWEAPON = 0x08000000, // Give cheat considers this not a weapon (used by Sigil)
// Flags used only by bot AI:

View File

@ -33,8 +33,7 @@ bool AWeaponPiece::TryPickupRestricted (AActor *&toucher)
{
// Wrong class, but try to pick up for ammo
if (ShouldStay())
{
// Can't pick up weapons for other classes in coop netplay
{ // Can't pick up weapons for other classes in coop netplay
return false;
}

View File

@ -296,6 +296,7 @@ static FFlagDef InventoryFlags[] =
DEFINE_FLAG(IF, IGNORESKILL, AInventory, ItemFlags),
DEFINE_FLAG(IF, NOATTENPICKUPSOUND, AInventory, ItemFlags),
DEFINE_FLAG(IF, PERSISTENTPOWER, AInventory, ItemFlags),
DEFINE_FLAG(IF, RESTRICTABSOLUTELY, AInventory, ItemFlags),
DEFINE_DEPRECATED_FLAG(PICKUPFLASH),
DEFINE_DEPRECATED_FLAG(INTERHUBSTRIP),