diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 905ed1a49..437a9cfe8 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1144,6 +1144,14 @@ FBehavior::FBehavior (int lumpnum, FileReader * fr, int len) Functions += 8; } + // Load JUMP points + chunk = (DWORD *)FindChunk (MAKE_ID('J','U','M','P')); + if (chunk != NULL) + { + for (i = 0;i < (int)LittleLong(chunk[1]);i += 4) + JumpPoints.Push(LittleLong(chunk[2 + i/4])); + } + // Initialize this object's map variables memset (MapVarStore, 0, sizeof(MapVarStore)); chunk = (DWORD *)FindChunk (MAKE_ID('M','I','N','I')); @@ -5188,6 +5196,11 @@ int DLevelScript::RunScript () pc = activeBehavior->Ofs2PC (LittleLong(*pc)); break; + case PCD_GOTOSTACK: + pc = activeBehavior->Jump2PC (STACK(1)); + sp--; + break; + case PCD_IFGOTO: if (STACK(1)) pc = activeBehavior->Ofs2PC (LittleLong(*pc)); diff --git a/src/p_acs.h b/src/p_acs.h index 44786e260..999dda7a5 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -165,6 +165,7 @@ public: void StartTypedScripts (WORD type, AActor *activator, bool always, int arg1, bool runNow); DWORD PC2Ofs (int *pc) const { return (DWORD)((BYTE *)pc - Data); } int *Ofs2PC (DWORD ofs) const { return (int *)(Data + ofs); } + int *Jump2PC (DWORD jumpPoint) const { return Ofs2PC(JumpPoints[jumpPoint]); } ACSFormat GetFormat() const { return Format; } ScriptFunction *GetFunction (int funcnum, FBehavior *&module) const; int GetArrayVal (int arraynum, int index) const; @@ -213,6 +214,7 @@ private: TArray Imports; DWORD LibraryID; char ModuleName[9]; + TArray JumpPoints; static TArray StaticModules; @@ -602,6 +604,7 @@ public: /*360*/ PCD_CALLSTACK, // from Eternity PCD_SCRIPTWAITNAMED, PCD_TRANSLATIONRANGE3, + PCD_GOTOSTACK, /*363*/ PCODE_COMMAND_COUNT };