It's normal for fewer charcters to be available than the maximum buffer
size . Confirmed that nothing depends on not zeroing out the remaining
bytes. (In fact, we've had problems before when not zeroing out buffers
in other kernel functions as scripts have been known to assume success
and use the buffer regardless of the return value.)
Prevents extra speed throttling from being applied when a script queries
the restart flag. Some rooms such as the KQ6 caves and the QFG4 caves do
this on every game cycle. In practice, this extra throttling didn't seem
to have much effect, but the intent is to only throttle game loops and
the script patches that fix inner loops.
Updated script patches to call kGameIsRestarting like game loops.
We have several SCI32 script patches that replace kGetTime spin loops
with calls to kWait for the intended delay. This prevents blocking
the main thread and allows ScummVM to be responsive and update the
screen. But kWait isn't a simple sleep, it's a throttling function,
and the duration that it sleeps (if any) is determined by the time
since it was last called. kWait was only in SCI16 interpreters so it
had to be restored to SCI32 and this required a further workaround
for Phant2 compatibility.
Now we have a dedicated custom kernel function, kScummVMSleep, which
does a simple sleep so that SCI32 script patch delays are consistent
and the Phant2 workaround isn't needed. This approach is similar to
kScummVMSaveLoad.
This was introduced as an extra mechanism of patching game scripts.
However, it's completely hardcoded with offsets for specific game
versions, with no endianess handling. Furthermore, the only patch
it's used for at the moment (input prompt for SQ3) has no visible
changes.
The SCI engine's script patcher has pattern matching functionality,
which allows it to be used in a variety of game versions. Furthermore,
it supports endianess handling for BE versions. Thus, it makes no
sense to keep a separate and complex script patching functionality
for a single patch that is hardcoded for a single game version with
no actual change in functionality. Since this is a fan patch, all of
these script changes can be added as part of the patch without any
changes to the engine code. We've discussed this with @sluicebox and
decided to remove all of this code, which should not have been part
of the engine's codebase because it clashes with the existing script
patcher
Restore object names in QFG1VGA workarounds that were removed to
accommodate the Mac version. Instead, don't match object names
on games that are known to not have them, since there are several.
Fixes workarounds not being applied to HOYLE4 Mac and LSL6 Mac.
SSCI doesn't return zero; it doesn't return anything. This shouldn't
affect any games since no scripts should depend on a non-existent
return value, but this discrepancy came up while investigating a
fan script that accidentally relies on this.
This only worked on the one version of the game (1.000 / 1.001) and
broke the final version of the game (1.200): typing "run" would always
kill the player and display "You don't know that spell." The patch
seems to have no effect on the many other versions of the game.
This code-injection scheme relies on hard-coded script offsets which are
entirely version specific, so I don't see how this can be fixed. There
is no mechanism to prevent patches from from being applied to other
versions and so the results are unpredictable. This particular patch
also injects text tuples which are also version specific, hence the
unintended death message.
Reverting so that the imminent release doesn't contain this regression.
The existing workarounds for this game's unique way of handling saves
assumed that the player restored a game at some point before the end.
Starting a new game and playing to the end would still cause an error
in the SCI1.1 floppy version because the game's save global would
contain an SCI id instead of our virtual id; we were only patching the
global when restoring.
Now we also patch the global on kSaveGame so that it always contains a
virtual id when there is a saved game.
Note that the existing uninitialized read workaround had no effect since
the read occurred in a local procedure but the workaround entry didn't
include a local procedure signature. Updating that workaround wouldn't
fix this; there would still be scenarios where the wrong save would be
auto-deleted.
Fixes bug #5294
Only enable the speech+subs toggle in the English version of PQ4.
French and German versions feature localized text with English voices.
Also, our injected speech+subtitles view is currently only in English.
This script patch caused the bug it claimed to fix.
It appears that during SCI32 development in 2017, a bug sent the horse
at Banbury Cross on an incorrect path behind the fountain instead of in
front of it. This would have looked glitchy since the horse has a higher
priority than the fountain. But this was misdiagnosed as a priority bug,
even though the original doesn't have any problems, and the script was
patched to set the horse to a lower priority. The real ScummVM bug was
fixed some time later, and ever since the horse has taken the correct
path and looked glitchy due to the patch setting the wrong priority.
Fixes Phantasmagoria 1 infinite loop when loading save games
SaveFileRewriteStream depended on MemoryWriteStreamDynamic::_size being
set by MemoryWriteStreamDynamic::ensureCapacity(), but this recently
changed in e83fed6c60
Fixes ego never walking down the museum staircase due to differences
in our pathfinding algorithm.
I don't know if there is a general change to our algorithm that could
take care of this, but given that both points are within multiple
barred access polygons this might be something that just happened to
work in the original.
Either way, we're close to a release so I only want to address this
specific issue.
With the latest changes to savegame streams, seeking to a location
past the end of a file results in an assert. Restore the previous
behavior, where the file pointer seeks to the maximum available
file location.
The pathfinding debugging code is using Sierra's buggy 8-bit matching
algorithm to find colors for drawing obstacles and path points in most
of the SCI 1.1 games. This usually results all colors being black.
Now we select the good 16-bit algorithm for internal use.
Fixes crash when kDebugLevelAvoidPath is enabled and kMergePoly merges
room obstacles, such in QFG1VGA after defeating a monster.
The debugging code that draws obstacles uses the polygon type as an
index to a color array and asserts that this value is between 0 and 3,
but that didn't take into account the 0x10 flag that kMergePoly sets.
Replaces a room-specific script patch with a generic one that should
fix the bug wherever it occurs. At the time, it wasn't known if this
could occur in other parts of the game under ScummVM, and so patching
the only known symptom was safer.
This is a mild optimization so that kGetTime only queries the time and
date when it actually uses the results. kGetTime is frequently called to
return the game time in ticks, and if each of those also calls
OSystem::getTimeAndDate() then that generates a lot of unnecessary
EventRecorder records.