Last Crusade (Amiga version): Corrupt IQ points counter!

Ask for help with ScummVM problems

Moderator: ScummVM Team

fingolfin
Retired
Posts: 1466
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin » Wed Oct 28, 2009 12:32 pm

If you provide details about the precise script bugs, we might be able to modify ScummVM to workaround those script bugs, without requiring any patching of game data files. We did that for various other script bugs in the past.

User avatar
JohnnyWalker2001
Posts: 76
Joined: Mon Oct 16, 2006 1:27 pm
Location: London, UK

Post by JohnnyWalker2001 » Wed Oct 28, 2009 9:16 pm

Wow, great job guys!

Let me know the bugs you've found and I might actually add them to my guide... one day. (I'm not great at updating it, but it is pretty comprehensive.

http://indyguide.mixnmojo.com

User avatar
icanntspell
Posts: 93
Joined: Mon May 18, 2009 12:14 pm
Location: The Netherlands
Contact:

Post by icanntspell » Thu Oct 29, 2009 7:00 am

I used your guide to map the puzzles, it's the best walkthrough available. It would be great if you find the time to update it. You already seem to have had a few suggestions for improvements.

In fact, bluntly using your guide, updating it and putting it somewhere is one of the thoughts that crosses my mind. However if you update it, that's even better. Let me know if I can help.

User avatar
icanntspell
Posts: 93
Joined: Mon May 18, 2009 12:14 pm
Location: The Netherlands
Contact:

anyone feel up to make a patch

Post by icanntspell » Wed Apr 27, 2011 5:23 pm

Sorry for raking up this old thread, but I found the discussion again when cleaning up my mail. I remember I had the intention to make a nice patch for the bugs but (insert favorite excuse here)...

