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


(local
    local0
    local1
    theGGOwnerX
    theGGOwnerY
    local4

)
(procedure (localproc_03d1)
    (switch (local1)
        (case 0
            (send gQg3Messager:say(2 6 2))
        )
        (case 1
            (send gQg3Messager:say(2 6 3))
        )
        (case 2
            (send gQg3Messager:say(2 6 4))
        )
        (case 3
            (send gQg3Messager:say(2 6 5))
        )
        (case 4
            (send gQg3Messager:say(2 6 6))
        )
    )
    ++local1
    = local4 0
)


(procedure (localproc_0445)
    (switch (local1)
        (case 0
            (send gQg3Messager:say(3 6 8))
        )
        (case 1
            (send gQg3Messager:say(3 6 9))
        )
        (case 2
            (send gQg3Messager:say(3 6 10))
        )
    )
    ++local1
    = local4 0
)


(instance public rm170 of PanoRoom
    (properties
        noun 1
        picture 170
        east 180
        west 160
    )

    (method (init param1)
        proc0_2()
        (send gLongSong2:stop())
        (self:
            setRegions(50)
            addObstacle((send ((Polygon:new())):
                    type(2)
                    init(0 139 66 139 114 153 207 156 219 168 290 179 319 158 319 189 0 189)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(212 67 212 73 196 73 196 67)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(319 49 278 47 248 42 59 42 0 42 0 0 319 0)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(124 133 111 142 77 134 75 127 93 123)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(292 138 292 131 314 132 311 143)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(261 108 289 108 289 121 266 121)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(267 142 281 138 293 141 296 149 267 149)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(203 97 225 97 225 104 203 104)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(261 89 276 89 276 94 261 94)
                    yourself()
                )
)
            setScript(
                (switch (gGClientModNum)
                    (case 400
                        proc0_3(6 3)
                        (send gOwner:posn(gGOwnerX gGOwnerY))
                        0
                    )
                    (case 600
                        proc0_4(94)
                        fromLeopards
                    )
                    (case 630
                        proc0_4(94)
                        fromLeopards
                    )
                    (case 700
                        fromJungle
                    )
                    (case east
                        = style 11
                        fromLostCityPanorama
                    )
                    (case west
                        = style 12
                        fromSimbaniPanorama
                    )
                    (default 
                        fromTree
                    )
                )
)
        )
        (bigTree:init())
        (giantAntHill:init())
        (gorge:init())
        (mountains:init())
        (sky:init())
        (send gOwner:solvePuzzle(210 3))
        (if (proc0_6(94))
            (leopardVillage:init())
        )
        (super:init(rest param1))
        (send gLongSong:
            number(170)
            setLoop(-1)
            play()
        )
    )


    (method (dispose)
        DisposeScript(41)
        DisposeScript(36)
        (super:dispose())
    )


    (method (cue)
        (if ((send gOwner:inRect(191 35 214 75)))
            (send global2:newRoom(750))
        )(else
            (if ((send gOwner:inRect(246 104 294 131)))
                (if (proc0_6(94))
                    (if (== global125 2)
                        (send global2:newRoom(630))
                    )(else
                        (send global2:newRoom(600))
                    )
                )(else
                    (send global2:newRoom(0))
                )
            )(else
                (if (> (send gOwner:x) 315)
                    (self:setScript(toLostCity))
                )(else
                    (if (< (send gOwner:x) 5)
                        (self:setScript(toSimbani))
                    )(else
                        (send global2:newRoom(0))
                    )
                )
            )
        )
    )

)
(instance fromJungle of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = theGGOwnerX gGOwnerX
                = theGGOwnerY gGOwnerY
                (if (proc0_6(93))
                    (send gOwner:view(154))
                    (send gOwner:
                        x(gGOwnerX)
                        y(gGOwnerY)
                    )
                    proc0_5(93)
                    proc0_4(88)
                    = local0 (/ GetDistance((send gOwner:x) (send gOwner:y) 319 (send gOwner:y)) 4)
                    (if (< local0 1)
                        (send gQg3Messager:say(3 6 8))
                        (send gQg3Messager:say(3 6 9))
                        (send gQg3Messager:say(3 6 10))
                    )
                    (send global2:setScript(walkManu))
                )(else
                    (if (proc0_6(92))
                        proc0_4(88)
                        (send gOwner:view(152))
                        (send gOwner:
                            x(gGOwnerX)
                            y(gGOwnerY)
                        )
                        = local0 (/ GetDistance((send gOwner:x) (send gOwner:y) 260 115) 6)
                        (if (< local0 1)
                            (send gQg3Messager:say(2 6 2))
                            (send gQg3Messager:say(2 6 3))
                            (send gQg3Messager:say(2 6 4))
                            (send gQg3Messager:say(2 6 5))
                            (send gQg3Messager:say(2 6 6))
                        )
                        (send global2:setScript(walkJohari))
                    )(else
                        proc0_3(6 3)
                        (send gOwner:
                            x(gGOwnerX)
                            y(gGOwnerY)
                        )
                        (self:dispose())
                    )
                )
            )
        )
    )

)
(instance walkManu of Script
    (properties)

    (method (doit)
        (super:doit())
        (if (not (% GetDistance((send gOwner:x) (send gOwner:y) theGGOwnerX theGGOwnerY) local0) and not local4)
            = local4 1
            localproc_0445()
        )(else
            (if ((> global120 2750) and proc0_6(81))
                = local4 1
                (send gOwner:setMotion(0))
                (send global2:setScript(campOutManu))
            )
        )
    )


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

)
(instance campOutManu of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gQg3Messager:say(3 6 14 0 self))
            )
            (case 1
                PalVary(pvCHANGE_TICKS 3)
                (fire:
                    x(+ (send gOwner:x) 5)
                    y((send gOwner:y))
                    init()
                    setCycle(Fwd)
                )
                = cycles 5
            )
            (case 2
                = seconds 9
            )
            (case 3
                PalVary(pvREVERSE 5)
                proc0_5(81)
                (fire:dispose())
                = global120 800
                ++global122
                = gGOwnerMaxStamina[17] (send gOwner:maxStamina())
                (send gOwner:
                    takeDamage(-16)
                    useMana(-16)
                )
                = cycles 5
            )
            (case 4
                = seconds 7
            )
            (case 5
                (send gQg3Messager:say(3 6 13 0 self))
            )
            (case 6
                = local4 0
                (send global2:setScript(walkManu))
            )
        )
    )

)
(instance walkJohari of Script
    (properties)

    (method (doit)
        (super:doit())
        (if (not (% GetDistance((send gOwner:x) (send gOwner:y) theGGOwnerX theGGOwnerY) local0) and not local4)
            localproc_03d1()
            = local4 0
        )(else
            (if (((> global120 2750) and proc0_6(81)) and not local4)
                = local4 1
                (send gOwner:setMotion(0))
                (send global2:setScript(campOutJohari))
            )
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                = cycles 5
            )
            (case 1
                (send gOwner:
                    cycleSpeed(6)
                    moveSpeed(6)
                    setMotion(PolyPath 260 115 self)
                )
            )
            (case 2
                = cycles 10
            )
            (case 3
                (send gQg3Messager:say(2 6 7 0 self))
            )
            (case 4
                (send global2:newRoom(600))
            )
        )
    )

)
(instance campOutJohari of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gQg3Messager:say(2 6 14 0 self))
            )
            (case 1
                PalVary(pvCHANGE_TICKS 3)
                (fire:
                    x(+ (send gOwner:x) 5)
                    y((send gOwner:y))
                    init()
                    setCycle(Fwd)
                )
                = cycles 5
            )
            (case 2
                = seconds 9
            )
            (case 3
                PalVary(pvREVERSE 5)
                proc0_5(81)
                (fire:dispose())
                = global120 800
                ++global122
                = gGOwnerMaxStamina[17] (send gOwner:maxStamina())
                (send gOwner:
                    takeDamage(-16)
                    useMana(-16)
                )
                = cycles 5
            )
            (case 4
                = seconds 7
            )
            (case 5
                (send gQg3Messager:say(2 6 13 0 self))
            )
            (case 6
                = local4 0
                (send global2:setScript(walkJohari))
            )
        )
    )

)
(instance toLostCity 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(180))
            )
        )
    )

)
(instance toSimbani 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(160))
            )
        )
    )

)
(instance fromSimbaniPanorama of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:
                    x(2)
                    setMotion(MoveTo 
                        (if (proc0_6(43))
                            15
                        )(else
                            10
                        )
 (send gOwner:y) self)
                )
            )
            (case 1
                (if (proc0_6(43))
                    proc0_4(143)
                    = global365 9
                    (send global2:newRoom(700))
                )(else
                    proc0_3(6 3)
                    (self:dispose())
                )
            )
        )
    )

)
(instance fromLostCityPanorama of Script
    (properties)

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

)
(instance fromLeopards of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_5(92)
                (send gOwner:
                    x(269)
                    y(132)
                    setMotion(PolyPath 254 142 self)
                )
            )
            (case 1
                proc0_3(6 3)
                (self:dispose())
            )
        )
    )

)
(instance fromTree of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:
                    x(205)
                    y(76)
                    setMotion(PolyPath 200 82 self)
                )
            )
            (case 1
                proc0_3(6 3)
                (self:dispose())
            )
        )
    )

)
(instance leopardVillage of Prop
    (properties
        x 262
        y 129
        noun 10
        view 150
        loop 1
        cel 1
        signal $4000
    )

    (method (init)
        (super:init())
        proc0_4(94)
    )


    (method (doVerb theVerb)
        (switch (theVerb)
            (case 4
                (send gOwner:setMotion(PolyPath 260 115 self))
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )


    (method (cue)
        (send global2:newRoom(600))
    )

)
(instance fire of Prop
    (properties
        x 115
        y 113
        view 150
    )
)
(instance bigTree of Feature
    (properties
        x 202
        y 53
        noun 5
        nsTop 35
        nsLeft 184
        nsBottom 72
        nsRight 220
    )
)
(instance giantAntHill of Feature
    (properties
        x 98
        y 132
        noun 6
        nsTop 126
        nsLeft 77
        nsBottom 139
        nsRight 119
        sightAngle 180
    )
)
(instance gorge of Feature
    (properties
        x 159
        y 37
        noun 7
        nsTop 32
        nsBottom 42
        nsRight 319
    )
)
(instance mountains of Feature
    (properties
        x 159
        y 13
        noun 8
        nsTop 6
        nsBottom 20
        nsRight 319
    )
)
(instance sky of Feature
    (properties
        x 159
        y 3
        noun 9
        nsBottom 7
        nsRight 319
    )
)
