Menu

#3598 COMI: Crash in ship-to-ship combat

Monkey Island 3
closed-works-for-me
5
2008-02-04
2008-01-26
No

Latest ScummVM SVN snapshot
English version of the game

If the *first* ship I try to attack is Captain Rottingham's, ScummVM crashes with the following error:

(39:2011:0x1E42): readArray: array 395 out of bounds: [1,7] exceeds [9,6]!

If I attack any other ship first, and then Rottingham's, the error does not happen. The original interpreter did not crash when I tried the same thing there.

The easiest way to initiate the ship-to-ship combat is to click once anywhere on the overhead map to get going, and then on the ship you wish to fight. It doesn't matter how far away it is. I have not been able to get this trick to work with the original - I have to sail close enough instead - but I don't know if this is a bug or a feature. (It certainly makes this part of the game less time-consuming.)

Discussion

  • Torbjörn Andersson

    Savegame before the first ship-to-ship combat

     
  • Max Horn

    Max Horn - 2008-01-26

    Logged In: YES
    user_id=12935
    Originator: NO

    Hm, does it also crash with 0.11.0? What about 0.10 ?

     
  • Torbjörn Andersson

    Logged In: YES
    user_id=577918
    Originator: YES

    Well, 0.11.0 produces the same error when using the same savegame, but perhaps that's not surprising. I'd have to replay the first half of the game with 0.10 and 0.11 to say for sure. (I tried it with boot params, but I can't even repeat the crash with the SVN version then.)

     
  • Torbjörn Andersson

    Logged In: YES
    user_id=577918
    Originator: YES

    Though the offset doesn't match, I think this is the part of room-39-2011 that triggers the crash:

    [039C] (65) if (array395[var391][1] == 99) {
    [03B7] (67) breakHere()
    [03B8] (79) startScript(0,300,[])
    [03C8] (66) } else {
    [03CD] (7D) jumpToScript(0,256,[1,localvar4])
    [03E7] (**) }

    The var391 variable is set to a number from one through 8 just before. I think these numbers represent the various ships, with 7 being Rottingham's ship. (Perhaps 8 is the glass-bottom boat I've heard can appear as an easter egg?)

    I added a debug printf() to ScummEngine_v6::readArray(). Oddly enough, if I attack Rottingham's ship immediately, FROM_LE_16(ah->dim1) is 9 and FROM_LE_16(ah->dim2) is 6. If I attack another ship first, these dimensions are swapped to 6 9.

    Oddly enough, as soon as I load the savegame, ScummEngine_v6::defineArray() sets the array's dimension to 6 9, which I assume is correct. Something - and I'm still trying to figure out what - then swaps the dimensions to 9 6.

     
  • Torbjörn Andersson

    Logged In: YES
    user_id=577918
    Originator: YES

    The "mysterious" change may be simply loading the savegame. So somewhere along the line, something changed the dimensions of the array? Going back to my old savegames, the dimensions were 6 9 before visiting the Voodoo Lady, but 9 6 at some point shortly afterwards. But I haven't been able to reproduce the swapping now.

    I don't remember if I was using the trunk or the 0.11 branch at this point, but one of the savegames is dated December 30th, 20:19, and the other December 31 09:32. Oddly enough, the latter savegame claims to have a much shorter playtime, so maybe all this means nothing after all...

     
  • Torbjörn Andersson

    Logged In: YES
    user_id=577918
    Originator: YES

    Just one more comment. :-)

    It's strange that script-259 changes the dimensions of array 395 to the correct ones, though. It's as if someone anticipated that the dimensions could be changed during gameplay.

     
  • Torbjörn Andersson

    Logged In: YES
    user_id=577918
    Originator: YES

    I've played the game all over again, from the beginning. This time, I wasn't able to trigger whatever bug had changed the dimensions of the array, and so I wasn't able to reproduce the crash. I don't know if the bug is invalid or not.

     
  • Max Horn

    Max Horn - 2008-02-04

    Logged In: YES
    user_id=12935
    Originator: NO

    Well, if we can't reproduce the issue, I am tempted to close this. Who knows what corrupted the original savegame. Not nice, of course :-/

     
  • Torbjörn Andersson

    Logged In: YES
    user_id=577918
    Originator: YES

    I guess I have to agree. Even *if* the bug happens again, it seems the scripts correct the array dimensions if you attack any other ship than Rottingham's (I'm still not sure exactly how the ship-to-ship combat works, though, and the click-to-attack-enemy-immediately is strange), so it's not very likely to ever be noticed.

     
  • Torbjörn Andersson

    • assigned_to: nobody --> eriktorbjorn
    • status: open --> closed-works-for-me