(include "sci.sh")
(use "Main")
(use "SQRoom")
(use "RandCycle")
(use "ForwardCounter")
(use "Sound")
(use "Cycle")
(use "PicView")
(use "Obj")
(script 17)


(local
    local0

)
(instance public rm017 of SQRoom
    (properties
        picture 17
    )

    (method (init)
        (var temp0[50])
        proc0_2()
        Load(rsVIEW 6)
        Load(rsVIEW 12)
        (super:init())
        (rogHead:init())
        (spArm:init())
        (self:
            setScript(rmScript)
            setRegions(707)
        )
    )

)
(instance rmScript of Script
    (properties)

    (method (doit)
        (super:doit())
        (if ((== (send gLongSong:prevSignal) 10) and (== state 1))
            (self:cue())
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gLongSong:
                    number(22)
                    loop(-1)
                    vol(127)
                    play()
                )
                = seconds 3
            )
            (case 1
                (spArm:setCel(1))
            )
            (case 2
                (static:
                    init()
                    play()
                )
                (vohaulHolo:
                    init()
                    setCycle(End self)
                )
            )
            (case 3
                (rogHead:setCel(2))
                (vohaulHolo:
                    setLoop(1)
                    cel(0)
                    setCycle(Fwd)
                )
                = seconds 3
            )
            (case 4
                = cycles 10
            )
            (case 5
                (vohaulHolo:
                    setLoop(2)
                    cel(0)
                    setCycle(RandCycle 50 self)
                )
                = local0 proc0_12("\"Hello, Roger Wilco. Surprised to see an old friend? You have no idea how special this moment is for me. This is no chance encounter I can assure you.\"" 67 100 15 70 218 28 global136 29 gColor 30 1 33 68)
            )
            (case 6
                (vohaulHolo:
                    setLoop(1)
                    cel(0)
                    setCycle(Fwd)
                )
                = seconds 5
            )
            (case 7
                (rogHead:setCel(1))
                proc0_12(local0)
                Animate((send gCast:elements) 0)
                = local0 proc0_12("\"I have this one loose end to tie-up before I begin my reign as The Supreme Being of All That Exists.\"" 67 100 15 70 218 28 global136 29 gColor 30 1 33 68)
                (vohaulHolo:
                    setLoop(2)
                    cel(0)
                    setCycle(RandCycle 50 self)
                )
            )
            (case 8
                (vohaulHolo:
                    setLoop(1)
                    cel(0)
                    setCycle(Fwd)
                )
                = seconds 5
            )
            (case 9
                proc0_12(local0)
                Animate((send gCast:elements) 0)
                = local0 proc0_12("\"I DO NOT LIKE TO LOSE. You are a blemish on what would otherwise be a perfect record of domination, terror, and invincibility. Besides, I'm still a bit miffed about that asteroid deal in Space Quest II." 67 100 15 70 218 28 global136 29 gColor 30 1 33 68)
                (vohaulHolo:
                    setLoop(2)
                    cel(0)
                    setCycle(RandCycle 50 self)
                )
            )
            (case 10
                (vohaulHolo:
                    setLoop(1)
                    cel(0)
                    setCycle(Fwd)
                )
                = seconds 7
            )
            (case 11
                proc0_12(local0)
                Animate((send gCast:elements) 0)
                = local0 proc0_12("\"Anyway, to relieve the pain of my humiliation, and to prevent you from being a pain in my... future, YOU MUST DIE. My charges will take care of the messy details. It's been nice seeing you one last time. Men, do the dirty deed!\"" 67 100 15 70 218 28 global136 29 gColor 30 1 33 68)
                (vohaulHolo:
                    setLoop(2)
                    cel(0)
                    setCycle(ForwardCounter 15 self)
                )
            )
            (case 12
                (vohaulHolo:
                    setLoop(1)
                    cel(0)
                    setCycle(Fwd)
                )
                = seconds 7
            )
            (case 13
                proc0_12(local0)
                (vohaulHolo:
                    setLoop(0)
                    setCel(16)
                    setCycle(Beg self)
                )
            )
            (case 14
                (static:dispose())
                (vohaulHolo:dispose())
                = seconds 2
            )
            (case 15
                (spArm:setCel(0))
                Animate((send gCast:elements) 0)
                (send global2:newRoom(15))
            )
        )
    )

)
(instance spArm of Prop
    (properties
        x 223
        y 109
        view 12
    )
)
(instance rogHead of Prop
    (properties
        x 61
        y 129
        view 12
        loop 1
        priority 14
        signal 16
    )
)
(instance vohaulHolo of Prop
    (properties
        x 173
        y 91
        view 6
        signal 16384
    )
)
(instance static of Sound
    (properties
        number 111
        loop -1
    )
)
