(version 2)
(include "sci.sh")
(exports
    0 rm200
)
(use "Main")
(use "FPRoom")
(use "Print")
(use "Inset")
(use "Scaler")
(use "ROsc")
(use "Osc")
(use "PolyPath")
(use "Polygon")
(use "CueObj")
(use "MoveFwd")
(use "n958")
(use "StopWalk")
(use "Cycle")
(use "View")
(use "Obj")
(script 200)


(local
    local0
    gEgoMoveSpeed

)
(instance public rm200 of FPRoom
    (properties
        noun 14
        picture 200
        east 210
    )

    (method (init)
        (switch (gGNumber)
            (case east
                = style 11
                (send gGame:handsOn())
            )
            (case 680
                (send gGame:handsOn())
            )
            (default 
                = style 100
                (send gEgo:
                    x(185)
                    y(106)
                )
                (send gGame:handsOn())
            )
        )
        (send gEgo:
            init()
            setScale(Scaler 100 50 175 95)
            normalize()
        )
        (super:init())
        (if (proc0_2(52))
            (dummyCredits:
                init()
                setScript(ScriptID(32 0))
            )
        )
        (if (== global119 10)
            proc958_0(132 2186 2187)
            proc958_0(128 204 202 203)
            (snail:
                approachVerbs(4)
                ignoreActors()
                setCycle(Fwd)
                setScript(sPlayContinuously)
                init()
            )
            (if (>= global131 3)
                (snail:
                    view(203)
                    loop(- global131 3)
                )
            )(else
                (snail:loop(global131))
            )
            (switch (global131)
                (case 0
                    (snail:
                        posn(49 65)
                        setPri(2)
                        approachX(43)
                        approachY(74)
                    )
                    (send global2:addObstacle((send ((Polygon:new())):
                            type(2)
                            init(10 87 10 108 81 134 190 110 206 136 303 114 249 84 263 68 319 82 319 189 0 189 0 0 319 0 319 66 255 50 201 49 134 50 119 58 73 61)
                            yourself()
                        )
 (send ((Polygon:new())):
                            type(2)
                            init(62 80 91 66 145 76 170 83 133 95)
                            yourself()
                        )
))
                )
                (case 1
                    (snail:
                        posn(17 83)
                        approachX(14)
                        approachY(90)
                        setPri(2)
                    )
                    (send global2:addObstacle((send ((Polygon:new())):
                            type(2)
                            init(16 89 10 108 81 134 190 110 206 136 303 114 249 84 263 68 319 82 319 189 0 189 0 0 319 0 319 66 255 50 201 49 134 50 119 58 71 65)
                            yourself()
                        )
 (send ((Polygon:new())):
                            type(2)
                            init(62 80 91 66 145 76 170 83 133 95)
                            yourself()
                        )
))
                )
                (case 2
                    (snail:
                        posn(50 102)
                        approachX(65)
                        approachY(109)
                    )
                    (send global2:addObstacle((send ((Polygon:new())):
                            type(2)
                            init(37 115 71 128 97 128 119 113 181 109 202 138 292 117 265 99 264 64 319 78 319 189 0 189 0 0 319 0 319 64 289 51 162 52 121 67 183 82 143 102 94 90 69 108)
                            yourself()
                        )
))
                )
                (case 3
                    (snail:
                        posn(95 116)
                        ignoreActors()
                        setPri(6)
                        approachX(89)
                        approachY(127)
                    )
                    (send global2:addObstacle((send ((Polygon:new())):
                            type(2)
                            init(97 128 142 113 181 109 202 138 292 117 265 99 264 64 319 78 319 189 0 189 0 0 319 0 319 64 289 51 162 52 121 67 183 82 140 109 84 128)
                            yourself()
                        )
))
                )
                (case 4
                    (snail:
                        posn(196 107)
                        approachX(175)
                        approachY(110)
                    )
                    (send global2:addObstacle((send ((Polygon:new())):
                            type(2)
                            init(10 87 10 108 81 134 190 110 206 136 303 114 249 84 263 68 319 82 319 189 0 189 0 0 319 0 319 66 255 50 201 49 134 50 119 58 73 61)
                            yourself()
                        )
 (send ((Polygon:new())):
                            type(2)
                            init(62 80 91 66 145 76 170 83 133 95)
                            yourself()
                        )
))
                )
            )
        )(else
            (if ((== global119 13) and proc0_2(27))
                (send global2:addObstacle((send ((Polygon:new())):
                        type(2)
                        init(10 87 10 108 83 124 201 108 216 130 303 114 249 84 263 68 319 82 319 189 0 189 0 0 319 0 319 66 255 50 201 49 134 50 119 58 73 61)
                        yourself()
                    )
))
            )(else
                (send global2:addObstacle((send ((Polygon:new())):
                        type(2)
                        init(10 87 10 108 81 134 190 110 206 136 303 114 249 84 263 68 319 82 319 189 0 189 0 0 319 0 319 66 255 50 201 49 134 50 119 58 73 61)
                        yourself()
                    )
))
            )
            (send global2:addObstacle((send ((Polygon:new())):
                    type(2)
                    init(62 80 91 66 145 76 170 83 133 95)
                    yourself()
                )
))
        )
        (if (not proc0_2(2) and (== global119 12))
            proc958_0(132 185 2184 2202)
            (send gGameMusic1:
                number(201)
                loop(-1)
                play()
            )
            (srini:
                init()
                stopUpd()
                setScale(-1 gEgo)
                approachVerbs(2 4)
            )
            proc0_4(84)
            = global138 0
        )
        (if (<> global119 10)
            (ants:
                setCycle(Fwd)
                init()
                ignoreActors()
                setPri(5)
            )
        )
        (if ((== global119 10) and (== global131 4))
            (self:setScript(sSlimeTime))
        )(else
            (if ((== global119 13) and not proc0_2(27))
                (send gGameMusic1:
                    number(203)
                    loop(-1)
                    play()
                )
                proc958_0(132 2180)
                (cedric:
                    init()
                    ignoreHorizon()
                )
                (vulture:
                    init()
                    ignoreActors()
                    stopUpd()
                )
                (cedric:setScript(sSeeCedric))
            )(else
                (if (== global119 13)
                    = local0 1
                    (send gGameMusic1:
                        number(203)
                        loop(-1)
                        play()
                    )
                    (localSound:
                        number(2180)
                        play()
                    )
                    (vulture2:
                        init()
                        setCycle(Fwd)
                        ignoreActors()
                    )
                )(else
                    (if ((== global119 19) and not proc0_2(98))
                        proc0_3(98)
                        (send gGameMusic2:
                            number(501)
                            loop(-1)
                            play()
                        )
                        (hopSingh:
                            init()
                            setScale(-1 gEgo)
                            setSpeed(12)
                            setStep(6 2)
                            setScript(sLeaveTown)
                        )
                    )
                )
            )
        )
        (if (proc0_2(2))
            (ladder:
                init()
                stopUpd()
                ignoreActors()
                approachVerbs(1 4)
                setPri(5)
            )
        )
        (anthill:
            init()
            approachVerbs(4 36)
            setOnMeCheck(1 2)
        )
        (rocks:
            init()
            approachVerbs(4)
            setOnMeCheck(1 4)
        )
        (cacti:
            init()
            setOnMeCheck(1 8)
        )
        (farCacti:
            init()
            setOnMeCheck(1 4096)
        )
        (road:
            init()
            approachVerbs(4)
            setOnMeCheck(1 16)
        )
        (bridge:
            init()
            approachVerbs(4)
            setOnMeCheck(1 32)
        )
        (tracks:
            init()
            approachVerbs(4)
            setOnMeCheck(1 64)
        )
        (cliff:
            init()
            approachVerbs(4)
            setOnMeCheck(1 128)
        )
    )


    (method (doit)
        (super:doit())
        (if (script)
        )(else
            (if (proc0_1(gEgo 16384))
                (send global2:setScript(sEgoFalls))
            )
        )
    )


    (method (dispose)
        (if (== global119 10)
            ++global131
        )
        (if (== global119 14)
            0
        )(else
            (send gGameMusic1:fade())
            (send gGameMusic2:fade())
        )
        DisposeScript(932)
        DisposeScript(32)
        (super:dispose())
    )

)
(instance sPlayContinuously of Script
    (properties)

    (method (doit)
        (super:doit())
        (if ((== (localSound:number) 2186) and (== (localSound:prevSignal) -1))
            (localSound:
                number(2186)
                loop(1)
                play(self)
            )
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (localSound:
                    number(2186)
                    loop(1)
                    play(self)
                )
            )
            (case 1
                (localSound:prevSignal(0))
                (self:changeState(0))
            )
        )
    )

)
(instance sLeaveTown of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = cycles 5
            )
            (case 1
                (send client:setCycle(End self))
            )
            (case 2
                (send client:setCycle(ROsc 3 5 6 self))
            )
            (case 3
                = seconds 2
            )
            (case 4
                (send client:setCycle(ROsc 3 5 6 self))
            )
            (case 5
                (send client:
                    setLoop(5)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 6
                (send client:
                    setLoop(1)
                    setCycle(Walk)
                    setMotion(MoveTo -30 100 self)
                )
            )
            (case 7
                (send gGameMusic2:fade(0 30 12 1))
                (self:dispose())
            )
        )
    )

)
(instance sWalkSrini of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = cycles 5
            )
            (case 1
                (sriniCU:setMotion(MoveTo 115 87 self))
            )
            (case 2
                (sriniCU:setCycle(ROsc Random(2 5) (sriniCU:cel) (+ (sriniCU:cel) 2) self))
            )
            (case 3
                (sriniCU:
                    setCycle(Walk)
                    setMotion(MoveTo 115 97 self)
                )
            )
            (case 4
                (sriniCU:setCycle(ROsc Random(2 5) (sriniCU:cel) (+ (sriniCU:cel) 2) self))
            )
            (case 5
                (sriniCU:
                    setCycle(Walk)
                    setMotion(MoveTo 115 107 self)
                )
            )
            (case 6
                (sriniCU:dispose())
                (inSriniWalk:dispose())
            )
        )
    )

)
(instance sEgoFalls of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                proc958_0(132 2133 2134)
                (if ((send gEgo:wearingGuns))
                    Load(rsVIEW 134)
                )(else
                    Load(rsVIEW 133)
                )
                (send gEgo:
                    setSpeed(7)
                    setHeading(180)
                )
                = cycles 5
            )
            (case 1
                (send gEgo:setMotion(MoveFwd 40 self))
            )
            (case 2
                (send gEgo:
                    setScale(Scaler 100 50 175 95)
                    setPri(15)
                    view(
                        (if ((send gEgo:wearingGuns))
                            134
                        )(else
                            133
                        )
)
                    setCel(0)
                    setSpeed(12)
                    setCycle(End self)
                )
                (localSound:
                    number(2133)
                    play(self)
                )
            )
            (case 3
                (send gEgo:hide())
            )
            (case 4
                (localSound:
                    number(2134)
                    play(self)
                )
                ShakeScreen(25 3)
                = ticks 190
            )
            (case 5
                ShakeScreen(5 3)
            )
            (case 6
                = seconds 3
            )
            (case 7
                = global122 9
                (send global2:newRoom(99))
            )
        )
    )

)
(instance sSlimeTime of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                (send gEgo:setMotion(PolyPath 265 65 self))
            )
            (case 1
                (send gEgo:setHeading(180))
                = cycles 10
            )
            (case 2
                (send gFpMessager:say(18 0 0 0 self))
            )
            (case 3
                = global122 16
                (send global2:newRoom(99))
            )
        )
    )

)
(instance sTalkToSrini of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gFpMessager:say(1 2 register 0 self))
            )
            (case 1
                (srini:
                    cycleSpeed(12)
                    setCycle(End self)
                )
            )
            (case 2
                (srini:setCycle(Beg self))
            )
            (case 3
                (srini:
                    stopUpd()
                    cycleSpeed(6)
                )
                (self:dispose())
            )
        )
    )

)
(instance sSeeCedric of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_3(27)
                = cycles 1
            )
            (case 1
                (cedric:
                    setLoop(1)
                    setCycle(Fwd)
                    setPri(15)
                    setMotion(MoveTo 269 38 self)
                )
            )
            (case 2
                (cedric:
                    setLoop(0)
                    stopUpd()
                )
                = seconds 2
            )
            (case 3
                (vulture:setCycle(End self))
            )
            (case 4
                = seconds 2
            )
            (case 5
                (vulture:setCycle(Beg self))
            )
            (case 6
                (vulture:
                    setLoop(3)
                    setCycle(Osc 3 self)
                )
            )
            (case 7
                (vulture:stopUpd())
                (self:dispose())
            )
        )
    )

)
(instance sPourBeer of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                (send gTimers:delete(ScriptID(0 13)))
                = gEgoMoveSpeed (send gEgo:moveSpeed)
                (send gEgo:setSpeed(6))
                (send gEgo:setMotion(PolyPath (snail:approachX) (snail:approachY) self))
            )
            (case 1
                (send gEgo:
                    view(204)
                    setLoop(1)
                    setCycle(Walk)
                    setMotion(PolyPath 87 128 self)
                )
            )
            (case 2
                (send gEgo:
                    view(204)
                    setLoop(0)
                    cel(0)
                    setCycle(Osc 3 self)
                )
                (localSound:
                    number(2813)
                    play()
                )
            )
            (case 3
                (localSound:stop())
                (send gFpMessager:say(2 33))
                (send gGame:points(16))
                (send gEgo:setSpeed(gEgoMoveSpeed))
                = global119 11
                (send global2:newRoom(205))
            )
        )
    )

)
(instance sSaveSrini of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                proc958_0(132 2202 185 2184)
                (send (ScriptID(1800 49)):
                    textY(35)
                    talkWidth(140)
                )
                (send (ScriptID(1802 40)):
                    x(207)
                    y(81)
                    textX(-170)
                    textY(35)
                    talkWidth(140)
                )
                (send gEgo:put(28))
                proc0_9(610)
                (send gGame:points(10))
                (send gFpMessager:say(3 36 10 1 2 self))
            )
            (case 1
                proc0_3(2)
                (ladder:
                    init()
                    stopUpd()
                    ignoreActors()
                    approachVerbs(1 4)
                    setPri(5)
                )
                (localSound:
                    number(2202)
                    play()
                )
                = cycles 30
            )
            (case 2
                (send gEgo:setMotion(PolyPath 116 104 self))
                (srini:
                    loop(2)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 3
                0
            )
            (case 4
                proc0_5(gEgo srini)
                = cycles 15
            )
            (case 5
                (send gOldCast:eachElementDo(#stopUpd))
                (send gOldCast:eachElementDo(#ignoreActors))
                = cycles 15
            )
            (case 6
                (send gFpMessager:say(3 36 10 3 self))
                proc0_9(0)
            )
            (case 7
                (send global2:setInset(inSriniWalk self))
            )
            (case 8
                proc0_9(610)
                = cycles 30
            )
            (case 9
                (send gFpMessager:say(3 36 10 4 self))
            )
            (case 10
                (srini:setMotion(MoveTo 109 61 self))
            )
            (case 11
                (srini:
                    setPri(-1)
                    setMotion(MoveTo 110 70 self)
                )
            )
            (case 12
                (send gEgo:setHeading(270))
                (srini:
                    moveSpeed(4)
                    cycleSpeed(4)
                    setMotion(PolyPath 106 104 self)
                )
            )
            (case 13
                (send gEgo:hide())
                (srini:
                    view(201)
                    loop(3)
                    cel(0)
                    x(112)
                    y(105)
                    moveSpeed(12)
                    cycleSpeed(12)
                    setCycle(CT 8 1 self)
                )
            )
            (case 14
                (send gFpMessager:say(3 36 10 5 7 self))
            )
            (case 15
                (srini:setCycle(End))
                = seconds 3
            )
            (case 16
                (send gFpMessager:say(1 2 1 0 self))
            )
            (case 17
                (send gOldCast:eachElementDo(#dispose))
                (send global2:drawPic(780 6))
                = seconds 3
            )
            (case 18
                (send gFpMessager:say(19 0 0 0 self))
            )
            (case 19
                (send global2:newRoom(610))
                (self:dispose())
            )
        )
    )

)
(instance hopSingh of Actor
    (properties
        x 90
        y 100
        noun 21
        view 844
        loop 3
    )
)
(instance snail of Actor
    (properties
        x 31
        y 64
        noun 2
        view 202
        loop 2
        detailLevel 2
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if ((send gEgo:has(54)) or proc0_2(32))
                    (send gFpMessager:say(noun theVerb 5))
                )(else
                    (send gEgo:get(54 self 1))
                    (send gGame:points(1 132))
                )
            )
            (case 33
                (if (== global119 10)
                    (send global2:setScript(sPourBeer))
                )(else
                    proc921_0("We need a msg here, Josh.")
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance srini of Actor
    (properties
        x 138
        y 67
        noun 1
        approachX 156
        approachY 103
        view 201
        loop 1
        priority 5
        signal $4010
    )

    (method (doVerb theVerb param2)
        (var temp0)
        = temp0 
            (if (proc0_2(2))
                1
            )(else
                3
            )
        (switch (theVerb)
            (case 1
                (if ((== temp0 3) and proc0_2(92))
                    = temp0 12
                    (send gFpMessager:say(noun theVerb temp0))
                )(else
                    (send gFpMessager:say(noun theVerb temp0))
                    proc0_3(92)
                )
            )
            (case 4
                (send gFpMessager:say(noun theVerb temp0))
            )
            (case 2
                (send global2:setScript(sTalkToSrini 0 temp0))
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance vulture of Prop
    (properties
        x 142
        y 169
        z 40
        noun 10
        view 209
        loop 2
        detailLevel 2
    )

    (method (doVerb theVerb param2)
        (var temp0)
        = temp0 
            (if (local0)
                9
            )(else
                8
            )
        (if (proc999_5(theVerb 1 4 2))
            (send gFpMessager:say(noun theVerb temp0))
        )(else
            (super:doVerb(theVerb rest param2))
        )
    )

)
(instance vulture2 of Actor
    (properties
        x 153
        y 173
        z 40
        noun 10
        view 209
        loop 4
    )

    (method (doVerb theVerb param2)
        (var temp0)
        = temp0 
            (if (local0)
                9
            )(else
                8
            )
        (if (proc999_5(theVerb 1 4 2))
            (send gFpMessager:say(noun theVerb temp0))
        )(else
            (super:doVerb(theVerb rest param2))
        )
    )

)
(instance ants of Prop
    (properties
        x 136
        y 64
        z -2
        noun 13
        view 200
        detailLevel 2
    )

    (method (doVerb theVerb)
        (if (== theVerb 1)
            (if ((send gOldCast:contains(srini)))
                (send gFpMessager:say(noun theVerb 10))
            )(else
                (send gFpMessager:say(noun theVerb 11))
            )
        )(else
            (super:doVerb(theVerb))
        )
    )

)
(instance cedric of Actor
    (properties
        x 270
        y -20
        noun 12
        view 209
        loop 1
        detailLevel 2
    )

    (method (doVerb theVerb param2)
        (var temp0)
        = temp0 8
        (if (proc999_5(theVerb 1 4 2))
            (send gFpMessager:say(noun theVerb temp0))
        )(else
            (super:doVerb(theVerb rest param2))
        )
    )

)
(instance dummyCredits of Prop
    (properties
        x -10
        y -10
        view 996
    )
)
(instance ladder of View
    (properties
        x 119
        y 82
        z 17
        noun 16
        approachX 129
        approachY 101
        view 200
        loop 1
        priority 5
        signal $4010
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (send gEgo:get(-1 28))
                proc0_4(2)
                (self:dispose())
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance anthill of Feature
    (properties
        x 126
        y 81
        noun 3
        sightAngle 40
        approachX 105
        approachY 91
        approachDist 26
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 36
                (if (== global119 12)
                    (send global2:setScript(sSaveSrini))
                )(else
                    (send gFpMessager:say(noun theVerb 11))
                )
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance rocks of Feature
    (properties
        x 80
        y 75
        noun 4
        sightAngle 40
        approachX 73
        approachY 95
        approachDist 26
    )
)
(instance cacti of Feature
    (properties
        x 125
        y 23
        noun 5
        sightAngle 40
        approachX 161
        approachY 66
        approachDist 81
    )
)
(instance farCacti of Feature
    (properties
        x 125
        y 23
        noun 17
        sightAngle 40
        approachX 161
        approachY 66
        approachDist 81
    )
)
(instance road of Feature
    (properties
        x 125
        y 23
        noun 6
        sightAngle 40
        approachX 161
        approachY 66
        approachDist 81
    )
)
(instance bridge of Feature
    (properties
        x 289
        y 60
        noun 7
        sightAngle 40
        approachX 235
        approachY 84
        approachDist 65
    )
)
(instance tracks of Feature
    (properties
        x 140
        y 160
        noun 8
        sightAngle 40
        approachX 81
        approachY 130
        approachDist 65
    )

    (method (doVerb theVerb param2)
        (var temp0)
        (switch (theVerb)
            (case 1
                (if (< global119 10)
                    = temp0 5
                )(else
                    (if (== global119 10)
                        = temp0 6
                    )(else
                        = temp0 7
                    )
                )
                (send gFpMessager:say(noun theVerb temp0))
            )
            (case 4
                = temp0 
                    (if (> global119 10)
                        7
                    )(else
                        5
                    )
                (send gFpMessager:say(noun theVerb temp0))
            )
            (case 32
                (if (== global119 10)
                    (send gFpMessager:say(noun theVerb 6))
                )(else
                    (super:doVerb(theVerb))
                )
            )
            (case 33
                (if (== global119 10)
                    (send global2:setScript(sPourBeer))
                )(else
                    (send gFpMessager:say(noun theVerb 13))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance cliff of Feature
    (properties
        x 180
        y 160
        noun 9
        sightAngle 40
        approachX 235
        approachY 84
        approachDist 65
    )
)
(instance inSriniWalk of Inset
    (properties
        view 205
        x 81
        y 32
        disposeNotOnMe 1
    )

    (method (init param1)
        (super:init(rest param1))
        (sriniCU:
            init()
            setLoop(1)
            setPri(15)
            ignoreActors()
            setCycle(Walk)
        )
        (send gGameMusic1:stop())
        (localSound:
            number(2184)
            play()
        )
        (self:setScript(sWalkSrini))
    )


    (method (dispose)
        (super:dispose())
        (ants:setCycle(Fwd))
        (srini:
            view(801)
            loop(1)
            x(106)
            y(66)
            setCycle(StopWalk -1)
        )
        (localSound:fade())
        (send gGameMusic1:
            number(185)
            loop(-1)
            play()
        )
    )

)
(instance sriniCU of Actor
    (properties
        x 117
        y 77
        view 205
    )
)
(instance localSound of FPSound
    (properties
        flags $0001
    )
)
(instance fallSound of FPSound
    (properties
        flags $0001
    )
)
