Author Topic: LSL5 critical issue in decompiled scene 130 and 205  (Read 1264 times)

0 Members and 1 Guest are viewing this topic.

Offline miracle.flame

LSL5 critical issue in decompiled scene 130 and 205
« on: June 27, 2024, 02:32:29 PM »
Hello dear SCI champs,

as you may be aware I am collaborating on a project of localizing LSL5 and 6 and finally we've entered a testing phase. LSL5 is the case where source code has to be decompiled and quite a few strings translated within scripts for recompilation. Doomlazer was kind enough to provide some code fixes in this thread.

Anyway we've stumbled upon some initial issues that perform differently in DosBox and ScummVM. In DosBox in the intro scene 130 when Mr. Big says "I understand the problem, but I want a solution!" a scene transition with text "Six months later, and a continent away, another Board of Directors meets..." should be displayed but with recompiled scripts this remains a black screen. Same applies to scene 205 "Meanwhile, back in your limo... Meanwhile,
another East Coast Board Meeting takes place...". In ScummVM these scenes even crash the game with console output:
Code: [Select]
WARNING: Attempt to use invalid/unused file handle 65535!
WARNING: Attempt to use invalid/unused file handle 65535!
WARNING: Attempt to use invalid/unused file handle 65535!
WARNING: Attempt to use invalid/unused file handle 65535!
Unknown kDisplay argument (0000:0001) from method ::export 25 (room 130, script 0, localCall ffffffff)!
Debugger started, type 'exit' to return to the game.
Type 'help' to see a little list of commands and variables.
ERROR: Unknown kDisplay argument (0000:0001) from method ::export 25 (room 130, script 0, localCall ffffffff)!
that's for scene 130 only. I can provide output for 205 if needed.

Can you see an obvious cause (and fix) so that these scenes would display the intended text and proceed as intended?

