- finished the state usage parser.

- added state usage specifiers to Actor and Inventory. The states in these classes must be set to full access so that any existing mod can link to them.
This commit is contained in:
Christoph Oelckers 2016-11-14 23:24:10 +01:00
parent c797319314
commit 4f998fa879
4 changed files with 36 additions and 2 deletions

View file

@ -736,3 +736,4 @@ xx(DamageFunction)
xx(Length)
xx(Unit)
xx(StateLabel)
xx(Overlay)

View file

@ -2387,6 +2387,39 @@ void ZCCCompiler::CompileStates()
for (auto s : c->States)
{
int flags;
if (s->Flags != nullptr)
{
flags = 0;
auto p = s->Flags;
do
{
switch (p->Id)
{
case NAME_Actor:
flags |= SUF_ACTOR;
break;
case NAME_Overlay:
flags |= SUF_OVERLAY;
break;
case NAME_Weapon:
flags |= SUF_WEAPON;
break;
case NAME_Item:
flags |= SUF_ITEM;
break;
default:
Error(p, "Unknown States qualifier %s", FName(p->Id).GetChars());
break;
}
p = static_cast<decltype(p)>(p->SiblingNext);
} while (p != s->Flags);
}
else
{
flags = static_cast<PClassActor *>(c->Type())->DefaultStateUsage;
}
auto st = s->Body;
if (st != nullptr) do
{

View file

@ -489,7 +489,7 @@ class Actor : Thinker native
return ACS_ExecuteAlways(-int(script), mapnum, arg1, arg2, arg3);
}
States
States(Actor, Overlay, Weapon, Item)
{
Spawn:
TNT1 A -1;

View file

@ -16,7 +16,7 @@ class Inventory : Actor native
private native void A_RestoreSpecialThing1();
private native void A_RestoreSpecialThing2();
States
States(Actor, Overlay, Weapon, Item)
{
HideDoomish:
TNT1 A 1050;