more inventory scriptification

* completely scriptified DehackedPickup and FakeInventory.
* scriptified all remaining virtual functions of Inventory, so that its inheritance is now 100% script-side.
* scriptified CallTryPickup and most of the code called by that.

- fixed: Passing local variables by reference did not work in the VM.
This commit is contained in:
Christoph Oelckers 2017-01-19 23:42:12 +01:00
commit 3c30b59bab
19 changed files with 483 additions and 612 deletions

View file

@ -3261,13 +3261,22 @@ void ModifyDropAmount(AInventory *inv, int dropamount)
static_cast<AWeapon *>(inv)->AmmoGive2 = int(static_cast<AWeapon *>(inv)->AmmoGive2 * dropammofactor);
inv->ItemFlags |= flagmask;
}
else if (inv->IsKindOf (RUNTIME_CLASS(ADehackedPickup)))
else if (inv->IsKindOf (PClass::FindClass(NAME_DehackedPickup)))
{
// For weapons and ammo modified by Dehacked we need to flag the item.
static_cast<ADehackedPickup *>(inv)->droppedbymonster = true;
inv->BoolVar("droppedbymonster") = true;
}
}
// todo: make this a scripted virtual function so it can better deal with some of the classes involved.
DEFINE_ACTION_FUNCTION(AInventory, ModifyDropAmount)
{
PARAM_SELF_PROLOGUE(AInventory);
PARAM_INT(dropamount);
ModifyDropAmount(self, dropamount);
return 0;
}
//---------------------------------------------------------------------------
//
// PROC P_DropItem