Commit graph

173 commits

Author SHA1 Message Date
Donovan Watteau
fea1a2d392 SCUMM: Properly stop Wendy's music in MM NES
In the NES version of Maniac Mansion, each kid has their own CD player
playing a different background music by default.

Each CD player script does something like this when you turn it off:

(2F) if (!getState04(46)) {
(D8)   printEgo("It's already off.");
(18) } else {
(67)   clearState04(46);
(1A)   Var[224] = 0;  # <==
(3C)   stopSound(71);
(**) }

but Wendy's CD player script is missing the `Var[224] = 0` line, so
although her music was stopped, the game scripts weren't properly aware
of this, and so her music could suddenly resume, such as when entering
and leaving room 3 with her character.
2022-05-28 15:32:45 +03:00
Donovan Watteau
ee26cf4d18 SCUMM: Get the workaround for bug #1025 closer to the original behavior
In most (if not all) versions of Loom before the Talkie v4 release, one
of the shepherds should trigger a "We are the masters of stealth" line
if Bobbin tries to use the stealth draft on them, but no proper value for
the actor number is ever given.  In the original interpreters, the invalid
line would be skipped.  The Talkie release changes the lines a bit and
makes the third shepherd (act. 4) say something similar, instead.

Until now, ScummVM would work around this by forcing the leftmost (act. 2)
shepherd to say this line.  But, looking at the original script, it seems
that the original intent may have been to let any of the four shepherds
say this line, since script 232 expects a parameter which could be given
by any of the associated 422--425 (act. 2--5) actor objects.

So, moving this check from actorTalk() to o5_startScript() lets us
implement a more comprehensive workaround (with a bit more safety checks,
since there are so many Loom versions), but it also exposes another bug
in some EGA versions and derivatives (e.g. the French EGA version has it,
but the English EGA 1.1 version doesn't): if Bobbin uses the stealth draft
on the second shepherd (act. 3), then some line(s) will be completely
missing, potentially because this actor has been removed from the scene
in the earliest versions, although he's still in use.

Having zero reaction from the shepherds when you try their draft upon
them can be extremely confusing, so we need to work around this, too.

Forcing this actor to "stay" doesn't fix the issue for now (and the
symptoms are a bit different between ScummVM and the original
interpreters), so at the moment we force this workaround even if
`_enableEnhancements` is not enabled, when we detect this strange
actor behavior.
2022-05-21 17:30:34 +03:00
Torbjörn Andersson
f66d898dee SCUMM: Clean up Smirk close-up workarounds
I decided I prefer an empty if clause (which I find easier to read than
inverting the whole condition) than a premature break.
2022-04-26 14:45:30 +02:00
Donovan Watteau
422b8986f0 SCUMM: Fix Lima bird glitch in Zak FM-TOWNS (bug #2762)
When switching back to Zak after using the blue crystal on the bird in
Lima, the bird disappears, comes back, and disappears again.  This is a
very strange visual behavior that only happens in the FM-TOWNS version.

(This has been confirmed, back in 2006, to be an original bug that also
occurs under the Unz emulator.)

This V3 port added an unconditional putActor(6,136,0) call at the start
of the 201 script which controls this, negating the getActorX() and
getActorY() checks which happen a few lines later.  Ignoring this
putActor() call appears to restore the original V2 behavior, i.e. the
bird flies back to the pedestal.
2022-04-20 11:03:55 +03:00
Torbjörn Andersson
8de5d3e0ca SCUMM: Work around Loom script bug to show correct sleeping Rusty close-up
Some versions of Loom will always show the close-up of sleeping Rusty
where he's wearing his own clothes. Later versions (e.g. FM Towns and
VGA) will show different close-ups depending on if you've used the
Reflection draft on him. So this adds that check to the older versions
as well.

