Commit Graph
4807 Commits
Author SHA1 Message Date
Orgad Shaneh 3919f53326 ENGINES: Replace new[]/memset with new[]() 2021-11-10 19:53:15 +01:00
sluicebox 91bf813e75 SCI32: Remove kFileIOReadString warning
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.)
2021-11-06 22:31:19 -05:00
sluicebox cc714bd292 SCI: Only throttle kGameIsRestarting from game loops
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.
2021-10-30 13:19:09 -05:00
sluicebox 72bdc5eab0 SCI: Fix HOYLE4 Gin Rummy undercut sound 2021-10-29 14:50:51 -05:00
sluicebox 3e877ab1d8 SCI: Update QFG3 uninit read workaround 2021-10-29 12:20:22 -05:00
sluicebox b67cfc203d SCI32: Add QFG4 uninit param read workaround 2021-10-29 03:51:31 -05:00
sluicebox dc70198c28 SCI32: Fix QFG4 upgraded inventory views
Fixes script bugs where items are upgraded but their graphics aren't
2021-10-29 03:51:31 -05:00
sluicebox ab20c9bee2 SCI: Add uninit read workarounds for QFG3, QFG4
Fixes bugs #13045, #13046
2021-10-28 18:23:47 -05:00
sluicebox 27195a1b0a SCI32: Fix GK2 "bad" cursor not appearing 2021-10-19 08:43:45 -05:00
sluicebox ff11be91c3 SCI32; Improve KQ7 cursor script patch
Removes a jump to an unverified offset
2021-10-19 08:40:33 -05:00
sluicebox 388f3a02ef SCI32: Create kScummVMSleep for script patches
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.
2021-10-19 08:40:33 -05:00
Filippos Karapetis a092a8a08e SCI: Remove the unused and unnecessary VM hooks mechanism
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
2021-10-17 01:37:33 +03:00
sluicebox 1db2211de3 SCI: Add LAURABOW2 workaround for uninit read in museum
Prevents a warning that frequently occurs during most of the game
as actors walk around the museum.
2021-10-15 21:34:21 -05:00
sluicebox 3ad5a82760 SCI: Apply workarounds to Mac games without object names
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.
2021-10-15 21:34:21 -05:00
sluicebox d93c132d2c SCI: Remove redundant check 2021-10-15 13:09:00 -05:00
sluicebox 04cdd7af00 SCI: Fix kSetPort return value
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.
2021-10-13 19:18:43 -05:00
sluicebox 684d4ab683 SCI: Revert QFG1 Running-on-ice script patch
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.
2021-09-30 12:08:30 -05:00
sluicebox 6ef5aaec6e SCI: Fix QFG3 crash when angering the guardian
Fixes bug #12968

Unrelated to bd992479b3
2021-09-29 04:45:30 -05:00
sluicebox 17917f3613 SCI: Add QFG1VGA Mac workaround for Brigands 2021-09-09 12:39:17 -05:00
sluicebox 4be3f914b2 SCI: Replace QFG1VGA fetch workaround with script patch
Spell animation now travels towards the intended plant as in the
original, and also fixes Mac version
2021-09-09 12:39:17 -05:00
sluicebox 412cd4ca4e SCI: Add MOTHERGOOSE256 workarounds for restarting 2021-09-08 17:02:36 -05:00
sluicebox e5951416d4 SCI: Improve MOTHERGOOSE256 save-id workaround
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
2021-09-08 17:02:36 -05:00
Filippos Karapetis df062c6baa SCI32: Fix game options crash in non-English PQ4 versions - bug #12901
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.
2021-09-08 22:45:42 +03:00
sluicebox 21b6ea143f SCI32: Delete Mother Goose Banbury Cross script patch
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.
2021-09-07 14:57:23 -05:00
sluicebox 46771958fa SCI: Fix SQ5 cursor when pressing Tab for inventory
Fixes bug #11619
2021-08-25 03:30:34 -05:00
sluicebox 0983cf9263 SCI32: Fix SaveFileRewriteStream
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
2021-08-18 02:41:28 -05:00
sluicebox 7295854df7 SCI: Add LB2 staircase pathfinding workaround
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.
2021-08-16 18:14:09 -05:00
Filippos Karapetis 4241d3fae4 SCI: Fix bug #12808 - restore the behavior of seek() in SCI
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.
2021-08-16 20:20:23 +03:00
sluicebox f20c9ab958 SCI: Fix pathfinding debug colors in SCI 1.1 games
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.
2021-08-13 15:36:15 -05:00
sluicebox ee43d777c4 SCI: Fix crash in pathfinding debug code
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.
2021-08-13 15:36:15 -05:00
sluicebox 7ceb99d982 SCI32: Exclude script patch when SCI32 is disabled
Fixes compiler warning
2021-08-10 21:46:46 -05:00
Eugene Sandulenko f114527cca SCI: Avoid global constructor 2021-08-10 19:51:14 +02:00
djsrv 2aa7e3e558 COMMON: Replace matchString pathMode with general wildcard exclusions
Different characters may need to be excluded for different path styles.
2021-08-09 17:43:12 -04:00
sluicebox 7fab586735 SCI: Update LB1 armor-oiling script patch
Simplifies the patch and updates the comments
2021-08-06 11:08:42 -05:00
sluicebox e8c2671de8 SCI: Improve ECOQUEST2 Ecorder script patches
Simplifies the patches and restores original timing
2021-07-29 21:19:04 -05:00
sluicebox 15fb671cd1 SCI32: Add more KQ7 workarounds for Malicia's house
Big thanks to sixsevsairis for discovering this
2021-07-29 19:47:53 -05:00
sluicebox f7058856c6 SCI: Fix KQ6 bugs when clicking Features too quickly
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.
2021-07-18 19:33:13 -05:00
sluicebox 009b9691dc SCI32: Fix KQ7 volcano erupting after exiting game 2021-07-17 16:52:37 -05:00
sluicebox ccb4aa6f98 SCI32: Fix KQ7 global initialization 2021-07-17 16:52:37 -05:00
sluicebox 2189a8e0fb SCI32: Fix KQ7 statue displaying wrong gems 2021-07-17 16:52:37 -05:00
sluicebox 562ad967ff SCI: kGetTime: Remove clock time query in tick mode
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.
2021-07-09 12:30:59 -05:00
Paul Gilbert 005561d305 COMMON: Increase Stream pos, seek, size from int32 to int64 2021-07-08 18:24:28 -07:00
Paul Gilbert 0136043f09 COMMON: Revert Change Rect and Point to have int32 fields
This reverts commit 1c3e7fb4e9.
2021-07-06 20:35:42 -07:00
Paul Gilbert 1c3e7fb4e9 COMMON: Change Rect and Point to have int32 fields 2021-07-04 18:24:26 -07:00
sluicebox 0174ef9b2e SCI32: Fix KQ7 crash when skipping opening cartoon 2021-06-24 18:27:26 -05:00
sluicebox 1c54777cc5 SCI: Remove broken SQ1 debugging hotkey 2021-06-24 18:27:26 -05:00
sluicebox 0ff7411a1d SCI: Fix SQ1 Spanish broken messages
¡Ay, caramba!
2021-06-18 15:18:49 -05:00
sluicebox ef333e8611 SCI: Fix several SQ1 message and verb script bugs 2021-06-16 22:27:15 -05:00
sluicebox 69576123b8 SCI: Document SQ1 droid script patch 2021-06-14 14:29:16 -05:00
sluicebox 60f389b37d SCI: Fix comment typo 2021-06-14 14:29:15 -05:00