- Added action functions that work with script names instead of script numbers. They are

named the same as their ACS function equivalents. e.g. From DECORATE, you can now use
  ACS_NamedExecuteAlways to run a script with a name.

SVN r3364 (trunk)
This commit is contained in:
Randy Heit 2012-02-16 21:49:09 +00:00
parent 4195993023
commit 7561beb212
3 changed files with 120 additions and 4 deletions

View file

@ -4099,3 +4099,112 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
}
}
//==========================================================================
//
// ACS_Named* stuff
//
// These are exactly like their un-named line special equivalents, except
// they take strings instead of integers to indicate which script to run.
// Some of these probably aren't very useful, but they are included for
// the sake of completeness.
//
//==========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteWithResult)
{
ACTION_PARAM_START(4);
ACTION_PARAM_NAME(scriptname, 0);
ACTION_PARAM_INT(arg1, 2);
ACTION_PARAM_INT(arg2, 3);
ACTION_PARAM_INT(arg3, 4);
bool res = !!P_ExecuteSpecial(ACS_ExecuteWithResult, NULL, self, false, -scriptname, arg1, arg2, arg3, 0);
ACTION_SET_RESULT(res);
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecute)
{
ACTION_PARAM_START(5);
ACTION_PARAM_NAME(scriptname, 0);
ACTION_PARAM_INT(mapnum, 1);
ACTION_PARAM_INT(arg1, 2);
ACTION_PARAM_INT(arg2, 3);
ACTION_PARAM_INT(arg3, 4);
bool res = !!P_ExecuteSpecial(ACS_Execute, NULL, self, false, -scriptname, mapnum, arg1, arg2, arg3);
ACTION_SET_RESULT(res);
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteAlways)
{
ACTION_PARAM_START(5);
ACTION_PARAM_NAME(scriptname, 0);
ACTION_PARAM_INT(mapnum, 1);
ACTION_PARAM_INT(arg1, 2);
ACTION_PARAM_INT(arg2, 3);
ACTION_PARAM_INT(arg3, 4);
bool res = !!P_ExecuteSpecial(ACS_ExecuteAlways, NULL, self, false, -scriptname, mapnum, arg1, arg2, arg3);
ACTION_SET_RESULT(res);
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecute)
{
ACTION_PARAM_START(5);
ACTION_PARAM_NAME(scriptname, 0);
ACTION_PARAM_INT(mapnum, 1);
ACTION_PARAM_INT(arg1, 2);
ACTION_PARAM_INT(arg2, 3);
ACTION_PARAM_INT(lock, 4);
bool res = !!P_ExecuteSpecial(ACS_LockedExecute, NULL, self, false, -scriptname, mapnum, arg1, arg2, lock);
ACTION_SET_RESULT(res);
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecuteDoor)
{
ACTION_PARAM_START(5);
ACTION_PARAM_NAME(scriptname, 0);
ACTION_PARAM_INT(mapnum, 1);
ACTION_PARAM_INT(arg1, 2);
ACTION_PARAM_INT(arg2, 3);
ACTION_PARAM_INT(lock, 4);
bool res = !!P_ExecuteSpecial(ACS_LockedExecuteDoor, NULL, self, false, -scriptname, mapnum, arg1, arg2, lock);
ACTION_SET_RESULT(res);
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedSuspend)
{
ACTION_PARAM_START(2);
ACTION_PARAM_NAME(scriptname, 0);
ACTION_PARAM_INT(mapnum, 1);
bool res = !!P_ExecuteSpecial(ACS_Suspend, NULL, self, false, -scriptname, mapnum, 0, 0, 0);
ACTION_SET_RESULT(res);
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedTerminate)
{
ACTION_PARAM_START(2);
ACTION_PARAM_NAME(scriptname, 0);
ACTION_PARAM_INT(mapnum, 1);
bool res = !!P_ExecuteSpecial(ACS_Terminate, NULL, self, false, -scriptname, mapnum, 0, 0, 0);
ACTION_SET_RESULT(res);
}

View file

@ -293,6 +293,14 @@ ACTOR Actor native //: Thinker
action native A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0);
action native A_CopyFriendliness(int ptr_source = AAPTR_MASTER);
action native ACS_NamedExecute(string script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0);
action native ACS_NamedSuspend(string script, int mapnum=0);
action native ACS_NamedTerminate(string script, int mapnum=0);
action native ACS_NamedLockedExecute(string script, int mapnum=0, int arg1=0, int arg2=0, int lock=0);
action native ACS_NamedLockedExecuteDoor(string script, int mapnum=0, int arg1=0, int arg2=0, int lock=0);
action native ACS_NamedExecuteWithResult(string script, int arg1=0, int arg2=0, int arg3=0);
action native ACS_NamedExecuteAlways(string script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0);
States
{
Spawn:

View file

@ -41,16 +41,16 @@ ACTOR DoomPlayer : PlayerPawn
PLAY A -1
Loop
See:
PLAY ABCD 4
PLAY ABCD 4
Loop
Missile:
PLAY E 12
PLAY E 12
Goto Spawn
Melee:
PLAY F 6 BRIGHT
Goto Missile
Pain:
PLAY G 4
PLAY G 4
PLAY G 4 A_Pain
Goto Spawn
Death:
@ -88,4 +88,3 @@ ACTOR DoomPlayer : PlayerPawn
Stop
}
}