Commit graph

3755 commits

Author SHA1 Message Date
Torbjörn Andersson
bd2bf31c5f 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:47:37 +01:00
Torbjörn Andersson
b99d0495ba SCUMM: Fix missing cursor in Mac Indy 3 and Loom after loading
This was a regression that was apparently introduced when the animation
flag was cleared for the Mac cursor. The animation made the cursor show
up when loading older save games, but not new ones. That's why it went
unnoticed until now.
2022-01-24 16:12:40 +01:00
Orgad Shaneh
961a83a2b2 SCUMM: Fix RTL indentation for multiline verbs 2021-12-14 22:16:34 +02:00
Orgad Shaneh
8512f90e13 ENGINES: Fix getSavegameFile for almost all engines
Use kSimpleSavesNames correctly, add where needed, remove where needed.

Trac #12977
2021-12-06 00:08:32 +00:00
Orgad Shaneh
43a44e213b ENGINES: Use MetaEngine consistently for getting autosave slot
The autosave refactoring that was done in
7adad5aaf5 used g_engine for identifying the
autosave slot. This worked for in-game save/load, but doesn't fit when
called from the launcher.

Fix by passing MetaEngine to SaveStateDescriptor ctor and using it for this
query.

Amends 7adad5aaf5.
2021-12-06 00:08:32 +00:00
Torbjörn Andersson
846e19d38c SCUMM: Don't try to apply workarounds to unloaded resources...
...because ScummVM will crash trying to do so.

