[Scummvm-tracker] [ScummVM :: Bugs] #15303: SCI: LSL5: Timed message skipped during LSL5 coffee scene (symptom of a bigger problem?) (was: SCI: LSL5: Timed message skipped during LSL5 coffee scene)
ScummVM :: Bugs
trac at scummvm.org
Fri Aug 2 10:21:17 UTC 2024
#15303: SCI: LSL5: Timed message skipped during LSL5 coffee scene (symptom of a
bigger problem?)
-------------------------+-----------------------------------
Reporter: eriktorbjorn | Owner: (none)
Type: defect | Status: new
Priority: normal | Component: Engine: SCI
Version: | Resolution:
Keywords: | Game: Leisure Suit Larry 5
-------------------------+-----------------------------------
Changes (by eriktorbjorn):
* summary: SCI: LSL5: Timed message skipped during LSL5 coffee scene =>
SCI: LSL5: Timed message skipped during LSL5 coffee scene (symptom of
a bigger problem?)
Old description:
> This one was a fluke...
>
> 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
>
> "Yes, I know" you offer proudly, "I'm the Chief Tape Rewinder and
> Sterilizer on this project!"
>
> 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:
>
> {{{
> (22
> (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!"
> )
> (23
> (= ticks 30)
> )
> }}}
>
> 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?
>
> 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?
New description:
(Description updated after discussion below.)
During 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:
"Yes, I know" you offer proudly, "I'm the Chief Tape Rewinder and
Sterilizer on this project!"
This 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.
The 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:
{{{
(if (> (GetTime) ticks)
(self dispose: disposeWhenDone)
(return)
)
}}}
What 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`.
I 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.
I 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.
I'm more worried about what other things may potentially be affected,
though.
--
--
Ticket URL: <https://bugs.scummvm.org/ticket/15303#comment:19>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM
More information about the Scummvm-tracker
mailing list