When entering fullscreen it was storing the default window size
in the config, which was overwriting the current window size. As
a result when exiting window size, instead of restoring to the
previous window size it was restoring to the default window size.
When loadVideoMode gets called to exit fullscreen, the window is
still fullscreen, which means that the SDL_WINDOW_MAXIMIZED is set
(at least on macOS). As a result the window was resized to the
stored maximized window size instead of the size it had before
entering fullscreen.
The Return to Zork installer has an option to turn off the digital music during
the introduction and play MIDI music instead. ScummVM would always play the
digital music. This commit adds the installer option to the launcher GUI.
The movie player would use OSystem::getMillis to check the elapsed playing time
to keep audio and video in sync. This would go wrong when the game was paused
during movie playback, as the player would try to make up for the pause time,
fast forwarding the movie and breaking A/V sync.
This commit improves this by using Engine::getTotalPlayTime, which subtracts
pause time, and Mixer::getElapsedTime, which returns the actual length of audio
played. The player seems to restart later than the audio when unpausing, so it
still catches up for about 10 frames, but it's not as bad as before and it does
not lose A/V sync.
For looping sounds the game script regularly checks if the sound has finished
playing, then plays it again. This works in the original interpreter (possibly
because it checks the first buffer of double-buffered sound output); it does
not work in ScummVM because the mixer will return if the sound has actually
stopped playing. This causes an audible gap when the sound loops.
This commit alters the sfSoundPlaying function to check if the current elapsed
playing time is less than 100ms before the end of the sound, which fixes the
issue. Not sure if this change is necessary or desirable for games other than
Return to Zork. This fixes issue #6443.
The MIDI music on external softsynths and devices would keep playing while the
engine was paused. This commit fixes this by implementing the
Engine::pauseEngineIntern method to pause the MIDI music when the engine is
paused.
This rewrites the MADE music player to remove the use of the MidiPlayer. This
fixes the following issues in Return to Zork:
- User music volume control did not work for AdLib.
- MIDI channels were remapped; sometimes channels were missing (f.e. at the
lighthouse exterior).
- Some music tracks did not play because the current track had to be stopped
before playing a new track (f.e. the music over the credits after the intro).
- MIDI played at half volume and volume control would reset when a new track
started playing.
- "Native MT-32" flag was not checked, so the Miles driver was not used for
hardware MT-32.
- MT-32 to GM instrument mapping did not work.
- Roland GS mode now works.
The Roland GS MT-32 emulation option would not select the MT-32 drumkit on the
GS device, because the drumkit change was filtered out in the MT32GM driver.
This commit fixes this by adding an exception for this drumkit change when GS
MT-32 emulation is active.
The engine used the plain sound type for sampled sound effects and movie audio
and applied the SFX user volume control to the plain sound type. This caused
emulators like the AdLib emulator and Munt to be affected by the SFX user
volume control, because they use the plain sound type. This commit fixes this
by using the SFX sound type instead of the plain sound type. User volume is
applied by Engine::syncSoundSettings.
This commit also fixes the setSoundVolume script function. Volume was
previously applied to the SFX and speech sound types, which were not used.
Also, by directly using Mixer::setVolumeForSoundType, it would override the
user volume setting. This is fixed by storing the game sound volume in a field
and applying this to the current and future audio streams. This fixes bug
#6444.