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



(instance public rm5 of Rm
    (properties
        picture 5
        north 12
        east 4
        south 44
        west 6
    )

    (method (init)
        (if (>= global101 1)
            proc958_0(128 302 700)
        )
        (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((send gEgo:x) 82))
            )
            (case south
                (send gEgo:posn(proc0_17(310 (send gEgo:x) 119) 186))
            )
            (case west
                (send gEgo:posn(4 proc0_17(185 proc0_18(121 (send gEgo:y) 91) 73)))
            )
            (case east
                (if (global130)
                    (send gEgo:y(proc0_17(153 (send gEgo:y) 109)))
                )(else
                    (if (< (send gEgo:y) 131)
                        (send gEgo:y(78))
                    )(else
                        (send gEgo:y(175))
                    )
                )
                (send gEgo:x(317))
            )
            (default 
                (send gEgo:posn(4 137))
            )
        )
        (send gEgo:init())
        (if (not global130)
            proc0_1()
        )
        (self:setRegions(603))
        (lake1:init())
        (lake2:init())
        (lake3:init())
        (lake4:init())
        (tree1:init())
        (tree2:init())
        (tree3:init())
        (tree4:init())
        (tree5:init())
        (bigrock1:init())
        (bigrock2:init())
        (bigrock3:init())
        (bigrock4:init())
        (smallrock1:init())
        (root1:init())
        (root2:init())
        (root3:init())
        (if (>= global101 1)
            (fish:init())
            (ripple:
                init()
                cycleSpeed(global101)
                setCycle(Fwd)
            )
        )
    )


    (method (doit)
        (var temp0)
        (if (proc999_5((send gEgo:onControl(1)) 2 4 8 16) and (<> (send gEgo:illegalBits) -24576))
            (send gEgo:illegalBits(-24576))
        )(else
            (if (not proc999_5((send gEgo:onControl(1)) 2 4 8 16) and (== (send gEgo:illegalBits) -24576))
                (send gEgo:illegalBits(-32768))
            )
        )
        = temp0 
            (switch ((send ((User:alterEgo)):edgeHit))
                (case 1
                    north
                )
                (case 2
                    east
                )
                (case 3
                    south
                )
                (case 4
                    west
                )
            )
        (if (temp0)
            proc0_11(44)
            (send gEgo:
                illegalBits(-32768)
                priority(-1)
            )
            (self:newRoom(temp0))
        )(else
            (if (script and not global130)
                (send script:doit())
            )(else
                (if ((not (send gEgo:script) and (== gNewRoomNumber gNumber)) and (& (send gEgo:onControl(1)) $2000))
                    (send global2:setScript(slipIntoWater))
                )(else
                    (if (script and global130)
                        (send script:doit())
                    )(else
                        (if ((& (send gEgo:onControl(1)) $0200) and (<> (send gEgo:script) climbHill))
                            (send gEgo:setScript(climbHill))
                        )
                    )
                )
            )
        )
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((super:handleEvent(pEvent)))
                return 
            )(else
                (if (Said('look,look>'))
                    (if (Said('[<at,around][/room,lake]'))
                        proc255_0(5 0)
                    )(else
                        (if (Said('/well'))
                            proc255_0(5 1)
                        )
                    )
                )
            )
        )
    )

)
(instance ripple of Prop
    (properties
        x 249
        y 132
        view 700
        loop 1
        signal $4000
    )

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


    (method (doVerb theVerb)
        (switch (theVerb)
            (case 1
                proc255_0(5 2)
            )
        )
    )

)
(instance fishJump of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (fish:
                    posn(Random(267 318) Random(120 146))
                    loop(Random(0 1))
                    setCycle(End self)
                )
            )
            (case 1
                (fish:stopUpd())
                (self:dispose())
            )
        )
    )

)
(instance fish of Prop
    (properties
        view 302
    )

    (method (init)
        (self:
            cycleSpeed(
                (if (>= global101 1)
                    1
                )(else
                    0
                )
)
            ignoreActors()
            stopUpd()
        )
        (super:init())
    )


    (method (doit)
        (super:doit())
        (if (((< Random(1 100) 3) and not (fish:script)) and not global130)
            (fish:setScript(fishJump))
        )
    )


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


    (method (doVerb theVerb)
        (switch (theVerb)
            (case 1
                (if ((fish:script))
                    proc255_0(5 3)
                )(else
                    proc255_0(5 4)
                )
            )
            (case 7
                proc255_0(5 5)
            )
        )
    )

)
(instance climbHill of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:
                    illegalBits(0)
                    setLoop(3)
                    setPri(1)
                    setMotion(MoveTo (send gEgo:x) + (send gEgo:y) 15 self)
                )
            )
            (case 1
                proc0_1()
                proc0_3()
                (send global2:newRoom((send global2:north)))
                (self:dispose())
            )
        )
    )

)
(instance slipIntoWater of Script
    (properties)

    (method (doit param1)
        (super:doit(rest param1))
        (if ((== state 0) and (& (send gEgo:onControl(1)) $0002))
            (self:changeState(1))
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:
                    setCycle(0)
                    ignoreActors()
                    illegalBits(0)
                    setStep(6 4)
                    setMotion(MoveTo 312 120)
                )
                (if (proc0_12(1))
                    proc255_0(5 6)
                    (send gGame:changeScore(-3))
                )
            )
            (case 1
                (send gEgo:
                    posn((send gEgo:x) + (send gEgo:y) 2)
                    setCycle(StopWalk 2)
                    setStep(3 2)
                    ignoreActors(0)
                    setMotion(0)
                )
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance lake1 of NewFeature
    (properties
        x 286
        y 131
        noun 3112
        nsTop 104
        nsLeft 253
        nsBottom 159
        nsRight 319
        description 3211
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        lookStr 3216
    )
)
(instance lake2 of NewFeature
    (properties
        x 237
        y 134
        noun 3112
        nsTop 116
        nsLeft 223
        nsBottom 153
        nsRight 252
        description 3211
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        lookStr 3216
    )
)
(instance tree1 of NewFeature
    (properties
        x 43
        y 17
        noun 3122
        nsLeft 3
        nsBottom 35
        nsRight 84
        description 3260
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3265
    )
)
(instance tree2 of NewFeature
    (properties
        x 75
        y 69
        noun 3122
        nsTop 35
        nsLeft 60
        nsBottom 104
        nsRight 90
        description 3260
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3265
    )
)
(instance tree3 of NewFeature
    (properties
        x 129
        y 29
        noun 3122
        nsTop 16
        nsLeft 105
        nsBottom 42
        nsRight 153
        description 3260
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3265
    )
)
(instance tree4 of NewFeature
    (properties
        x 110
        y 47
        noun 3122
        nsTop 42
        nsLeft 89
        nsBottom 53
        nsRight 131
        description 3260
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3265
    )
)
(instance tree5 of NewFeature
    (properties
        x 110
        y 3
        noun 3122
        nsTop -1
        nsLeft 83
        nsBottom 7
        nsRight 138
        description 3260
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3265
    )
)
(instance bigrock1 of NewFeature
    (properties
        x 42
        y 87
        noun 3129
        nsTop 57
        nsLeft 25
        nsBottom 117
        nsRight 59
        description 3356
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3365
    )
)
(instance bigrock2 of NewFeature
    (properties
        x 18
        y 92
        noun 3129
        nsTop 71
        nsLeft 12
        nsBottom 113
        nsRight 25
        description 3356
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3365
    )
)
(instance bigrock3 of NewFeature
    (properties
        x 107
        y 86
        noun 3129
        nsTop 76
        nsLeft 90
        nsBottom 96
        nsRight 125
        description 3356
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3365
    )
)
(instance bigrock4 of NewFeature
    (properties
        x 81
        y 120
        noun 3129
        nsTop 104
        nsLeft 59
        nsBottom 136
        nsRight 104
        description 3356
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3365
    )
)
(instance smallrock1 of NewFeature
    (properties
        x 232
        y 102
        noun 3138
        nsTop 92
        nsLeft 214
        nsBottom 112
        nsRight 251
        description 3472
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3483
    )
)
(instance lake3 of NewFeature
    (properties
        x 191
        y 114
        noun 3147
        nsTop 105
        nsLeft 173
        nsBottom 123
        nsRight 209
        description 3254
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        lookStr 3216
    )
)
(instance lake4 of NewFeature
    (properties
        x 295
        y 98
        noun 3147
        nsTop 96
        nsLeft 271
        nsBottom 101
        nsRight 320
        description 3574
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        lookStr 3216
    )
)
(instance root1 of NewFeature
    (properties
        x 121
        y 101
        noun 3154
        nsTop 95
        nsLeft 99
        nsBottom 107
        nsRight 143
        description 3586
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3591
    )
)
(instance root2 of NewFeature
    (properties
        x 134
        y 115
        noun 3154
        nsTop 107
        nsLeft 110
        nsBottom 124
        nsRight 159
        description 3586
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3591
    )
)
(instance root3 of NewFeature
    (properties
        x 123
        y 131
        noun 3154
        nsTop 124
        nsLeft 113
        nsBottom 139
        nsRight 134
        description 3586
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3591
    )
)
