This fixes Fukuoka-Go-Round, which ends up passing the main EXE as a movie
to (re)open at runtime instead of a movie. Without this, clicking back to
the main menu crashes the disc.
Previously, the Lingo state would be frozen by persisting the frames on
the bottom of the callstack with a special flag. This required extra
logic to determine whether or not the callstack was intended to be empty
after execution finished, with some complex edge cases.
The new approach is to swap out the LingoState object on the window,
meaning that an empty callstack always signifies execution has completed.
It remains to be seen if we'll need to track more than one frozen
context; for now it seems to be okay.
Fixes driving to locations in DEVO Presents: Adventures of the Smart Patrol.
The previous arrangement was to copy the bits of Lingo state back and forth from
the Window object to the Lingo instance, and query the window for the
callstack. This refactor consolidates the current Lingo state into a single
struct, owned by the Window object and accessible via a pointer on the
Lingo object.
The loading of the next movie and corresponding shared cast
is now handled in seperate functions.
There checks when to load a new shared cast and when to delete
the previous one could be simplified by returning early when the
previous and new shared casts are the same.
At the same time it fixes a Dereference after null check from Coverity.
sharedCast->getArchive() could return a null pointer and wasn't checked
in all places.
Fixes COVERITY: 1498090
processTransitionEvent skipped passing events to the window manager
and sent them directly to the current window, which is no good since the
event may need to go to another window. It also broke stopping
transitions on click.
Since there may be frames left on the call stack after Lingo::execute()
is called now, it isn't safe to share one call stack between several
movies executing in parallel.