(version 2)
(include "sci.sh")
(exports
    0 rm36
)
(use "Main")
(use "Class_255_0")
(use "NewFeature")
(use "n958")
(use "Cycle")
(use "Game")
(use "Obj")
(script 36)



(procedure (localproc_0566)
    proc255_0(36 14)
)


(instance public rm36 of Rm
    (properties
        picture 36
        horizon 57
        north 45
        east 35
        south 29
        west 37
    )

    (method (init)
        proc958_0(128 31 30)
        Load(rsSOUND 21)
        (self:style(
            (switch (gGNumber)
                (case north
                    5
                )
                (case west
                    3
                )
                (case east
                    2
                )
                (case south
                    4
                )
                (default 
                    7
                )
            )
))
        (super:init())
        (switch (gGNumber)
            (case north
                (send gEgo:
                    posn(144 + horizon 2)
                    init()
                )
                proc0_1()
            )
            (case south
                (send gEgo:
                    y(188)
                    init()
                )
                proc0_1()
            )
            (case west
                (send gEgo:
                    posn(3 proc0_17(188 proc0_18(173 (send gEgo:y) 167) 95))
                    init()
                )
                proc0_1()
            )
            (case east
                (send gEgo:
                    posn(317 proc0_17(188 proc0_18(130 (send gEgo:y) 124) 75))
                    init()
                )
                proc0_1()
            )
            (default 
                (self:setScript(egoFromHole))
            )
        )
        (tree:init())
        (tree1:init())
        (tree6:init())
        (tree5:init())
        (tree4:init())
        (tree3:init())
        (tree2:init())
        (tree10:init())
        (tree9:init())
        (tree8:init())
        (tree7:init())
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if (Said('reach/hole'))
                (if ((send gEgo:inRect(142 125 175 131)))
                    proc255_0(36 0)
                )(else
                    localproc_0566()
                )
            )(else
                (if (Said('climb,climb,enter,go,(crawl[<in,in,through])/hole'))
                    (if ((send gEgo:inRect(142 125 175 131)))
                        proc255_0(36 1)
                    )(else
                        localproc_0566()
                    )
                )(else
                    (if (Said('get,get/glow'))
                        (if ((send gEgo:inRect(134 125 219 138)))
                            proc255_0(36 2)
                        )(else
                            localproc_0566()
                        )
                    )(else
                        (if (Said('get,get/boulder'))
                            (if ((send gEgo:inRect(134 125 219 138)))
                                proc255_0(36 3)
                            )(else
                                localproc_0566()
                            )
                        )(else
                            (if (Said('move,move/boulder'))
                                (if ((send gEgo:inRect(134 125 219 138)))
                                    proc255_0(36 4)
                                )(else
                                    localproc_0566()
                                )
                            )(else
                                (if ((Said('look,look<in/hole') or Said('look,look/hole')) or proc0_14(pEvent 151 113 166 126))
                                    (if ((send gEgo:inRect(142 125 175 131)))
                                        proc255_0(36 5)
                                    )(else
                                        (if ((send gEgo:inRect(134 125 219 138)))
                                            proc255_0(36 6)
                                        )(else
                                            localproc_0566()
                                        )
                                    )
                                )(else
                                    (if ((((Said('look,look/boulder') or proc0_14(pEvent 133 113 215 126)) or proc0_14(pEvent 111 100 245 113)) or proc0_14(pEvent 134 91 200 99)) or proc0_14(pEvent 156 85 193 90))
                                        proc255_0(36 7)
                                    )(else
                                        (if (Said('look,look>'))
                                            (if (Said('[<at,around][/room]'))
                                                proc255_0(36 8)
                                            )(else
                                                (if (Said('/glow[<green]'))
                                                    (if ((send gEgo:inRect(142 125 175 131)))
                                                        proc255_0(36 9)
                                                    )(else
                                                        proc255_0(36 10)
                                                    )
                                                )(else
                                                    (if (Said('/boulder'))
                                                        (if ((send gEgo:inRect(134 125 219 138)))
                                                            proc255_0(36 11)
                                                        )(else
                                                            proc255_0(36 12)
                                                        )
                                                    )(else
                                                        (super:handleEvent(pEvent))
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
    )

)
(instance egoFromHole of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:
                    init()
                    posn(166 119)
                    view(31)
                    setMotion(MoveTo 157 137 self)
                )
            )
            (case 1
                (send (ScriptID(0 21)):
                    number(21)
                    init()
                    play()
                )
                (send gEgo:
                    view(30)
                    cycleSpeed(1)
                    cel(6)
                    setMotion(0)
                    setCycle(Beg self)
                )
                proc0_19(105 1)
            )
            (case 2
                proc0_1()
                (send gEgo:loop(2))
                (if (((((send gEgo:has(14)) and (send gEgo:has(1))) and (send gEgo:has(16))) and (< gNumber 70)) and (<> gNumber 53))
                    proc255_0(36 13)
                )
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance tree10 of NewFeature
    (properties
        x 130
        y 74
        noun 2140
        nsTop 58
        nsLeft 104
        nsBottom 90
        nsRight 156
        description 2165
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2170
    )
)
(instance tree9 of NewFeature
    (properties
        x 95
        y 83
        noun 2140
        nsTop 78
        nsLeft 88
        nsBottom 89
        nsRight 103
        description 2165
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2170
    )
)
(instance tree8 of NewFeature
    (properties
        x 257
        y 83
        noun 2140
        nsTop 68
        nsLeft 201
        nsBottom 98
        nsRight 313
        description 2165
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2170
    )
)
(instance tree7 of NewFeature
    (properties
        x 237
        y 33
        noun 2140
        nsTop -1
        nsLeft 156
        nsBottom 68
        nsRight 319
        description 2165
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2170
    )
)
(instance tree6 of NewFeature
    (properties
        x 65
        y 32
        noun 2140
        nsTop -1
        nsLeft 11
        nsBottom 65
        nsRight 119
        description 2165
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2170
    )
)
(instance tree5 of NewFeature
    (properties
        x 32
        y 78
        noun 2140
        nsTop 65
        nsLeft 4
        nsBottom 92
        nsRight 61
        description 2165
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2170
    )
)
(instance tree4 of NewFeature
    (properties
        x 265
        y 112
        noun 2140
        nsTop 98
        nsLeft 252
        nsBottom 127
        nsRight 278
        description 2165
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2170
    )
)
(instance tree3 of NewFeature
    (properties
        x 36
        y 138
        noun 2140
        nsTop 118
        nsLeft 10
        nsBottom 158
        nsRight 63
        description 2165
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2170
    )
)
(instance tree2 of NewFeature
    (properties
        x 84
        y 151
        noun 2140
        nsTop 145
        nsLeft 62
        nsBottom 158
        nsRight 107
        description 2165
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2170
    )
)
(instance tree1 of NewFeature
    (properties
        x 28
        y 164
        noun 2140
        nsTop 158
        nsLeft 20
        nsBottom 171
        nsRight 37
        description 2165
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2170
    )
)
(instance tree of NewFeature
    (properties
        x 5
        y 134
        noun 2140
        nsTop 130
        nsBottom 139
        nsRight 10
        description 2165
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2170
    )
)
