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



(instance public rm48 of Rm
    (properties
        picture 48
        east 41
        south 33
        west 47
    )

    (method (init)
        proc958_0(128 57 18)
        proc958_0(132 70 95)
        (self:style(
            (switch (gGNumber)
                (case west
                    3
                )
                (case south
                    4
                )
                (default 
                    8
                )
            )
))
        (super:init())
        (switch (gGNumber)
            (case south
                (send gEgo:
                    posn(proc0_17(220 (send gEgo:x) 0) 188)
                    init()
                )
                proc0_1()
            )
            (case west
                (send gEgo:
                    posn(3 proc0_17(188 (send gEgo:y) 127))
                    init()
                )
                proc0_1()
            )
            (default 
                (self:setScript(skyDiver))
            )
        )
        (cliff1:init())
        (cliff2:init())
        (cliff3:init())
        (rock2:init())
        (rock1:init())
        (bush6:init())
        (bush5:init())
        (bush4:init())
        (bush3:init())
        (bush2:init())
        (bush1:init())
    )


    (method (doit)
        (var temp0)
        (if (script)
            (send script:doit())
        )(else
            (if (== (send gEgo:onControl(1)) 32)
                (self:setScript(fall))
            )(else
                (if (== (send gEgo:onControl(1)) 16)
                    (self:setScript(fall))
                )(else
                    (if (== (send gEgo:onControl(1)) 64)
                        (self:setScript(fallNorth))
                    )(else
                        (if (== (send gEgo:onControl(1)) 128)
                            (self:setScript(fall))
                        )(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 ((super:handleEvent(pEvent)))
                return 
            )(else
                (if (Said('climb,climb,enter,jump[<in,in]/hole'))
                    proc255_0(48 0)
                )(else
                    (if (Said('climb,climb/cliff'))
                        (if (> (send gEgo:x) 235)
                            proc255_0(48 1)
                        )(else
                            proc255_0(48 2)
                        )
                    )(else
                        (if (((Said('look,look/hole') or proc0_14(pEvent 152 142 172 150)) or proc0_14(pEvent 126 144 152 157)) or proc0_14(pEvent 96 150 126 160))
                            (if ((send gEgo:inRect(88 140 183 167)))
                                proc255_0(48 3)
                            )(else
                                proc255_0(48 4)
                            )
                        )(else
                            (if (Said('look,look>'))
                                (if (Said('[<at,around][/room]'))
                                    proc255_0(48 5)
                                )(else
                                    (if (Said('/blossom'))
                                        proc255_0(48 6)
                                    )(else
                                        (if (Said('/clearing'))
                                            proc255_0(48 7)
                                        )(else
                                            (if (Said('/hill,hill'))
                                                proc255_0(48 8)
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
    )

)
(instance fallNorth of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:
                    view(57)
                    illegalBits(0)
                    setPri(9)
                    loop(8)
                    cel(0)
                    setMotion(0)
                    cycleSpeed(1)
                    setCycle(End self)
                )
            )
            (case 1
                (send gEgo:
                    cycleSpeed(0)
                    setCycle(End self)
                )
            )
            (case 2
                (send gEgo:
                    loop(9)
                    setStep(2 2)
                    setCycle(End self)
                )
            )
            (case 3
                proc0_3()
                (send global2:newRoom(73))
            )
        )
    )

)
(instance fall of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:
                    view(57)
                    illegalBits(0)
                    setPri(9)
                    cel(0)
                    loop(
                        (if (< (send gEgo:x) 139)
                            1
                        )(else
                            0
                        )
)
                    setMotion(0)
                    cycleSpeed(1)
                    setCycle(End self)
                )
            )
            (case 1
                (if (proc0_12(1))
                    proc255_0(48 9)
                    proc0_11(1)
                    proc0_11(17)
                    proc0_8(5)
                    (send gGame:changeScore(-3))
                )
                (send gEgo:setCycle(End self))
            )
            (case 2
                (send gEgo:
                    setLoop(
                        (if (< (send gEgo:x) 139)
                            3
                        )(else
                            2
                        )
)
                    cel(0)
                    setStep(2 2)
                    setCycle(End self)
                )
            )
            (case 3
                proc0_3()
                (send global2:newRoom(73))
            )
        )
    )

)
(instance skyDiver of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send (ScriptID(0 21)):
                    number(17)
                    loop(1)
                    init()
                    play()
                )
                (send gEgo:
                    init()
                    ignoreHorizon(1)
                    view(18)
                    setPri(11)
                    posn(182 -40)
                    yStep(14)
                    illegalBits(0)
                    setCycle(0)
                    setMotion(MoveTo 182 133 self)
                )
            )
            (case 1
                (send (ScriptID(0 21)):
                    number(95)
                    play()
                )
                (send gEgo:
                    setLoop(1)
                    cycleSpeed(1)
                    posn(181 132)
                    setCycle(CT 2 1 self)
                )
            )
            (case 2
                ShakeScreen(6)
                (send gEgo:setCycle(End))
                = seconds 3
            )
            (case 3
                (send gEgo:
                    setLoop(2)
                    setCel(0)
                    posn(181 132)
                )
                = cycles 2
            )
            (case 4
                (send (ScriptID(0 21)):
                    number(70)
                    play()
                )
                (send gEgo:
                    cycleSpeed(2)
                    setCycle(End self)
                )
            )
            (case 5
                proc0_1()
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance cliff1 of NewFeature
    (properties
        x 287
        y 123
        noun 2409
        nsTop 57
        nsLeft 255
        nsBottom 189
        nsRight 320
        description 2461
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2467
    )
)
(instance cliff2 of NewFeature
    (properties
        x 178
        y 53
        noun 2413
        nsTop 22
        nsLeft 108
        nsBottom 85
        nsRight 249
        description 2530
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2467
    )
)
(instance cliff3 of NewFeature
    (properties
        x 52
        y 45
        noun 2413
        nsTop 23
        nsBottom 67
        nsRight 105
        description 2537
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2467
    )
)
(instance bush1 of NewFeature
    (properties
        x 69
        y 151
        noun 2413
        nsTop 141
        nsLeft 42
        nsBottom 161
        nsRight 97
        description 2544
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2550
    )
)
(instance rock2 of NewFeature
    (properties
        x 35
        y 120
        noun 2420
        nsTop 116
        nsBottom 124
        nsRight 71
        description 2609
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2614
    )
)
(instance rock1 of NewFeature
    (properties
        x 85
        y 155
        noun 2420
        nsTop 150
        nsLeft 72
        nsBottom 161
        nsRight 98
        description 2609
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2614
    )
)
(instance bush6 of NewFeature
    (properties
        x 41
        y 99
        noun 2424
        nsTop 79
        nsBottom 119
        nsRight 83
        description 2701
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2706
    )
)
(instance bush5 of NewFeature
    (properties
        x 23
        y 67
        noun 2424
        nsTop 56
        nsBottom 79
        nsRight 47
        description 2701
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2706
    )
)
(instance bush4 of NewFeature
    (properties
        x 110
        y 106
        noun 2424
        nsTop 93
        nsLeft 82
        nsBottom 119
        nsRight 139
        description 2701
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2706
    )
)
(instance bush3 of NewFeature
    (properties
        x 84
        y 83
        noun 2424
        nsTop 73
        nsLeft 62
        nsBottom 93
        nsRight 107
        description 2701
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2706
    )
)
(instance bush2 of NewFeature
    (properties
        x 276
        y 182
        noun 2424
        nsTop 175
        nsLeft 234
        nsBottom 189
        nsRight 318
        description 2701
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 2706
    )
)