I still have all the details about this so an average programmer should be able to create a patch for it. I gladly forward the details to anyone interested in making scummvm handle the scriptbugs. (Assuming this isn't fixed yet)

User avatar
ssdsa
Posts: 42
Joined: Tue Nov 01, 2005 10:19 pm
Location: Cologne, Germany

Re: anyone feel up to make a patch

Post by ssdsa » Wed Apr 27, 2011 6:18 pm

icanntspell wrote:I still have all the details about this so an average programmer should be able to create a patch for it. I gladly forward the details to anyone interested in making scummvm handle the scriptbugs. (Assuming this isn't fixed yet)
Why don't you just post your findings right here?

User avatar
icanntspell
Posts: 93
Joined: Mon May 18, 2009 12:14 pm
Location: The Netherlands
Contact:

Re: anyone feel up to make a patch

Post by icanntspell » Thu Apr 28, 2011 4:20 pm

Ok, here come my findings. I compared the amiga version to the PC/Steam version. The thing to look out for is

startScript(125,[30,15]);

This script 125 is the one responsible for giving the IQ points. First parameter is the puzzle number (here 30), 2nd one is the amount if IQ points you get.
Last edited by icanntspell on Tue May 17, 2011 6:08 pm, edited 1 time in total.

User avatar
icanntspell
Posts: 93
Joined: Mon May 18, 2009 12:14 pm
Location: The Netherlands
Contact:

Bug #1 : Escape through fireplace

Post by icanntspell » Tue May 17, 2011 5:59 pm

I quote "adalsgaard" on this comment about this bug.
About the points error leaving Castle Brunwald: It seems to "reversed"! When you get caught, free yourself and escape, you get 25 IQ points even though you're not supposed to. However if you escape WITHOUT getting caught, you get 0 IQ points (supposed to get 25 IQ points). Weird stuff...
Once I managed to dump the scripts using the build-in dump-resource option in ScummVM it all became obvious.

First the PC version :

Code: Select all

root@gateway:/home/ftp/incoming/dumps# ../scummvm/tools/trunk/descumm -u -3 Steam/roomobj-25-363.dmp
Events:
  43 - 0A17
  21 - 0000
  66 - 7269
  65 - 6C70
  61 - 6563
[0000] (C9) faceActor(VAR_RESULT,??Local??[3840]);
[0005] (43) Var[363] = getActorX(15616);
[000A] (06) VAR_NUM_ACTOR = getActorElevation(38);
[000E] (02) startMusic(93);
[0010] (00) stopObjectCode();
[0011] (43) ??Var??[2583] = getActorX(33);
[0016] (00) stopObjectCode();
[0017] (66) ??Local??[617 + ??Local??[101]] = getClosestObjActor(24940);
[001E] (63) Var[101] = getActorFacing(15);
[0022] (6C) Var[257] = getActorWidth(161);
[0026] (00) stopObjectCode();
[0027] (A8) if (Var[92 Bit 15]) {
[002C] (40)   cutscene([]);
[002E] (0F)   if (getState(367) == 0) {
[0034] (0A)     startScript(125,[36,25]);
[003D] (**)   }
and this is the Amiga version :

Code: Select all

root@gateway:/home/ftp/incoming/dumps# ../scummvm/tools/trunk/descumm -u -3 Amiga/roomobj-25-363.dmp
Events:
   A - 001F
[001F] (0F) if (getState(364) == 1) {
[0025] (A8)   if (Var[92 Bit 15]) {
[002A] (40)     cutscene([]);
[002C] (0F)     if (getState(367) == 1) {
[0032] (0A)       startScript(125,[36,25]);
[003B] (**)     }

Apart from the leading rubbish in the PC version (haven't fot a clue on why this happens) there is a tiny difference

PC : [002E] (0F) if (getState(367) == 0) {
Amiga : [002C] (0F) if (getState(367) == 1) {

The Amiga version tests for the wrong value which explains the "reversed" behaviour. To fix this bug I edited 25.LFL and changed the "1" into a "0". Loaded my savegame, went through the fireplace and got the expected 25 points.

User avatar
icanntspell
Posts: 93
Joined: Mon May 18, 2009 12:14 pm
Location: The Netherlands
Contact:

Bug #2: No points for defeating the security officer

Post by icanntspell » Tue May 17, 2011 6:06 pm

For the 2nd bug (not getting the points for KO of the security officer a.k.a. puzzle 29) :

Amiga :

Code: Select all

[0038] (48) if (Var[115] == 2) {
[003F] (40)   cutscene([]);
[0041] (0A)   startScript(125,[30,15]);
[004A] (1A)   VAR_EGO = 8;
[004F] (36)   walkActorToObject(8,465);
[0053] (3B)   ??Var??[3848] = getActorScale(209);
[0057] (01)   putActor(0,9,281);
[005D] (D1)   animateCostume(VAR_EGO,??Local??[3072]);
[0062] (80)   breakHere();
[0063] (80)   breakHere();
[0064] (5D)   setClass(8,[150]);
[006B] (1E)   walkActorTo(8,78,80);
[0071] (3B)   ??Var??[3336 + 8] = getActorScale(26);
[0077] (BC)   stopSound(Var[512]);
[007A] (00)   stopObjectCode();
[007B] (1A)   VAR_EGO = 1;
[0080] (C0)   endCutscene();
[0081] (18) } else {
[0084] (13)   ActorOps(8,[Costume(33),Palette(6,14)]);
[008C] (48)   if (Var[180] == 403) {
[0093] (13)     ActorOps(1,[Costume(30)]);
[0098] (48)   } else if (Var[180] == 406) {
[00A2] (13)     ActorOps(1,[Costume(35)]);
[00A7] (48)   } else if (Var[180] == 405) {
[00B1] (13)     ActorOps(1,[Costume(36),Palette(6,0)]);
[00B9] (18)     /* goto 00BC; */
[00BC] (**)   }
[00BC] (0A)   startScript(62,[4]);
[00C2] (1A)   Var[222] = 70;
[00C7] (1A)   Var[223] = 258;
[00CC] (0A)   startScript(35,[8,0,1,1]);
[00DB] (80)   breakHere();
[00DC] (68)   VAR_RESULT = isScriptRunning(35);
[00E0] (28)   unless (!VAR_RESULT) goto 00DB;
[00E5] (0A)   startScript(52,[]);
[00E8] (0A)   startScript(120,[8,11]);
[00F1] (1A)   Var[188] = 1;
[00F6] (0A)   startScript(125,[30,15]);
[00FF] (**) }
Steam

Code: Select all

[0038] (48) if (Var[115] == 2) {
[003F] (40)   cutscene([]);
[0041] (0A)   startScript(125,[30,15]);
[004A] (1A)   VAR_EGO = 8;
[004F] (36)   walkActorToObject(8,465);
[0053] (3B)   ??Var??[3848] = getActorScale(209);
[0057] (01)   putActor(0,9,281);
[005D] (D1)   animateCostume(VAR_EGO,??Local??[3072]);
[0062] (80)   breakHere();
[0063] (80)   breakHere();
[0064] (5D)   setClass(8,[150]);
[006B] (1E)   walkActorTo(8,78,80);
[0071] (3B)   ??Var??[3336 + 8] = getActorScale(26);
[0077] (BC)   stopSound(Var[512]);
[007A] (00)   stopObjectCode();
[007B] (1A)   VAR_EGO = 1;
[0080] (C0)   endCutscene();
[0081] (18) } else {
[0084] (13)   ActorOps(8,[Costume(33),Palette(6,14)]);
[008C] (48)   if (Var[180] == 403) {
[0093] (13)     ActorOps(1,[Costume(30)]);
[0098] (48)   } else if (Var[180] == 406) {
[00A2] (13)     ActorOps(1,[Costume(35)]);
[00A7] (48)   } else if (Var[180] == 405) {
[00B1] (13)     ActorOps(1,[Costume(36),Palette(6,0)]);
[00B9] (18)     /* goto 00BC; */
[00BC] (**)   }
[00BC] (0A)   startScript(62,[4]);
[00C2] (1A)   Var[222] = 70;
[00C7] (1A)   Var[223] = 258;
[00CC] (0A)   startScript(35,[8,0,1,1]);
[00DB] (80)   breakHere();
[00DC] (68)   VAR_RESULT = isScriptRunning(35);
[00E0] (28)   unless (!VAR_RESULT) goto 00DB;
[00E5] (0A)   startScript(52,[]);
[00E8] (0A)   startScript(120,[8,11]);
[00F1] (1A)   Var[188] = 1;
[00F6] (0A)   startScript(125,[29,10]);
[00FF] (**) }

In plain english ; in the Amiga version you get the 15 points for puzzle 30 if you give the book or KO the guy. The PC version correctly gives 10 points for puzzle 29 for KO and 15 for puzzle 30 when giving the book. I changed the file 31.LFL to give the 10 points for puzzle 29 in case of a KO as the PC version does and tested it.

fingolfin
Retired
Posts: 1466
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin » Tue May 17, 2011 9:07 pm

For the newer 256 color (VGA) PC versions, they changed the disk format and some opcodes, so instead of -u you have to pass -n in order to get sensible output out of descumm for indy3.

All in all, the descumm options are a bit messy, and they don't cover all possibilities, so for some scripts in certain games, the current descumm is not able to 100% correctly decompile them.

fingolfin
Retired
Posts: 1466
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin » Tue May 17, 2011 9:12 pm

Oh, and in all versions of indy3 I have, for the first bug you report, the script has
getState(364) == 1

This includes my Indy3 FM-towns, and both an english and a german VGA version of the game, as well as an english EGA version. So I guess the PC version you got from steam received fixes from LucasArts ?

It shouldn't be too hard to override both script bugs from within ScummVM, too. Very nice catches, both!

EDIT: Oops, my mistake. Of course the relevant line is the one with
if (getState(367) == 1)
resp.
if (getState(367) == 0)

I get "1" in the EGA version, and 0 in the VGA + TOWNS versions. So, it is exactly as you described, and there is no weird steam-only fix :)

User avatar
icanntspell
Posts: 93
Joined: Mon May 18, 2009 12:14 pm
Location: The Netherlands
Contact:

Post by icanntspell » Wed May 18, 2011 6:12 pm

Thanks. It would be great if it would make it into ScummVM at some time. If it ever does, please drop me message. I don't have the time to track all patches that make it into ScummVM anymore ;)

fingolfin
Retired
Posts: 1466
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin » Thu May 19, 2011 5:57 am

If you (or somebody else) wants to ensure these are not forgotten, then please file a bug report on our website, with the information you included here.

User avatar
icanntspell
Posts: 93
Joined: Mon May 18, 2009 12:14 pm
Location: The Netherlands
Contact:

Bug reported

Post by icanntspell » Mon May 23, 2011 6:51 am

OK, posted a bug report for it.

https://sourceforge.net/tracker/?func=d ... tid=418820

Thanks for your time.

fingolfin
Retired
Posts: 1466
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin » Tue May 24, 2011 11:36 am

I posted a patch on your bug tracker item which should cure the bugs. But I currently don't have the time to properly test it, so it's not (yet?) in our code repository.

User avatar
icanntspell
Posts: 93
Joined: Mon May 18, 2009 12:14 pm
Location: The Netherlands
Contact:

Post by icanntspell » Mon Jul 11, 2011 12:27 pm

I updated and tested your patch and it is working as expected. It would be nice if it was merged at some point.

In case somebody is interested, I uploaded my other ScummVm patches at my website. I didn't enter them in the patchtracker since they are not really into the spirit of ScummVM.

Post Reply