Add some functions for use with DECORATE return

- Since DECORATE's return statement can only return the results of
  function calls (I do not want to spend the time necessary to make it
  return arbitrary expressions), here are three functions to get around
  this limitation:
  * A_State - Returns the state passed to it. You can simulate A_Jump
    functions with this.
  * A_Int - Returns the int passed to it.
  * A_Bool - Returns the bool passed to it.
- e.g. If you want to return the number 3, you use this:

    return A_Int(3);

  If you want to jump to a different state, you use this:

    return A_State("SomeState");
This commit is contained in:
Randy Heit 2016-02-18 22:11:05 -06:00
commit eace79ccad
3 changed files with 53 additions and 0 deletions

View file

@ -6757,3 +6757,48 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMovementDirection)
}
ACTION_RETURN_BOOL(true);
}
//===========================================================================
//
// A_State
//
// Returns the state passed in.
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_State)
{
PARAM_ACTION_PROLOGUE;
PARAM_STATE(returnme);
ACTION_RETURN_STATE(returnme);
}
//===========================================================================
//
// A_Int
//
// Returns the int passed in.
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Int)
{
PARAM_ACTION_PROLOGUE;
PARAM_INT(returnme);
ACTION_RETURN_INT(returnme);
}
//===========================================================================
//
// A_Bool
//
// Returns the bool passed in.
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Bool)
{
PARAM_ACTION_PROLOGUE;
PARAM_BOOL(returnme);
ACTION_RETURN_BOOL(returnme);
}