(version 2)
(include "sci.sh")
(exports
    0 rm47
)
(use "Main")
(use "Class_255_0")
(use "NewFeature")
(use "n958")
(use "RFeature")
(use "Cycle")
(use "Game")
(use "User")
(use "PicView")
(use "Obj")
(script 47)



(instance public rm47 of Rm
    (properties
        picture 47
        east 48
        south 34
        west 46
        picAngle 50
    )

    (method (init)
        proc958_0(128 247 242 1 370)
        (self:style(
            (switch (gGNumber)
                (case north
                    5
                )
                (case west
                    3
                )
                (case east
                    2
                )
                (case south
                    4
                )
            )
))
        (super:init())
        (switch (gGNumber)
            (case north
                (send gEgo:posn(142 (+ horizon 2)))
            )
            (case south
                (if (< (send gEgo:x) 230)
                    (send gEgo:posn(proc0_17(83 (- (send gEgo:x) 100) 3) 187))
                )(else
                    (send gEgo:posn(283 187))
                )
            )
            (case west
                (send gEgo:posn(3 proc0_17(188 (send gEgo:y) 79)))
            )
            (case east
                (send gEgo:posn(315 proc0_17(188 (send gEgo:y) 100)))
            )
            (default 
                (send gEgo:posn(3 137))
            )
        )
        (send gEgo:init())
        proc0_1()
        (if (not proc0_12(69))
            (mushroom:init())
        )
        (send gAddToPics:
            add(castle)
            eachElementDo(#init)
            doit()
        )
        (self:setRegions(608))
        (rock:
            init()
            stopUpd()
        )
        (water0:
            init()
            stopUpd()
        )
        (water1:
            init()
            stopUpd()
        )
        (if (>= global101 1)
            (water0:setCycle(Fwd))
            (water1:setCycle(Fwd))
            (water2:
                init()
                setCycle(Fwd)
            )
            (water3:
                init()
                setCycle(Fwd)
            )
            (water4:
                init()
                setCycle(Fwd)
            )
        )
        (cliff1:init())
        (cliff2:init())
        (cliff3:init())
        (cliff4:init())
        (bush1:init())
        (bush2:init())
        (river1:init())
        (river2:init())
        (river3:init())
        (bush3:init())
        (bush4:init())
        (tree1:init())
        (tree2:init())
        (stump:init())
    )


    (method (doit)
        (var temp0)
        (if (script)
            (send script:doit())
        )(else
            = temp0 
                (switch ((send ((User:alterEgo)):edgeHit))
                    (case 1
                        north
                    )
                    (case 2
                        east
                    )
                    (case 3
                        south
                    )
                    (case 4
                        west
                    )
                )
            (if (temp0)
                (self:newRoom((= temp0 
                        (switch ((send ((User:alterEgo)):edgeHit))
                            (case 1
                                north
                            )
                            (case 2
                                east
                            )
                            (case 3
                                south
                            )
                            (case 4
                                west
                            )
                        )
)))
            )
        )
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if (Said('look,look>'))
                (if (Said('[<at,around][/room,clearing]'))
                    (if (proc0_12(69))
                        proc255_0(47 0)
                    )(else
                        (if (<= (send gEgo:x) 140)
                            proc255_0(47 1)
                        )(else
                            proc255_0(47 2)
                        )
                    )
                )(else
                    (if (Said('/grass') or Said('<down'))
                        (if (not proc0_12(69) and (<= (send gEgo:distanceTo(mushroom)) 30))
                            proc255_0(47 3)
                        )(else
                            proc255_0(47 4)
                        )
                    )(else
                        (if (Said('<across[/brook,water,brook]'))
                            (if (> (send gEgo:x) 140)
                                proc255_0(47 5)
                            )(else
                                proc255_0(47 6)
                            )
                        )(else
                            (if (Said('/boulder'))
                                proc255_0(47 7)
                            )(else
                                (if (Said('/rapid'))
                                    proc255_0(47 8)
                                )
                            )
                        )
                    )
                )
            )(else
                (if (Said('smell,smell/mushroom,aroma'))
                    (if (proc0_12(69))
                        (if ((send gEgo:has(19)))
                            proc255_0(47 9)
                        )(else
                            proc0_6()
                        )
                    )(else
                        (if (> (send gEgo:distanceTo(mushroom)) 30)
                            proc255_0(47 10)
                        )(else
                            proc255_0(47 11)
                        )
                    )
                )(else
                    (if (Said('get,get,pick/mushroom'))
                        (if (proc0_12(69))
                            proc255_0(47 12)
                        )(else
                            (if (<= (send gEgo:x) 140)
                                proc255_0(47 13)
                            )(else
                                (if (> (send gEgo:distanceTo(mushroom)) 20)
                                    proc0_4()
                                )(else
                                    (if (proc0_12(1))
                                        proc255_0(47 14)
                                    )(else
                                        (send global2:setScript(getMush))
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
    )

)
(instance castle of RPicView
    (properties
        x 121
        y 58
        longRangeDist 500
        view 370
    )

    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((super:handleEvent(pEvent)))
                return 
            )(else
                (if (Said('look,look/castle'))
                    (self:doVerb(1))
                )
            )
        )
    )


    (method (doVerb theVerb)
        (switch (theVerb)
            (case 1
                proc255_0(47 15)
            )
        )
    )

)
(instance mushroom of View
    (properties
        x 200
        y 127
        view 247
        loop 2
    )

    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((super:handleEvent(pEvent)))
                return 
            )(else
                (if (Said('look,look/mushroom'))
                    (if (proc0_12(69) and (send gEgo:has(19)))
                        (send pEvent:claimed(0))
                    )(else
                        (self:doVerb(1))
                    )
                )
            )
        )
    )


    (method (doVerb theVerb)
        (switch (theVerb)
            (case 1
                (if (proc0_12(69))
                    proc255_0(47 16)
                )(else
                    (if (<= (send gEgo:x) 140)
                        proc255_0(47 13)
                    )(else
                        (if (> (send gEgo:distanceTo(mushroom)) 30)
                            proc255_0(47 17)
                        )(else
                            proc255_0(47 18)
                        )
                    )
                )
            )
        )
    )

)
(instance getMush of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                proc0_15(gEgo mushroom)
                = cycles 2
            )
            (case 1
                (send gEgo:
                    view(1)
                    setMotion(0)
                    setCycle(End self)
                )
            )
            (case 2
                (send (ScriptID(0 21)):
                    number(105)
                    loop(1)
                    init()
                    play()
                )
                proc0_19(69 1)
                (send gEgo:get(19))
                (mushroom:dispose())
                = cycles 4
            )
            (case 3
                (send gEgo:setCycle(Beg self))
            )
            (case 4
                proc0_1()
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance rock of View
    (properties
        x 159
        y 169
        view 242
        loop 6
    )

    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((super:handleEvent(pEvent)))
                return 
            )(else
                (if (Said('look,look/boulder'))
                    (self:doVerb(1))
                )
            )
        )
    )


    (method (doVerb theVerb)
        (switch (theVerb)
            (case 1
                proc255_0(47 19)
            )
        )
    )

)
(instance water0 of Prop
    (properties
        x 162
        y 188
        description 3736
        view 242
        loop 5
        priority 6
        signal $4810
        cycleSpeed 1
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 1
                proc255_0(47 20)
            )
        )
    )

)
(instance water1 of Prop
    (properties
        x 105
        y 109
        description 3757
        view 247
        cel 1
        priority 6
        signal $0010
    )

    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((super:handleEvent(pEvent)))
                return 
            )(else
                (if (Said('look,look/waterfall'))
                    (self:doVerb(1))
                )
            )
        )
    )


    (method (doVerb theVerb)
        (switch (theVerb)
            (case 1
                proc255_0(47 21)
            )
        )
    )

)
(instance water2 of Prop
    (properties
        x 114
        y 79
        description 3757
        view 247
        loop 1
        cel 2
        priority 6
        signal $0010
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 1
                proc255_0(47 21)
            )
        )
    )

)
(instance water3 of Prop
    (properties
        x 116
        y 120
        description 3757
        view 247
        loop 3
        cel 1
        priority 6
        signal $0010
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 1
                proc255_0(47 21)
            )
        )
    )

)
(instance water4 of Prop
    (properties
        x 103
        y 128
        description 3757
        view 247
        loop 4
        priority 6
        signal $0010
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 1
                proc255_0(47 21)
            )
        )
    )

)
(instance cliff1 of NewFeature
    (properties
        x 191
        y 39
        noun 3669
        nsTop 23
        nsLeft 164
        nsBottom 55
        nsRight 219
        description 3795
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3801
    )
)
(instance cliff2 of NewFeature
    (properties
        x 234
        y 36
        noun 3669
        nsTop 12
        nsLeft 217
        nsBottom 60
        nsRight 251
        description 3795
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3801
    )
)
(instance cliff3 of NewFeature
    (properties
        x 264
        y 26
        noun 3669
        nsTop 10
        nsLeft 251
        nsBottom 43
        nsRight 277
        description 3795
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3801
    )
)
(instance cliff4 of NewFeature
    (properties
        x 155
        y 52
        noun 3669
        nsTop 43
        nsLeft 146
        nsBottom 62
        nsRight 164
        description 3795
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3801
    )
)
(instance bush1 of NewFeature
    (properties
        x 14
        y 44
        noun 3673
        nsTop 22
        nsBottom 67
        nsRight 28
        description 3911
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3916
    )
)
(instance bush2 of NewFeature
    (properties
        x 218
        y 84
        noun 3673
        nsTop 58
        nsLeft 144
        nsBottom 110
        nsRight 292
        description 3911
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3916
    )
)
(instance bush3 of NewFeature
    (properties
        x 298
        y 62
        noun 3673
        nsTop 27
        nsLeft 277
        nsBottom 97
        nsRight 320
        description 3911
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3916
    )
)
(instance bush4 of NewFeature
    (properties
        x 266
        y 51
        noun 3673
        nsTop 45
        nsLeft 255
        nsBottom 58
        nsRight 277
        description 3911
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3916
    )
)
(instance river1 of NewFeature
    (properties
        x 119
        y 137
        noun 3680
        nsTop 121
        nsLeft 82
        nsBottom 154
        nsRight 156
        description 4018
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        lookStr 4024
    )
)
(instance river2 of NewFeature
    (properties
        x 149
        y 171
        noun 3680
        nsTop 154
        nsLeft 99
        nsBottom 189
        nsRight 199
        description 4018
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        lookStr 4024
    )
)
(instance river3 of NewFeature
    (properties
        x 165
        y 147
        noun 3680
        nsTop 140
        nsLeft 155
        nsBottom 154
        nsRight 175
        description 4018
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        lookStr 4024
    )
)
(instance tree1 of NewFeature
    (properties
        x 61
        y 14
        noun 3690
        nsBottom 28
        nsRight 122
        description 4139
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 4144
    )
)
(instance tree2 of NewFeature
    (properties
        x 33
        y 44
        noun 3690
        nsTop 29
        nsLeft 21
        nsBottom 60
        nsRight 45
        description 4139
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 4144
    )
)
(instance stump of NewFeature
    (properties
        x 53
        y 76
        noun 3694
        nsTop 61
        nsLeft 26
        nsBottom 91
        nsRight 80
        description 4199
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 4205
    )
)
