mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- Make deferred scripts work with named scripts.
- Added ACS_Named* function variants of the ACS_* specials that take script names instead of numbers. As these are functions and not specials, they can only be used from inside ACS. SVN r3363 (trunk)
This commit is contained in:
parent
6f17e0f51b
commit
4195993023
3 changed files with 47 additions and 5 deletions
|
@ -3,7 +3,7 @@
|
|||
** General BEHAVIOR management and ACS execution environment
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 1998-2008 Randy Heit
|
||||
** Copyright 1998-2012 Randy Heit
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
|
@ -3198,6 +3198,13 @@ enum EACSFunctions
|
|||
ACSF_SpawnForced,
|
||||
ACSF_AnnouncerSound, // Skulltag
|
||||
ACSF_SetPointer,
|
||||
ACSF_ACS_NamedExecute,
|
||||
ACSF_ACS_NamedSuspend,
|
||||
ACSF_ACS_NamedTerminate,
|
||||
ACSF_ACS_NamedLockedExecute,
|
||||
ACSF_ACS_NamedLockedExecuteDoor,
|
||||
ACSF_ACS_NamedExecuteWithResult,
|
||||
ACSF_ACS_NamedExecuteAlways,
|
||||
};
|
||||
|
||||
int DLevelScript::SideFromID(int id, int side)
|
||||
|
@ -3691,6 +3698,25 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
|
|||
case ACSF_SpawnForced:
|
||||
return DoSpawn(args[0], args[1], args[2], args[3], args[4], args[5], true);
|
||||
|
||||
case ACSF_ACS_NamedExecute:
|
||||
case ACSF_ACS_NamedSuspend:
|
||||
case ACSF_ACS_NamedTerminate:
|
||||
case ACSF_ACS_NamedLockedExecute:
|
||||
case ACSF_ACS_NamedLockedExecuteDoor:
|
||||
case ACSF_ACS_NamedExecuteWithResult:
|
||||
case ACSF_ACS_NamedExecuteAlways:
|
||||
{
|
||||
int scriptnum = -FName(FBehavior::StaticLookupString(args[0]));
|
||||
int arg1 = argCount > 1 ? args[1] : 0;
|
||||
int arg2 = argCount > 2 ? args[2] : 0;
|
||||
int arg3 = argCount > 3 ? args[3] : 0;
|
||||
int arg4 = argCount > 4 ? args[4] : 0;
|
||||
return P_ExecuteSpecial(NamedACSToNormalACS[funcIndex - ACSF_ACS_NamedExecute],
|
||||
activationline, activator, backSide,
|
||||
scriptnum, arg1, arg2, arg3, arg4);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -7283,8 +7309,9 @@ FArchive &operator<< (FArchive &arc, acsdefered_t *&defertop)
|
|||
BYTE type;
|
||||
arc << more;
|
||||
type = (BYTE)defer->type;
|
||||
arc << type << defer->script << defer->playernum
|
||||
<< defer->arg0 << defer->arg1 << defer->arg2;
|
||||
arc << type;
|
||||
SerializeScriptNumber(arc, defer->script, false);
|
||||
arc << defer->playernum << defer->arg0 << defer->arg1 << defer->arg2;
|
||||
defer = defer->next;
|
||||
}
|
||||
more = 0;
|
||||
|
@ -7300,8 +7327,8 @@ FArchive &operator<< (FArchive &arc, acsdefered_t *&defertop)
|
|||
*defer = new acsdefered_t;
|
||||
arc << more;
|
||||
(*defer)->type = (acsdefered_t::EType)more;
|
||||
arc << (*defer)->script << (*defer)->playernum
|
||||
<< (*defer)->arg0 << (*defer)->arg1 << (*defer)->arg2;
|
||||
SerializeScriptNumber(arc, (*defer)->script, false);
|
||||
arc << (*defer)->playernum << (*defer)->arg0 << (*defer)->arg1 << (*defer)->arg2;
|
||||
defer = &((*defer)->next);
|
||||
arc << more;
|
||||
}
|
||||
|
|
|
@ -69,6 +69,19 @@
|
|||
|
||||
static FRandom pr_glass ("GlassBreak");
|
||||
|
||||
// There are aliases for the ACS specials that take names instead of numbers.
|
||||
// This table maps them onto the real number-based specials.
|
||||
BYTE NamedACSToNormalACS[7] =
|
||||
{
|
||||
ACS_Execute,
|
||||
ACS_Suspend,
|
||||
ACS_Terminate,
|
||||
ACS_LockedExecute,
|
||||
ACS_LockedExecuteDoor,
|
||||
ACS_ExecuteWithResult,
|
||||
ACS_ExecuteAlways,
|
||||
};
|
||||
|
||||
FName MODtoDamageType (int mod)
|
||||
{
|
||||
switch (mod)
|
||||
|
|
|
@ -197,6 +197,8 @@ typedef int (*lnSpecFunc)(struct line_t *line,
|
|||
|
||||
extern lnSpecFunc LineSpecials[256];
|
||||
|
||||
extern BYTE NamedACSToNormalACS[7];
|
||||
|
||||
int P_FindLineSpecial (const char *string, int *min_args=NULL, int *max_args=NULL);
|
||||
bool P_ActivateThingSpecial(AActor * thing, AActor * trigger, bool death=false);
|
||||
int P_ExecuteSpecial(int num,
|
||||
|
|
Loading…
Reference in a new issue