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

@ -420,6 +420,10 @@ PPrototype *FxExpression::ReturnProto()
static int EncodeRegType(ExpEmit reg)
{
int regtype = reg.RegType;
if (reg.Fixed && reg.Target)
{
regtype |= REGT_ADDROF;
}
if (reg.Konst)
{
regtype |= REGT_KONST;
@ -10008,10 +10012,9 @@ FxExpression *FxReturnStatement::Resolve(FCompileContext &ctx)
{
for (unsigned i = 0; i < Args.Size(); i++)
{
auto &Value = Args[0];
Value = new FxTypeCast(Value, ctx.ReturnProto->ReturnTypes[i], false, false);
Value = Value->Resolve(ctx);
if (Value == nullptr) fail = true;
Args[i] = new FxTypeCast(Args[i], ctx.ReturnProto->ReturnTypes[i], false, false);
Args[i] = Args[i]->Resolve(ctx);
if (Args[i] == nullptr) fail = true;
}
if (fail)
{