There are several dead-ends in the original game and I was wondering if there was anything that could be done to fix the scripts. Take the example of the paint remover. You need it to get access to the door behind the plant. However, you can use it on pretty much anything causing it to disappear from your inventory.
Technical:
Through a mix of ScummVM debug and descumm I have narrowed the paint remover down to the following roomobj-14-200 script:
Code: Select all
Events:
3 - 004E
B - 0027
E - 0024
[0024] (D0) pickupObject(VAR_ACTIVE_OBJECT1);
[0026] (00) stopObjectCode();
[0027] (A9) setOwnerOf(VAR_ACTIVE_OBJECT1,14);
[002A] (48) if (VAR_ACTIVE_OBJECT2 == 101) {
[0030] (07) setState08(101);
[0033] (57) setState02(101);
[0036] (18) } else {
[0039] (D8) printEgo("That sure was a waste.");
[004D] (**) }
[004D] (00) stopObjectCode();
[004E] (48) if (VAR_ACTIVE_OBJECT2 == 14) {
[0054] (D8) printEgo("Yech! No thanks.");
[0064] (78) } else if (VAR_ACTIVE_OBJECT2 < 8) {
[006D] (E9) setOwnerOf(VAR_ACTIVE_OBJECT1,VAR_ACTIVE_OBJECT2);
[0070] (**) }
[0070] (00) stopObjectCode();
END
I am not sure on the usage of opcodes, but isn't the problem with this line:
setOwnerOf(VAR_ACTIVE_OBJECT1,14)
Shouldn't this be in the if clause rather than before it?
In other words, am I right in saying that setOwnerOf(x,14) causes you to lose an item from your inventory?
Update
Okay, I have managed to create a patch (after finding out the entire 14.LFL is XOR'd with 0xFF).
I have got to the point where the paint remover ONLY works on the paint blotch. For everything else, nothing happens. I am trying to get it so that you are given a decent message.
Here is the original section of code I am changing:
Code: Select all
[0027] (A9) setOwnerOf(VAR_ACTIVE_OBJECT1,14); // a9 09 0e
[002A] (48) if (VAR_ACTIVE_OBJECT2 == 101) { // 48 00 0a 65 00 09 00
[0030] (07) setState08(101); // 07 65 00
[0033] (57) setState02(101); // 57 65 00
[0036] (18) } else { // 18 14 00
[0039] (D8) printEgo("That sure was a waste.");
// d8 54 68 61 f4 73 75 72 e5 77 61 f3 e1 77 61 73 74 65 2e 00
[004D] (**) }
[004D] (00) stopObjectCode(); // 00
Code: Select all
[0027] (48) if (VAR_ACTIVE_OBJECT2 == 101) { // 48 0a 65 00 09 00
[002D] (A9) setOwnerOf(VAR_ACTIVE_OBJECT1,14); // a9 09 0e
[0030] (07) setState08(101); // 07 65 00
[0033] (57) setState02(101); // 57 65 00
[0036] (18) } else { // 18 14 00
[0039] (D8) printEgo("That would be a waste.");
// d8 54 68 61 f4 77 6f 75 6c e4 62 e5 e1 77 61 73 74 65 2e 00
[004D] (**) }
[004D] (00) stopObjectCode(); // 00
Code: Select all
Events:
3 - 004E
B - 0027
E - 0024
[0024] (D0) pickupObject(VAR_ACTIVE_OBJECT1);
[0026] (00) stopObjectCode();
[0027] (48) if (VAR_ACTIVE_OBJECT2 == 101) {
[002D] (A9) setOwnerOf(VAR_ACTIVE_OBJECT1,14);
[0030] (07) setState08(101);
[0033] (57) setState02(101);
[0036] (**) }
[0036] (18) goto 004D;
[0039] (D8) printEgo("That would be a waste.");
[004D] (00) stopObjectCode();
[004E] (48) if (VAR_ACTIVE_OBJECT2 == 14) {
[0054] (D8) printEgo("Yech! No thanks.");
[0064] (78) } else if (VAR_ACTIVE_OBJECT2 < 8) {
[006D] (E9) setOwnerOf(VAR_ACTIVE_OBJECT1,VAR_ACTIVE_OBJECT2);
[0070] (**) }
[0070] (00) stopObjectCode();
END
Update 2
Cool, got this working fully now in ScummVM and DosBox. The issue in my last update was due to the if statement needs to specify the relative jump. As my if block was now 3 bytes larger, I just needed to add 3 to the jump (09 to 0c).