This was discovered in bugs #13111 and #13113, where loading a HE
savegame does not load sound resource 1 but still tried to apply
workarounds to it. I don't know if this is the only case.
2021-11-29 07:32:39 +01:00
Torbjörn Andersson
e7c345fa11 SCUMM: DiMUSE: Backport fix for looping Dig music (bug #13058)
This is taken from pull request #3368 ("New Digital iMUSE Engine").
AndywinXp asked me to do it for him because it was less inconvenient for
me. It is only being applied to the 2.5 branch since his pull request
should take care of everything on the master branch later.
2021-11-07 14:07:24 +01:00
Eugene Sandulenko
b2f7f94f3c
SCUMM: Added override keywords 2021-10-19 21:11:27 +03:00
Torbjörn Andersson
d1f8e3a0ea 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:28:18 +02:00
Torbjörn Andersson
b2818479f7 SCUMM: Warn on unhandled escape sequences in Mac font renderer
This should, of course, never happen.
2021-10-19 19:28:11 +02:00
Torbjörn Andersson
db67aa0e34 SCUMM: Add setting for correct font spacing in Indy 3 Mac
For all the purists out there (I know there is at least one), the
default behavior is to try and emulate the original's slightly broken
font spacing. Even though I prefer correct spacing myself.
2021-10-19 19:28:00 +02:00
Torbjörn Andersson
e19557462d SCUMM: Implement the incorrect character spacing used in Indy 3 Mac
This is more guesswork, but seems to match the original for where I've
tried it. Next step is to implement an option to use the correct spacing
instead since it arguably looks better.
2021-10-19 19:27:50 +02:00
Torbjörn Andersson
34c2883e84 SCUMM: Move COMI getStringWidth() to CharsetRendererNut
As far as I know, that's the only game that uses the Nut charset
renderer.
2021-10-19 19:27:41 +02:00
Torbjörn Andersson
5373856bde SCUMM: Add braces to empty loop
It's mandatory in our code formatting conventions.
2021-10-19 19:27:31 +02:00
Torbjörn Andersson
201ba0007a SCUMM: Center text better in Mac Loom (bug #12984)
Measure the whole string before dividing the length by 2 to get the
low-res width of the string. Before, each character width was divided
which led to rounding errors. The result is better, but not pixel
perfect. I'm not sure what I'm still getting wrong.
2021-10-19 19:27:15 +02:00
Torbjörn Andersson
b69bd64897 SCUMM: Position text better in Indy 3 Mac (bug #12983)
The text positioning seemed to be correct in all cases I checked (which
admittedly weren't all of them). The original spaces characters
differently, but I would say that the original does it wrong. I typed
the same text in ResEdit, and it came out the way ScummVM draws it.

I see no reason for being that bug compatible with the original.
2021-10-19 19:26:53 +02:00
Torbjörn Andersson
9180cf454c SCUMM: Space lines in Indy 3 text boxes like the original (bug #12983)
I didn't think anyone would notice that the lines of the Indy 3 text
boxes were spaced slightly differently in ScummVM than in the original.
I realized it wouldn't be as tricky as first thought to fix that, though
I may clean it up a bit later.

This fixes a tiny part of bug #12983.
2021-10-19 19:26:34 +02:00
Torbjörn Andersson
dfe2c57b84 SCUMM: The Indy 3 / Loom Macintosh cursors aren't animated
So there's no need to keep reading the cursor from the Mac resource over
and over again.
2021-10-14 08:48:17 +02:00
Eugene Sandulenko
9f5112da37
SCUMM: Fix detection for Japanese Mac fbpack 2021-09-28 21:45:01 +02:00
Eugene Sandulenko
c541dd87fc
SCUMM: Added detection for Japanese Mac fbpack 2021-09-28 21:12:41 +02:00
athrxx
c0960a1172 SCUMM: (SCUMM7/8) - fix minor walking code glitch
(see https://bugs.scummvm.org/ticket/12499#comment:11)

In Actor::startWalkActor() we call adjustXYToBeInBox() twice, first with the dest coords, then again with the resulting coords from the first call. In the example from the bug ticket (clicking on Kenny the lemonade selling pirate) this will adjust the x position from 503 to 501 on the first pass and from 501 to 500 on the second pass.

The original SCUMM 5 and 6 (I checked MI2 and SAM) actually do it exactly like that, so it becomes kind of obvious where our code originates from.

However, for SCUMM 7 and 8 (I checked FT, DIG, COMI) the function has been simplified considerately. It makes the call to adjustXYToBeInBox() only once (and no call to checkXYInBoxBounds() either), so in our COMI example the x position will stay at 501.
2021-09-23 23:14:50 +02:00
Ben Castricum
18601e51d7 SCUMM: Fill in missing language for 2 HES games 2021-09-12 22:27:38 +03:00
athrxx
07878592a4 SCUMM: (FT) - fix bug no. 12903 ("Sometimes skipping videos occur")
Prevent autosave during smush playback. Thanks to AndywinXp for the tip.
2021-09-09 16:10:16 +02:00
athrxx
163313751c SCUMM: (SCUMM 3) - avoid possible division by 0
(I haven't encountered a case where it actually happened, but it looks like it could...)
2021-09-04 18:30:09 +02:00
Torbjörn Andersson
327e183eab
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:15:06 +02:00
Orgad Shaneh
83347cc17d SCUMM: Extend Ctrl handling to all the games on versions 3-7
Tested with Loom and The Dig. It seems to be consistent.

Sam&Max seems to have different mapping for Ctrl. The DOS version
has the following actions:

Ctrl-I: Rotates the current action
Ctrl-J: Switches to Joystick Mode
Ctrl-K: Shows memory stats
Ctrl-C: Prompts to quit
Ctrl-M: Switches to Mouse Mode

Anyway, since it doesn't break anything, I did not add an exclusion for it.
2021-09-02 07:24:22 +03:00
Filippos Karapetis
ccee4a18c6
SCUMM: Fix comment 2021-08-31 10:15:30 +02:00
Ben Castricum
da4175c46f
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-31 10:15:26 +02:00
Orgad Shaneh
29d8f0c70c
SCUMM: Fix handling of Ctrl+Key in monkey1 and monkey2
There are several Ctrl+Key combinations that are accepted by the engine.
Most famous one is Ctrl+W, which is Instant Win on monkey1 (monkey2 uses
Alt+W, and has a similar hack for passing it correctly).

This used to work with ScummVM 1.9.0/SDL1, but broke with SDL2, and was
later broken further even for SDL1 in f5ed14e93d.

Fixes #10644.
2021-08-30 23:14:01 +02:00
athrxx
c19a3f1cc1 SCUMM: (COMI/CJK) - add actor text color hack
Just something I came across in the disasm while doing something else. I also ran the original CJK interpreter in VirtualBox to confirm this weirdness...
2021-08-28 14:10:00 +02:00
Eugene Sandulenko
2e1391e3b0
SCUMM: Added atlantis Mac demo. Bugreport #12831 2021-08-23 16:17:31 +02:00
athrxx
033084505c SCUMM: (COMI) - fix bug no. 4424 ("Guybrush walks in place when examining certain objects")
Minor walking code fix from disasm. I have verified that the changes have to be applied to all SCUMM7/8 games, but not to the lower versions.
2021-08-23 15:48:10 +02:00
Orgad Shaneh
7adad5aaf5 ENGINES: Streamline auto-save write/delete protection
Some engines call setAutosave and some don't. isAutosave is used to
determine if a saved game is an autosave, but in fact, on most cases it
just falls back to comparing the name to "Autosave".

This is wrong for several reasons:
* Older versions of ScummVM used Autosave 0.
* The name "Autosave" is translated, so if you change the language, it
  won't be detected.

Instead of relying on the name, use the well-known getAutosaveSlot() from
Engine/MetaEngine.

Fixes #12735.
2021-08-23 13:34:35 +02: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
Ben Castricum
bb9b151c19 SCUMM: Add SegaCD MI1 Lemonhead lines 2021-08-18 21:53:40 +03:00
Ben Castricum
8e0aeaab73 SCUMM: Add FM-Towns MI1 Lemonhead lines 2021-08-18 10:33:25 +03:00
athrxx
bfd8c8ed8c SCUMM: whitespace 2021-08-16 18:29:47 +02:00
athrxx
f35b1f1125 SCUMM: (COMI) - add comment and some cleanup
- removed obsolete (and incorrectly implemented) COMI Chinese handling
- some preparations to make it easier if we would want to get rid of SmushFont::getStringWidth() in favour of this
2021-08-16 18:23:09 +02:00
Andrea Boscarino
5dfe57d230 SCUMM: COMI: Attempt at a proper fix to getStringWidth 2021-08-16 17:46:09 +02:00
Andrea Boscarino
4f98ab5789 SCUMM: COMI: Fix getStringWidth behavior 2021-08-16 17:46:09 +02:00
Jan Sperling
f12fe5e9b5 SCUMM: Add German MI1 Lemonhead lines 2021-08-15 22:07:38 +03:00
athrxx
c1bc192abf SCUMM: (COMI) - fix vertical position of object descriptions
This is just a small hack to address bug no. 12796 ("SCUMM: COMI: Object label line printed on the wrong spot"). It tries to apply the correct fix that we already have in SmushFont::drawStringWrap() to "normal" (non-Smush) blast strings.
2021-08-15 15:48:32 +02:00
athrxx
02bf7e0063 SCUMM: fix comment (typo/wording) 2021-08-15 00:48:34 +02:00
athrxx
e39b911895 SCUMM: (COMI/CJK) - fix 1-byte-character display in Smush movies
(bug #11947 - "SMUSH text rendering differences with Korean COMI")

Turns out that the interpreter has another hack that I missed...
2021-08-14 15:24:29 +02:00
D G Turner
7196d85486 SCUMM: DiMUSE: Fix GCC Warnings
These are due to checking for greater than zero on byte type fields
which are defined using an unsigned type.
2021-08-14 01:33:45 +01:00
Andrea Boscarino
75b36c6fd8 SCUMM: DiMUSE: Implement actual setVolume and setPan constraints 2021-08-14 00:03:23 +03:00
Torbjörn Andersson
d1f4824864 SCUMM: Add MI1 Lemonhead lines for the Mac CD versions too
The Mac CD versions that I have use the same GUI as the DOS CD version,
but don't have CD audio tracks for the music. (So there is no music for
the cannibal village.) The script to patch is identical to the DOS CD
version, but located four bytes earlier in the room resource.
2021-08-10 22:05:02 +02:00
Andrea Boscarino
b5e56e9230
SCUMM: Add italian translation for MI1 Cannibal script patch 2021-08-10 22:39:11 +03:00
athrxx
5f4c1e86c9 SCUMM: fix regression from 0876537f
(there could still be use after delete cases)
2021-08-10 21:03:33 +02:00