mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-14 08:30:50 +00:00
- removed a parsing hack for the old internal definitions.
- fixed: The state cast hack for DECORATE could not properly create state constants. Instead they were passed to FxRuntimeStateIndex without resolving them to something constant. This adds proper handling of constant indices within that class.
This commit is contained in:
parent
779f9d7a72
commit
7da4e0d03d
2 changed files with 22 additions and 10 deletions
|
@ -8101,12 +8101,28 @@ FxExpression *FxRuntimeStateIndex::Resolve(FCompileContext &ctx)
|
||||||
delete this;
|
delete this;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if (Index->isConstant() && static_cast<FxConstant *>(Index)->GetValue().GetInt() <= 0)
|
else if (Index->isConstant())
|
||||||
|
{
|
||||||
|
int index = static_cast<FxConstant *>(Index)->GetValue().GetInt();
|
||||||
|
if (index < 0 || (index == 0 && !ctx.FromDecorate))
|
||||||
{
|
{
|
||||||
ScriptPosition.Message(MSG_ERROR, "State index must be positive");
|
ScriptPosition.Message(MSG_ERROR, "State index must be positive");
|
||||||
delete this;
|
delete this;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
else if (index == 0)
|
||||||
|
{
|
||||||
|
auto x = new FxConstant((FState*)nullptr, ScriptPosition);
|
||||||
|
delete this;
|
||||||
|
return x->Resolve(ctx);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto x = new FxStateByIndex(index, ScriptPosition);
|
||||||
|
delete this;
|
||||||
|
return x->Resolve(ctx);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (Index->ValueType->GetRegType() != REGT_INT)
|
else if (Index->ValueType->GetRegType() != REGT_INT)
|
||||||
{ // Float.
|
{ // Float.
|
||||||
Index = new FxIntCast(Index, ctx.FromDecorate);
|
Index = new FxIntCast(Index, ctx.FromDecorate);
|
||||||
|
|
|
@ -181,15 +181,11 @@ FxExpression *ParseParameter(FScanner &sc, PClassActor *cls, PType *type, bool c
|
||||||
{
|
{
|
||||||
if (sc.String[0] == 0 || sc.Compare("None"))
|
if (sc.String[0] == 0 || sc.Compare("None"))
|
||||||
{
|
{
|
||||||
x = new FxConstant((FState*)NULL, sc);
|
x = new FxConstant((FState*)nullptr, sc);
|
||||||
}
|
}
|
||||||
else if (sc.Compare("*"))
|
else if (sc.Compare("*"))
|
||||||
{
|
{
|
||||||
if (constant)
|
sc.ScriptError("Invalid state name '*'");
|
||||||
{
|
|
||||||
x = new FxConstant((FState*)(intptr_t)-1, sc);
|
|
||||||
}
|
|
||||||
else sc.ScriptError("Invalid state name '*'");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue