The last 2 commits might not be fully compliant with the ScummVM GMM code and our handling of global sound pausing/resuming. This commit makes sure that only sounds will resume that were actually playing.
This mainly concerns restoring sounds after loading savefiles, but it should make the whole relationship between playing and paused sounds more accurate.
The test case which I was told about was KQ4, room 21, picking up the golden ball under the bridge, saving during playback of the pickup sound and then loading that savegame. It would result in hanging note due toe the sound being triggered multiple times by reconstructPlaylist() and updateSci0Cues(). Now, the sound should only start once.
I've changed the code to be more in line with disasm and tested some situations that sluicebox told me about or that I found in the comments (ICEMAN room 14, LSL3 start scene). I got rid of isQueued, since the original doesn't have that, it has caused some confusion and doesn't even get saved with the savegames.
I cleaned up updateSci0Cues(), so that it (together with processUpdateCues()) does a bit more what the original Midi timer proc does there. An exception is the sound fade out code in processUpdateCues(). It seems that we need that, as we don't have the fading code in the drivers like the original.
The original SCI0 code is actually much simpler than our code. It relies on a correctly sorted playlist (based on priority), but my impression is that we got that right, even if we do it slightly differently. I added a sortPlayList() to the sound init, since the original inserts the node at the right position, too.
When _mainThreadCalled is set the function call should be enqueued just like the Midi messages that get sent before the start of a new track, so that everything happens in the right order.
This is emitted when -Wdeprecated-copy is enabled. The fix implemented
is to explicitly declare this to be the default copy operator.
Since this may be a latent bug, this is marked with a FIXME.
This is emitted when -Wdeprecated-copy is enabled. The fix implemented
is to explicitly declare this to be the default copy operator.
Since this may be a latent bug, this is marked with a FIXME.
If On A Winter's Night, Four Travelers was such as game that
generated fully transparent screenshots. I am not completely
sure why it happens, and the easiest solution was to reset
the alpha byte to 0xff.
The code was only working for one specific case of 24bpp
pixel formats, and it is now generic. This fixes wrong
colors in the AGS savegame screenshots.
We were passing an empty palette to blit, causing
black screenshots for example in Trilby's Notes.
Screenshots seemed to be working already in some
other games, such as Black Cauldron, and I have
no idea how.
The allegro set_palette_range includes both the first
and last indexes passed, but we were excluded the last
index, which means we copied one less color than we
should. This was well visible in Trilby's Notes right
from the start of the game.
This function is used to list files that match a given pattern.
For example Kathy Rain uses it to list ./*.tra files. The
original engine uses al_findfirst() and al_findnext().
This fixes listing the available languages in the Kathy
Rain in-game options.
AGS uses agssave.xxx for its savegames, and it was already
changed to use the gameid in ScummVM, except when this is
called from scripts. Some games, such as If On A Winter's
Night Four Travelers, access savegames from scripts and
those are now mapped to ScummVm names. This solves the
missing Continue menu on the start screen for IOAWN4T
when we already saved the game.
Some games also save additional files in the save game
directory, and they can have generic names such as
'playersettings.dat', or 'user.cfg', and since we use
the same savegame path for all games, to avoid any
conflict we now prepend the game target name to all the
files created or read from there.