(include "sci.sh")
(use "Main")
(use "ulence")
(use "SQRoom")
(use "Sound")
(use "Cycle")
(use "User")
(use "PicView")
(use "Obj")
(script 620)


(local
    local0
    local1
    local2
    local3
    local4[45] = (0 0 0 0 100 55 0 119 40 5 87 16 0 43 45 5 21 7 0 98 45 1 154 67 2 212 7 3 170 10 4 145 11 5 105 5 0 98 28 5 113 12 65535 142 13 )

)
(procedure (localproc_0828)
    Display(620 0 108 local2)
    Display(620 0 108 local1)
)


(procedure (localproc_0843)
    (var gIconBarCurIcon)
    (User:
        canControl(0)
        canInput(0)
    )
    = gIconBarCurIcon (send gIconBar:curIcon)
    (send gIconBar:disable(0 1 2 3 4 5 6 7))
    (send gIconBar:curIcon(gIconBarCurIcon))
    (send gGame:setCursor(global21 1))
)


(instance public rm620 of SQRoom
    (properties
        picture 620
    )

    (method (init)
        (ulence:roomVer(22791))
        Bset(15)
        (send gEgo:
            init()
            view(625)
            setLoop(3)
            normal(0)
            posn(100 55)
            setScript(flyScript)
            setPri(5)
            illegalBits(32768)
            ignoreActors(1)
            setStep(6 6)
        )
        (mono1:
            init()
            setCel(1)
            setPri(4)
        )
        (mono2:
            init()
            setPri(4)
        )
        (mono3:
            init()
            setPri(4)
            setScript(mono3Script)
        )
        (super:init())
        (self:setRegions(706))
        (if (<> gWest 615)
            (send gLongSong2:
                vol(85)
                number(804)
                loop(-1)
                playBed()
            )
        )
        Load(rsSOUND 881)
        Load(rsSOUND 882)
        (send gLongSong:flags(1))
        (send gLongSong2:flags(1))
    )

)
(instance mono3Script of Script
    (properties)

    (method (doit)
        (super:doit())
        (if ((== state 2) and (send ((User:curEvent)):type))
            = seconds 0
            = local0 1
            = cycles 1
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = cycles 2
            )
            (case 1
                localproc_0843()
                (if (local0)
                    = cycles 1
                )(else
                    = seconds Random(1 3)
                )
            )
            (case 2
                = local0 0
                (mono1:setCel(0))
                (mono3:setCycle(Fwd))
                ++register
                (switch (register)
                    (case 1
                        = local1 Display("\"Well, lookee here! If it ain't Mister\nLook-at-me-I'm-in-VGA.\"" 106 160 101 1 105 4 107 100 152 5 102 gColor)
                        = local2 Display("\"Well, lookee here! If it ain't Mister\nLook-at-me-I'm-in-VGA.\"" 106 160 101 1 105 4 107 100 153 5 102 gBack)
                    )
                    (case 2
                        = local1 Display("\"Whatsamatter, monochrome not\ngood enough for you?\"" 106 160 101 1 105 4 107 100 152 5 102 gColor)
                        = local2 Display("\"Whatsamatter, monochrome not\ngood enough for you?\"" 106 160 101 1 105 4 107 100 153 5 102 gBack)
                    )
                    (case 3
                        = local1 Display("\" What's dis? 256 colors all for one\n little bitmapped WIMP?! Whatta\nwaste of VGA. Har, har!\"" 106 160 101 1 105 4 107 100 152 5 102 gColor)
                        = local2 Display("\" What's dis? 256 colors all for one\n little bitmapped WIMP?! Whatta\nwaste of VGA. Har, har!\"" 106 160 101 1 105 4 107 100 153 5 102 gBack)
                    )
                    (case 4
                        = local1 Display("\"Hey, fellas! I bet I can toss\nhim all the way out from the\nbottom o' the stairs. Bet ya\nan ale.\"                        " 106 160 101 1 105 4 107 100 152 5 102 gColor)
                        = local2 Display("\"Hey, fellas! I bet I can toss\nhim all the way out from the\nbottom o' the stairs. Bet ya\nan ale.\"                        " 106 160 101 1 105 4 107 100 153 5 102 gBack)
                    )
                    (case 5
                        (mono3:
                            setScript(0)
                            setCycle(0)
                        )
                        (send gEgo:
                            setScript(0)
                            setMotion(0)
                        )
                        (send gLongSong2:fade(70 10 10 0))
                        (send global2:newRoom(610))
                    )
                )
                = seconds Random(5 10)
            )
            (case 3
                localproc_0828()
                (mono3:setCel(0))
                (if (not local3)
                    = local3 1
                )(else
                    (mono1:setCycle(Fwd))
                    = local3 0
                )
                (if (local0)
                    = cycles 1
                )(else
                    = seconds Random(1 3)
                )
            )
            (case 4
                (self:init())
            )
        )
    )

)
(instance mono1 of Prop
    (properties
        x 77
        y 53
        view 625
        loop 4
    )
)
(instance mono2 of Prop
    (properties
        x 143
        y 27
        view 625
        loop 1
    )
)
(instance mono3 of Prop
    (properties
        x 229
        y 50
        view 625
    )
)
(instance flyScript of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                = cycles 2
            )
            (case 1
                localproc_0843()
                (mono2:setCel(1))
                (send gEgo:setCycle(End self))
            )
            (case 2
                = cycles Random(10 20)
            )
            (case 3
                (send gEgo:setCycle(Beg self))
            )
            (case 4
                = cycles Random(5 10)
            )
            (case 5
                (mono2:setCel(0))
                (send gEgo:setCycle(End self))
            )
            (case 6
                = cycles Random(5 10)
            )
            (case 7
                (send gEgo:setCycle(Beg self))
            )
            (case 8
                (buzzSound:play())
                (send gEgo:setMotion(MoveTo 119 40 self))
            )
            (case 9
                (send gEgo:
                    setMotion(MoveTo 87 16 self)
                    setPri(3)
                )
            )
            (case 10
                (send gEgo:setMotion(MoveTo 43 45 self))
            )
            (case 11
                (mono2:setCel(5))
                (send gEgo:setMotion(MoveTo 21 7 self))
            )
            (case 12
                (send gEgo:
                    setMotion(MoveTo 98 45 self)
                    setPri(5)
                )
            )
            (case 13
                (mono2:setCel(1))
                (send gEgo:setMotion(MoveTo 154 67 self))
            )
            (case 14
                (send gEgo:setMotion(MoveTo 212 7 self))
            )
            (case 15
                (send gEgo:setMotion(MoveTo 170 10 self))
            )
            (case 16
                (mono2:setCycle(CT 3 1))
                (send gEgo:setMotion(MoveTo 145 11 self))
            )
            (case 17
                (send gEgo:setMotion(MoveTo 105 5 self))
            )
            (case 18
                (mono2:setCel(0))
                (send gEgo:setMotion(MoveTo 98 28 self))
            )
            (case 19
                (mono2:setCel(5))
                (send gEgo:setMotion(MoveTo 113 12 self))
            )
            (case 20
                (send gEgo:setMotion(MoveTo 142 13 self))
            )
            (case 21
                (buzzSound:
                    number(882)
                    play()
                )
                (mono2:
                    setLoop(2)
                    setCycle(End self)
                )
            )
            (case 22
                = cycles Random(5 10)
            )
            (case 23
                (send gEgo:hide())
                (mono2:setCycle(Beg self))
            )
            (case 24
                (mono2:
                    setLoop(1)
                    setCycle(CT 1 1)
                )
                = seconds 5
            )
            (case 25
                (self:dispose())
            )
        )
    )

)
(instance buzzSound of Sound
    (properties
        number 881
        flags 1
    )
)
