Backported GZDoom commits to fix ACS-related crashes
These are several GZDoom commits that I backported to fix an issue from a Zandronum mod that caused Zandronum to crash. Basically, if an ACS script (let's pretend said script is defined in a library called "LIB1") executes a function that's defined in another library (let's also pretend this library is called "LIB2"), and that function causes a division/modulus of zero and forces the script to terminate, the game will crash.
The reason why this happens is because when a function from another library/module is executed, DLevelScript::activeBehavior
is temporarily changed to that of the function. There are several or more p-codes that can change the script's state to SCRIPT_DivideBy0
or SCRIPT_ModulusBy0
, but they won't revert activeBehavior
back to what it originally was.