(include "sci.sh")
(use "Main")
(use "PriorityTalker")
(use "Print")
(use "CueObj")
(use "n958")
(use "Sound")
(use "Cycle")
(use "Sounds")
(use "User")
(use "View")
(use "Obj")
(script 440)


(local
    local0
    local1
    local2
    local3
    local4
    local5
    local6 = 5
    local7[6] = (182 93 180 92 190 120 )

)
(instance theMusic4 of Sound
    (properties)
)
(instance public rm440 of Rm
    (properties
        picture 83
        style 100
    )

    (method (init param1)
        proc958_0(128 459 458)
        (theLookLeft:
            init()
            setOnMeCheck(1 2)
        )
        (theLookRight:
            init()
            setOnMeCheck(1 4)
        )
        (theLookStraight:
            init()
            setOnMeCheck(1 8)
        )
        (send gDirectionHandler:addToFront(self))
        (send gEgo:
            view(0)
            init()
            dispose()
        )
        (send gSq5IconBar:disable(0 3 4 5 6 1))
        (switch (gGModNum)
            (case 420
                ((send gRoom:setScript(sInitRoom))  )
            )
            (default 
                ((send gRoom:setScript(sInitRoom)) )
            )
        )
        (super:init(rest param1))
    )


    (method (doit param1)
        (if (== (send gSq5IconBar:curIcon) (send gSq5IconBar:at(2)))
            (if (proc999_4(0 25 174 163 gPEventX gPEventY))
                (send gSQ5:setCursor(3270))
            )(else
                (if (proc999_4(175 22 315 162 gPEventX gPEventY))
                    (send gSQ5:setCursor(3272))
                )(else
                    (send ((send gSq5IconBar:at(2))):cursor(982))
                    (send gSQ5:setCursor((send ((send gSq5IconBar:at(2))):cursor)))
                )
            )
        )
        (super:doit(rest param1))
    )


    (method (dispose param1)
        (send gSq5IconBar:enable())
        (send gDirectionHandler:delete(self))
        (super:dispose(rest param1))
    )


    (method (handleEvent pEvent param2)
        (var pEventMessage, temp1)
        (if ((User:controls))
            (if ((= pEventMessage (send pEvent:message)) and (& (send pEvent:type) $0004))
                (switch (pEventMessage)
                    (case 3
                        SetCursor(250 100)
                        = gPEventX 250
                        = gPEventY 100
                        (send pEvent:claimed(1))
                        (send gRoom:setScript(sLook 0 2))
                    )
                    (case 7
                        SetCursor(100 100)
                        = gPEventX 100
                        = gPEventY 100
                        (send pEvent:claimed(1))
                        (send gRoom:setScript(sLook 0 1))
                    )
                    (default 
                        (send pEvent:claimed(0))
                        (super:handleEvent(pEvent rest param2))
                    )
                )
            )(else
                (if ((= pEventMessage (send pEvent:message)) and (& (send pEvent:type) $0040))
                    (switch (pEventMessage)
                        (case 3
                            SetCursor(250 100)
                            = gPEventX 250
                            = gPEventY 100
                            (send pEvent:claimed(1))
                            (send gRoom:setScript(sLook 0 2))
                        )
                        (case 7
                            SetCursor(100 100)
                            = gPEventX 100
                            = gPEventY 100
                            (send pEvent:claimed(1))
                            (send gRoom:setScript(sLook 0 1))
                        )
                        (default 
                            (send pEvent:claimed(0))
                            (super:handleEvent(pEvent rest param2))
                        )
                    )
                )(else
                    (send pEvent:claimed(0))
                    (super:handleEvent(pEvent rest param2))
                )
            )
        )(else
            (super:handleEvent(pEvent rest param2))
        )
        (send pEvent:claimed)
    )

)
(instance sInitRoom of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (pukoidHead:init()) (rogHead:init()) = cycles 2  )
            )
            (case 1
                ((rogHead:stopUpd()) = cycles 2  )
            )
            (case 2
                ((send gTestMessager:say(2 0 0 1 self))  )
            )
            (case 3
                ((rogHead:stopUpd()) = cycles 2  )
            )
            (case 4
                ((send gTestMessager:say(2 0 0 2 self))  )
            )
            (case 5
                ((pukoidHead:stopUpd()) = cycles 2  )
            )
            (case 6
                ((send gTestMessager:say(2 0 0 3 self))  )
            )
            (case 7
                ((rogHead:stopUpd()) = cycles 2  )
            )
            (case 8
                ((send gTestMessager:say(2 0 0 4 self))  )
            )
            (case 9
                ((pukoidHead:stopUpd()) = cycles 2  )
            )
            (case 10
                ((send gTestMessager:say(2 0 0 5 self))  )
            )
            (case 11
                ((pukoidHead:stopUpd()) = cycles 2  )
            )
            (case 12
                ((send gTestMessager:say(2 0 0 6 self))  )
            )
            (case 13
                ((send gSQ5:handsOn()) = cycles 1  )
            )
            (case 14
                ((send gSq5IconBar:disable(0 3 4 5 6 1)) (send gSq5IconBar:curIcon((send gSq5IconBar:at(2)))) = cycles 1  )
            )
            (case 15
                ((pukoidHead:startUpd()) (rogHead:
                    startUpd()
                    setScript(sDrool)
                )
 (drool:init()) = cycles 1  )
            )
            (case 16
                ((self:dispose()) )
            )
        )
    )

)
(instance sLook of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (
                (switch (register)
                    (case 1
                        (
                        (if (== local3 0)
                            = local4 1
                        )
 = local0 1 
                        (if (local3)
                        )(else
                            2
                        )
 (rogHead:
                            loop(1)
                            cel(0)
                            x(147)
                            y(111)
                        )
  )
                    )
                    (case 2
                        (
                        (if (== local3 0)
                            = local4 2
                        )
 
                        (if (local3)
                        )(else
                            1
                        )
 = local0 2 (rogHead:
                            loop(2)
                            cel(0)
                            x(146)
                            y(110)
                        )
  )
                    )
                    (case 3
                        (= local0 0 (rogHead:
                            setLoop(0)
                            cel(0)
                            x(145)
                            y(110)
                        )
 )
                    )
                )
 = cycles 1  )
            )
            (case 1
                ((self:dispose()) )
            )
        )
    )

)
(instance sDrool of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (= seconds 2  )
            )
            (case 1
                ((theMusic4:
                    number(461)
                    loop(1)
                    play()
                )
 = seconds 1  )
            )
            (case 2
                ((pukoidHead:init()) (drool:
                    init()
                    show()
                    setCycle(End self)
                )
  )
            )
            (case 3
                ((drool:setCycle(Beg)) (drip:
                    init()
                    show()
                    setPri(4)
                    setMotion(MoveTo local7[local5] local7[+ (= local5 (* local2 2)) 1] self)
                )
  )
            )
            (case 4
                (
                (if (== local0 local2)
                    = local1 1
                    (drip:hide())
                    (send gSQ5:handsOff())
                    (self:setScript(sDrooledOn self))
                )(else
                    (switch (local2)
                        (case 0
                            (if (== local0 2)
                                (drip:
                                    setPri(2)
                                    setMotion(MoveTo 193 144 self)
                                )
                            )(else
                                (drip:
                                    setPri(4)
                                    setMotion(MoveTo 193 144 self)
                                )
                            )
                        )
                        (case 2
                            (drip:
                                setPri(5)
                                setMotion(MoveTo 193 155 self)
                            )
                        )
                        (case 1
                            (drip:
                                setPri(2)
                                setMotion(MoveTo 189 130 self)
                            )
                        )
                    )
                )
 )
            )
            (case 5
                (
                (if (== local1 1)
                    = cycles 1
                )(else
                    (splat:init())
                    (spray:init())
                    = cycles 1
                )
 )
            )
            (case 6
                (
                (if (== local1 1)
                    (self:dispose())
                )(else
                    (splat:addToPic())
                    (drip:hide())
                    = local3 0
                    = local4 0
                    (if (== (= local6 (- local6 1)) 0)
                        (self:setScript(sShootPukoid))
                    )(else
                        = state -1
                        = cycles 1
                    )
                )
 )
            )
        )
    )

)
(instance sShootPukoid of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) (rogHead:
                    loop(2)
                    cel(0)
                    x(146)
                    y(110)
                )
 (pukoidHead:setCel(1)) (blast1:
                    init()
                    setCycle(Fwd)
                )
 (blast2:init()) (theMusic4:
                    number(402)
                    setLoop(1)
                    play()
                )
 = seconds 2  )
            )
            (case 1
                ((blast1:hide()) (blast2:hide()) = seconds 1  )
            )
            (case 2
                ((theMusic4:
                    number(402)
                    setLoop(1)
                    play()
                )
 (blast1:show()) (blast2:show()) (wince:init()) = seconds 1  )
            )
            (case 3
                ((blast1:hide()) (blast2:hide()) = seconds 1  )
            )
            (case 4
                ((send gRoom:newRoom(420)) )
            )
        )
    )

)
(instance sDrooledOn of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (
                (switch (local0)
                    (case 0
                        ((drip:
                            show()
                            setPri(5)
                            view(459)
                            setLoop(7)
                            cel(0)
                            x(183)
                            y(98)
                        )
 = seconds 2  )
                    )
                    (case 1
                        ((rogHead:
                            setLoop(1)
                            cel(1)
                            x(147)
                            y(111)
                        )
 = seconds 1  )
                    )
                    (case 2
                        ((rogHead:
                            setLoop(2)
                            cel(1)
                            x(146)
                            y(110)
                        )
 = seconds 1  )
                    )
                    (default 
                        (= cycles 1 )
                    )
                )
  )
            )
            (case 1
                (
                (switch (local0)
                    (case 0
                        ((ooze:
                            init()
                            setCycle(End self)
                        )
  )
                    )
                    (case 1
                        ((drip:
                            show()
                            setLoop(7)
                            cel(0)
                            x(164)
                            y(96)
                            setCycle(End self)
                        )
  )
                    )
                    (case 2
                        ((drip:
                            show()
                            setLoop(7)
                            cel(0)
                            x(193)
                            y(129)
                            setCycle(End self)
                        )
  )
                    )
                    (default 
                        (= cycles 1 )
                    )
                )
  )
            )
            (case 2
                (= seconds 1  )
            )
            (case 3
                ((drip:hide()) (eyescross:
                    hide()
                    dispose()
                )
 (rogHead:
                    setLoop(5)
                    cel(0)
                    x(145)
                    y(110)
                    cycleSpeed(10)
                    setCycle(End self)
                )
 = cycles 3  )
            )
            (case 4
                (= seconds 1  )
            )
            (case 5
                (= local0 0 (send gSq5Music1:fade()) proc0_9(24) )
            )
        )
    )

)
(instance pukoidHead of Prop
    (properties
        x 150
        y 84
        view 458
        cel 1
        priority 10
    )

    (method (init param1)
        (switch (local0)
            (case 0
                ((self:
                    setLoop(0)
                    cel(1)
                    x(150)
                    y(84)
                    setPri(10)
                )
 = local2 0  )
            )
            (case 1
                ((self:
                    setLoop(0)
                    cel(0)
                    x(150)
                    y(84)
                )
 = local2 1  )
            )
            (case 2
                ((self:
                    setLoop(0)
                    cel(2)
                    x(150)
                    y(84)
                )
 = local2 2 )
            )
        )
        (super:init(rest param1))
    )

)
(instance wince of Prop
    (properties
        x 157
        y 39
        view 458
        loop 6
        cel 1
        priority 11
        signal 16
    )
)
(instance rogHead of Prop
    (properties
        x 145
        y 110
        view 459
        priority 3
        signal 16
    )

    (method (init param1)
        (self:setPri(3))
        (super:init(rest param1))
    )

)
(instance eyescross of View
    (properties
        x 145
        y 110
        view 459
        loop 3
        priority 4
        signal 16400
    )
)
(instance ooze of Prop
    (properties
        x 177
        y 100
        view 459
        loop 9
        priority 5
        signal 16
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            setLoop(9)
            cel(0)
            cycleSpeed(10)
        )
    )

)
(instance drool of Actor
    (properties
        x 183
        y 67
        view 458
        loop 4
        priority 6
        signal 16400
    )

    (method (init param1)
        (switch (local0)
            (case 0
                ((self:
                    setLoop(4)
                    cel(0)
                    x(182)
                    y(74)
                )
  )
            )
            (case 1
                ((self:
                    setLoop(4)
                    cel(0)
                    x(176)
                    y(72)
                )
  )
            )
            (case 2
                ((self:
                    setLoop(4)
                    cel(0)
                    x(185)
                    y(79)
                )
 )
            )
        )
        (super:init(rest param1))
    )

)
(instance drip of Actor
    (properties
        view 459
        loop 6
        priority 6
        signal 16400
    )

    (method (init param1)
        (switch (local0)
            (case 0
                ((self:
                    setLoop(6)
                    cel(0)
                    x(182)
                    y(74)
                    setStep(3 9)
                )
  )
            )
            (case 1
                ((self:
                    setLoop(6)
                    cel(0)
                    x(176)
                    y(72)
                    setStep(3 9)
                )
  )
            )
            (case 2
                ((self:
                    setLoop(6)
                    cel(0)
                    x(185)
                    y(79)
                    setStep(3 9)
                )
 )
            )
        )
        (super:init(rest param1))
    )

)
(instance splat of Prop
    (properties
        view 459
        loop 7
        priority 2
        signal 16400
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            setPri((drip:priority))
            x((drip:x))
            y((drip:y))
        )
    )

)
(instance spray of Prop
    (properties
        view 459
        loop 8
        priority 2
        signal 16400
    )

    (method (init param1)
        (super:init(rest param1))
        (self:
            setPri((drip:priority))
            x((drip:x))
            y((drip:y))
        )
    )

)
(instance blast1 of Prop
    (properties
        x 102
        y 62
        view 458
        loop 5
        priority 4
        signal 16
    )

    (method (init)
        (self:
            view(458)
            loop(5)
            cel(0)
            x(104)
            y(63)
        )
        (super:init())
    )

)
(instance blast2 of Prop
    (properties
        x 197
        y 25
        view 458
        loop 6
        priority 4
        signal 16400
    )

    (method (init)
        (self:
            view(458)
            setLoop(6)
            cel(0)
            x(197)
            y(25)
        )
        (super:init())
    )

)
(instance public pukoid of PriorityTalker
    (properties
        x 117
        y 24
        view 458
        cel 1
        priority 10
        signal 16384
        talkWidth 180
    )

    (method (init param1)
        = font gFont
        (send (= gSq5Win gNewSpeakWindow):
            tailX(160)
            tailY(35)
            xOffset(65496)
            isBottom(1)
        )
        (rogHead:stopUpd())
        (super:init(0 peyes pmouth rest param1))
    )


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


    (method (display param1)
        (var theTalkWidth, newGSq5Win)
        = theTalkWidth talkWidth
        (send (= newGSq5Win (send gSq5Win:new())):
            color(color)
            back(back)
        )
        (if (not HaveMouse() and (<> gSaveCursor 996))
            = saveCursor gSaveCursor
            (send gSQ5:setCursor(996))
        )(else
            = saveCursor 0
        )
        (if (showTitle)
            (Print:addTitle(name))
        )
        (Print:
            window(newGSq5Win)
            posn(x y)
            font(font)
            width(theTalkWidth)
            addText(param1)
            modeless(1)
            init()
        )
    )

)
(instance pmouth of Prop
    (properties
        nsTop 44
        nsLeft 46
        view 458
        loop 1
        cel 3
        priority 7
        signal 16
    )
)
(instance peyes of Prop
    (properties
        nsTop 31
        nsLeft 72
        view 458
        loop 3
        cel 1
        priority 5
        signal 16
    )
)
(instance public roger of PriorityTalker
    (properties
        x 140
        y 75
        view 459
        priority 4
        signal 16384
        talkWidth 180
    )

    (method (init param1)
        = font gFont
        (send (= gSq5Win gNewSpeakWindow):
            tailX(170)
            tailY(135)
            xOffset(65516)
            isBottom(0)
        )
        (pukoidHead:stopUpd())
        (super:init(0 0 rmouth rest param1))
    )


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


    (method (display param1)
        (var theTalkWidth, newGSq5Win)
        = theTalkWidth talkWidth
        (send (= newGSq5Win (send gSq5Win:new())):
            color(color)
            back(back)
        )
        (if (not HaveMouse() and (<> gSaveCursor 996))
            = saveCursor gSaveCursor
            (send gSQ5:setCursor(996))
        )(else
            = saveCursor 0
        )
        (if (showTitle)
            (Print:addTitle(name))
        )
        (Print:
            window(newGSq5Win)
            posn(x y)
            font(font)
            width(theTalkWidth)
            addText(param1)
            modeless(1)
            init()
        )
    )

)
(instance rmouth of Prop
    (properties
        nsTop 29
        nsLeft 29
        view 459
        loop 4
        cel 6
        priority 5
        signal 16
    )
)
(instance theLookLeft of Feature
    (properties
        x 200
        y 170
        onMeCheck 2
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 4
                (
                (if (<> local0 1)
                    (send gRoom:setScript(sLook 0 1))
                )(else
                    (super:doVerb(param1 rest param2))
                )
 )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
(instance theLookRight of Feature
    (properties
        x 200
        y 170
        onMeCheck 4
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 4
                (
                (if (<> local0 2)
                    (send gRoom:setScript(sLook 0 2))
                )(else
                    (super:doVerb(param1 rest param2))
                )
 )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
(instance theLookStraight of Feature
    (properties
        x 200
        y 170
        onMeCheck 8
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 4
                (
                (if (<> local0 0)
                    (send gRoom:setScript(sLook 0 3))
                )(else
                    (super:doVerb(param1 rest param2))
                )
 )
            )
            (default 
                ((super:doVerb(param1 rest param2)) )
            )
        )
    )

)
