(include "sci.sh")
(use "Main")
(use "SQRoom")
(use "MCyc")
(use "Sound")
(use "User")
(use "PicView")
(use "Obj")
(script 355)


(local
    local0
    local1[287] = (1 0 184 187 1 0 184 181 1 0 184 175 1 0 184 169 1 0 184 163 1 0 184 157 1 0 184 151 1 0 184 145 1 0 184 139 1 0 184 133 1 0 184 127 1 0 184 121 1 0 184 115 1 0 184 109 1 0 184 103 1 0 184 97 1 0 184 91 1 0 184 85 1 0 184 79 1 0 184 73 1 0 184 67 1 0 184 61 1 0 184 55 1 0 184 49 1 0 184 43 1 0 184 37 1 0 184 31 1 0 184 25 1 0 184 19 1 0 184 13 1 0 184 7 1 0 184 1 1 0 184 65531 1 0 184 65526 1 0 184 65516 1 0 184 65506 0 0 65436 65436 32768 0 0 111 20 0 0 108 20 0 0 105 20 0 0 102 20 0 0 99 20 0 0 96 20 0 0 93 20 0 0 90 20 0 0 87 20 0 0 84 20 0 0 81 20 0 0 78 20 0 0 75 20 0 0 72 20 0 0 69 20 0 0 66 20 0 0 62 20 32768 0 1 146 20 0 1 150 20 0 1 154 20 0 1 158 20 0 1 163 20 0 1 168 20 0 1 173 20 0 1 179 20 0 1 182 20 0 1 189 20 0 1 191 20 0 1 194 20 0 1 197 20 0 1 200 20 0 1 203 20 0 1 206 20 0 1 210 20 32768 )

)
(class mdlScript of Script
    (properties
        client 0
        state -1
        start 0
        timer 0
        cycles 0
        seconds 0
        lastSeconds 0
        register 0
        script 0
        caller 0
        next 0
    )

    (method (doit)
        (super:doit())
        (if (local0 and proc999_5((send ((User:curEvent)):type) 1 4))
            proc0_12(local0)
            = local0 (= seconds 0)
            = cycles 1
        )
    )

)
(instance public rm355 of SQRoom
    (properties
        picture 355
    )

    (method (init)
        (var temp0[50])
        proc0_2()
        Load(rsVIEW 355)
        (super:init())
        (door0:init())
        (door1:init())
        (carSFX:init())
        (send gLongSong:
            number(355)
            vol(127)
            loop(-1)
            flags(1)
            playBed()
        )
        (self:setScript(rmScript))
    )

)
(instance rmScript of mdlScript
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (carSFX:play())
                (ship:
                    init()
                    setCycle(MCyc @local1)
                )
                = cycles 1
            )
            (case 1
                (door0:setCycle(MCyc @local65430))
                (door1:setCycle(MCyc @local65499 self))
            )
            (case 2
                = cycles 14
            )
            (case 3
                (carSFX:fade())
                (door0:setCycle(MCyc @local65430 -1))
                (door1:setCycle(MCyc @local65499 self -1))
            )
            (case 4
                (send gLongSong:fade())
                (send gCast:eachElementDo(156))
                (send global2:drawPic(803 6))
                = seconds 2
            )
            (case 5
                (door0:dispose())
                (door1:dispose())
                = cycles 1
            )
            (case 6
                proc0_14(12)
                (send global2:drawPic(119 7))
                = cycles 1
            )
            (case 7
                (send gLongSong:
                    number(48)
                    loop(1)
                    vol(127)
                    playBed()
                )
                = local0 proc0_12("Meanwhile...back in Space Quest ." 67 20 140 28 global137 29 gColor 30 1 70 275)
                = seconds 15
            )
            (case 8
                Display(355 0 108 local0)
                = cycles 1
            )
            (case 9
                (send global2:newRoom(153))
            )
        )
    )

)
(instance carSFX of Sound
    (properties
        number 109
        loop -1
    )
)
(instance door0 of Prop
    (properties
        x 111
        y 20
        view 355
        priority 4
        signal 26640
    )

    (method (cue)
        (super:cue())
        (self:hide())
    )

)
(instance door1 of Prop
    (properties
        x 146
        y 20
        view 355
        cel 1
        priority 4
        signal 26640
    )

    (method (cue)
        (super:cue())
        (self:hide())
    )

)
(instance ship of Actor
    (properties
        x 138
        y 197
        yStep 5
        view 355
        loop 1
        priority 5
        signal 14352
        xStep 5
    )
)
