(include "sci.sh")
(use "Main")
(use "SQRoom")
(use "MCyc")
(use "Sound")
(use "Cycle")
(use "PicView")
(use "Obj")
(script 59)


(local
    local0[65] = (0 0 125 94 0 0 125 93 0 0 125 94 0 0 124 94 0 0 125 94 0 0 125 93 0 0 126 94 0 0 125 94 0 0 125 95 0 0 125 94 0 0 126 94 0 0 125 94 0 0 125 93 0 0 125 94 0 0 124 94 0 0 125 94 32768 )

)
(instance public rm059 of SQRoom
    (properties
        picture 59
        style 30
    )

    (method (init)
        (var temp0[50])
        proc0_2()
        Load(rsVIEW 22)
        Load(rsSOUND 110)
        Load(rsSCRIPT 942)
        (super:init())
        (self:setScript(rmScript))
        (shipBlast:init())
        (switch (gWest)
            (case 72
                (ship:
                    posn(126 256)
                    init()
                )
            )
            (default 
                (ship:
                    x(29)
                    y(65531)
                    init()
                )
            )
        )
    )

)
(instance rmScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = cycles 1
            )
            (case 1
                proc0_14(12)
                (if (<> gWest 72)
                    (send gLongSong:
                        number(801)
                        loop(-1)
                        vol(127)
                        flags(1)
                        playBed()
                    )
                    (shipBlast:
                        number(109)
                        loop(-1)
                        vol(127)
                        play()
                    )
                )
                = cycles 1
            )
            (case 2
                (ship:setMotion(MoveTo 126 94 self))
            )
            (case 3
                (ship:setCycle(MCyc @local0 self))
            )
            (case 4
                (if (== gWest 72)
                    (ship:setCycle(MCyc @local0 self))
                )(else
                    (self:cue())
                )
            )
            (case 5
                (if (== gWest 72)
                    (send gEgo:view(0))
                )
                (shipBlast:
                    number(110)
                    loop(1)
                    flags(1)
                    play()
                )
                (ship:
                    cycleSpeed(0)
                    setCycle(End)
                    setMotion(MoveTo 150 193 self)
                )
            )
            (case 6
                (shipBlast:stop())
                (if (== gWest 72)
                    (send global2:newRoom(119))
                )(else
                    (send global2:newRoom(60))
                )
            )
        )
    )

)
(instance ship of Actor
    (properties
        yStep 3
        view 22
        signal 8192
        cycleSpeed 1
    )
)
(instance shipBlast of Sound
    (properties)
)
