diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 9a06f61eb..7fe6bbb1a 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4243,17 +4243,37 @@ int DLevelScript::RunScript () } break; + case PCD_PUSHFUNCTION: + { + int funcnum = NEXTBYTE; + PushToStack(funcnum | activeBehavior->GetLibraryID()); + break; + } case PCD_CALL: case PCD_CALLDISCARD: + case PCD_CALLSTACK: { int funcnum; int i; ScriptFunction *func; - FBehavior *module = activeBehavior; + FBehavior *module; SDWORD *mylocals; - funcnum = NEXTBYTE; + if(pcd == PCD_CALLSTACK) + { + funcnum = STACK(1); + module = FBehavior::StaticGetModule(funcnum>>16); + --sp; + + funcnum &= 0xFFFF; // Clear out tag + } + else + { + module = activeBehavior; + funcnum = NEXTBYTE; + } func = activeBehavior->GetFunction (funcnum, module); + if (func == NULL) { Printf ("Function %d in %s out of range\n", funcnum, ScriptPresentation(script).GetChars()); diff --git a/src/p_acs.h b/src/p_acs.h index 4ce82f6e0..da363958b 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -598,8 +598,10 @@ public: PCD_STRCPYTOMAPCHRANGE, // [FDARI] input range (copy string to all/part of array) PCD_STRCPYTOWORLDCHRANGE, PCD_STRCPYTOGLOBALCHRANGE, + PCD_PUSHFUNCTION, +/*360*/ PCD_CALLSTACK, -/*359*/ PCODE_COMMAND_COUNT +/*361*/ PCODE_COMMAND_COUNT }; // Some constants used by ACS scripts