(include "sci.sh")
(use "Main")
(use "SQRoom")
(use "Osc")
(use "RandCycle")
(use "n958")
(use "Grooper")
(use "Cycle")
(use "PicView")
(use "Obj")
(script 16)


(local
    local0
    local1[6]
    local7
    theLoop
    theCel

)
(instance public rm016 of SQRoom
    (properties
        picture 16
    )

    (method (init)
        proc958_0(128 16 7)
        (super:init())
        (self:setRegions(707))
        (alien1:init())
        (alien2:init())
        (alien3:
            init()
            setScript(alienScript)
        )
        (lAnt:init())
        (rAnt:init())
        (rogHead:
            setScript(convScript)
            init()
        )
        (rogEyes:init())
        (rogMouth:init())
        (rHand:init())
        = local0 proc0_12("We join Roger as he relates one of his (greatly\nexaggerated) tales of adventure. The aliens are\nonly too happy to listen (as long as Roger is buying)." 67 1 160 70 320 28 global135 29 gColor 30 1 33 68)
    )

)
(instance alienScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (alien1:setCycle(Osc))
                = cycles Random(10 20)
            )
            (case 1
                (alien1:setCycle(0 1))
                = cycles Random(10 50)
            )
            (case 2
                (alien2:setCycle(Osc))
                = cycles Random(10 20)
            )
            (case 3
                (alien2:setCycle(0 1))
                = cycles Random(10 50)
            )
            (case 4
                (alien3:setCycle(Osc))
                = cycles Random(10 20)
            )
            (case 5
                (alien3:setCycle(0 1))
                = cycles Random(10 50)
            )
            (case 6
                (self:init())
            )
        )
    )

)
(instance convScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = cycles 1
            )
            (case 1
                (rogEyes:setCel(1))
                (send gLongSong:
                    vol(127)
                    changeState()
                )
                (send gLongSong2:
                    number(824)
                    loop(-1)
                    vol(127)
                    play()
                )
                (rogMouth:setCycle(RandCycle))
                (rHand:setCel(1))
                = seconds 2
            )
            (case 2
                (rogEyes:setCel(0))
                = local7 2
                (rogMouth:
                    setCycle(0)
                    setCel(0)
                )
                (rHand:setCel(0))
                = seconds 1
            )
            (case 3
                = local7 2
                = seconds 2
            )
            (case 4
                (rAnt:setCel(2))
                (lAnt:setCel(1))
                (rogEyes:setCel(1))
                = seconds 1
            )
            (case 5
                = local7 2
                (rAnt:setCel(0))
                (lAnt:setCel(0))
                (rogMouth:
                    setCycle(0)
                    setCycle(RandCycle)
                )
                (rHand:setCel(1))
                = seconds 1
            )
            (case 6
                (rogEyes:setCel(0))
                = seconds 2
            )
            (case 7
                = local7 2
                = seconds 1
            )
            (case 8
                (rogMouth:
                    setCycle(0)
                    setCel(0)
                )
                (if (not (send global2:script))
                    (send global2:setScript(spScript))
                )
                (self:init())
            )
        )
    )

)
(instance spScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                Animate((send gCast:elements) 0)
                (gunSp:
                    setCycle(Walk)
                    setLoop(Grooper)
                    init()
                    setMotion(MoveTo 189 87 self)
                )
                (doorSp:
                    setCycle(Walk)
                    setLoop(Grooper)
                    init()
                    setMotion(MoveTo 164 87)
                )
            )
            (case 1
                (doorSp:setHeading(180))
                (gunSp:setHeading(180))
                = seconds 2
            )
            (case 2
                (doorSp:setHeading(90))
                (gunSp:setHeading(270))
                = seconds 2
            )
            (case 3
                (gunSp:setHeading(180))
                = seconds 2
            )
            (case 4
                (doorSp:setHeading(180))
                = cycles 10
            )
            (case 5
                (gunSp:setHeading(90 self))
            )
            (case 6
                (gunSp:setMotion(MoveTo 330 87 self))
            )
            (case 7
                = seconds 4
            )
            (case 8
                proc0_12(local0)
                (gunSp:
                    view(16)
                    setLoop(6)
                    setCel(0)
                    setStep(10 1)
                    posn(377 161)
                    setPri(13)
                    setMotion(MoveTo 251 161 self)
                )
            )
            (case 9
                (gunSp:signal(32817))
                (rogHead:
                    setPri(15)
                    setScript(0)
                    setCel(0)
                    setLoop(0)
                    posn(132 84)
                )
                (rogMouth:
                    posn(132 84)
                    setCycle(0)
                    setLoop(3)
                    setCel(0)
                )
                (rHand:setCel(0))
                (rAnt:setCel(1))
                (lAnt:setCel(2))
                = local0 proc0_12("\"Are you Roger Wilco?\"" 67 95 15 70 120 28 global136 29 gColor 30 0 33 68)
                (spHead:
                    init()
                    setCycle(RandCycle)
                )
                = seconds 7
            )
            (case 10
                (spHead:
                    setCycle(0)
                    setCel(0)
                )
                proc0_12(local0)
                Animate((send gCast:elements) 0)
                = seconds 3
            )
            (case 11
                (rogMouth:
                    setCel(0)
                    setCycle(RandCycle 8)
                )
                = local0 proc0_12("\"Uh, yeah.\"" 67 45 15 70 160 28 global137 29 gColor 30 0 33 68)
                = seconds 7
            )
            (case 12
                (rogMouth:setCel(0))
                proc0_12(local0)
                Animate((send gCast:elements) 0)
                Animate((send gCast:elements) 0)
                (spHead:
                    init()
                    setCycle(RandCycle)
                )
                = local0 proc0_12("\"Please come with me.\"" 67 90 15 70 125 28 global136 29 gColor 30 -1 33 68)
                = seconds 5
            )
            (case 13
                (spHead:
                    setCycle(0)
                    setCel(0)
                )
                = seconds 3
            )
            (case 14
                proc0_12(local0)
                Animate((send gCast:elements) 0)
                Animate((send gCast:elements) 0)
                (send gLongSong:fade(80 15 10 0))
                (send gLongSong2:fade())
                (send global2:newRoom(15))
            )
        )
    )

)
(instance alien1 of Prop
    (properties
        x 69
        y 74
        description "alien."
        lookStr "It looks like a cross between a praying mantis and Richard Nixon."
        view 19
        priority 11
        signal 16
    )
)
(instance alien2 of Prop
    (properties
        x 187
        y 86
        description "alien."
        lookStr "Must be a duck billed planetpuss."
        view 19
        loop 1
        priority 11
        signal 16
    )
)
(instance alien3 of Prop
    (properties
        x 249
        y 82
        description "alien."
        lookStr "Hey, it's a gilled Thwarkian lambotraus! I havn't seen one of those in years!"
        view 19
        loop 2
        priority 11
        signal 16
    )
)
(instance lAnt of Prop
    (properties
        x 73
        y 146
        view 16
        loop 4
        cel 1
        priority 14
        signal 16
    )
)
(instance rAnt of Prop
    (properties
        x 250
        y 127
        view 16
        loop 5
        cel 1
        priority 14
        signal 16
    )
)
(instance rogHead of Prop
    (properties
        x 132
        y 85
        view 16
        cel 1
        priority 13
        signal 16400
    )
)
(instance rogEyes of View
    (properties
        x 134
        y 58
        view 16
        loop 8
        priority 14
        signal 16400
    )

    (method (doit param1)
        (super:doit(rest param1))
        (switch (local7)
            (case 1
                = loop theLoop
                = cel theCel
                --local7
            )
            (case 2
                = theLoop (rogEyes:loop)
                = theCel (rogEyes:cel)
                = loop 9
                = cel 1
                --local7
            )
        )
    )

)
(instance rogMouth of Prop
    (properties
        x 132
        y 82
        view 16
        loop 1
        cel 1
        priority 14
        signal 16400
    )
)
(instance rHand of Prop
    (properties
        x 135
        y 154
        view 16
        loop 2
        priority 14
        signal 16
    )
)
(instance gunSp of Actor
    (properties
        x 146
        y 50
        view 7
        cel 5
        signal 16400
    )
)
(instance doorSp of Actor
    (properties
        x 121
        y 51
        view 7
        cel 5
        signal 16400
    )
)
(instance spHead of Prop
    (properties
        x 234
        y 40
        view 16
        loop 7
        priority 15
        signal 16
    )
)
