[Scummvm-devel] Global menu save/load dialogs
lordhoto at gmail.com
Tue Nov 11 13:48:15 CET 2008
On Tuesday 11 November 2008 11:17:00 Max Horn wrote:
> Could you please elaborate? What needs interrupting? The animation
> code is not run while the GUI is up. Do you mean you need to pause
A 'simple' example from HoF:
When processing a mouse click in KyraEngine_HoF::handleInput, it could very
vell be that we run some script in the following sub functions:
Both could execute some script, which maybe makes the character move towards
a scene exit, create some items in off scene rooms etc.
Now this is all done via the functions named above. So I'm unable to create
a proper savegame at that point, since there is no way to go back to those
functions on save load.
On the other hand I simply can not allow loading at those points, since
after loading, it would return to script execution in those functions. So
there's a chance of doing really unexpected things, i.e. trying to execute
stuff from the new room scripts, accessing bad memory etc.
The original did not allow save/load in those cases at all, to be precise it
did not show up the menu.
Now on the other hand in some branches of KyraEngine_HoF::handleInput, it
might very vell be possible to allow saving/loading, for example when
KyraEngine_HoF::handleInput calls the KyraEngine_HoF::inputSceneChange
function, which basically just moves the character to a given position.
Of course KyraEngine_HoF::inputSceneChange might change a room somewhere in
some called function, where saving/loading is not possible at all.
To prevent such accidental saves/loads in the original, the original engine
(as we do), has some handling for input checks in those called functions
and when there's some mouse input event found, it would just return to the
caller, thus allow a clean state on save/load.
I also can not add faked input events in pauseEngineIntern, since those
would for example skip dialog lines when the GMM is opened up in a dialog
=> bad. So the whole pauseEngine thingy is not really useful to slove that.
I *could* of course search through all the code, and check all places where
saving is possible and set the '_isSaveAllowed' flag of KyraEngine_v1 to
true, but that would be major work and it would have to be done very
carefully. So I'm currently only enabling save/load in the safe parts of
the run loop of the kyra engine.
More information about the Scummvm-devel