(version 2)
(include "sci.sh")
(exports
    0 rm160
)
(use "Main")
(use "PanoRoom")
(use "PolyPath")
(use "Polygon")
(use "CueObj")
(use "Cycle")
(use "View")
(use "Obj")
(script 160)


(local
    local0
    local1
    local2

)
(procedure (localproc_0482)
    return 
        (switch (global125)
            (case 0
                (switch (++local1)
                    (case 1
                        return 20
                    )
                    (case 2
                        return 17
                    )
                    (case 3
                        return 18
                    )
                    (case 4
                        return 19
                    )
                    (default 
                        return 16
                    )
                )
            )
            (case 1
                (switch (++local1)
                    (case 1
                        return 11
                    )
                    (case 2
                        return 12
                    )
                    (case 3
                        return 13
                    )
                    (case 4
                        return 14
                    )
                    (default 
                        return 15
                    )
                )
            )
            (case 2
                (switch (++local1)
                    (case 1
                        return 6
                    )
                    (case 2
                        return 7
                    )
                    (case 3
                        return 8
                    )
                    (case 4
                        return 9
                    )
                    (default 
                        return 10
                    )
                )
            )
            (default 
                (switch (++local1)
                    (case 1
                        return 1
                    )
                    (case 2
                        return 2
                    )
                    (case 3
                        return 3
                    )
                    (case 4
                        return 4
                    )
                    (default 
                        return 5
                    )
                )
            )
        )
)


