diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 5c0a5aa6e..02543313d 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -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; } diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index dd66fdb0f..746db932d 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -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) diff --git a/src/p_lnspec.h b/src/p_lnspec.h index 1b842d29f..1d6a21bd9 100644 --- a/src/p_lnspec.h +++ b/src/p_lnspec.h @@ -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,