| 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 |
(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
)
)(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.")
)
)Start of IntroScript.
End of Init.
Oops!
(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.
What happens if you make rm104 go to a different room (e.g. not 110)... does it crash then?Going from 104 to 102 (random pick) instead of rm110 gives exactly the same results: changeState case 0 runs, init completes, and it crashes. DebugPrint calls in places matching rm110's confirm it.
(method (init)
SetPort(0 0 200 320 0 0)
(if (gDialog) (send gDialog:dispose()) )
(super:init())
//important lines to make handleEvent work
(send gOldMH:addToFront(self))
(send gOldKH:addToFront(self))
//...
)
(method (dispose param1)
//...
(send gOldKH:delete(self))
(send gOldMH:delete(self))
(super:dispose(rest param1))
)
(method (handleEvent pEvent)
(if ((send pEvent:type))
(send pEvent:claimed(1))
(send gGame:newRoom([wherever]))
)
)Okay, so that worked. For no good reason at all, I then made rm103 skip to rm104 instead, and added the same stuff to rm104 to make it skip to rm110 in turn.Do you really need that many rooms for your introduction sequence or would things get too cluttered (or hard on memory/heap?) by combining a couple into one script?It's mostly for the sake of keeping track of things, yeah.