(instance public rm160 of PanoRoom
    (properties
        noun 9
        picture 160
        east 170
        west 150
    )

    (method (init param1)
        (self:
            setRegions(50)
            addObstacle((send ((Polygon:new())):
                    type(2)
                    init(122 89 124 99 64 99 64 89)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(177 91 185 105 179 117 153 117 168 101 150 100 141 91)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(176 177 319 156 319 189 0 189 0 159 54 159)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(251 80 251 87 213 87 205 80)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(319 0 319 42 262 42 173 39 152 46 112 52 0 53 0 0)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(171 72 171 76 148 76 148 72)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(102 127 142 121 148 130 125 139)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(109 149 124 145 142 151 159 143 190 143 189 154 159 166 124 162)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(194 101 185 93 198 81 214 90 214 100)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(214 140 238 140 238 145 214 145)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(220 95 223 91 239 89 248 90 251 94 231 100)
                    yourself()
                )
)
            setScript(
                (switch (gGClientModNum)
                    (case 400
                        (send gOwner:posn(gGOwnerX gGOwnerY))
                        0
                    )
                    (case 700
                        (send gOwner:posn(gGOwnerX gGOwnerY))
                        0
                    )
                    (case 410
                        fromSimbani
                    )
                    (case east
                        = style 11
                        fromTreePanorama
                    )
                    (case west
                        = style 12
                        fromTarnaPanorama
                    )
                    (default 
                        fromSprings
                    )
                )
)
        )
        (poolOfPeace:init())
        (simbaniVillage:init())
        (bluffs:init())
        (highHill:init())
        (leapFrogRocks:init())
        (miscRocks:init())
        (send gOwner:solvePuzzle(209 3))
        (if (proc0_6(99) and (== gGClientModNum_2 gClientModNum))
            (honeyTree:
                x(gGOwnerX_3)
                y(gGOwnerY_3)
                init()
                stopUpd()
            )
        )
        proc0_3(6 3)
        (super:init(rest param1))
        (if (not proc0_6(88))
            (send gOwner:code(whereIsHe))
            (if (<> (send gLongSong:number) 160)
                (send gLongSong:
                    number(160)
                    setLoop(-1)
                    play()
                )
            )
        )
    )


    (method (dispose)
        (super:dispose())
        DisposeScript(35)
    )


    (method (cue)
        (if ((send gOwner:inRect(208 82 250 97)))
            (if (proc0_6(43))
                (self:setScript(tellScript))
            )(else
                (send global2:newRoom(410))
            )
        )(else
            (if ((proc0_6(99) and (== gGClientModNum_2 gClientModNum)) and (send gOwner:inRect(gGOwnerX_3 (- gGOwnerY_3 20) (+ gGOwnerX_3 20) gGOwnerY_3)))
                proc0_4(143)
                = global365 2
                (self:newRoom(400))
            )(else
                (if ((send gOwner:inRect(128 153 162 174)))
                    (send global2:newRoom(390))
                )(else
                    (if (> (send gOwner:x) 315)
                        (send global2:setScript(toJungle))
                    )(else
                        (if (< (send gOwner:x) 5)
                            (send global2:setScript(toTarna))
                        )(else
                            (send global2:newRoom(0))
                        )
                    )
                )
            )
        )
    )

)
(instance tellScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gQg3Messager:say(3 6 21 0 self))
            )
            (case 1
                proc0_2()
                (send global2:newRoom(400))
            )
        )
    )

)
(instance toTarna of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(PolyPath 1 (send gOwner:y) self))
            )
            (case 1
                (send global2:newRoom(150))
            )
        )
    )

)
(instance toJungle of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(PolyPath 319 (send gOwner:y) self))
            )
            (case 1
                (send global2:newRoom(170))
            )
        )
    )

)
(instance fromSimbani of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:
                    posn(233 87)
                    setMotion(PolyPath 214 95 self)
                )
            )
            (case 1
                proc0_3(6 3)
                (self:dispose())
            )
        )
    )

)
(instance fromSprings of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:
                    posn(140 165)
                    setMotion(PolyPath 152 170 self)
                )
            )
            (case 1
                proc0_3(6 3)
                (self:dispose())
            )
        )
    )

)
(instance fromTreePanorama of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:
                    x(318)
                    setMotion(PolyPath 314 (send gOwner:y) self)
                )
            )
            (case 1
                proc0_3(6 3)
                (self:dispose())
            )
        )
    )

)
(instance fromTarnaPanorama of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if (proc0_6(88))
                    (send gOwner:view(153))
                )
                (send gOwner:
                    x(2)
                    setMotion(PolyPath 6 (send gOwner:y) self)
                )
            )
            (case 1
                (if (proc0_6(88))
                    (fire:
                        init()
                        hide()
                    )
                    (send global2:setScript(rakeeshWalk))
                )(else
                    (self:cue())
                )
            )
            (case 2
                proc0_3(6 3)
                (self:dispose())
            )
        )
    )

)
(instance rakeeshWalk of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                proc0_5(6)
                (send gOwner:
                    cycleSpeed(6)
                    moveSpeed(6)
                    setMotion(PolyPath 29 100 self)
                )
            )
            (case 1
                (send gQg3Messager:say(1 6 localproc_0482() 0 self))
            )
            (case 2
                proc0_5(6)
                PalVary(pvINIT gClientModNum 3)
                (send gOwner:setMotion(PolyPath 30 103 self))
            )
            (case 3
                (self:setScript(campOut self))
            )
            (case 4
                (send gOwner:setMotion(PolyPath 75 107 self))
            )
            (case 5
                (send gQg3Messager:say(1 6 localproc_0482() 0 self))
            )
            (case 6
                proc0_5(6)
                (send gOwner:setMotion(PolyPath 107 133 self))
            )
            (case 7
                (send gOwner:setMotion(PolyPath 110 136 self))
            )
            (case 8
                (send gOwner:setMotion(PolyPath 140 130 self))
            )
            (case 9
                (send gQg3Messager:say(1 6 localproc_0482() 0 self))
            )
            (case 10
                proc0_5(6)
                (send gOwner:setMotion(PolyPath 165 133 self))
            )
            (case 11
                (send gQg3Messager:say(1 6 localproc_0482() 0 self))
            )
            (case 12
                proc0_5(6)
                (send gOwner:setMotion(PolyPath 207 101 self))
            )
            (case 13
                (send gQg3Messager:say(1 6 localproc_0482() 0 self))
            )
            (case 14
                proc0_5(6)
                (send gOwner:setMotion(PolyPath 217 94 self))
            )
            (case 15
                proc0_4(85)
                proc0_5(88)
                proc0_4(6)
                = global120 2600
                = global122 3
                (send global2:newRoom(410))
            )
        )
    )

)
(instance campOut of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gQg3Messager:say(1 6 22 0 self))
            )
            (case 1
                proc0_5(6)
                (fire:
                    x(+ (send gOwner:x) 5)
                    y((send gOwner:y))
                    show()
                    setCycle(Fwd)
                )
                = cycles 5
            )
            (case 2
                = seconds 9
            )
            (case 3
                PalVary(pvREVERSE 5)
                (fire:dispose())
                ++global122
                = gGOwnerMaxStamina[17] (send gOwner:maxStamina())
                (send gOwner:
                    takeDamage(-16)
                    useMana(-16)
                )
                = cycles 5
            )
            (case 4
                = seconds 7
            )
            (case 5
                (send gQg3Messager:say(1 6 23 0 self))
            )
            (case 6
                proc0_5(6)
                (self:dispose())
            )
        )
    )

)
(instance fire of Prop
    (properties
        x 115
        y 113
        view 150
    )
)
(instance honeyTree of Prop
    (properties
        view 150
        loop 1
        cel 2
        signal $4000
    )
)
(instance poolOfPeace of Feature
    (properties
        x 142
        y 158
        noun 2
        nsTop 152
        nsLeft 121
        nsBottom 164
        nsRight 163
        sightAngle 180
    )
)
(instance simbaniVillage of Feature
    (properties
        x 228
        y 83
        noun 4
        nsTop 79
        nsLeft 208
        nsBottom 87
        nsRight 248
        sightAngle 180
    )
)
(instance bluffs of Feature
    (properties
        x 219
        y 91
        noun 5
        nsTop 82
        nsLeft 190
        nsBottom 100
        nsRight 249
        sightAngle 180
    )
)
(instance highHill of Feature
    (properties
        x 162
        y 90
        noun 6
        nsTop 82
        nsLeft 148
        nsBottom 99
        nsRight 176
        sightAngle 180
    )
)
(instance leapFrogRocks of Feature
    (properties
        x 95
        y 93
        noun 7
        nsTop 89
        nsLeft 68
        nsBottom 98
        nsRight 122
        sightAngle 180
    )
)
(instance miscRocks of Feature
    (properties
        x 171
        y 149
        noun 8
        nsTop 144
        nsLeft 156
        nsBottom 155
        nsRight 186
        sightAngle 180
    )
)
(instance whereIsHe of Code
    (properties)

    (method (doit)
        (if ((send global2:script))
            0
        )(else
            (if ((send gOwner:inRect(123 154 164 164)))
                (send gOwner:setMotion(0))
                (send global2:newRoom(390))
            )(else
                (if (> (send gOwner:x) 315)
                    (send gOwner:setMotion(0))
                    (send global2:setScript(toJungle))
                )(else
                    (if (< (send gOwner:x) 5)
                        (send global2:setScript(toTarna))
                    )(else
                        (if (not proc0_6(43) and (send gOwner:inRect(208 82 252 92)))
                            (send gOwner:setMotion(0))
                            (send global2:newRoom(410))
                        )
                    )
                )
            )
        )
    )

)
