(version 2)
(include "sci.sh")
(exports
    0 rm650
)
(use "Main")
(use "FPRoom")
(use "Scaler")
(use "Polygon")
(use "CueObj")
(use "Cycle")
(use "View")
(use "Obj")
(script 650)


(local
    local0

)
(instance public rm650 of FPRoom
    (properties
        noun 28
        picture 650
        style $000a
    )

    (method (init)
        (send gEgo:
            init()
            setScale(Scaler 149 89 184 146)
            normalize()
        )
        (switch (gGNumber)
            (case 240
                (send global2:setScript(sEnterFrom240))
            )
            (case 680
                (send gGame:handsOn())
            )
            (default 
                (send gEgo:
                    x(160)
                    y(160)
                )
                (send gGame:handsOn())
            )
        )
        (super:init())
        (send global2:addObstacle((send ((Polygon:new())):
                type(3)
                init(302 178 286 162 247 162 246 155 190 150 100 150 89 185 302 185)
                yourself()
            )
))
        (potato:
            init()
            setOnMeCheck(1 2)
        )
        (boxes:
            init()
            setOnMeCheck(1 4)
        )
        (barrels:
            init()
            setOnMeCheck(1 8)
        )
        (sacks:
            init()
            setOnMeCheck(1 16)
        )
        (horseShoe:
            init()
            setOnMeCheck(1 32)
        )
        (paper1:
            init()
            setOnMeCheck(1 64)
        )
        (paper2:
            init()
            setOnMeCheck(1 128)
        )
        (paper3:
            init()
            setOnMeCheck(1 256)
        )
        (mirror:
            init()
            setOnMeCheck(1 512)
        )
        (photo:
            init()
            setOnMeCheck(1 1024)
        )
        (lantern:
            init()
            setOnMeCheck(1 2048)
        )
        (pots:
            init()
            setOnMeCheck(1 4096)
        )
        (pitcher:
            init()
            setOnMeCheck(1 8192)
        )
        (rope:
            init()
            setOnMeCheck(1 16384)
        )
        (buckets:
            init()
            setOnMeCheck(1 -32768)
        )
        (pans:
            init()
            setOnMeCheck(1 2)
        )
        (light:
            init()
            setOnMeCheck(1 4)
        )
        (broom:
            init()
            setOnMeCheck(1 8)
        )
        (lantern2:
            init()
            setOnMeCheck(1 16)
        )
        (paper4:
            init()
            setOnMeCheck(1 32)
        )
        (paper5:
            init()
            setOnMeCheck(1 64)
        )
        (paper6:
            init()
            setOnMeCheck(1 128)
        )
        (stove:
            init()
            setOnMeCheck(1 256)
        )
        (backCounter:
            init()
            setOnMeCheck(1 512)
        )
        (grinder:
            init()
            setOnMeCheck(1 1024)
        )
        (paper7:
            init()
            setOnMeCheck(26505)
        )
        (if ((not (send gEgo:has(41)) and not (send gEgo:has(20))) and not (> global119 9))
            (paperBag:
                init()
                approachVerbs(4)
            )
        )
        (if (== gGNumber 240)
            (frontDoor:
                init()
                setCel(3)
                approachVerbs(4 3)
            )
        )(else
            (frontDoor:
                init()
                approachVerbs(4 3)
            )
        )
        (if (proc0_2(102))
            0
        )(else
            (if (proc0_2(36))
                (knife:
                    init()
                    approachVerbs(4)
                )
            )(else
                (willie:
                    init()
                    setScript(sWillieMoves)
                )
            )
        )
        (shavings:init())
        (if (== gGNumber 240)
            0
        )(else
            (send gGameMusic1:
                number(652)
                flags(1)
                loop(-1)
                play()
            )
        )
    )


    (method (dispose)
        (send gOldWH:delete(frontDoor))
        (send gGameMusic1:fade(80 10 16 0))
        (super:dispose())
    )

)
(instance sEnterFrom240 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (doorSound:
                    number(2650)
                    play(self)
                )
            )
            (case 1
                (send gEgo:
                    x(330)
                    y(178)
                    setMotion(MoveTo 275 178 self)
                )
            )
            (case 2
                (frontDoor:setCycle(Beg self))
                (doorSound:
                    number(2147)
                    play()
                )
            )
            (case 3
                (send gFpMessager:say(42 0 0))
                (frontDoor:stopUpd())
                = cycles 10
            )
            (case 4
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance sExitTo240 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                (doorSound:
                    number(2146)
                    play()
                )
                (frontDoor:setCycle(End self))
            )
            (case 1
                (send gEgo:setMotion(MoveTo 320 178 self))
            )
            (case 2
                (doorSound:
                    number(2650)
                    play(self)
                )
            )
            (case 3
                (send gEgo:setHeading(90))
                (send global2:newRoom(240))
                (self:dispose())
            )
        )
    )

)
(instance sWillieMoves of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send client:setCycle(Fwd))
                = seconds Random(5 10)
            )
            (case 1
                (send client:setCycle(CT 0 1 self))
            )
            (case 2
                = seconds Random(5 10)
            )
            (case 3
                (self:changeState(0))
            )
        )
    )

)
(instance willie of Actor
    (properties
        x 233
        y 151
        noun 12
        view 652
        signal $4000
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 53
                (if (== global119 19)
                    proc0_3(36)
                    (send gGame:points(2 156))
                    (if (<> local0 1)
                        (send gFpMessager:say(41 0 0))
                        = local0 1
                    )(else
                        (send gFpMessager:say(41 0 10))
                    )
                )(else
                    (super:doVerb(theVerb rest param2))
                )
            )
            (case 43
                (if (== global119 19)
                    proc0_3(36)
                    (send gGame:points(2 156))
                    (if (<> local0 1)
                        (send gFpMessager:say(41 0 0))
                        = local0 1
                    )(else
                        (send gFpMessager:say(41 0 10))
                    )
                )(else
                    (super:doVerb(theVerb rest param2))
                )
            )
            (case 52
                (if (== global119 19)
                    proc0_3(36)
                    (send gGame:points(2 156))
                    (if (<> local0 1)
                        (send gFpMessager:say(41 0 0))
                        = local0 1
                    )(else
                        (send gFpMessager:say(41 0 10))
                    )
                )(else
                    (super:doVerb(theVerb rest param2))
                )
            )
            (case 2
                (if ((== global119 8) and (== global119 9))
                    (send gFpMessager:say(12 2 4))
                )(else
                    (if (== global119 10)
                        (send gFpMessager:say(12 2 5))
                    )(else
                        (if (== global119 12)
                            (send gFpMessager:say(12 2 6))
                        )(else
                            (if (== global119 13)
                                (send gFpMessager:say(12 2 7))
                            )(else
                                (if (== global119 16)
                                    (send gFpMessager:say(12 2 8))
                                )(else
                                    (if (== global119 19)
                                        (send gFpMessager:say(12 2 9))
                                    )(else
                                        (if (== global120 1)
                                            (send gFpMessager:say(12 2 1))
                                        )(else
                                            (if (== global120 2)
                                                (send gFpMessager:say(12 2 2))
                                            )(else
                                                (if (== global120 3)
                                                    (send gFpMessager:say(12 2 3))
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance shavings of Prop
    (properties
        x 205
        y 146
        noun 45
        view 650
        loop 2
    )
)
(instance frontDoor of Prop
    (properties
        x 299
        y 144
        noun 40
        approachX 265
        approachY 178
        view 650
        priority 14
        signal $4011
    )

    (method (init)
        (send gOldWH:add(frontDoor))
        (super:init())
    )


    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (send global2:setScript(sExitTo240))
            )
            (case 3
                (send global2:setScript(sExitTo240))
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance knife of View
    (properties
        x 228
        y 133
        noun 43
        approachX 232
        approachY 155
        view 650
        loop 1
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                proc0_3(102)
                (send gEgo:get(27 knife))
                (send gGame:points(1))
                (self:dispose())
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance paperBag of View
    (properties
        x 200
        y 116
        noun 44
        approachX 180
        approachY 150
        view 650
        loop 3
        priority 10
        signal $0010
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (send gEgo:get(41 paperBag 2 self))
                (send gGame:points(1))
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance potato of Feature
    (properties
        x 296
        y 189
        noun 13
        nsTop 134
        nsLeft 167
        nsBottom 189
        nsRight 319
    )
)
(instance boxes of Feature
    (properties
        x 94
        y 189
        noun 14
        nsTop 149
        nsLeft 43
        nsBottom 189
        nsRight 146
    )
)
(instance barrels of Feature
    (properties
        x 162
        y 189
        noun 15
        nsTop 133
        nsLeft 126
        nsBottom 189
        nsRight 198
    )
)
(instance sacks of Feature
    (properties
        x 80
        y 189
        noun 16
        nsTop 135
        nsLeft 44
        nsBottom 173
        nsRight 117
    )
)
(instance horseShoe of Feature
    (properties
        x 34
        y 189
        noun 17
        nsTop 29
        nsLeft 13
        nsBottom 68
        nsRight 56
    )
)
(instance paper1 of Feature
    (properties
        x 17
        y 189
        noun 18
        nsBottom 38
        nsRight 34
    )
)
(instance paper2 of Feature
    (properties
        x 14
        y 189
        noun 19
        nsTop 39
        nsBottom 88
        nsRight 29
    )
)
(instance paper3 of Feature
    (properties
        x 15
        y 189
        noun 20
        nsTop 88
        nsBottom 129
        nsRight 30
    )
)
(instance mirror of Feature
    (properties
        x 20
        y 189
        noun 21
        nsTop 72
        nsBottom 96
        nsRight 40
    )
)
(instance photo of Feature
    (properties
        x 116
        y 189
        noun 29
        nsTop 92
        nsLeft 105
        nsBottom 114
        nsRight 127
    )
)
(instance lantern of Feature
    (properties
        x 111
        y 187
        noun 23
    )
)
(instance pots of Feature
    (properties
        x 92
        y 187
        noun 24
    )
)
(instance pitcher of Feature
    (properties
        x 123
        y 187
        noun 25
    )
)
(instance rope of Feature
    (properties
        x 235
        y 187
        noun 26
    )
)
(instance buckets of Feature
    (properties
        x 280
        y 130
        z 59
        noun 27
    )
)
(instance pans of Feature
    (properties
        x 193
        y 50
        noun 22
    )
)
(instance light of Feature
    (properties
        x 185
        y 115
        noun 30
    )
)
(instance broom of Feature
    (properties
        x 171
        y 50
        noun 31
    )
)
(instance lantern2 of Feature
    (properties
        x 143
        y 50
        noun 32
    )
)
(instance paper4 of Feature
    (properties
        x 223
        y 50
        noun 33
    )
)
(instance paper5 of Feature
    (properties
        x 242
        y 50
        noun 34
    )
)
(instance paper6 of Feature
    (properties
        x 253
        y 50
        noun 35
    )
)
(instance stove of Feature
    (properties
        x 268
        y 50
        noun 36
    )
)
(instance backCounter of Feature
    (properties
        x 148
        y 50
        noun 37
    )
)
(instance grinder of Feature
    (properties
        x 69
        y 187
        noun 38
    )
)
(instance paper7 of Feature
    (properties
        x 119
        y 189
        noun 39
        nsTop 69
        nsLeft 105
        nsBottom 95
        nsRight 133
    )
)
(instance doorSound of FPSound
    (properties
        flags $0001
    )
)
