- converted all of Doom's actors.

- fixed a few problems that were encountered during conversion:
 * action specials as action functions were not recognized by the parser.
 * Player.StartItem could not be parsed.
 * disabled the naming hack for PowerupType. ZScript, unlike DECORATE will never prepend 'Power' to the power's name, it always needs to specified by its full name.
 * states and defaults were not checked for empty bodies.
 * the scope qualifier for goto labels was not properly converted to a string, because it is an ENamedName, not an FName.
This commit is contained in:
Christoph Oelckers 2016-10-14 20:08:41 +02:00
parent 9e2830a3db
commit 784f7ed671
58 changed files with 4377 additions and 3903 deletions

View file

@ -2431,7 +2431,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, type, S, PowerupGiver)
// Yuck! What was I thinking when I decided to prepend "Power" to the name?
// Now it's too late to change it...
PClassActor *cls = PClass::FindActor(str);
if (cls == NULL || !cls->IsDescendantOf(RUNTIME_CLASS(APowerup)))
if (cls == NULL || !cls->IsDescendantOf(RUNTIME_CLASS(APowerup)) && !bag.fromZScript)
{
FString st;
st.Format("%s%s", strnicmp(str, "power", 5)? "Power" : "", str);

View file

@ -458,6 +458,18 @@ state_flow_type(X) ::= GOTO(T) IDENTIFIER(C) SCOPE dottable_id(A) state_goto_off
X = flow;
}
state_flow_type(X) ::= GOTO(T) SUPER(C) SCOPE dottable_id(A) state_goto_offset(B).
{
NEW_AST_NODE(StateGoto, flow, T);
flow->Label = A;
flow->Offset = B;
NEW_AST_NODE(Identifier,id,C);
id->Id = NAME_Super;
flow->Qualifier =id;
X = flow;
}
state_goto_offset(X) ::= . { X = NULL; }
state_goto_offset(X) ::= ADD expr(A). { X = A; /*X-overwrites-A*/ } /* Must evaluate to a non-negative integer constant. */

View file

@ -1657,7 +1657,7 @@ void ZCCCompiler::DispatchProperty(FPropertyInfo *prop, ZCC_PropertyStmt *proper
// Skip the DECORATE 'no comma' marker
if (*p == '_') p++;
else if (*p == 0)
if (*p == 0)
{
if (exp != property->Values)
{
@ -1834,7 +1834,7 @@ void ZCCCompiler::InitDefaults()
for (auto d : c->Defaults)
{
auto content = d->Content;
do
if (content != nullptr) do
{
switch (content->NodeType)
{
@ -1870,7 +1870,7 @@ void ZCCCompiler::InitFunctions()
{
TArray<PType *> rets(1);
TArray<PType *> args;
TArray<DWORD> argflags;
TArray<uint32_t> argflags;
TArray<ENamedName> argnames;
for (auto c : Classes)
@ -2032,8 +2032,13 @@ FxExpression *ZCCCompiler::SetupActionFunction(PClassActor *cls, ZCC_TreeNode *a
}
else
{
Error(af, "%s: action function not found in %s", FName(id->Identifier).GetChars(), cls->TypeName.GetChars());
return nullptr;
// it may also be an action special so check that first before printing an error.
if (!P_FindLineSpecial(FName(id->Identifier).GetChars()))
{
Error(af, "%s: action function not found in %s", FName(id->Identifier).GetChars(), cls->TypeName.GetChars());
return nullptr;
}
// Action specials fall through to the code generator.
}
}
return ConvertAST(af);
@ -2074,7 +2079,7 @@ void ZCCCompiler::CompileStates()
for (auto s : c->States)
{
auto st = s->Body;
do
if (st != nullptr) do
{
switch (st->NodeType)
{
@ -2187,7 +2192,7 @@ void ZCCCompiler::CompileStates()
statename = "";
if (sg->Qualifier != nullptr)
{
statename << sg->Qualifier->Id << "::";
statename << FName(sg->Qualifier->Id) << "::";
}
auto part = sg->Label;
do