The original fixed versions will look at a variable to determine if
you've  used the Reflection draft on Rusty. Unfortunately, it's not the
same variable across all versions - there are even different EGA
versions with different variables! - so instead we check if the Bobbin
actor has a different costume. That seems to work across all versions so
far.
2022-04-08 06:42:16 +02:00
Torbjörn Andersson
88aaf2ce4d SCUMM: Make Fate of Atlantis intro workaround optional.
I didn't create this workaround, but I think it makes sense to make it
(ensuring that the window is broken and the coat is there even if you
skip the intro) optional.
2022-04-06 10:14:41 +02:00
Torbjörn Andersson
6b28000af8 SCUMM: Make it easier to go back to the cave in VGA Loom (bug #13385)
The object that the click registers on doesn't has an empty object
script, so it won't move you back into the caves. Redirect to the
appropriate object's script instead. I've verified with the built-in
debug mode that the original seems to have the same problem.

In the EGA version, and others I've tried, the problematic object is
later in the object list, so the cave object takes precedence.
2022-04-06 07:58:09 +03:00
Donovan Watteau
9b7654c56b SCUMM: Fix text color when Mandible speaks with Goodmold
Script 203 in room 90 only contains two lines, but the second one
is missing its color parameter in the original Talkie script.
2022-04-04 22:15:18 +03:00
Torbjörn Andersson
c447a9ccbd SCUMM: Fix missing Lemonhead line in MI1 Ultimate Talkie (bug #13374)
There was no WaitForMessage() after "Oooh, that's nice." when you give
the wimpy idol to the cannibals, so we simulate one. The other missing
lines, that were mysteriously dropped from the VGA CD version, were
probably never recorded so we make no attempt to reinstate them for this
version.
2022-04-03 07:27:35 +02:00
Torbjörn Andersson
608a334c22 SCUMM: Make recent Loom workarounds optional
Unfortunately that means I had to add the enhancements checkbox to the
EGA Loom settings widget, because I can't see any way to automatically
combine the static and dynamic settings widget. Oh well.
2022-03-23 16:02:49 +01:00
Torbjörn Andersson
cb561f462e SCUMM: Read the "enable_enhancements" setting only once
I can't change during gameplay, it's shorter to type, and we won't
accidentally involve the config manater in some tight loop.
2022-03-23 15:23:10 +01:00
Torbjörn Andersson
f496f75eb9 SCUMM: Make fixing Mandible's distaff animation in VGA Loom optional 2022-03-23 15:23:10 +01:00
Torbjörn Andersson
2a796cedd7 SCUMM: Make fixing VGA Loom "Choas" typo optional 2022-03-23 15:23:10 +01:00
Torbjörn Andersson
f4b1919da9 SCUMM: Make MI1 Smirk background noises optional 2022-03-23 15:23:10 +01:00
Torbjörn Andersson
88206f2ff4 SCUMM: Make MI1 clock tower restored behavior optional 2022-03-23 15:23:10 +01:00
Torbjörn Andersson
cf02446865 SCUMM: Make MI1 Smirk cigar smoke optional 2022-03-23 15:23:10 +01:00
Torbjörn Andersson
9c7cd2c7e2 SCUMM: Fix teleporting Rusty glitch in Loom (bug #13370)
Don't let the "send Rusty's ghost to guard the rift" script start as
long as the "make Rusty's ghost appear" script is running, because once
he reaches the rift he will then instantly teleport back to his body.

This bug happens in the original as well, though at least in ScummVM it
behaves a little bit differently in the FM Towns version than in any of
the other I tried. The fix still works for all of them, though.

The VGA talkie version is not affected, because there Rusty's ghost
appears in the rift, and the dialog makes sense regardless of whether
Bobbin or Rusty speaks first.
2022-03-23 10:40:27 +01:00
Torbjörn Andersson
60515e873b SCUMM: Don't allow Bobbin to escape through a closed door (bug #13367)
This was a script bug in the EGA DOS, Amiga and Atari ST versions, where
the open door object was left clickable after the door closed. Later
versions fixed it in two different ways: Either by making sure it wasn't
clickable, or by checking that the door really was open in the object
script.

We use the first fix, even though it becomes a bit inconsistent when the
object is later made unclickable. The second fix is only used by the FM
Towns and TurboGrafx-16 versions, as far as I can tell.
2022-03-22 14:24:01 +01:00
Torbjörn Andersson
041605f44c SCUMM: Play outdoors sound in CD version of MI1 during Smirk close-up
You're both still outside, so it doesn't make sense for the background
sound to suddenly stop. I guess the makers of the Special Edition agree,
because there the sound doesn't stop either.
2022-03-17 15:24:00 +01:00
Pragyansh Chaturvedi
34bc417d12
SCUMM: Fix bug #13196 - Invalid phrase with GIVE crashes Monkey EGA Demo
* SCUMM: Fix Invalid phrase with GIVE crashes Monkey Island EGA Demo
* SCUMM: Suggested changes on Pull #3731
* SCUMM: specify game id in Pull #3731
* SCUMM: seperated AMIGA monkey VGA and VGA Demo variants. Assigned GF_DEMO flags
2022-03-07 12:28:09 +02:00
Torbjörn Andersson
2f753222fe SCUMM: Work around timing bug when Mandible uses distaff in VGA Loom
The first and second animation when Mandible uses the distaff were so
close that they looked like one, and it looked like the second one was
missing. This patch adjusts the timing of the second one.
2022-03-05 20:01:05 +02:00
Torbjörn Andersson
27bd123278 SCUMM: Rewrite PC Engine Loom dragon workaround
The more I looked at it, the less I liked my old solution. Intercepting
getVar() meant that jumpRelative() would still be called, which made it
sensitive to what getVar() returned when the workaround was active. And
I have no idea how it didn't mess up _scriptPointer somewhere along the
way. So now it's in o5_equalZero() instead, where it can completely
replace the original instruction with o5_breakHere().
2022-02-23 19:19:37 +01:00
Torbjörn Andersson
1d71a2859c SCUMM: Work around TurboGrafx-16 / PC Engine Loom glitch
When examining the dragon's pile of gold a second time, the "Wow!"
message was not visible. This appears to be a scripting bug particular
to this version (it works in the EGA version), and we work around it by
simulating a WaitForMessage() instruction after the message is printed.
2022-02-23 16:35:58 +01:00
Torbjörn Andersson
907feaf84c SCUMM: Fix regression in ScummEngine_v5::decodeParseString()
I noticed that the "I am Choas" typo in VGA Loom was no longer patched,
and I'm guessing the other workarounds may have been broken too. This
was a regression from when the missing Lemonhead lines in Monkey Island
1 were reinstated.
2022-02-23 11:45:18 +01:00
Torbjörn Andersson
132a07c0e8 SCUMM: Fix graphics glitch in TurboGrafx-16 version of Loom
Now Bobbin's palette is changed when entering/leaving the darkened tent.
It's odd that this effect looks so different from all other versions of
the game that I've tried (VGA, EGA and FM Towns), but it seems to match
the original behavior based on YouTube videos I've watched.
2022-02-04 18:51:40 +01:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Orgad Shaneh
ed5489929c SCUMM: Use nullptr
Using clang-tidy modernize-use-nullptr
2021-11-14 15:51:59 +02:00
Torbjörn Andersson
2dbf32353d SCUMM: Hack Indy 3 Mac credits to use correct text color
The credits script asks for white shadowed text, but the original (at
least when running in Basilisk II) uses light gray shadowed text. I have
no idea why, and the only workaround I can think of is to force the text
color this way.

It's possible for scripts to remap colors, of course, but that's not
what seems to be going on here.
2021-10-19 19:24:31 +02:00
Torbjörn Andersson
7aadf63014 SCUMM: Add Spanish version of the MI1 Lemonhead patch
I don't have this version of the game myself, so it's based on a YouTube
playthrough and walking through the process of extracting the necessary
data with timofonic. It has not been properly tested, though the
messages do look correct if I insert them into the English version.
2021-09-02 13:14:42 +02:00
Filippos Karapetis
3f7e12f3fc SCUMM: Fix comment 2021-08-30 19:21:36 +03:00
Ben Castricum
86b7ca64a2 SCUMM: Indy4 - Put coat/window in office, fixes bug #12420
WORKAROUND bug #12420 (also occurs in original) Broken window and coat missing

This happens when you skip the cutscenes in the beginning, in particular
the one where Indy enters the office for the first time. If object 23 (National
Archeology) is in possession of Indy (owner == 1) then it's safe the force the
coat (object 24) and broken window (object 25) into the room to compensate for
the skipped code.
2021-08-30 19:21:36 +03:00
Ben Castricum
9f44c5522a SCUMM: MONKEY-VGA fix bug #10571, Object stopped with active cutscene
Also occurs in original

Script 68 contains the code for handling the mugs. The issue occurs when a mug
changes state. It will call setObjectName for the new state which in its turn
restarts objects in inventory. Some objects (kidnap note) can be in a cutscene state
what causes a crash if the object gets restarted. This workaroud waits for cutscenes
to end, preventing the crash.

Script #68
[0000] (DD) setClass(Local[0],[146]);
[0007] (28) if (!Bit[421]) {
[000C] (1A)   Bit[421] = 1;
[0011] (62)   stopScript(201);
[0013] (62)   stopScript(188);
[0015] (80)   breakHere();
[0016] (D8)   printEgo([Text(sound(0x612F889, 0xA) + "This stuff is eating right through the mug!")]);
[0054] (80)   breakHere();
[0055] (0A)   startScript(201,[]);
[0058] (**) }
[0058] (2E) delay(300);
[005C] (DD) setClass(Local[0],[147]);
[0063] (D4) setObjectName(Local[0],"melting mug");
[0072] (1A) Var[233] = 500;
[0077] (48) if (VAR_ROOM == 33) {
[007E] (3A)   Var[233] -= 2;
[0083] (48) } else if (VAR_ROOM == 35) {
[008D] (3A)   Var[233] -= 3;
[0092] (48) } else if (VAR_ROOM == 34) {
[009C] (3A)   Var[233] -= 5;
[00A1] (18) } else {
[00A4] (3A)   Var[233] -= 1;
[00A9] (**) }
[00A9] (80) breakHere();
[00AA] (78) unless (Var[233] < 1) goto 0077;
[00B1] (DD) setClass(Local[0],[134]);
[00B8] (D4) setObjectName(Local[0],"mug near death");
[00CA] (2E) delay(300);
[00CE] (DD) setClass(Local[0],[12]);
[00D5] (D4) setObjectName(Local[0],"pewter wad");
[00E3] (9A) Local[1] = VAR_ROOM;
[00E8] (80) breakHere();
[00E9] (C8) if (Local[1] == VAR_ROOM) {
[00F0] (18)   goto 00E8;
[00F3] (**) }
[00F3] (A9) setOwnerOf(Local[0],0);
[00F7] (A9) setOwnerOf(Local[0],15);
[00FB] (0A) startScript(11,[]);
[00FE] (0A) startScript(12,[]);
[0101] (DD) setClass(Local[0],[19,6,140]);
[010E] (0C) Resource.unlockScript(69);
[0111] (A0) stopObjectCode();
END
2021-08-23 00:08:08 +03:00
Ben Castricum
ccc7412c57 SCUMM: MONKEY-VGA fix bug #346, Object stopped with active cutscene
Also occurs in original.

In script 204 room 25 (Cannibal Village) a crash can occur when you are
expected to give something to the cannibals, but instead look at certain
items like the compass or kidnap note. Those inventory items contain little
cutscenes and are abrubtly stopped by the cutscene in script 204 at 0x0060.

This workaround changes the result of isScriptRunning(164) to also wait for
any inventory scripts that are in a cutscene state, preventing the crash.

Script #204
[0000] (1A) Bit[354] = 1;
[0005] (1A) Var[249] = 0;
[000A] (5D) setClass(303,[32]);
[0011] (DD) setClass(VAR_EGO,[5]);
[0018] (2E) delay(1200);
[001C] (80) breakHere();
[001D] (68) VAR_RESULT = isScriptRunning(164);
[0021] (A8) if (VAR_RESULT) {
[0026] (18)   goto 001C;
[0029] (**) }
[0029] (58) endOverride();
[002B] (91) animateCostume(VAR_EGO,3);
[002F] (5D) setClass(303,[160]);
[0036] (40) cutscene([]);
[0038] (AE) WaitForMessage();
[003A] (14) print(5,[Text("Obviously you have nothing for us.")]);
[0060] (C0) endCutscene();
[0061] (2A) startScript(105,[],F);
[0064] (A0) stopObjectCode();
END
2021-08-23 00:08:08 +03:00
Jan Sperling
f12fe5e9b5 SCUMM: Add German MI1 Lemonhead lines 2021-08-15 22:07:38 +03:00
Andrea Boscarino
b5e56e9230
SCUMM: Add italian translation for MI1 Cannibal script patch 2021-08-10 22:39:11 +03:00
Torbjörn Andersson
c193fa74bf SCUMM: Restore old clock tower behavior to the CD version of MI1
In the floppy VGA version (and presumably the EGA version as well), the
clock tower only gets a new description ("e.g. "Hmm.  Still ten
o'clock.") if you leave the room after examining it. In the CD version,
someone has "fixed" the behavior so that the description changes
immediately when the clock tower is examined.

Since it also changes on exiting the room after examining the clock
tower, that means you're much less likely to ever see the second
description. (There are only three, with a random variation on the
last one.) It doesn't completely ruin the joke, but...

To restore the original behavior, we don't allow the clock tower script
to increment the variable that changes its description.
2021-08-10 12:47:03 +03:00
Torbjörn Andersson
400e40da8e SCUMM: MI1: Use correct colors for Smirk's cigar smoke in CD version
We recently enabled the smoke animation that was present in the EGA and
VGA floppy versions of MI1, but removed in the CD version. However, for
a couple of reasons the colors were not correct.

For one thing, the animation doesn't use the same color indexes as in
the floppy version. But it still tries to remap the floppy version's
color indexes to other colors.

For another, one of the colors it tries to remap to gets overwritten,
probably to ensure that the GUI uses consistent colors. If that's the
only reason, we can safely ignore that for this room since it has no
visible GUI.

The voodoo lady's smoke is still using different colors than the floppy
version. I have no good ideas for how to fix that. Those colors will get
overwritten, and this time there is a visible GUI. But perhaps that
shouldn't be fixed since the special edition, for better or for worse,
pretty much made those colors canonical.
2021-08-10 12:41:48 +03:00
Torbjörn Andersson
0209d79652 SCUMM: Simplify Indy 3 Mac workarounds
I was confused when writing them. There shouldn't be any need to check
if the script is global when that's already implied by the script
number.
2021-08-09 10:06:26 +02:00
Torbjörn Andersson
4bcfd4aa3b SCUMM: Prepare for translated versions of the MI1 cannibal patch 2021-08-07 11:57:48 +03:00
Torbjörn Andersson
30ce02e9e3 SCUMM: Simplify MI1 cannibal patch
There's enough space to just change the first message and insert the
WaitForMessage(). No need to mess with the second message, since that
one's already correct.
2021-08-07 11:57:48 +03:00
Torbjörn Andersson
8e8e3225da SCUMM: Add missing Lemonhead lines in English CD Monkey Island 1
Apparently these were lost when the game was converted from floppy to CD
version. Not just in the English version, but that's all I have. We
should come up with a way to make it easy to add other languages,
though.
2021-08-07 11:57:48 +03:00
Torbjörn Andersson
a5d7d9fdd2 SCUMM: Limit Loom CD Choas/Chaos workaround to the appropriate script 2021-08-03 21:05:24 +02:00
Torbjörn Andersson
c6b8b1b9ac SCUMM: Remove stray "the" from recent captain Smirk workaround comment
And I forgot to mention in the previous commits that they were for
Monkey Island 1. Oops. Too late to do anything about that now.
2021-08-02 18:54:36 +02:00
Torbjörn Andersson
8b29bf5271 SCUMM: Restore missing cigar smoke to captain Smirk's close-up
In the EGA and VGA floppy versions, the close-up of captain Smirk has
animated cigar smoke. I don't have the EGA version, but in the VGA
version it apparently depends on whether you're running the game from
floppy or hard disk. If you run it from floppy, there is no smoke,
probably to cut down on disk access.

This is implemented in the entry script for room 76, where it either
sets costume 76 or 0 on actor 12.

In the VGA CD version, it always sets costume 0. Setting it to 76
restores the smoke, but the position is a bit off. Using the positions
from the floppy verion's script 57 fixes that. I have no idea why they
were changed in the CD version when they seem to use the same animation.
Only the colors are a bit different.

The "Ultimate Talkie" version already fixes this, but this fix should
not interfer with that. It uses slightly different positions for the
smoke, but the difference is never more than a single pixel so I'm not
touching those.
2021-08-02 16:21:20 +02:00
Torbjörn Andersson
e2544841df SCUMM: Handle shadow palette in Macintosh b/w mode
In Macintosh b/w mode, there really is no such thing as palette
manipulation. Any color changes have to be handled by the renderer.
Instead of marking the palette as dirty, changes to the shadow palette
trigger a full redraw of the screen.

At the time of writing, I'm only aware of two things that use this: The
lightning flashes at Castle Brunwald in Indiana Jones and the Last
Crusade, and the scene where the dragon finds Rusty in Loom. I have
verified that both of these seem to work correctly.
2021-07-13 09:53:36 +02:00
Torbjörn Andersson
3b730ecc55 SCUMM: Extended old workaround for overlapping MI2 music
While testing the Mac version of MI2, I noticed that the game would
resume the Woodtick music while Largo's theme was still playing after
the scene with the bartender. We already have a workaround for a similar
problem when he's talking to Mad Marty, and the cause seems to be the
same both times: Optimistic scripting. So delay that music transition as
well.

I've excluded the Amiga version from this workaround, because that one
cuts much of the music so it shouldn't be needed there. But if I'm
wrong, please let me know.
2021-07-09 12:50:09 +02:00
athrxx
e452349eea SCUMM: remove obsolete workaround
(obsolete due to f039bdb0)
2021-07-04 21:15:32 +02:00
Torbjörn Andersson
985463cfd0 SCUMM: Make the Indy 3 Mac fix a bit more specific
I don't know if there can ever be any confusion, but check that it's a
global script that's called, just to be safe.
2021-06-30 14:59:55 +02:00
Torbjörn Andersson
671a169153 SCUMM: Fix inventory problem when offering items to other characters.
If you offered an object to someone, e.g. one of the guards at Castle
Brunwald, then clicked "Never mind" instead, the next time you tried you
would only see one inventory object. This seems to be because unlike the
DOS version (at least the 256-color version), script 12 only enables
verb 101, not the whole inventory.

Perhaps the Mac version treated the inventory as a single verb?
2021-06-30 14:59:55 +02:00
sluicebox
674ed112aa JANITORIAL: Update more old bug tracker numbers
I missed the six digit ones and a few others in:
93eeffc84d
2021-06-09 14:28:52 -06:00