- the keybinding control works again, this time fully scripted.

This commit is contained in:
Christoph Oelckers 2017-02-12 18:38:23 +01:00
commit dbf3530696
19 changed files with 161 additions and 162 deletions

View file

@ -5069,7 +5069,6 @@ FxExpression *FxNew::Resolve(FCompileContext &ctx)
ExpEmit FxNew::Emit(VMFunctionBuilder *build)
{
assert(ValueType == val->ValueType);
ExpEmit from = val->Emit(build);
from.Free(build);
ExpEmit to(build, REGT_POINTER);
@ -10167,6 +10166,8 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
ScriptPosition.Message(MSG_OPTERROR,
"Unknown class name '%s' of type '%s'",
clsname.GetChars(), desttype->TypeName.GetChars());
delete this;
return nullptr;
}
else
{

View file

@ -882,6 +882,9 @@ void InitThingdef()
fieldptr = new PField("CleanHeight_1", TypeSInt32, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&CleanHeight_1);
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
fieldptr = new PField("menuactive", TypeSInt32, VARF_Native | VARF_Static, (intptr_t)&menuactive);
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
fieldptr = new PField("OptionMenuSettings", NewStruct("FOptionMenuSettings", nullptr), VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&OptionSettings);
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);

View file

@ -785,8 +785,11 @@ begin:
OP(NEW_K):
OP(NEW):
{
PClass *cls = (PClass*)(pc->op == OP_NEW ? reg.a[C] : konsta[C].v);
reg.a[B] = cls->CreateNew();
b = B;
PClass *cls = (PClass*)(pc->op == OP_NEW ? reg.a[b] : konsta[b].v);
if (cls->ObjectFlags & OF_Abstract) ThrowAbortException(X_OTHER, "Cannot instantiate abstract class %s", cls->TypeName.GetChars());
reg.a[a] = cls->CreateNew();
reg.atag[a] = ATAG_OBJECT;
NEXTOP;
}

View file

@ -597,6 +597,10 @@ void ZCCCompiler::CreateClassTypes()
c->cls->Type = nullptr;
}
}
if (c->cls->Flags & ZCC_Abstract)
{
c->Type()->ObjectFlags |= OF_Abstract;
}
if (c->Type() == nullptr) c->cls->Type = parent->FindClassTentative(c->NodeName());
c->Type()->bExported = true; // this class is accessible to script side type casts. (The reason for this flag is that types like PInt need to be skipped.)
c->cls->Symbol = new PSymbolType(c->NodeName(), c->Type());