Remove "action" from Actor functions that don't actually need it

- An actor function really only needs to be an action function if:
  1. It can be called with no parameters specified, either because it takes
     none or because all its parameters are optional. This lets SetState()
     call it directly without creating a wrapper function for it.
  2. It wants access to the callingstate or stateowner parameters. Most
     functions don't care about them, so passing them is superfluous.
This commit is contained in:
Randy Heit 2016-04-19 20:21:00 -05:00
commit 39df62b20e
8 changed files with 245 additions and 255 deletions

View file

@ -26,7 +26,7 @@ static FRandom pr_fswordflame ("FSwordFlame");
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropWeaponPieces)
{
PARAM_ACTION_PROLOGUE;
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS(p1, AActor);
PARAM_CLASS(p2, AActor);
PARAM_CLASS(p3, AActor);

View file

@ -28,7 +28,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Bang4Cloud)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveQuestItem)
{
PARAM_ACTION_PROLOGUE;
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT(questitem);
// Give one of these quest items to every player in the game

View file

@ -345,4 +345,8 @@ void AddStateLight(FState *state, const char *lname);
// Number of action paramaters
#define NAP 3
#define PARAM_SELF_PROLOGUE(type) \
PARAM_PROLOGUE; \
PARAM_OBJECT(self, type);
#endif // __INFO_H__

View file

@ -2773,7 +2773,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_VileChase)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ExtChase)
{
PARAM_ACTION_PROLOGUE;
PARAM_SELF_PROLOGUE(AActor);
PARAM_BOOL (domelee);
PARAM_BOOL (domissile);
PARAM_BOOL_OPT (playactive) { playactive = true; }

File diff suppressed because it is too large Load diff

View file

@ -881,6 +881,7 @@ public:
ExpEmit Emit(VMFunctionBuilder *build, bool tailcall);
bool CheckEmitCast(VMFunctionBuilder *build, bool returnit, ExpEmit &reg);
unsigned GetArgCount() const { return ArgList == NULL ? 0 : ArgList->Size(); }
PFunction *GetFunction() const { return Function; }
VMFunction *GetVMFunction() const { return Function->Variants[0].Implementation; }
bool IsDirectFunction();
};

View file

@ -3844,7 +3844,7 @@ VMFunction *FxReturnStatement::GetDirectFunction()
// then it can be a "direct" function. That is, the DECORATE
// definition can call that function directly without wrapping
// it inside VM code.
if (Call != NULL && Call->GetArgCount() == 0)
if (Call != NULL && Call->GetArgCount() == 0 && (Call->GetFunction()->Flags & VARF_Action))
{
return Call->GetVMFunction();
}