(version 2)
(include "sci.sh")
(exports
    0 rm660
)
(use "Main")
(use "OccasionalCycle")
(use "FPRoom")
(use "Scaler")
(use "RandCycle")
(use "PolyPath")
(use "Polygon")
(use "CueObj")
(use "TimedCue")
(use "Timer")
(use "Cycle")
(use "View")
(use "Obj")
(script 660)


(local
    local0 =     1
    local1
    gEgoMoveSpeed

)
(instance public rm660 of FPRoom
    (properties
        noun 25
        picture 660
        south 230
    )

    (method (init)
        (send gEgo:
            init()
            setScale(Scaler 100 73 159 110)
            normalize()
        )
        (switch (gGNumber)
            (case south
                (self:setScript(sEnterRoom))
            )
            (case 235
                (self:setScript(sEnterRoom))
            )
            (case 680
                (send gGame:handsOn())
            )
            (default 
                = style 100
                (send gEgo:
                    x(160)
                    y(160)
                )
                (send gGame:handsOn())
            )
        )
        (super:init())
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(0 134 0 0 319 0 319 189 0 189 0 146 95 162 101 165 217 165 198 150 164 161 105 161 91 153 94 130 179 126 179 119 199 119 199 115 155 115 148 112 121 112 115 123)
                yourself()
            )
))
        (send (ScriptID(1800 49)):y((+ (send (ScriptID(1800 49)):y) 70)))
        (if (not == global119 3)
            (helen:
                init()
                setLoop(2)
                setCel(0)
                approachVerbs(2 4)
                setScript(sHelenWorks)
            )
        )
        (flies:init())
        (if (proc0_2(29))
            (hopSingh:
                view(664)
                setLoop(7)
                setCel(0)
                posn(206 116)
                approachVerbs(2 4)
                setPri(9)
                setCycle(Fwd)
                init()
            )
            (swingDoors:setCel(0))
            (swingDoors2:setCel(0))
            (plop:
                init()
                setScale(-1 gEgo)
                setCycle(Fwd)
            )
            (send gGameMusic1:
                number(501)
                loop(-1)
                play()
            )
        )(else
            (send gGameMusic1:
                number(660)
                loop(-1)
                play()
            )
            (hopSingh:
                init()
                approachVerbs(2 4)
                setLoop(0)
                setCycle(OccasionalCycle 1 30 120 6 12)
            )
        )
        (if (proc999_5(global119 8 9 22 23 24))
            (lady1:
                init()
                setCycle(OccasionalCycle 1 10 40 2 6)
                ignoreActors()
                setScript(sPlayContinuously)
            )
            (penny:
                init()
                setCycle(OccasionalCycle 1 10 40 2 6)
                ignoreActors()
            )
            (lady2:
                init()
                setCycle(OccasionalCycle 1 10 40 2 6)
                ignoreActors()
            )
        )
        (if (> global120 2)
            (coffee:
                init()
                setCycle(Fwd)
                approachVerbs(4)
            )
        )
        (if ((> global120 2) and not proc0_2(14))
            (pie:
                init()
                stopUpd()
            )
        )
        (if (not proc0_2(25))
            (tinCan:
                init()
                approachVerbs(4)
            )
        )
        (steam:
            init()
            setCycle(Fwd)
        )
        (orderWheel:
            init()
            stopUpd()
        )
        (swingDoors:
            init()
            stopUpd()
        )
        (swingDoors2:
            init()
            stopUpd()
        )
        (bottle:
            init()
            setOnMeCheck(1 2)
        )
        (corn:
            init()
            setOnMeCheck(1 4)
        )
        (leftTable:
            init()
            setOnMeCheck(1 8)
        )
        (rightTable:
            init()
            setOnMeCheck(1 16)
        )
        (shelf:
            init()
            setOnMeCheck(1 32)
        )
        (lamp:
            init()
            setOnMeCheck(1 64)
        )
        (post:
            init()
            setOnMeCheck(1 128)
        )
        (cabinet:
            init()
            setOnMeCheck(1 256)
        )
        (kitchen:
            init()
            setOnMeCheck(1 512)
        )
        (kitchenDoor:
            init()
            setOnMeCheck(1 1024)
        )
        (flowers:
            init()
            setOnMeCheck(1 2048)
        )
        (counter:
            init()
            setOnMeCheck(1 4096)
        )
        (kitchenCounter:
            init()
            setOnMeCheck(1 8192)
        )
    )


    (method (doit)
        (super:doit())
        (if (script)
        )(else
            (if (proc0_1(gEgo 2))
                (self:setScript(sExitRoom))
            )
        )
    )


    (method (dispose)
        (send gGameMusic1:fade(0 30 12 1))
        (send gGameMusic2:fade(0 30 12 1))
        (send gTimers:delete(flyTimer))
        (super:dispose())
    )


    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (== global119 3)
                    (send gFpMessager:say(noun theVerb 5))
                )(else
                    (send gFpMessager:say(noun theVerb 4))
                )
            )
            (case 1
                (if (== global119 3)
                    (send gFpMessager:say(noun theVerb 5))
                )(else
                    (send gFpMessager:say(noun theVerb 4))
                )
            )
            (case 66
                (send global2:setScript(sDunkPlop))
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )


    (method (newRoom newRoomNumber)
        (if ((== newRoomNumber 230) and proc999_5(global119 8 9 20 22))
            = newRoomNumber 235
        )
        (super:newRoom(newRoomNumber))
    )

)
(instance sPlayContinuously of Script
    (properties)

    (method (doit)
        (super:doit())
        (if ((== (send gGameMusic2:number) 2942) and (== (send gGameMusic2:prevSignal) -1))
            (send gGameMusic2:
                number(2662)
                flags(1)
                loop(1)
                play(self)
            )
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGameMusic2:
                    number(2662)
                    flags(1)
                    loop(1)
                    play(self)
                )
            )
            (case 1
                (send gGameMusic2:prevSignal(0))
                (self:changeState(0))
            )
        )
    )

)
(instance sHelenWorks of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (helen:
                    view(661)
                    setScale(0)
                    setLoop(2)
                    setCycle(End self)
                )
            )
            (case 1
                (helen:
                    view(661)
                    setLoop(0)
                    setCycle(OccasionalCycle 1 30 120 2 6 self)
                )
            )
            (case 2
                (self:changeState(0))
            )
        )
    )

)
(instance sGetFlies of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send client:
                    view(661)
                    setLoop(1)
                    setCel(0)
                    setScale(0)
                    setCycle(End self)
                )
            )
            (case 1
                (send client:setCycle(Beg self))
                (swatSound:play())
            )
            (case 2
                (flyTimer:seconds(1))
                (send gFpMessager:say(35 0 0 Random(1 5) self))
            )
            (case 3
                = next sHelenWorks
                (self:dispose())
            )
        )
    )

)
(instance sGetCan of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gFpMessager:say(29 4 4 0 self))
            )
            (case 1
                (tinCan:dispose())
                (send gEgo:get(-1 56))
                (send gGame:points(1))
                proc0_3(25)
                (self:dispose())
            )
        )
    )

)
(instance sDunkPlop of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                = gEgoMoveSpeed (send gEgo:moveSpeed)
                (send gEgo:setSpeed(6))
                proc0_3(29)
                proc0_3(103)
                (if (<= (send gEgo:y) 141)
                    = cycles 2
                )(else
                    (send gEgo:
                        view(664)
                        setLoop(2)
                        setCel(0)
                        setCycle(Walk)
                        setMotion(PolyPath 92 152 self)
                    )
                )
            )
            (case 1
                (if ((> (send gEgo:x) 86) and (< (send gEgo:y) 125))
                    = cycles 2
                )(else
                    (send gEgo:
                        view(664)
                        setLoop(1)
                        setCel(0)
                        setCycle(Walk)
                        setMotion(PolyPath 149 124 self)
                    )
                )
            )
            (case 2
                (send gEgo:
                    view(664)
                    setLoop(2)
                    setCel(0)
                    setMotion(PolyPath 133 117 self)
                )
            )
            (case 3
                (send gEgo:
                    setLoop(4)
                    setCel(0)
                    setCycle(CT 4 1 self)
                )
            )
            (case 4
                (send gEgo:setCycle(End self))
                (plop:
                    init()
                    setCycle(Fwd)
                )
            )
            (case 5
                (send gEgo:
                    normalize()
                    loop(1)
                    put(23)
                    setMotion(PolyPath 110 129 self)
                )
                (helen:
                    setScript(0)
                    view(664)
                    setLoop(5)
                    cel(0)
                    setCycle(End self)
                )
                (send gTimers:delete(flyTimer))
            )
            (case 6
                0
            )
            (case 7
                (send gFpMessager:say(36 0 0 0 self))
            )
            (case 8
                (hopSingh:
                    view(664)
                    setLoop(10)
                    setCel(0)
                    y(+ (hopSingh:y) 7)
                    setCycle(TimedCue 3 self)
                )
            )
            (case 9
                (send gFpMessager:say(37 0 0 0 self))
            )
            (case 10
                (send gGameMusic1:
                    number(501)
                    loop(-1)
                    play()
                )
                (hopSingh:
                    setLoop(9)
                    setCycle(Walk)
                    setMotion(MoveTo 248 121 self)
                )
            )
            (case 11
                (swingDoors:setCycle(Beg))
                (swingDoors2:setCycle(Beg))
                (hopSingh:
                    setPri(9)
                    ignoreActors()
                    setMotion(MoveTo 215 113 self)
                )
            )
            (case 12
                (swingDoors:stopUpd())
                (swingDoors2:stopUpd())
                (hopSingh:
                    setLoop(7)
                    posn(204 116)
                    setCycle(Fwd)
                )
                (send (ScriptID(0 12)):setReal(ScriptID(0 12) 0 3))
                (send gGame:points(9 158))
                (send gEgo:setSpeed(gEgoMoveSpeed))
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance sEnterRoom of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:
                    view(660)
                    setLoop(1)
                    setCel(0)
                    posn(0 138)
                    setMotion(MoveTo 65 138 self)
                )
            )
            (case 1
                (send gEgo:
                    normalize()
                    loop(0)
                    setCel(0)
                    setMotion(MoveTo 86 141 self)
                )
            )
            (case 2
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance sExitRoom of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                (send gEgo:setMotion(MoveTo 56 141 self))
            )
            (case 1
                (send gEgo:
                    view(660)
                    setLoop(2)
                    setCel(0)
                    posn(56 138)
                    setMotion(MoveTo -4 138 self)
                )
            )
            (case 2
                (send global2:newRoom((send global2:south)))
                (self:dispose())
            )
        )
    )

)
(instance flies of Actor
    (properties
        noun 35
        view 660
        loop 8
    )

    (method (init)
        (super:init())
        (self:
            x(Random(10 300))
            y(Random(10 180))
            setLoop(8)
            setPri(13)
            ignoreActors()
            ignoreHorizon()
            setCycle(RandCycle)
            setMotion(MoveTo Random(10 300) Random(10 180) self)
        )
    )


    (method (doit)
        (super:doit())
        (if ((self:inRect(191 90 228 135)) and local0)
            = local0 0
            = local1 1
            (if ((send gOldCast:contains(helen)) and not proc0_2(29))
                (helen:setScript(sGetFlies))
            )
            (self:setMotion(MoveTo 206 Random(105 122)))
            (flyTimer:setReal(flies Random(6 12)))
        )
    )


    (method (cue)
        (if (== (helen:script) sGetFlies)
            (helen:setScript(sHelenWorks))
        )
        (if (local1)
            = local1 0
            (self:setMotion(MoveTo Random(10 300) Random(10 180) self))
        )(else
            = local0 1
            (self:setMotion(MoveTo Random(10 300) Random(10 180) self))
        )
    )

)
(instance helen of Actor
    (properties
        x 237
        y 141
        noun 11
        approachX 178
        approachY 123
        view 661
        loop 2
        priority 11
        signal $5011
        detailLevel 2
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 2
                (if ((send gEgo:has(54)))
                    (send gFpMessager:say(noun 2 2))
                    proc0_3(32)
                )(else
                    (if ((== global120 1) and not proc0_2(88))
                        (send gFpMessager:say(noun theVerb 6))
                        proc0_3(88)
                    )(else
                        (if ((== global120 1) and not proc0_2(89))
                            (send gFpMessager:say(noun theVerb 7))
                            proc0_3(89)
                        )(else
                            (if (== global120 1)
                                (send gFpMessager:say(noun theVerb 8))
                            )(else
                                (if ((== global119 16) and proc0_2(103))
                                    (send gFpMessager:say(noun theVerb 16))
                                )(else
                                    (if (== global119 16)
                                        (send gFpMessager:say(noun theVerb 15))
                                    )(else
                                        (if (== global119 17)
                                            (send gFpMessager:say(noun theVerb 13))
                                        )(else
                                            (if (== global119 13)
                                                (send gFpMessager:say(noun theVerb 12))
                                            )(else
                                                (if (== global119 8)
                                                    (send gFpMessager:say(noun theVerb 9))
                                                )(else
                                                    (if (== global119 9)
                                                        (send gFpMessager:say(noun theVerb 9))
                                                    )(else
                                                        (if (== global119 12)
                                                            (send gFpMessager:say(noun theVerb 11))
                                                        )(else
                                                            (if (== global119 10)
                                                                (send gFpMessager:say(noun theVerb 10))
                                                            )(else
                                                                (send gFpMessager:say(noun 2))
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
            (case 30
                (if (proc0_2(32))
                    (send gFpMessager:say(noun 0 3))
                    (send gEgo:put(54))
                    (send gGame:points(1))
                )(else
                    (send gFpMessager:say(noun 2 2 0 self))
                    proc0_3(32)
                )
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )


    (method (cue)
        (self:doVerb(30))
    )

)
(instance plop of Prop
    (properties
        x 125
        y 112
        noun 38
        view 664
        detailLevel 2
    )
)
(instance penny of Prop
    (properties
        x 155
        y 117
        noun 34
        view 663
        cel 2
        priority 12
        signal $1010
        cycleSpeed 15
        detailLevel 2
    )
)
(instance lady1 of Prop
    (properties
        x 129
        y 157
        noun 32
        view 663
        loop 1
        cel 3
        priority 12
        signal $1010
        cycleSpeed 10
        detailLevel 2
    )
)
(instance lady2 of Prop
    (properties
        x 175
        y 121
        noun 33
        view 663
        loop 2
        cel 5
        priority 11
        signal $1010
        cycleSpeed 10
        detailLevel 2
    )
)
(instance coffee of Prop
    (properties
        x 103
        y 110
        z 24
        noun 27
        approachX 121
        approachY 119
        view 660
        loop 3
        signal $4000
        detailLevel 2
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 4
                (if ((send gEgo:has(11)))
                    (send gFpMessager:say(noun 4 1))
                )(else
                    (if (proc0_2(157))
                        (send gEgo:get(-1 11 2))
                        (send gFpMessager:say(noun 4 17))
                    )(else
                        (send gEgo:get(11 self 2))
                        (send gGame:points(1 157))
                    )
                )
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance pie of Prop
    (properties
        x 269
        y 110
        z 20
        noun 28
        view 660
        loop 7
        signal $4001
        detailLevel 2
    )
)
(instance hopSingh of Actor
    (properties
        x 250
        y 108
        noun 26
        approachX 178
        approachY 123
        view 662
        signal $4000
        detailLevel 2
        xStep 2
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 2
                (if ((== global120 1) and not proc0_2(90))
                    (send gFpMessager:say(noun theVerb 6))
                    proc0_3(90)
                )(else
                    (if ((== global120 1) and not proc0_2(91))
                        (send gFpMessager:say(noun theVerb 7))
                        proc0_3(91)
                    )(else
                        (if (== global120 1)
                            (send gFpMessager:say(noun theVerb 8))
                        )(else
                            (if ((== global119 16) and proc0_2(103))
                                (send gFpMessager:say(noun theVerb 16))
                            )(else
                                (if (== global119 16)
                                    (send gFpMessager:say(noun theVerb 15))
                                )(else
                                    (if (== global119 17)
                                        (send gFpMessager:say(noun theVerb 13))
                                    )(else
                                        (if (== global119 13)
                                            (send gFpMessager:say(noun theVerb 12))
                                        )(else
                                            (if (== global119 8)
                                                (send gFpMessager:say(noun theVerb 9))
                                            )(else
                                                (if (== global119 9)
                                                    (send gFpMessager:say(noun theVerb 9))
                                                )(else
                                                    (if (== global119 12)
                                                        (send gFpMessager:say(noun theVerb 11))
                                                    )(else
                                                        (if (== global119 10)
                                                            (send gFpMessager:say(noun theVerb 10))
                                                        )(else
                                                            (send gFpMessager:say(noun 2))
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance steam of Prop
    (properties
        x 259
        y 66
        view 660
        loop 4
        signal $4000
        detailLevel 2
    )
)
(instance orderWheel of Prop
    (properties
        x 262
        y 120
        z 55
        noun 30
        view 660
        loop 5
        priority 15
        signal $4011
        detailLevel 2
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (== global119 3)
                    (send gFpMessager:say(noun theVerb 5))
                )(else
                    (send gFpMessager:say(noun theVerb 4))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance swingDoors of Prop
    (properties
        x 226
        y 84
        noun 31
        view 660
        cel 2
        priority 9
        signal $4011
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (== global119 3)
                    (send gFpMessager:say(21 theVerb 5))
                )(else
                    (send gFpMessager:say(21 theVerb 4))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance swingDoors2 of Prop
    (properties
        x 226
        y 84
        noun 31
        view 660
        loop 9
        cel 2
        priority 10
        signal $4011
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (== global119 3)
                    (send gFpMessager:say(21 theVerb 5))
                )(else
                    (send gFpMessager:say(21 theVerb 4))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance tinCan of View
    (properties
        x 107
        y 170
        z 51
        noun 29
        approachX 126
        approachY 162
        view 660
        loop 6
        priority 14
        signal $4011
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (== global119 3)
                    (send gFpMessager:say(noun theVerb 5))
                )(else
                    (send global2:setScript(sGetCan))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance bottle of Feature
    (properties
        x 37
        y 200
        noun 12
        onMeCheck $0002
    )
)
(instance corn of Feature
    (properties
        x 84
        y 200
        noun 13
        onMeCheck $0004
    )
)
(instance leftTable of Feature
    (properties
        x 90
        y 100
        noun 14
        onMeCheck $0008
    )
)
(instance rightTable of Feature
    (properties
        x 148
        y 120
        noun 15
        onMeCheck $0010
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (== global119 3)
                    (send gFpMessager:say(noun theVerb 5))
                )(else
                    (send gFpMessager:say(noun theVerb 4))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance shelf of Feature
    (properties
        x 97
        y 10
        noun 16
        onMeCheck $0020
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (== global119 3)
                    (send gFpMessager:say(noun theVerb 5))
                )(else
                    (send gFpMessager:say(noun theVerb 4))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance lamp of Feature
    (properties
        x 136
        y 100
        noun 17
        onMeCheck $0040
    )
)
(instance post of Feature
    (properties
        x 136
        y 100
        noun 18
        onMeCheck $0080
    )
)
(instance cabinet of Feature
    (properties
        x 174
        y 1
        noun 19
        onMeCheck $0100
    )
)
(instance kitchen of Feature
    (properties
        x 264
        y 100
        noun 20
        onMeCheck $0200
    )
)
(instance kitchenDoor of Feature
    (properties
        x 218
        y 80
        noun 21
        onMeCheck $0400
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (== global119 3)
                    (send gFpMessager:say(noun theVerb 5))
                )(else
                    (send gFpMessager:say(noun theVerb 4))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance flowers of Feature
    (properties
        x 223
        y 200
        noun 22
        onMeCheck $0800
    )
)
(instance counter of Feature
    (properties
        x 203
        y 115
        noun 23
        onMeCheck $1000
    )
)
(instance kitchenCounter of Feature
    (properties
        x 250
        y 110
        noun 24
        onMeCheck $2000
    )
)
(instance flyTimer of Timer
    (properties)
)
(instance swatSound of FPSound
    (properties
        flags $0001
        number 2543
    )
)
