(include "sci.sh")
(use "Main")
(use "AnimDialog")
(use "Blink")
(use "Scaler")
(use "Osc")
(use "PolyPath")
(use "Polygon")
(use "CueObj")
(use "n958")
(use "Sound")
(use "Cycle")
(use "Sounds")
(use "View")
(use "Obj")
(script 640)


(local
    local0
    local1
    local2

)
(instance theMusic3 of Sound
    (properties)
)
(instance public rm640 of Rm
    (properties
        noun 8
        picture 103
    )

    (method (init)
        proc958_0(143 number)
        proc958_0(128 0)
        (bigShroom:
            init()
            setOnMeCheck(1 (bigShroom:onMeCheck))
        )
        (send gRoom:addObstacle((send ((Polygon:new())):
                type(3)
                init(84 108 115 115 149 126 216 138 233 151 260 145 319 145 319 131 301 126 285 129 266 126 253 123 285 116 319 118 319 95 281 98 277 105 257 115 230 115 241 105 214 105 202 103 255 101 271 100 269 98 256 93 203 100 182 98 158 106 142 108 114 98 93 104)
                yourself()
            )
))
        = style 
            (switch (gGModNum)
                (case 620
                    (11  )
                )
                (default 
                    (32778 )
                )
            )
        (send gEgo:edgeHit(0))
        (super:init())
        proc0_6(18)
        (if (== gGModNum 620)
            (if (proc0_1(91))
                (self:setScript(sEnterHigh))
            )(else
                (self:setScript(sEnterLow))
            )
        )(else
            (self:setScript(sFrom660))
        )
    )


    (method (doit)
        (if (not script)
            (if (& (= local0 (send gEgo:onControl(1))) $0008)
                (send gRoom:setScript(sExitLow))
            )(else
                (if (& local0 $0004)
                    (send gRoom:setScript(sExitHigh))
                )(else
                    (if (((proc0_1(29) and not proc0_1(99)) and (== global142 1)) and (< (send gEgo:x) 162))
                        (send gRoom:setScript(sAmbush))
                    )
                )
            )
        )
        (super:doit())
    )

)
(instance sFrom660 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (vinew:init()) (bea:
                    init()
                    view(560)
                    loop(6)
                    cel(0)
                    x(118)
                    y(112)
                    illegalBits(0)
                    ignoreActors(1)
                )
 (send gEgo:
                    init()
                    view(559)
                    setCycle(0)
                    cel(6)
                    x(96)
                    y(146)
                    priority(1)
                    setLoop(0)
                    signal(16)
                    setCycle(Fwd)
                    setScript(sBreath)
                )
 = seconds 2  )
            )
            (case 1
                ((send gEgo:
                    moveSpeed(0)
                    setLoop(0)
                    setMotion(MoveTo 96 139 self)
                )
  )
            )
            (case 2
                ((send gEgo:
                    setCycle(0)
                    setLoop(1)
                    cel(0)
                    x(95)
                    y(100)
                )
 = seconds 5  )
            )
            (case 3
                ((send gEgo:setCycle(End self))  )
            )
            (case 4
                (= cycles 2  )
            )
            (case 5
                ((bigPukeHead:init()) (bigPukeBody:init()) (send gSq5Music2:
                    number(260)
                    setLoop(1)
                    play()
                )
 (send gRoom:drawPic(103 9)) = seconds 1  )
            )
            (case 6
                (proc0_6(18) (send gEgo:
                    setPri(-1)
                    setLoop(-1)
                    setCycle(Walk)
                    moveSpeed(6)
                    setMotion(MoveTo 128 108 self)
                    setScale(Scaler 97 71 159 100)
                )
  )
            )
            (case 7
                ((send gEgo:setHeading(180)) = seconds 1  )
            )
            (case 8
                ((send gSq5Music2:
                    number(260)
                    setLoop(1)
                    play()
                )
 (puker1:
                    init()
                    setCycle(End self)
                )
 (puker2:
                    init()
                    setCycle(End self)
                )
 (puker3:
                    init()
                    setCycle(End self)
                )
  )
            )
            (case 9
                (0  )
            )
            (case 10
                (0  )
            )
            (case 11
                ((roger:init()) (bea:dispose()) (send gEgo:dispose()) = seconds 1  )
            )
            (case 12
                ((bigPukeHead:setCel(1)) = seconds 2  )
            )
            (case 13
                ((bigPukeHead:setCel(0)) = seconds 1  )
            )
            (case 14
                ((theMusic3:
                    number(519)
                    setLoop(1)
                    play()
                )
 
                (if (proc0_1(99))
                    (send gSq5Music2:
                        number(260)
                        setLoop(1)
                        play()
                    )
                    (pukeWall:
                        init()
                        setCycle(End self)
                    )
                    (roger:
                        posn(124 111)
                        view(23)
                        setLoop(0)
                        cel(15)
                        setScale(Scaler 97 71 159 100)
                        setCycle(Beg self)
                    )
                )(else
                    (pukeWall:
                        init()
                        setCycle(CT 6 1 self)
                    )
                )
 )
            )
            (case 15
                (
                (if (not proc0_1(99))
                    proc0_9(30)
                )
 )
            )
            (case 16
                (proc0_2(104) (send gRoom:newRoom(240)) )
            )
        )
    )

)
(instance sAmbush of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (send gSq5Music2:stop()) (send gSq5Music1:
                    priority(2)
                    number(35)
                    setLoop(-1)
                    play()
                )
 (send gEgo:setMotion(PolyPath 120 101 self))  )
            )
            (case 1
                ((bea:
                    init()
                    cel(4)
                    x(169)
                    y(64)
                )
 = ticks 15  )
            )
            (case 2
                ((send gTestMessager:say(4 0 0 0 self))  )
            )
            (case 3
                ((bea:
                    cel(5)
                    x(167)
                    y(65)
                )
 = ticks 15  )
            )
            (case 4
                ((bea:
                    cel(6)
                    x(170)
                    y(64)
                )
 = ticks 15  )
            )
            (case 5
                ((bea:
                    cel(7)
                    x(159)
                    y(62)
                )
 = ticks 15  )
            )
            (case 6
                ((bea:
                    cel(8)
                    x(146)
                    y(64)
                )
 = ticks 15  )
            )
            (case 7
                ((bea:
                    cel(8)
                    x(135)
                    y(77)
                )
 = ticks 15  )
            )
            (case 8
                ((bea:
                    cel(8)
                    x(127)
                    y(94)
                )
 = ticks 15  )
            )
            (case 9
                ((bea:dispose()) (theMusic3:
                    number(5041)
                    setLoop(1)
                    play(self)
                )
 (send gEgo:
                    view(560)
                    setLoop(4)
                    cel(0)
                    setCycle(End self)
                )
  )
            )
            (case 10
                ((theMusic3:
                    number(102)
                    setLoop(1)
                    play()
                )
 (send gEgo:
                    setLoop(1)
                    posn(105 106)
                    setCycle(Osc 3 self)
                )
  )
            )
            (case 11
                ((send gEgo:
                    setLoop(2)
                    cycleSpeed(10)
                    setCycle(End self)
                )
  )
            )
            (case 12
                (= seconds 1  )
            )
            (case 13
                ((send gEgo:
                    setPri(1)
                    moveSpeed(30)
                    setStep(7 7)
                    setMotion(MoveTo 102 122 self)
                )
  )
            )
            (case 14
                (= seconds 1  )
            )
            (case 15
                ((send gEgo:
                    setLoop(5)
                    posn(102 123)
                    moveSpeed(3)
                    setMotion(MoveTo 102 146 self)
                )
  )
            )
            (case 16
                (proc0_2(104) (send gEgo:setCycle(Osc 3 self))  )
            )
            (case 17
                ((send gRoom:newRoom(660)) )
            )
        )
    )

)
(instance sExitLow of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (proc0_3(91) (send gRoom:newRoom(620)) )
            )
        )
    )

)
(instance sExitHigh of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) proc0_2(91) (send gEgo:edgeHit(0)) (send gEgo:setMotion(MoveTo 340 108 self))  )
            )
            (case 1
                ((send gSQ5:handsOn()) (send gRoom:newRoom(620)) )
            )
        )
    )

)
(instance sEnterHigh of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) proc0_6(18) (send gEgo:
                    init()
                    ignoreActors(1)
                    posn(311 108)
                    setScale(Scaler 97 71 159 100)
                    setScript(sBreath)
                    setMotion(PolyPath 251 120 self)
                )
  )
            )
            (case 1
                ((send gSQ5:handsOn()) (self:dispose()) )
            )
        )
    )

)
(instance sEnterLow of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) proc0_6(18) (send gEgo:
                    init()
                    ignoreActors(1)
                    setScale(Scaler 97 71 159 100)
                    setScript(sBreath)
                    posn(350 135)
                    setMotion(MoveTo 288 135 self)
                )
  )
            )
            (case 1
                ((send gSQ5:handsOn()) (self:dispose()) )
            )
        )
    )

)
(instance bea of Actor
    (properties
        x 169
        y 64
        view 560
        cel 4
        priority theMusic3
        signal 16
    )
)
(instance bigPukeBody of View
    (properties
        x 163
        y 106
        view 561
        loop 5
        priority 15
        signal 16
    )
)
(instance bigPukeHead of View
    (properties
        x 277
        y 125
        view 561
        loop 6
    )
)
(instance puker3 of Actor
    (properties
        x 83
        y 115
        view 561
        loop 7
        signal 16384
    )
)
(instance puker1 of Actor
    (properties
        x 163
        y 117
        view 561
        loop theMusic3
    )
)
(instance puker2 of Actor
    (properties
        x 145
        y 129
        view 561
        loop 9
    )
)
(instance roger of Actor
    (properties
        x 120
        y 112
        view 560
        loop 3
    )
)
(instance pukeWall of Actor
    (properties
        x 115
        y 104
        view 561
        loop 4
        priority 9
        signal 16
    )
)
(instance vinew of Actor
    (properties
        x 97
        y 135
        view 559
        loop 3
    )
)
(instance public floTalker of ChoiceTalker
    (properties
        x theMusic3
        y 15
        view 1008
        signal 16
        talkWidth 180
        keepWindow 1
        textX 100
        normal 1
    )

    (method (init param1)
        = font gFont
        (super:init(floBust floEyes floMouth rest param1))
    )


    (method (dispose param1)
        = gSq5Win gSq5Win_2
        (super:dispose(rest param1))
    )

)
(instance floBust of Prop
    (properties
        view 1008
    )
)
(instance floEyes of Prop
    (properties
        nsTop 33
        nsLeft 39
        view 1008
        loop 2
        signal 16384
    )
)
(instance floMouth of Prop
    (properties
        nsTop 43
        nsLeft 45
        view 1008
        loop 1
        signal 16384
    )
)
(instance bigShroom of Feature
    (properties
        x 55
        y 33
        noun 2
        onMeCheck 256
    )
)
(instance public sUseComm of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) = local2 
                    (if ((== global142 0) or proc0_1(104))
                        5
                    )(else
                        6
                    )
 (send gEgo:
                    view(553)
                    loop(8)
                    cel(0)
                    setCycle(End self)
                )
 (send gSq5Music2:
                    number(603)
                    setLoop(1)
                    play()
                )
  )
            )
            (case 1
                ((floTalker:
                    normal(0)
                    keepWindow(1)
                    curNoun(local2)
                    curVerb(0)
                    curCase(4)
                )
 = cycles 1  )
            )
            (case 2
                ((send gSQ5:handsOn()) (send gSq5IconBar:select((send gSq5IconBar:at(2)))) (send gSQ5:setCursor(982)) (send gTestMessager:say(local2 0 4 0 self))  )
            )
            (case 3
                ((floTalker:
                    normal(1)
                    keepWindow(0)
                )
 (send gTestMessager:say(local2 0 (= local1 
                        (switch ((floTalker:whichSelect))
                            (case 1
                                (1  )
                            )
                            (case 2
                                (2  )
                            )
                            (case 3
                                (3 )
                            )
                        )
) 0 self))  )
            )
            (case 4
                ((send gEgo:setCycle(Beg self))  )
            )
            (case 5
                (proc0_6(18) (send gEgo:setHeading(180)) 
                (if (not 
                (if (== local1 1)
                    == local2 5
                )
)
                    (send gSQ5:handsOn())
                    (self:dispose())
                )(else
                    = seconds 1
                )
 )
            )
            (case 6
                ((send gEgo:
                    view(6)
                    setLoop(0)
                    cel(15)
                    setCycle(Beg self)
                )
  )
            )
            (case 7
                ((send gEgo:dispose()) = seconds 2  )
            )
            (case 8
                ((send gSQ5:handsOn()) (send gRoom:newRoom(240)) )
            )
        )
    )

)
(instance sBreath of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSq5Music2:
                    number(550)
                    setLoop(1)
                    play(self)
                )
  )
            )
            (case 1
                (= state -1 = seconds Random(2 4) )
            )
        )
    )

)
(instance public myRogTalker of Talker
    (properties
        x theMusic3
        y 25
        view 556
        loop 5
        talkWidth 150
        back 5
        textX 120
        textY 2
    )

    (method (init param1)
        = font gFont
        (super:init(rogBust 0 rogMouth rest param1))
    )


    (method (dispose param1)
        (super:dispose(rest param1))
    )

)
(instance rogBust of Prop
    (properties
        view 556
    )
)
(instance rogMouth of Prop
    (properties
        nsTop 18
        nsLeft 43
        view 556
        loop 2
    )
)
