Allow multiple actions per frame
- You can now call several actions from one frame by grouping them between
curly braces. i.e. :
POSS G 3 { A_Pain; A_Log("Ow! That hurt!"); }
I will probably add an `if (something) { blah; blah; } else { wah; wah; }`
construct later, but that's the extent of the munging I plan for DECORATE. The
real work goes to the scripting language, not here. But if this branch is
getting merged to master sooner than later, here's an immediate benefit
from it right now.
This commit is contained in:
parent
9044ac9503
commit
7d0faa5bd5
5 changed files with 198 additions and 47 deletions
|
|
@ -289,17 +289,15 @@ static void FinishThingdef()
|
|||
FStateTempCall *tcall = StateTempCalls[i];
|
||||
VMFunction *func;
|
||||
|
||||
assert(tcall->Call != NULL);
|
||||
if (tcall->Call->GetArgCount() == 0)
|
||||
{
|
||||
// There are no arguments, so we can call this function directly
|
||||
// without wrapping it in an anonymous function.
|
||||
func = tcall->Call->GetVMFunction();
|
||||
}
|
||||
else
|
||||
assert(tcall->Code != NULL);
|
||||
|
||||
// Can we call this function directly without wrapping it in an
|
||||
// anonymous function? e.g. Are we passing any parameters to it?
|
||||
func = tcall->Code->GetDirectFunction();
|
||||
if (func == NULL)
|
||||
{
|
||||
FCompileContext ctx(tcall->ActorClass);
|
||||
tcall->Call->Resolve(ctx);
|
||||
tcall->Code->Resolve(ctx);
|
||||
VMFunctionBuilder buildit;
|
||||
|
||||
// Allocate registers used to pass parameters in.
|
||||
|
|
@ -307,7 +305,7 @@ static void FinishThingdef()
|
|||
buildit.Registers[REGT_POINTER].Get(3);
|
||||
|
||||
// Emit a tail call via FxVMFunctionCall
|
||||
tcall->Call->Emit(&buildit, true);
|
||||
tcall->Code->Emit(&buildit, true);
|
||||
|
||||
VMScriptFunction *sfunc = buildit.MakeFunction();
|
||||
sfunc->NumArgs = NAP;
|
||||
|
|
@ -322,8 +320,8 @@ static void FinishThingdef()
|
|||
codesize += sfunc->CodeSize;
|
||||
}
|
||||
}
|
||||
delete tcall->Call;
|
||||
tcall->Call = NULL;
|
||||
delete tcall->Code;
|
||||
tcall->Code = NULL;
|
||||
for (int k = 0; k < tcall->NumStates; ++k)
|
||||
{
|
||||
tcall->ActorClass->OwnedStates[tcall->FirstState + k].SetAction(func);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue