It's enough to do it after thigns have had a chance to change. Not every
iteration of waitForTimer(). This means we no longer have as precise
resolution for our animation timers, but I don't think that's any reason
not to cut down on the (admittedly small) amount of extra work the GUI
has to do.
This is still just a mock-up, and a bad one at that. It will all be for
nought unless I can figure out how to wire up these buttons to the SCUMM
verbs.
This get rids of a whole class of sound glitches across the
engine, where temporary saves paused sound for a fraction
of second, resulting in a hiccup.
Examples: reading the dialogue of Plato in INDY4, looking
at the recipe book in COMI.
Concept suggested by eriktorbjorn, and proved by the fact
that disasms do not pause audio at when saving.
The turning interpolation was completely disabled for v7/8, since it
interfered with DIG walk scripts. The result was that DIG was the only
v7/8 game that still had (script controlled) turning animations. COMI
and FT don't use walk scripts. So the actors would just flip directly from
the current facing direction to the target facing.
I have now changed parts of the walking code (and some other parts)
to better match the original v7/8 code.
Albeit not 100% necessary for rewriting the HE sound engine,
I decided to make this change in order to:
- Give proper meaning to magic numbers and variables
which were given temporary names 20 years ago;
- Avoid going insane when making comparison with HE code
and ours, when rewriting the sound code.
For now this is implemented via config file only.
It will be added to the GUI as soon as the enhancements
revamping PR is merged, which includes a generic SCUMM
engine widget.
The game speed changes in this commit were verified against
the latest WinUAE version. MI1 apparently has internal routines
which keep the speed of game and music constant between PAL
and NTSC; LOOM does that only for the music. Older games
have their video and sound speed based on the main VBlank rate.
iMUSE games do their own thing as usual and already work fine :-)
This commit implements proper loading of savestates saved from
the original menu in v0-3 games and loaded either from launcher
or GMM. Why is all of this necessary? It is because these saves
are built under the assumption that they will be reloaded from the
main menu room, and that therefore there will be a graceful
termination of the global script handling the main menu.
Terminating said script gracefully implies cleaning up variables,
stopping menu related scripts, and reboot other scripts which had
previously been stopped.
This certainly doesn't happen when reloading said savestates from
the GMM/launcher, and what instead happens is, in order:
- The game loads from the menu room;
- The menu scripts continues from an inconsistent location,
effectively re-saving the game;
- This invalidates the thumbnail of the savestate, which will now
show a picture of the menu;
- Closing the menu gets the user back to the saved state,
with probably an inconsistent state of some variables and scripts.
This fixes all of this, by detecting if we are loading a savestate
saved from the original menu, and by manually running the correct
script operations for each game in order to correctly close the
menu and resume the game.
Please note that this commit works under different assumptions
from the ones pertaining the already available post-load fixes
(which assume that you are saving the game from GMM).
This was caused by the fact that the pre and post save screen scripts
were not being called, and this messed up the cursor state with savegames
created as quicksaves.
Also, renamed the variables containing said scripts numbers, so that
they are a little bit more meaningful now.
A bit of history: this piece of code was apparently put in place in a time
where ScummVM only ran the SCUMM engine, and there was no common
PRNG module (see e48fbc0). This meant that at the time the PRNG was
not seeded as it is today, hence the workaround, which aimed at making
the generated numbers less predictable. This piece of code is not found
in any of the original executables.
Nowadays we put a lot of attention and care into our speedrunner-friendly
features; for example, we have an option which lets the user choose their
own seed for random numbers, so that we can have a degree of replicability
for the various runs. And the piece of code that is being removed in this commit
was reported for causing issues in the runs in which random numbers played
a bigger role.
Bug: "Subtitles are not shown anymore in some games".
To solve this we use the "subtitles" and "speech_mute" keys as masters
and "original_gui_text_status", used to sync the original GUI as slave.
We call Dialog::runModal() which in turn, calls pauseEngine().
At this point, SMUSH player is not yet initialized, but our implementation
calls _splayer->pause() which leads to a crash on Android.
If I'm not mistaken was used as a workaround back then when the MI2 difficulty
screen wouldn't show up; after some time it had been commented out, and it
remained like that ever since. Thanks to einstein95 for pointing that out!
There was a nasty bug in the fuel tower room, when the cops arrive at the
tower and the player regains control, in which the camera would be brought up
and then down again.
While I was there, since this is the same domain, I rechecked the v7-8 camera
code from the disasm, made some corrections, and properly fixed#1195 and
#1579. Another workaround bites the dust :)