mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- reviewed all places where VARF_Action and NAP were used and fixed what was still wrong.
This commit is contained in:
parent
371712c53a
commit
37914223f0
5 changed files with 20 additions and 17 deletions
|
@ -808,22 +808,23 @@ void SetDehParams(FState *state, int codepointer)
|
|||
else
|
||||
{
|
||||
VMFunctionBuilder buildit(true);
|
||||
int numargs = sym->GetImplicitArgs();
|
||||
// Allocate registers used to pass parameters in.
|
||||
// self, stateowner, state (all are pointers)
|
||||
buildit.Registers[REGT_POINTER].Get(NAP);
|
||||
buildit.Registers[REGT_POINTER].Get(numargs);
|
||||
// Emit code to pass the standard action function parameters.
|
||||
for (int i = 0; i < NAP; i++)
|
||||
for (int i = 0; i < numargs; i++)
|
||||
{
|
||||
buildit.Emit(OP_PARAM, 0, REGT_POINTER, i);
|
||||
}
|
||||
// Emit code for action parameters.
|
||||
int argcount = MBFCodePointerFactories[codepointer](buildit, value1, value2);
|
||||
buildit.Emit(OP_TAIL_K, buildit.GetConstantAddress(sym->Variants[0].Implementation, ATAG_OBJECT), NAP + argcount, 0);
|
||||
buildit.Emit(OP_TAIL_K, buildit.GetConstantAddress(sym->Variants[0].Implementation, ATAG_OBJECT), numargs + argcount, 0);
|
||||
// Attach it to the state.
|
||||
VMScriptFunction *sfunc = new VMScriptFunction;
|
||||
buildit.MakeFunction(sfunc);
|
||||
sfunc->NumArgs = NAP;
|
||||
sfunc->ImplicitArgs = NAP;
|
||||
sfunc->NumArgs = numargs;
|
||||
sfunc->ImplicitArgs = numargs;
|
||||
state->SetAction(sfunc);
|
||||
sfunc->PrintableName.Format("Dehacked.%s.%d.%d", MBFCodePointers[codepointer].name.GetChars(), value1, value2);
|
||||
}
|
||||
|
@ -2121,7 +2122,8 @@ static int PatchCodePtrs (int dummy)
|
|||
else
|
||||
{
|
||||
TArray<DWORD> &args = sym->Variants[0].ArgFlags;
|
||||
if ((sym->Variants[0].Flags & (VARF_Method | VARF_Action)) != (VARF_Method | VARF_Action) || (args.Size() > NAP && !(args[NAP] & VARF_Optional)))
|
||||
unsigned numargs = sym->GetImplicitArgs();
|
||||
if ((sym->Variants[0].Flags & VARF_Virtual || (args.Size() > numargs && !(args[numargs] & VARF_Optional))))
|
||||
{
|
||||
Printf("Frame %d: Incompatible code pointer '%s'\n", frame, Line2);
|
||||
sym = NULL;
|
||||
|
@ -2733,7 +2735,8 @@ static bool LoadDehSupp ()
|
|||
else
|
||||
{
|
||||
TArray<DWORD> &args = sym->Variants[0].ArgFlags;
|
||||
if ((sym->Variants[0].Flags & (VARF_Method|VARF_Action)) != (VARF_Method | VARF_Action) || (args.Size() > NAP && !(args[NAP] & VARF_Optional)))
|
||||
unsigned numargs = sym->GetImplicitArgs();
|
||||
if ((sym->Variants[0].Flags & VARF_Virtual || (args.Size() > numargs && !(args[numargs] & VARF_Optional))))
|
||||
{
|
||||
sc.ScriptMessage("Incompatible code pointer '%s'", sc.String);
|
||||
}
|
||||
|
|
|
@ -2773,7 +2773,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Chase)
|
|||
PARAM_STATE_OPT (missile) { missile = NULL; }
|
||||
PARAM_INT_OPT (flags) { flags = 0; }
|
||||
|
||||
if (numparam >= NAP + 1)
|
||||
if (numparam > 1)
|
||||
{
|
||||
if ((flags & CHF_RESURRECT) && P_CheckForResurrection(self, false))
|
||||
return 0;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include "actor.h"
|
||||
#include "a_pickups.h"
|
||||
#include "info.h"
|
||||
#include "sc_man.h"
|
||||
#include "tarray.h"
|
||||
|
@ -602,16 +602,16 @@ void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray<FxExpression
|
|||
int pnum = 0;
|
||||
bool zeroparm;
|
||||
|
||||
if (afd->Variants[0].Flags & VARF_Method)
|
||||
if (afd->Variants[0].Flags & VARF_Action)
|
||||
{
|
||||
numparams -= NAP;
|
||||
pnum += NAP;
|
||||
}
|
||||
else if (afd->Variants[0].Flags & VARF_Method)
|
||||
{
|
||||
numparams--;
|
||||
pnum++;
|
||||
}
|
||||
if (afd->Variants[0].Flags & VARF_Action)
|
||||
{
|
||||
numparams -= 2;
|
||||
pnum += 2;
|
||||
}
|
||||
assert(numparams >= 0);
|
||||
zeroparm = numparams == 0;
|
||||
if (numparams > 0 && !(paramflags[pnum] & VARF_Optional))
|
||||
|
|
|
@ -143,7 +143,7 @@ PFunction *CreateAnonymousFunction(PClass *containingclass, PType *returntype, i
|
|||
SetImplicitArgs(&args, &argflags, &argnames, containingclass, flags);
|
||||
|
||||
PFunction *sym = new PFunction(containingclass, NAME_None); // anonymous functions do not have names.
|
||||
sym->AddVariant(NewPrototype(rets, args), argflags, argnames, nullptr, VARF_Action|VARF_Method);
|
||||
sym->AddVariant(NewPrototype(rets, args), argflags, argnames, nullptr, flags);
|
||||
return sym;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include "actor.h"
|
||||
#include "a_pickups.h"
|
||||
#include "thingdef.h"
|
||||
#include "sc_man.h"
|
||||
#include "c_console.h"
|
||||
|
|
Loading…
Reference in a new issue