- State code now properly calls action functions and has a RET instruction. As expected,

running with the checked VM can be quite slow, since it has asserts everywhere. Some other
  fixes were needed before the code actually worked:
  - A_CallSpecial needs to have its arguments cast to ints.
  - Some functions that set pnum/paramnum directly did not decrement it by 1. This also applies
    to A_Jump, though it just uses the value of paramnum instead of changing it.
  - Renamed pnum in the PARAM macros to paramnum, since pnum is already used in a few other
    places for something different, so this makes searching for it easier.
  This has not been tested especially thoroughly, but a first glance seems to indicate success.

SVN r2163 (scripting)
This commit is contained in:
Randy Heit 2010-02-14 19:59:21 +00:00
commit 6f1bf257e9
9 changed files with 130 additions and 108 deletions

View file

@ -81,7 +81,7 @@ bool DoActionSpecials(FScanner &sc, FState & state, Baggage &bag, FStateTempCall
{
for (i = 0; i < 5;)
{
tcall->Parameters.Push(new FxParameter(ParseExpression(sc, bag.Info->Class)));
tcall->Parameters.Push(new FxParameter(new FxIntCast(ParseExpression(sc, bag.Info->Class))));
i++;
if (!sc.CheckToken (',')) break;
}
@ -98,8 +98,7 @@ bool DoActionSpecials(FScanner &sc, FState & state, Baggage &bag, FStateTempCall
sc.ScriptError ("Too many arguments to %s", specname.GetChars());
}
//FIXME
//state.SetAction(FindGlobalActionFunction("A_CallSpecial"), false);
tcall->Function = FindGlobalActionFunction("A_CallSpecial")->Function;
return true;
}
return false;
@ -262,6 +261,7 @@ do_stop:
if (sym != NULL && sym->SymbolType == SYM_ActionFunction)
{
PSymbolActionFunction *afd = static_cast<PSymbolActionFunction *>(sym);
tcall->Function = afd->Function;
if (!afd->Arguments.IsEmpty())
{
const char *params = afd->Arguments.GetChars();
@ -374,7 +374,7 @@ endofstate:
sc.ScriptError ("Invalid frame character string '%s'", statestring.GetChars());
count = -count;
}
if (tcall->Parameters.Size() != 0)
if (tcall->Function != NULL)
{
tcall->ActorInfo = actor;
tcall->FirstState = bag.statedef.GetStateCount() - count;