I have in my project:
rm100 | Title screen |
rm102 | Rating selection and question list |
rm103 | Introduction cutscene |
rm104 | Credits and exposition cutscene |
rm110 | The first playable room that helped find that polygon bug |
Normal progression is 100-102-103-104-110. I mean to put a skip feature in there but there's another problem.
I can newRoom(110) from any one of these, except for 104. Calling gGame:newRoom(110) from any point in rm104 causes an Oops error in Sierra SCI, yet passes with no issue in ScummVM.
rm104.sc:
(version 2)
(include "sci.sh")
(include "Verbs.sh")
(include "0.shm")
(exports
0 rm104
)
(use "Main")
(use "Controls")
(use "Print")
(use "Cycle")
(use "Game")
(use "View")
(use "DebugOut")
(use "Obj")
(script 104)
(local
creditNum
captionNum
timer
textBuffer[200]
)
(define CREDITS 5)
(define CAPTIONS 2) //Should be 11 but we stop early for testing
(instance public rm104 of Rm
(properties
picture 104
)
(method (init)
SetPort(0 0 200 320 0 0)
//(if (gDialog) (send gDialog:dispose()) )
(super:init())
(send gGame:handsOff())
//(send gSq5IconBar:hide() disable())
//(send gUser:
// canControl(TRUE)
// canInput(TRUE)
//)
(aRoad:init() setCycle(Fwd) setPri(4))
(aCar:init())
= creditNum 0
= captionNum 0
= timer 0
(self:setScript(rmScript))
)
(method (dispose param1)
SetPort(0 0 190 320 10 0)
//(send gSq5IconBar:hide() enable())
//= gCursor 999
//(send gGame:setCursor(996 1))
(super:dispose(rest param1))
)
)
(instance rmScript of Script
(properties)
(method (changeState newState)
(switch (= state newState)
(case 0
//(send gSq5Music1: number(1001) loop(1) play())
= seconds 4
)
(case 1
++timer
(if (== timer 2)
++creditNum
= timer 0
(if (< creditNum CREDITS)
Message(msgGET 104 0 0 0 creditNum @textBuffer)
Display(@textBuffer dsCOORD 8 48 dsCOLOR 7 dsBACKGROUND 0 dsWIDTH 168 dsFONT 0 dsALIGN alCENTER)
)
)
++captionNum
(if (< captionNum CAPTIONS)
Message(msgGET 104 1 0 0 captionNum @textBuffer)
DebugPrint("Caption: %s" @textBuffer)
Display(@textBuffer dsCOORD 8 160 dsCOLOR 7 dsBACKGROUND 0 dsWIDTH 304 dsFONT 7 dsALIGN alCENTER)
--state
)
= seconds 6
)
(case 2
(aCar:setMotion(MoveTo 350 102 self))
)
(case 3
//Play crash
//(send gSq5Music1: number(1001) loop(1) play(self))
= seconds 2
)
(case 4
(send gGame:newRoom(110))
)
)
)
)
(instance aCar of Actor
(properties
view 104
x 240
y 102
)
)
(instance aRoad of Prop
(properties
view 104
loop 1
x 184
y 111
)
)
Excerpt from rm110.sc, which works fine if not coming from rm104:
(instance public rm110 of Rm
(properties
picture 110
style (| dpANIMATION_BLACKOUT dpOPEN_FADEPALETTE)
horizon 50
vanishingX 130
vanishingY 50
east 120
noun N_ROOM
)
(method (init)
//AddPolygonsToRoom(@P_Default110) //commented out for ScummVM's sake
(super:init())
SetUpEgo()
(switch (gPreviousRoomNumber)
(case east
(send gEgo: posn(150 180) loop(3))
)
(default
(send gEgo: posn(150 130) loop(1))
)
)
(send gEgo:init())
(aPuddle:init())
(aCar:init())
(send gGame:handsOn())
(if (not (== (send gSq5Music1: number) scriptNumber))
(send gSq5Music1: number(scriptNumber) loop(-1) play())
)
(if (not Btest(fDayOneStart))
Bset(fDayOneStart)
(send gEgo:get(0 1)) //Give keys and manuscript
(self:setScript(IntroScript))
)(else
(self:setScript(RoomScript))
)
DebugPrint("End of Init.")
)
)
There's a DebugPrint in the first and last case of IntroScript, and one in the first case of RoomScript.
Start of IntroScript.
End of Init.
Oops!
Strangely, skipping the entire script in rm104 like this
(aRoad:init() setCycle(Fwd) setPri(4))
(aCar:init())
= creditNum 0
= captionNum 0
= timer 0
//(self:setScript(rmScript))
(send gGame:newRoom(110))
)
yields no crash at all -- it flashes an empty road for as long as the transitions take, and the game begins just fine:
Start of IntroScript.
End of Init.
End of IntroScript.
Switched to RoomScript.
And again, the crash does not happen at all in ScummVM -- only in Sierra SCI.