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


(local
    local0

)
(instance public rm9 of Rm
    (properties
        picture 9
        horizon 70
        north 24
        east 10
        south 8
        west 16
    )

    (method (init)
        (self:style(
            (switch (gGNumber)
                (case north
                    5
                )
                (case west
                    3
                )
                (case east
                    2
                )
                (case south
                    4
                )
            )
))
        (if (not proc0_12(22) and (<> Random(0 3) 1))
            = local0 60
            Load(rsVIEW 155)
            proc958_0(132 30 62)
        )
        (super:init())
        (switch (gGNumber)
            (case north
                (send gEgo:posn(proc0_17(163 (send gEgo:x) 102) (+ horizon 2)))
            )
            (case south
                (send gEgo:y(188))
            )
            (case west
                (send gEgo:posn(3 proc0_17(189 (send gEgo:y) 85)))
            )
            (case east
                (send gEgo:posn(317 proc0_17(189 proc0_18(172 (send gEgo:y) 156) 98)))
            )
            (default 
                = local0 60
            )
        )
        (send gEgo:init())
        proc0_1()
        (bush1:init())
        (bush2:init())
        (bush3:init())
        (smalltree1:init())
        (smalltree2:init())
        (smalltree3:init())
        (smalltree4:init())
        (smalltree5:init())
        (tree1:init())
        (tree2:init())
        (tree3:init())
        (tree4:init())
        (tree5:init())
        (tree6:init())
        (tree7:init())
    )


    (method (doit)
        (var temp0)
        (if (script and (<> script momShow))
            (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
                            )
                        )
)))
            )(else
                (if (script)
                    (send script:doit())
                )(else
                    (if (> local0 1)
                        --local0
                    )(else
                        (if ((not (send gEgo:inRect(88 130 125 150)) and (== local0 1)) and not proc0_12(1))
                            --local0
                            (send global2:setScript(momShow))
                        )
                    )
                )
            )
        )
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((super:handleEvent(pEvent)))
                return 
            )(else
                (if (Said('look,look>'))
                    (if (Said('[<at,around][/room,clearing,ceder]'))
                        proc255_0(9 0)
                    )
                )(else
                    (if (Said('/fairy'))
                        proc255_0(9 1)
                    )
                )
            )
        )
    )

)
(instance mom of Actor
    (properties
        description 2892
        view 155
    )

    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((super:handleEvent(pEvent)))
                return 
            )(else
                (if (Said('look,look/fairy') or proc255_5(self pEvent 3))
                    proc255_0(9 2)
                )(else
                    (if (Said('get,get/fairy'))
                        proc255_0(9 3)
                    )(else
                        (if (Said('/fairy') or Said('say,talk,speak'))
                            proc255_0(9 4)
                        )
                    )
                )
            )
        )
    )


    (method (doVerb theVerb)
        (switch (theVerb)
            (case 1
                proc255_0(9 2)
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance momShow of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send (ScriptID(0 21)):
                    number(30)
                    init()
                    play()
                )
                proc0_2()
                proc0_15(gEgo 111 140)
                (mom:
                    illegalBits(0)
                    ignoreHorizon(1)
                    ignoreActors(1)
                    setLoop(0)
                    setCycle(Fwd)
                    setPri(10)
                    posn(40 -5)
                    setMotion(MoveTo 66 30 self)
                    setStep(3 4)
                    init()
                )
            )
            (case 1
                (mom:setMotion(MoveTo 69 44 self))
            )
            (case 2
                (mom:setMotion(MoveTo 108 77 self))
            )
            (case 3
                (mom:
                    setStep(2 2)
                    setMotion(MoveTo 101 100 self)
                )
            )
            (case 4
                (mom:setMotion(MoveTo 96 123 self))
            )
            (case 5
                (mom:
                    setStep(1 1)
                    setMotion(MoveTo 111 135)
                )
                = seconds 3
            )
            (case 6
                (mom:
                    posn(111 140)
                    setLoop(1)
                    cel(0)
                    cycleSpeed(1)
                    setCycle(End self)
                )
            )
            (case 7
                (mom:
                    setLoop(2)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 8
                (mom:setScript(talkMom))
                proc255_0(9 5)
                = seconds 4
            )
            (case 9
                proc255_0(9 6)
                proc0_10(22)
                = global124 3000
                (send global2:setRegions(616))
                = seconds 4
            )
            (case 10
                (send (ScriptID(0 21)):
                    number(62)
                    play()
                )
                (mom:
                    setScript(0)
                    setLoop(2)
                    cel(7)
                    setCycle(Beg self)
                )
            )
            (case 11
                (mom:
                    ignoreActors(1)
                    setLoop(1)
                    cel(4)
                    setCycle(Beg self)
                )
            )
            (case 12
                (send (ScriptID(0 21)):
                    number(30)
                    play()
                )
                (mom:
                    setLoop(0)
                    posn(111 135)
                    cycleSpeed(0)
                    setCycle(Fwd)
                )
                = seconds 2
            )
            (case 13
                proc255_0(9 7)
                (mom:
                    setStep(2 2)
                    setMotion(MoveTo 34 77 self)
                )
            )
            (case 14
                (mom:
                    setStep(7 7)
                    setMotion(MoveTo 210 -18 self)
                )
            )
            (case 15
                (send (ScriptID(0 21)):
                    loop(1)
                    fade()
                )
                proc0_3()
                (mom:dispose())
                (self:dispose())
            )
        )
    )

)
(instance talkMom of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (mom:
                    ignoreActors(0)
                    setLoop(2)
                    cel(7)
                    setCycle(CT 1 -1 self)
                )
            )
            (case 1
                (mom:setCycle(End self))
            )
            (case 2
                = cycles Random(3 6)
            )
            (case 3
                (self:changeState(0))
            )
        )
    )

)
(instance bush1 of NewFeature
    (properties
        x 162
        y 79
        noun 2868
        nsTop 72
        nsLeft 155
        nsBottom 86
        nsRight 170
        description 2928
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2933
    )
)
(instance bush2 of NewFeature
    (properties
        x 292
        y 91
        noun 2868
        nsTop 85
        nsLeft 275
        nsBottom 97
        nsRight 310
        description 2928
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2933
    )
)
(instance bush3 of NewFeature
    (properties
        x 310
        y 158
        noun 2868
        nsTop 145
        nsLeft 301
        nsBottom 171
        nsRight 320
        description 2928
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2933
    )
)
(instance smalltree1 of NewFeature
    (properties
        x 42
        y 93
        noun 2872
        nsTop 77
        nsLeft 24
        nsBottom 109
        nsRight 61
        description 3018
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3029
    )
)
(instance smalltree2 of NewFeature
    (properties
        x 69
        y 98
        noun 2872
        nsTop 90
        nsLeft 60
        nsBottom 106
        nsRight 79
        description 3079
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3029
    )
)
(instance smalltree3 of NewFeature
    (properties
        x 266
        y 134
        noun 2872
        nsTop 127
        nsLeft 244
        nsBottom 141
        nsRight 288
        description 3079
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3029
    )
)
(instance smalltree4 of NewFeature
    (properties
        x 252
        y 150
        noun 2872
        nsTop 146
        nsLeft 231
        nsBottom 155
        nsRight 273
        description 3079
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3029
    )
)
(instance smalltree5 of NewFeature
    (properties
        x 17
        y 96
        noun 2872
        nsTop 89
        nsLeft 11
        nsBottom 104
        nsRight 23
        description 3079
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3029
    )
)
(instance tree1 of NewFeature
    (properties
        x 214
        y 11
        noun 2879
        nsTop -1
        nsLeft 110
        nsBottom 23
        nsRight 318
        description 3134
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3029
    )
)
(instance tree2 of NewFeature
    (properties
        x 175
        y 54
        noun 2879
        nsTop 23
        nsLeft 165
        nsBottom 85
        nsRight 186
        description 3134
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3029
    )
)
(instance tree3 of NewFeature
    (properties
        x 207
        y 50
        noun 2879
        nsTop 24
        nsLeft 198
        nsBottom 77
        nsRight 216
        description 3134
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3029
    )
)
(instance tree4 of NewFeature
    (properties
        x 271
        y 35
        noun 2879
        nsTop 23
        nsLeft 222
        nsBottom 47
        nsRight 320
        description 3134
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3029
    )
)
(instance tree5 of NewFeature
    (properties
        x 284
        y 57
        noun 2879
        nsTop 47
        nsLeft 249
        nsBottom 68
        nsRight 320
        description 3134
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3029
    )
)
(instance tree6 of NewFeature
    (properties
        x 262
        y 93
        noun 2879
        nsTop 69
        nsLeft 254
        nsBottom 117
        nsRight 271
        description 3134
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3029
    )
)
(instance tree7 of NewFeature
    (properties
        x 38
        y 38
        noun 2879
        nsBottom 77
        nsRight 77
        description 3134
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3029
    )
)
