Merge commit 'ec58178695' into scripting

Conflicts:
	src/p_enemy.cpp
	src/p_enemy.h
	wadsrc/static/actors/constants.txt

(Scripting branch update part 1)
This commit is contained in:
Christoph Oelckers 2015-04-28 09:34:51 +02:00
commit 56989d3422
19 changed files with 170 additions and 58 deletions

View file

@ -1418,6 +1418,8 @@ bool AInventory::TryPickupRestricted (AActor *&toucher)
bool AInventory::CallTryPickup (AActor *toucher, AActor **toucher_return)
{
TObjPtr<AInventory> Invstack = Inventory; // A pointer of the inventories item stack.
// unmorphed versions of a currently morphed actor cannot pick up anything.
if (toucher->flags & MF_UNMORPHED) return false;
@ -1438,7 +1440,27 @@ bool AInventory::CallTryPickup (AActor *toucher, AActor **toucher_return)
GoAwayAndDie();
}
if (res) GiveQuest(toucher);
if (res)
{
GiveQuest(toucher);
// Transfer all inventory accross that the old object had, if requested.
if ((ItemFlags & IF_TRANSFER))
{
while (Invstack)
{
AInventory* titem = Invstack;
Invstack = titem->Inventory;
if (titem->Owner == this)
{
if (!titem->CallTryPickup(toucher)) // The object no longer can exist
{
titem->Destroy();
}
}
}
}
}
return res;
}