- more exporting of AInventory.

This commit is contained in:
Christoph Oelckers 2017-01-19 20:56:31 +01:00
parent 7c6542e595
commit 1750ded7c4
14 changed files with 291 additions and 397 deletions

View file

@ -1038,12 +1038,14 @@ DEFINE_ACTION_FUNCTION(AActor, UseInventory)
AInventory *AActor::DropInventory (AInventory *item)
{
AInventory *drop = item->CreateTossable ();
if (drop == NULL)
AInventory *drop = nullptr;
IFVIRTUALPTR(item, AInventory, CreateTossable)
{
return NULL;
VMValue params[1] = { (DObject*)this };
VMReturn ret((void**)&drop);
GlobalVMStack.Call(func, params, 1, &ret, 1, nullptr);
}
if (drop == nullptr) return NULL;
drop->SetOrigin(PosPlusZ(10.), false);
drop->Angles.Yaw = Angles.Yaw;
drop->VelFromAngle(5.);
@ -3945,7 +3947,11 @@ void AActor::Tick ()
// by the order in the inventory, not the order in the thinker table
while (item != NULL && item->Owner == this)
{
item->DoEffect();
IFVIRTUALPTR(item, AInventory, DoEffect)
{
VMValue params[1] = { item };
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
}
item = item->Inventory;
}
@ -7592,10 +7598,13 @@ int AActor::GetModifiedDamage(FName damagetype, int damage, bool passive)
auto inv = Inventory;
while (inv != nullptr)
{
inv->ModifyDamage(damage, damagetype, damage, passive);
IFVIRTUALPTR(inv, AInventory, ModifyDamage)
{
VMValue params[5] = { (DObject*)inv, damage, int(damagetype), &damage, passive };
GlobalVMStack.Call(func, params, 5, nullptr, 0, nullptr);
}
inv = inv->Inventory;
}
return damage;
}