Author Topic: LSL5 endgame bug  (Read 1104 times)

0 Members and 1 Guest are viewing this topic.

Offline miracle.flame

LSL5 endgame bug
« on: July 21, 2024, 09:32:26 AM »
Another weekend another bug. I have my hopes high for this community's success rate is remarkable. We are actually considering putting SCIprogramming.com forum and some nicknames in the credits of the localization.

The game crashes right when these lines appear at the end of scene
"Suddenly,
a westbound flight
heads South!"



Through DosBox it also crashes at that point but with the brave in-game


It's script 380 causing the crash and I suspect it has to do with this snippet
Code: [Select]
(DrawPic 1 100)
(gLongSong2 stop:)
(Display ; "Suddenly, a westbound flight heads South!"
380
44
dsALIGN
alCENTER
dsCOLOR
global131
dsFONT
global175
dsWIDTH
318
dsCOORD
1
82
)
(= cycles 2)
)
(49
(gNumber newRoom: 385)

I've tried to "fix" it like
Code: [Select]
(Display ; "Suddenly, a westbound flight heads South!"
380 44
dsALIGN 1
alCENTER
dsCOLOR global131
dsFONT global175
dsWIDTH 318
dsCOORD 1 82
)
...but it's still crashing with different output



Any ideas how to fix it better than me?





Offline Kawa

Re: LSL5 endgame bug
« Reply #1 on: July 21, 2024, 09:43:02 AM »
Your fix only made it worse: dsALIGN 1 alCENTER should be dsALIGN alCENTER. The al___ constants are arguments for dsALIGN. So the "unknown kDisplay argument" bit is easy.

Offline lskovlun

Re: LSL5 endgame bug
« Reply #2 on: July 21, 2024, 10:19:02 AM »
A backtrace, please? (command 'bt')

Offline miracle.flame

Re: LSL5 endgame bug
« Reply #3 on: July 21, 2024, 11:34:59 AM »
Code: [Select]
[lsl5-fallback-1.000 380 sCartoon::changeState @ 0720]: lookupSelector: Attempt to send to non-object or invalid script. Address 0000:017c!
Debugger started, type 'exit' to return to the game.
Type 'help' to see a little list of commands and variables.
ERROR: [lsl5-fallback-1.000 380 sCartoon::changeState @ 0720]: lookupSelector: Attempt to send to non-object or invalid script. Address 0000:017c!


Call stack (current base: 0x0):
 0: script 994 - LSL5::replay()
     obj@0001:1de0 pc=000b:036c sp=ST:0000 fp=ST:0000 argp:ST:0001
 1: script 0 - LSL5::doit()
     by 0 obj@0001:1de0 pc=0001:0ac4 sp=ST:0002 fp=ST:0002 argp:ST:0001
 2: script 994 - Game::doit()
     by 1 obj@0001:1de0 pc=000b:023d sp=ST:0006 fp=ST:0004 argp:ST:0003
 3: script 999 - regions::eachElementDo(0000:003c)
     by 2 obj@000b:0fbc pc=0004:0325 sp=ST:000c fp=ST:0009 argp:ST:0007
 4: script 18 - rm380::doit()
     by 3 obj@004e:074e pc=0014:0234 sp=ST:000f fp=ST:000e argp:ST:000d
 5: script 999 - sCartoon::doit()
     by 4 obj@004e:0790 pc=0004:06b5 sp=ST:0012 fp=ST:0011 argp:ST:0010
 6: script 999 - sCartoon::cue()
     by 5 obj@004e:0790 pc=0004:07f4 sp=ST:0014 fp=ST:0014 argp:ST:0013
 7: script 380 - sCartoon::changeState(0000:0031)
     by 6 obj@004e:0790 pc=004e:071e sp=ST:001b fp=ST:0017 argp:ST:0015

Offline miracle.flame

Re: LSL5 endgame bug
« Reply #4 on: July 21, 2024, 12:04:21 PM »
Alright, now that I've been through commits history a few details snapped in.

The code we're talking about is actually not the one SCIC decompiled - that one works actually.

This seems to be sluicebox's script refactored by Doomlazer to fit decompiled variable names.

Actually I'm good now I guess if you don't feel like hunting the bug for whatever reason.

Offline doomlazer

Re: LSL5 endgame bug
« Reply #5 on: July 21, 2024, 01:23:23 PM »
Looking at my 380.sc from that thread you linked it might be the newRoom command crashing the game. First fix your display command as Kawa mentioned:

Code: [Select]
(48
(DrawPic 1 100)
(gLongSong2 stop:)
(Display ; "Suddenly, a westbound flight heads South!"
380 44
dsALIGN alCENTER
dsCOLOR global131
dsFONT global175
dsWIDTH 318
dsCOORD 1 82
)
(= cycles 2)
)

For some reason I have the following state using gNumber:

Code: [Select]
(49
(gNumber newRoom: 385)
)

When it should be global2 (or gCurRoom depending on your global names):

Code: [Select]
(49
(global2 newRoom: 385)
)

Offline lskovlun

Re: LSL5 endgame bug
« Reply #6 on: July 21, 2024, 03:03:46 PM »
It actually dies in state 49 (0x31) then... the one after the one containing that Display statement. As I suspected. But  state 49 consists of only that newRoom call, as doomlazer says. Yeah, it's crashing the game because a newRoom command is being sent to the current room number, instead of the current roomobject. Check your variable names.
« Last Edit: July 21, 2024, 03:07:06 PM by lskovlun »

Offline miracle.flame

Re: LSL5 endgame bug
« Reply #7 on: July 22, 2024, 06:03:56 AM »
True, it was this. Thank you for debugging, I actually prefer sluicebox's format over whatever the "pushi" one that comes from decompilation is called.


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.036 seconds with 23 queries.