Skip to content

Commit 95d236c

Browse files
committed
Merge branch 'MainMenuRewrite' of https://github.com/Rubberduckycooly/Sonic-1-2-2013-Decompilation into MainMenuRewrite
2 parents 0dc6f57 + d33f91e commit 95d236c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

RSDKv4/Script.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4864,9 +4864,14 @@ void ProcessScript(int scriptCodePtr, int jumpTablePtr, byte scriptEvent)
48644864
}
48654865
case FUNC_RETURN:
48664866
opcodeSize = 0;
4867-
scriptCodePtr = functionStack[--functionStackPos];
4868-
jumpTablePtr = functionStack[--functionStackPos];
4869-
scriptDataPtr = functionStack[--functionStackPos];
4867+
if (!functionStackPos) { //event, stop running
4868+
running = false;
4869+
}
4870+
else { //function, jump out
4871+
scriptCodePtr = functionStack[--functionStackPos];
4872+
jumpTablePtr = functionStack[--functionStackPos];
4873+
scriptDataPtr = functionStack[--functionStackPos];
4874+
}
48704875
break;
48714876
case FUNC_SETLAYERDEFORMATION:
48724877
opcodeSize = 0;

0 commit comments

Comments
 (0)