- scriptified the Heresiarch.

This commit is contained in:
Christoph Oelckers 2016-11-29 17:17:10 +01:00
parent f5b3429274
commit f17f6c30c2
7 changed files with 461 additions and 596 deletions

View file

@ -842,6 +842,13 @@ DEFINE_ACTION_FUNCTION(DObject, GameType)
ACTION_RETURN_INT(gameinfo.gametype);
}
DEFINE_ACTION_FUNCTION(DObject, BAM)
{
PARAM_PROLOGUE;
PARAM_FLOAT(ang);
ACTION_RETURN_INT(DAngle(ang).BAMs());
}
DEFINE_ACTION_FUNCTION(FStringTable, Localize)
{
PARAM_PROLOGUE;
@ -856,4 +863,5 @@ DEFINE_ACTION_FUNCTION(FString, Replace)
PARAM_STRING(s2);
self->Substitute(*s1, *s2);
return 0;
}
}

View file

@ -2285,6 +2285,25 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
sym->AddVariant(NewPrototype(rets, args), argflags, argnames, afd == nullptr ? nullptr : *(afd->VMPointer), varflags, useflags);
c->Type()->Symbols.ReplaceSymbol(sym);
auto cls = dyn_cast<PClass>(c->Type());
PFunction *virtsym = nullptr;
if (cls != nullptr && cls->ParentClass != nullptr) virtsym = dyn_cast<PFunction>(cls->ParentClass->Symbols.FindSymbol(FName(f->Name), true));
unsigned vindex = ~0u;
if (virtsym != nullptr) vindex = virtsym->Variants[0].Implementation->VirtualIndex;
if (vindex != ~0u || (varflags & VARF_Virtual))
{
// Todo: Check if the declaration is legal.
// First step: compare prototypes - if they do not match the virtual base method does not apply.
// Second step: Check flags. Possible cases:
// 1. Base method is final: Error.
// 2. This method is override: Base virtual method must exist
// 3. This method is virtual but not override: Base may not have a virtual method with the same prototype.
}
if (!(f->Flags & ZCC_Native))
{
if (f->Body == nullptr)