SCUMM: Add workaround for MI1 Sega CD clobbering bit variables#6557
SCUMM: Add workaround for MI1 Sega CD clobbering bit variables#6557bluegr merged 2 commits intoscummvm:masterfrom
Conversation
Any conversation in the game is likely to set one or more bit variables that are intended for other things. Luckily none of them appear to be game breaking, but still... We detect and correct the faulty pattern, but old savegames will still be impacted.
|
Note that I've only tested this with an English version. Apparently there are others? |
This workaround is scary enough as it is. Someone who owns and understand the Japanese version will have to validate that one.
|
This is the list of bit flags that I put in the comment for the workaround: I think these convertsation options are enough to set the flags incorrectly. Note that it's enough that you see them, you don't actually need to choose them: 504 - The pirate leaders, "I want to be a fireman." So what I should do next (but it'll probably be a few days before I have the time to even begin) is to trigger these (or equivalent) conversation options, and then see if they actually suppress what I think they do. While at the same time doing a parallel playthrough where the workaround is active, to see that the messages aren't suppressed and that the game is still completable. To tell them apart, I'll be using Sega graphics mode for the run with enhancements enabled. The only case I've tried so far is asking Cobb about Loom: So that one works, at least. It used to be impossible to get that conversation option, because talking to Cobb would always set flag 504. |
|
I'm still not sure what bit 506 does, but my theory is that the first time you lose a sword fight Guybrush should always say "I give up! You win!". On subsequent losses, the game picks a random message. ("UNCLE! UNCLE!", "Yikes! Nice move.", etc.) |
|
Just a reminder, there are some restored conversation options that aren't part of this pull request. This one: And this one: For these the missing options are not removed, they're just drawn outside the screen and you can still select them with the arrow keys. So for these, the workaround is There are also some cut lines from the bridge troll conversation, but since they were actually removed from the script I will not make any attempt to restore them. |
This may cause problems for players, as the new code that fixes these clobbered variables may break existing saves when toggled |
I don't see how it would. At worst, turning off the workaround will allow the game to write to the wrong bit-variables again and of course there's nothing you can do to repair it after it's happened. But the breakage is pretty small, as shown in the screenshots. There is nothing in the workaround that should introduce any new breakage when you turn it on, since it's just redirecting the conversation trees to write to the same variables as the DOS version does. And in the Sega version, that group of variables is unused. Only the code that clears them remains, not the code that reads them. I'm still a bit fuzzy on exactly what they're used for in the DOS version. I think it may be so force the game to automatically pick a conversation option if there's only one available. E.g. if you talk to the shopkeeper and all you can tell him is that you'd like to browse. (Edit: No, that doesn't seem to be it.) |
|
The conversation tree here is a bit convoluted, and at least one message appears more than once under different circumstances. In these two screenshots I did take the same options, though:
And yet I get completely different outcomes. This is where it uses bit-variables 510, 511, and 512. I'm going to assume the workaround is correct here too. |
|
Thanks for your work, and for your thorough testing, @eriktorbjorn! Since this fix is isolated for a specific game platform version, and since that version has been tested in full, your changes are good to merge. Thanks again! Merging |
















Here's a scary one!
Any conversation in the Sega CD version of MI1 is likely - perhaps even guaranteed - to set one or more bit variables that are intended for other things. Luckily none of them appear to be game breaking, but still...
Since this is a global bug, I've been relying on NUTCracker for dissecting the scripts. While I'm a bit fuzzy on some of the details, MI1 uses nine bit flags numbered 384 through 392. They are set when conversation options are presented. In the DOS CD version it can look like this:
And then the script that handles conversation trees test and clears these variables. (They're cleared manually in some cases too.) The conversation tree handling in the Sega version is different, and doesn't use these variables but still clears them.
It also sets them, and that's where the bug comes in. Because here's the corresponding code from the Sega version:
The
V.100 -= 120line is missing. So the Sega version will set bits 504 through 512 instead. And they're used for completely different things throughout the game. I didn't notice until I got to the cannibals, and found that when they asked if they could do anything for them I couldn't ask them for a ship or for money. But the easiest one to reproduce is with Cobb: Guybrush will never say "Geeze, what an obvious sales pitch." to him:The good news is that the pattern
B.384[V.100] = 1only appears in these buggy conversation scripts. We can detect and correct that pattern. The bad news is that it appears more than 500 times, so testing them all is not reasonable.