Changes between Version 7 and Version 19 of Ticket #15303


Ignore:
Timestamp:
Aug 2, 2024, 10:21:17 AM (3 months ago)
Author:
eriktorbjorn
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #15303

    • Property Summary SCI: LSL5: Timed message skipped during LSL5 coffee sceneSCI: LSL5: Timed message skipped during LSL5 coffee scene (symptom of a bigger problem?)
  • Ticket #15303 – Description

    v7 v19  
    1 This one was a fluke...
     1(Description updated after discussion below.)
    22
    3 I made a savegame at the beginning of Leisure Suit Larry 5 (English), right after the end of the intro. When bringing coffee to Silas, the game was supposed to print the message
     3During the coffee delivery scene in Leisure Suit Larry 5 (the optional tutorial after the intro), I noticed that one of the lines was skipped, or rather the text box for it was dismissed so quickly that I could barely see it. The skipped message was supposed to be:
    44
    55"Yes, I know" you offer proudly, "I'm the Chief Tape Rewinder and Sterilizer on this project!"
    66
    7 But that message was only shown for a split second, before skipping to the next message. I ''think'' what's going on here is some sort of integer overflow. This is how the message is displayed in rm150.sc, sCartoon:
     7This glitch is quite timing sensitive, so I have include a savegame during the scene itself. Don't skip any text boxes, just let the scene play out with default settings for everything.
     8
     9The problem seems to be the way the `Talker` class times out text boxes. First the `doit` method calculates a duration based on string length and, I assume, text speed, and assigns it to the `ticks` property. Then `say` adds another 60 ticks for good measure, and adds the current game time as reported by `GetTime`. The `doit` method then polls `GetTime` to see if the text box should be dismissed:
    810
    911{{{
    10                         (22
    11                                 (Say You_a 150 9 108 139 self) ; "Yes, I know," you offer proudly, "I'm the Chief Tape Rewinder and Sterilizer on this project!"
    12                         )
    13                         (23
    14                                 (= ticks 30)
    15                         )
     12                (if (> (GetTime) ticks)
     13                        (self dispose: disposeWhenDone)
     14                        (return)
     15                )
    1616}}}
    1717
    18 I think that means the message is supposed to stay up for 30 "ticks". Though that seems awfully short, so maybe it's 30 ''additional'' ticks?
     18What seems to happen is that if `GetTime` is close enough to 32,767, adding the duration causes `ticks` to become negative. Which means that `GetTime` is immediately greater than `ticks`.
    1919
    20 If you load the attached savegame, and let the messages time out on their own (don't click to speed it up!), the skipped message happens at a point when KGETTIME_TICKS in the kGetTime() function comes (dangerously?) close to 32,767. Could that somehow cause the timeout to trigger prematurely?
     20I believe this means that the glitch could happen at any point in the game, and I was just lucky (?) to catch it here. And the same mechanism seems to be present in several other games, but no one ever noticed. I blame the lengthy cutscenes in LSL5 for triggering it.
     21
     22I imagine it should be possible to fix, at least on a case-by-case basis. The arithmetic workarounds seem like a reasonable place to start, but it might need some extending to call a custom C++ function to do the comparison? We know that `ticks` should stay constant until the text box is dismissed.
     23
     24I'm more worried about what other things may potentially be affected, though.