I'll provide the scene 130 script below:
Code: [Select]
;;; Sierra Script 1.0 - (do not remove this comment)
(script# 130)
(include sci.sh)
(use Main)
(use LLRoom)
(use RTRandCycle)
(use n958)
(use Sound)
(use PicView)
(use Obj)

(public
rm130 0
)

(local
[local0 2]
local2
)
(instance rm130 of LLRoom
(properties
picture 130
)

(method (init)
(proc958_0 128 130 1130)
(proc958_0 132 130 140)
(proc0_2)
(cigar init: setPri: 15 addToPic:)
(vMouth init: setPri: 13 addToPic:)
(brow1 init: addToPic:)
(brow2 init: addToPic:)
(gAddToPics doit:)
(super init:)
(proc0_13 155)
(gLongSong number: 130 flags: 1 loop: 0 play:)
(self setScript: sCartoon)
(gLl5KDHandler add: sCartoon)
(gLl5MDHandler add: sCartoon)
)

(method (dispose)
(gLl5MDHandler delete: sCartoon)
(gLl5KDHandler delete: sCartoon)
(super dispose:)
(gLongSong fade: 0 15 12 1)
)
)

(instance vMouth of View
(properties
x 154
y 129
view 1130
)
)

(instance brow1 of View
(properties
x 127
y 53
view 130
)
)

(instance brow2 of View
(properties
x 179
y 55
view 130
loop 1
)
)

(instance cigar of View
(properties
x 201
y 104
view 130
loop 3
)
)

(instance officeHit of Sound
(properties
number 130
)
)

(instance Mr__Bigg of Talker
(properties
x -1
y 10
nsTop 79
nsLeft 111
view 1130
loop 3
priority 14
signal $0010
talkWidth 280
name "Pan Bigg"
)

(method (init)
(= mouth biggMouth)
(super init: &rest)
)

(method (doit)
(super doit:)
(if (not (mod (++ local2) 32)) (Palette 6 206 254 -1))
)

(method (show &tmp temp0)
(if (not underBits)
(= underBits
(Graph grSAVE_BOX nsTop nsLeft nsBottom nsRight 1)
)
)
(= temp0 (PicNotValid))
(PicNotValid 1)
(if bust
(DrawCel
(bust view?)
(bust loop?)
(bust cel?)
(+ (bust nsLeft?) nsLeft)
(+ (bust nsTop?) nsTop)
14
)
)
(if eyes
(DrawCel
(eyes view?)
(eyes loop?)
(eyes cel?)
(+ (eyes nsLeft?) nsLeft)
(+ (eyes nsTop?) nsTop)
14
)
)
(if mouth
(DrawCel
(mouth view?)
(mouth loop?)
(mouth cel?)
(+ (mouth nsLeft?) nsLeft)
(+ (mouth nsTop?) nsTop)
14
)
)
(DrawCel view loop cel nsLeft nsTop 10)
(Graph grUPDATE_BOX nsTop nsLeft nsBottom nsRight 1)
(PicNotValid temp0)
)

(method (cycle param1 &tmp temp0)
(if (and param1 (param1 cycler?))
(= temp0 (param1 cel?))
((param1 cycler?) doit:)
(if (!= temp0 (param1 cel?))
(DrawCel
(param1 view?)
(param1 loop?)
(param1 cel?)
(+ (param1 nsLeft?) nsLeft)
(+ (param1 nsTop?) nsTop)
14
)
(param1
nsRight:
(+
(param1 nsLeft?)
(CelWide (param1 view?) (param1 loop?) (param1 cel?))
)
)
(param1
nsBottom:
(+
(param1 nsTop?)
(CelHigh (param1 view?) (param1 loop?) (param1 cel?))
)
)
(Graph
grUPDATE_BOX
(+ (param1 nsTop?) nsTop)
(+ (param1 nsLeft?) nsLeft)
(+ (param1 nsBottom?) nsTop)
(+ (param1 nsRight?) nsLeft)
1
)
)
)
)
)

(instance biggMouth of Prop
(properties
view 1130
priority 14
signal $0010
cycleSpeed 10
)
)

(instance sCartoon of Script
(properties)

(method (changeState newState)
(switch (= state newState)
(0 (= cycles 2))
(1
(proc0_18 Mr__Bigg 130 0 108 139 self)
)
(2 (= seconds 3))
(3
(gIconBar disable:)
(DrawPic 1 -32762)
(= seconds 3)
)
(4
(gIconBar enable:)
(proc0_25 3 global128 130 1)
(= seconds 3)
)
(5 (global2 newRoom: 140))
)
)

(method (handleEvent pEvent &tmp [temp0 2])
(if
(and
(== (self state?) 4)
(or
(== (pEvent type?) evKEYBOARD)
(== (pEvent type?) evMOUSEBUTTON)
)
)
(pEvent claimed: 1)
(self changeState: 5)
)
)
)



Offline doomlazer

Re: LSL5 critical issue in decompiled scene 130 and 205
« Reply #1 on: June 28, 2024, 02:51:57 AM »
First guess is an issue with the sCartoon script state 4 line "(proc0_25 3 global128 130 1)".

Can you post your proc0_25 from the Main/0 script?

Offline Kawa

Re: LSL5 critical issue in decompiled scene 130 and 205
« Reply #2 on: June 28, 2024, 03:20:07 AM »
For reference, that's procedure (CenterDisplay lines color ...). Think of it as the SCI0 template game's title screen text display, but given the correct amount of lines it'll vertically center too. This is three lines in white, that's what global128 is.

Offline miracle.flame

Re: LSL5 critical issue in decompiled scene 130 and 205
« Reply #3 on: June 28, 2024, 10:58:09 AM »
I suppose it's this...?
Code: [Select]
(procedure (proc0_25 param1 param2 theRest &tmp temp0)
(if gTheNewDialog (gTheNewDialog dispose:))
(= temp0 (GetPort))
(SetPort 0)
(Display
&rest theRest
dsALIGN
dsCOLOR 1
param2
dsFONT
global175
dsWIDTH
318
dsCOORD
1
(- 89 (/ (* 14 param1) 2))
)
(SetPort temp0)
)

I recall this particular part was throwing errors upon immediate recompilation attempt of a decompiled resource so maybe I've messed it up.

Offline Kawa

Re: LSL5 critical issue in decompiled scene 130 and 205
« Reply #4 on: June 28, 2024, 12:12:44 PM »
That's exactly it, yeah. The only real difference is that the Companion compiler doesn't like a bare &rest, so theRest must be added... but I just tested it myself in my testing scratch game and it works fine, both with a local string and a Text resource tuple.

I see the mistake though: dsALIGN alCENTER. You're missing that bit. Here:
Code: [Select]
(Display
&rest theRest
dsALIGN alCENTER
dsCOLOR theColor
dsFONT global175
dsWIDTH 318
dsCOORD 1 (- 89 (/ (* 14 lines) 2))
)

Offline miracle.flame

Re: LSL5 critical issue in decompiled scene 130 and 205
« Reply #5 on: June 28, 2024, 12:35:23 PM »
I get 'Undeclared identifier' for TheColor and lines.

Offline doomlazer

Re: LSL5 critical issue in decompiled scene 130 and 205
« Reply #6 on: June 28, 2024, 12:46:20 PM »
I think you've got the "1' after dsCOLOR when it should be after dsALIGN.

The code Kawa posted would look like this for you:

Code: [Select]
(Display
&rest theRest
dsALIGN 1
dsCOLOR param2
dsFONT global175
dsWIDTH 318
dsCOORD 1 (- 89 (/ (* 14 param1) 2))
)

You're passing two values to dsCOLOR and no value to dsALIGN here:

Code: [Select]
&rest theRest
dsALIGN
dsCOLOR 1
param2
dsFONT

Offline miracle.flame

Re: LSL5 critical issue in decompiled scene 130 and 205
« Reply #7 on: June 28, 2024, 01:17:24 PM »
Splendid! This fixed it so the text is displayed in both DosBox and ScummVM with no crash.
Hopefully this also applies to 205 and other similar scenes.

Offline Kawa

Re: LSL5 critical issue in decompiled scene 130 and 205
« Reply #8 on: June 28, 2024, 01:40:50 PM »
If they call the same CenterPrint from Main, I see no reason for them to not work.


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

Page created in 0.046 seconds with 23 queries.