(include "sci.sh")
(use "Main")
(use "SQRoom")
(use "n958")
(use "Cycle")
(use "PicView")
(use "Obj")
(script 20)


(local
    local0

)
(instance public rm020 of SQRoom
    (properties
        picture 20
        style 30
    )

    (method (init)
        (var temp0[50])
        proc958_0(128 20 21)
        (super:init())
        (self:setRegions(707))
        (switch (global12)
            (case 15
                (tr:
                    view(21)
                    setLoop(0)
                    cel(0)
                    posn(237 94)
                    setCycle(Walk)
                    init()
                )
                (roger:
                    view(21)
                    setLoop(2)
                    cel(0)
                    posn(254 91)
                    setCycle(Walk)
                    init()
                )
                (self:setScript(firstTimeScript))
            )
            (default 
                (roger:
                    view(20)
                    setLoop(5)
                    setCel(0)
                    posn(174 111)
                    init()
                )
                (tr:
                    view(20)
                    setLoop(0)
                    cel(0)
                    posn(195 116)
                    init()
                )
                (self:setScript(ripScript))
            )
        )
    )

)
(instance ripScript of Script
    (properties)

    (method (doit param1)
        (super:doit(rest param1))
        (if (== state 8)
            (roger:x((- (roger:x) register)))
            ++register
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = seconds 2
            )
            (case 1
                = local0 proc0_12("\"We've got to do this\nfast! Shield your eyes!\"" 67 60 15 70 260 28 global135 29 global129 30 1)
                = seconds 3
            )
            (case 2
                (send gLongSong2:
                    number(121)
                    loop(1)
                    vol(127)
                    play()
                )
                (roger:setCycle(End))
                (tr:
                    setPri(+ (roger:priority) 1)
                    setCycle(End self)
                )
            )
            (case 3
                proc0_12(local0)
                (tr:
                    setLoop(1)
                    cel(0)
                    setCycle(End self)
                )
                (send gLongSong2:
                    number(821)
                    play()
                )
                (rip:
                    init()
                    cycleSpeed(0)
                    setCycle(Fwd)
                )
            )
            (case 4
                (tr:stopUpd())
                (roger:stopUpd())
                = seconds 3
            )
            (case 5
                proc0_12("\"Jump into the Time Rip! Do it NOW! You've got to! If I take the time to explain we're both parking lot pizza! You'll understand soon!\"" 67 30 15 70 280 28 global135 29 global129 30 1)
                (send gLongSong2:
                    number(822)
                    play()
                )
                (rip:
                    setLoop(3)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 6
                (rip:
                    setLoop(4)
                    setCel(0)
                    setCycle(Fwd)
                )
                = seconds 4
            )
            (case 7
                (roger:
                    setLoop(6)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 8
                (rip:setPri(11))
                (roger:
                    setPri(12)
                    setStep(7 1)
                    setMotion(MoveTo 105 115 self)
                )
            )
            (case 9
                (rip:
                    setLoop(3)
                    cel(16)
                    setCycle(Beg self)
                )
            )
            (case 10
                (send gLongSong2:fade())
                (rip:dispose())
                = cycles 3
            )
            (case 11
                (send global2:newRoom(
                    (if (== global12 19)
                        21
                    )(else
                        19
                    )
))
            )
        )
    )

)
(instance firstTimeScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (tr:setMotion(MoveTo 196 110 self))
                (roger:setMotion(MoveTo 174 113 self))
            )
            (case 1
                (tr:
                    view(5)
                    setLoop(4)
                    posn(196 108)
                )
            )
            (case 2
                (roger:
                    view(20)
                    setLoop(5)
                    setCel(0)
                    posn(174 111)
                )
                = cycles 2
            )
            (case 3
                (send global2:newRoom(19))
            )
        )
    )

)
(instance tr of Actor
    (properties
        view 21
        priority 11
        signal 16400
        xStep 4
    )
)
(instance roger of Actor
    (properties
        priority 12
        signal 16
        illegalBits 0
        xStep 4
    )
)
(instance rip of Prop
    (properties
        x 122
        y 92
        view 20
        loop 2
        priority 14
        signal 16
    )
)
