This enhancement could probably be improved if the original issue is
real, since the game really doesn't expect you to go back to the
front of the castle, but as I don't own the German release and can't
reproduce this bug from a normal gameplay on my other releases, I'd
rather only adjust the _enableEnhancements flag for now.
When Low finds the meaning of the crypt inside the tomb, subtitles are
not printed because of a missing waitForActor() call. This also happens
in the original interpreters.
In Trac#4410 and commit 3b05a52588, this
was implemented as an actor.cpp workaround, but doing it this way make
Low glide on the floor instead of having his usual walking animation.
Having him wait finishing his sentence before he moves to the crypt may
feel a bit odd too, but Low already does that in some other parts of the
game, and he just reacts at a very slow pace in general.
Moving this to o6_talkActor() also means that it's next to the other
waitForActor() workarounds, where we try to only target the impacted
lines when we can.
Also make this workaround use `_enableEnhancements` while there.
_walkbox may be equal to kOldInvalidBox, which is 255, but then
_extraBoxFlags[_walkbox] would be dereferenced while _extraBoxFlags only
has 65 elements.
Found with UBSan in Loom Talkie, when the leaf falls from the tree.
This commit:
- Continues my AKOS relabeling task and adds some documentation and missing information;
- Renames the codec functions from codec1, codec5 and codec16 to something more expressive;
- Add '_' in front of private class members, when missing;
- Changes "v1" names (unnamed variables supposedly coming from Ghidra or similar tools...) to something more expressive;
- Renames related variables from foo_bar (or foobar) to fooBar (on costume.cpp, base-costume.cpp and akos.cpp).
This is part of an on-going effort on my end to document the AKOS code, and fix strange stuff
such as integers being used as booleans, and variable_names instead of variableNames
Guybrush can read the clock of Puerto Pollo, but this was only enabled
in the English, Italian and (fan-made) Russian releases, probably
because the result was poor for the other languages.
The German, French, Spanish, Brazilian Portuguese and CJK releases
disabled this feature, but the check was done in the interpreter, not in
the scripts. This replicates this original behavior.
Findings and ScummEngine_v7::actorTalk() change by AndywinXp.
Also include room palette fixes for games that were saved with a different video mode. Unfortunately the scripts make changes to the room palette based on VAR_VIDEOMODE. The original interpreter does not fix that.
In the end, once fully understood, the CGA rendering is very similar for all versions. So I did manage to clean out some code. Hercules mode for MI1EGA is broken here, I will have another commit for that, once I understand how it works.
(original bug)
In LOOM, the scripts actually read the videomode var and make actor palette adjustments based on that. Which means for games saved in EGA mode, with the wrong videomode var value, there will be glitches.
This concerns not only Bobbin, but the script does things for various actors and costumes in various situations.
We just set the videomode var to the actual config after loading.
For Bobbin in normal costume, I also include a post-load fix for savegames that will not have the actor palettes fixed by the scripts (savegames that we allow in situations where the original would prevent them).
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.
The direction parameter used in setDirection can be > 360, so it may not be passed to newDirToOldDir() directly.
Also, fix the converting routine for old saves.
(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.
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...
(final fix for ticket no. 3215 ("SCUMM: Zak McKracken - intro behavior + movement")
The ticket has been closed a couple weeks ago, since a user claimed that the intro was fully fixed. And it mostly was. Except one little thing about the movement of the floating hat which, after chasing Zak, would return to the left of the screen one step to early.
Turns out that o2_waitForActor() got triggered one step to early, because we didn't set the final MF_TURN flag...
After my recent effort to do this for SCUMM3 I now try to achieve the same thing for v1/2. (Unsurprisingly) the step calculations actually have more in common with SCUMM3 than with the later versions upon which the code was based. However, I find the v1/2 code somewhat more difficult to fix than v3, since it is quite heavily twisted and refactored to fit into our common code. So all testing and bug reporting is welcome...