(version 2)
(include "sci.sh")
(exports
    0 rm031
)
(use "Main")
(use "Sound")
(use "Cycle")
(use "Game")
(use "TheMenuBar")
(use "Feature")
(use "Obj")
(script 31)


(local
    local0
    local1
    local2[2]

)
(instance public rm031 of Rm
    (properties)

    (method (init)
        (var temp0[50])
        (self:picture(31))
        = global17 0
        proc0_2()
        = global159 1
        (TheMenuBar:hide())
        (SL:disable())
        Load(128 54)
        (if (not global151)
            Load(128 58)
            Load(128 60)
            Load(129 30)
            Load(132 10)
            Load(132 80)
        )
        Load(132 9)
        Load(132 79)
        (super:init())
        (ship:init())
        (self:setScript(shipScript))
    )

)
(instance shipScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = cycles 5
            )
            (case 1
                (ship:setMotion(MoveTo 164 110 self))
                (send gLongSong:
                    number(9)
                    play()
                )
            )
            (case 2
                (ship:
                    cycleSpeed(
                        (if (<> global209 6)
                            2
                        )(else
                            0
                        )
)
                    setCycle(End self)
                )
            )
            (case 3
                (if (== global209 6)
                    (ship:
                        cel(0)
                        setLoop(1)
                        setCycle(End self)
                    )
                    (hit:
                        number(79)
                        play()
                    )
                )(else
                    = cycles 2
                )
                (send gLongSong:stop())
            )
            (case 4
                = seconds 2
                (hit:stop())
            )
            (case 5
                (if (not global151)
                    (send gLongSong:
                        number(10)
                        play()
                    )
                    = seconds 3
                )(else
                    (send gLongSong:fade())
                    (send global2:newRoom(14))
                )
            )
            (case 6
                (termShip:
                    setLoop(0)
                    init()
                )
                (send global2:setScript(termScript))
            )
        )
    )

)
(instance termScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if (not global151)
                    (termShip:setCycle(End self))
                )(else
                    (self:changeState(4))
                )
            )
            (case 1
                (if (< (termShip:loop) 6)
                    (termShip:
                        cel(0)
                        setLoop(+ (termShip:loop) 1)
                    )
                    (self:changeState((- state 1)))
                )(else
                    = global151 1
                    (termShip:setCycle(Fwd))
                    = seconds 3
                )
            )
            (case 2
                (send global2:setScript(rm30Script))
            )
            (case 3
                (termShip:
                    setCycle(0)
                    setMotion(MoveTo 158 142 self)
                )
            )
            (case 4
                = cycles 3
            )
            (case 5
                (termShip:setMotion(MoveTo (termShip:x) (- (termShip:y) 20) self))
            )
            (case 6
                (termShip:
                    cel(0)
                    setLoop(7)
                    setCycle(End self)
                )
            )
            (case 7
                (termShip:
                    cel(0)
                    setLoop(8)
                    setCycle(End self)
                )
                (hit:
                    number(80)
                    play()
                )
                (send gLongSong:stop())
            )
            (case 8
                = seconds 2
            )
            (case 9
                (send global2:newRoom(14))
            )
        )
    )

)
(instance rm30Script of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (ship:dispose())
                (termShip:dispose())
                (send global2:drawPic(30))
                (mouth:init())
                (starBar:
                    init()
                    stopUpd()
                )
                = cycles 2
            )
            (case 1
                = seconds 3
            )
            (case 2
                = local0 Display("...DEMRIFNOC YTITNEDI" 105 601 106 115 102 10 101 1 100 116 35 107)
                = seconds 3
            )
            (case 3
                = local1 Display("OCLIW REGOR\n:218UO ESAC" 105 601 106 115 102 10 100 116 45 101 1 107)
                = seconds 4
            )
            (case 4
                Display(31 0 108 local0)
                Display(31 0 108 local1)
                = cycles 5
            )
            (case 5
                = local0 Display("ROF DETNAW OCLIW\nDUARF ENIHCAM GNIDNEV\n\n:FFITNIALP\n.OC YTLEVON DIOZAPPIG " 105 601 106 115 102 10 101 1 100 116 35 107)
                = seconds 5
            )
            (case 6
                Display(31 0 108 local0)
                = cycles 5
            )
            (case 7
                = local0 Display(":TNEMEGDUJ" 105 601 106 115 102 10 100 122 38 101 1 107)
                = seconds 2
            )
            (case 8
                = cycles 10
            )
            (case 9
                (termText:
                    init()
                    setCycle(End self)
                )
            )
            (case 10
                (termText:
                    setLoop(2)
                    cel(0)
                    setCycle(Fwd)
                )
                = seconds 2
            )
            (case 11
                (mouth:setMotion(MoveTo 162 190 self))
            )
            (case 12
                = seconds 2
            )
            (case 13
                (mouth:stopUpd())
                (starBar:setMotion(MoveTo (- (starBar:x) 40) (starBar:y) self))
            )
            (case 14
                (mouth:dispose())
                (starBar:dispose())
                (termText:dispose())
                Display(31 0 108 local0)
                (send global2:drawPic(31))
                (termShip:
                    setLoop(6)
                    setCel(0)
                    init()
                )
                = cycles 2
            )
            (case 15
                (send global2:setScript(termScript))
            )
        )
    )

)
(instance ship of Act
    (properties)

    (method (init)
        (super:init())
        (self:
            view(54)
            setLoop(0)
            setCel(0)
            posn(164 179)
            setStep(1 1)
            ignoreActors(1)
            illegalBits(0)
            setCycle(0)
        )
    )

)
(instance termShip of Act
    (properties)

    (method (init)
        (super:init())
        (self:
            view(60)
            cel(0)
            posn(158 152)
            setStep(1 1)
            ignoreActors(1)
            illegalBits(0)
            setCycle(0)
        )
    )

)
(instance mouth of Act
    (properties)

    (method (init)
        (super:init())
        (self:
            view(58)
            setLoop(0)
            posn(162 174)
            setStep(1 4)
            ignoreActors(1)
            illegalBits(0)
            stopUpd()
        )
    )

)
(instance starBar of Act
    (properties)

    (method (init)
        (super:init())
        (self:
            view(58)
            setLoop(3)
            posn(193 74)
            setPri(4)
            setStep(2 1)
            ignoreActors(1)
            setCycle(0)
        )
    )

)
(instance termText of Prop
    (properties)

    (method (init)
        (super:init())
        (self:
            view(58)
            setLoop(1)
            setCel(0)
            posn(179 58)
            setPri(10)
            ignoreActors(1)
        )
    )

)
(instance hit of Sound
    (properties
        priority 5
    )
)
