(version 2)
(include "sci.sh")
(exports
    0 rm270
)
(use "Main")
(use "FPRoom")
(use "Scaler")
(use "PolyPath")
(use "Polygon")
(use "CueObj")
(use "Cycle")
(use "View")
(use "Obj")
(script 270)


(local
    local0

)
(instance public rm270 of FPRoom
    (properties
        noun 5
        picture 270
        west 260
    )

    (method (init)
        (if (proc0_2(1))
            = west 265
        )(else
            = west 260
        )
        (switch (gGNumber)
            (case west
                = style 12
                (send gGame:handsOn())
            )
            (case 680
                (send gGame:handsOn())
            )
            (default 
                = style 100
                (send gEgo:
                    x(160)
                    y(160)
                )
                (send gGame:handsOn())
            )
        )
        (send gEgo:
            init()
            setScale(Scaler 100 50 175 95)
            normalize()
        )
        (super:init())
        (if (<> global119 14)
            (send gGameMusic2:fade(20 30 12 0))
        )
        (if (proc0_2(52))
            (dummyCredits:
                init()
                setScript(ScriptID(32 0))
            )
        )
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(0 0 319 0 319 189 0 189 0 135 119 148 169 186 236 186 278 157 269 153 240 163 201 75 56 75 0 85)
                yourself()
            )
))
        (mine:
            init()
            setOnMeCheck(1 2)
        )
        (house1:
            init()
            setOnMeCheck(1 4)
        )
        (house2:
            init()
            setOnMeCheck(1 8)
        )
        (tracks:
            init()
            setOnMeCheck(1 16)
        )
        (waterTower:
            init()
            setOnMeCheck(1 128)
        )
        (train:
            init()
            setOnMeCheck(1 512)
        )
        (swamp:
            init()
            setOnMeCheck(1 1024)
        )
        (swampLine:
            init()
            setOnMeCheck(1 2048)
        )
        (upperRightShrub:
            stopUpd()
            init()
        )
        (upperLeftShrub:
            stopUpd()
            init()
        )
        (leftShrub:
            stopUpd()
            init()
        )
        (rightShrub:
            stopUpd()
            init()
        )
        (if (> (send gGame:detailLevel()) 2)
            (bubbles:
                hide()
                init()
            )
        )
    )


    (method (doit)
        (super:doit())
        (if (script)
        )(else
            (if (proc0_1(gEgo 1024))
                (send global2:setScript(sDieInSwamp))
            )(else
                (if (proc0_1(gEgo 2048))
                    (send global2:setScript(sDieInSwamp))
                )
            )
        )
    )


    (method (dispose)
        DisposeScript(32)
        (super:dispose())
    )

)
(instance sBubbles of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = cycles 1
            )
            (case 1
                = seconds Random(7 15)
            )
            (case 2
                (bubbleSound:
                    number(2270)
                    flags(1)
                    loop(1)
                    prevSignal(0)
                    play()
                )
                (send client:
                    show()
                    setCycle(Fwd)
                )
                = cycles 1
            )
            (case 3
                = cycles 1
            )
            (case 4
                (if (<> (bubbleSound:prevSignal) -1)
                    (self:changeState(3))
                )(else
                    (send client:setCycle(End self))
                )
            )
            (case 5
                (send client:hide())
                (self:changeState(0))
            )
        )
    )

)
(instance sDieInSwamp of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                (bubbles:dispose())
                = cycles 1
            )
            (case 1
                (send gFpMessager:say(9 0 0 0 self))
            )
            (case 2
                (send gEgo:setMotion(PolyPath 193 105 self))
            )
            (case 3
                (send gEgo:setHeading(180 self))
            )
            (case 4
                = cycles 3
            )
            (case 5
                (send gFpMessager:say(8 0 1 0 self))
            )
            (case 6
                (send gEgo:
                    view(271)
                    setLoop(0)
                    setCel(0)
                    moveSpeed(12)
                    cycleSpeed(12)
                    setCycle(End self)
                )
            )
            (case 7
                = global122 7
                (send global2:newRoom(99))
                (self:dispose())
            )
        )
    )

)
(instance sBreezeShrubs of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = seconds Random(5 20)
            )
            (case 1
                (send client:setCycle(Fwd))
                = seconds Random(1 5)
            )
            (case 2
                (send client:stopUpd())
                (self:changeState(0))
            )
        )
    )

)
(instance bubbles of Prop
    (properties
        x 186
        y 118
        noun 16
        view 270
        cel 4
        cycleSpeed 10
        detailLevel 2
    )

    (method (init)
        (super:init())
        (if (> (send gGame:detailLevel()) 2)
            (self:setScript(sBubbles))
        )
    )

)
(instance upperLeftShrub of Prop
    (properties
        noun 12
        view 270
        loop 1
        cycleSpeed 10
        detailLevel 2
    )

    (method (init)
        (super:init())
        (if (> (send gGame:detailLevel()) 2)
            (self:setScript(sBreezeShrubs))
        )
    )

)
(instance leftShrub of Prop
    (properties
        y 197
        z 51
        noun 10
        view 270
        loop 3
        priority 15
        signal $0010
        cycleSpeed 10
        detailLevel 2
    )

    (method (init)
        (super:init())
        (if (> (send gGame:detailLevel()) 2)
            (self:setScript((sBreezeShrubs:new())))
        )
    )

)
(instance rightShrub of Prop
    (properties
        x 319
        y 189
        noun 11
        view 270
        loop 4
        cycleSpeed 10
        detailLevel 2
    )

    (method (init)
        (super:init())
        (if (> (send gGame:detailLevel()) 2)
            (self:setScript((sBreezeShrubs:new())))
        )
    )

)
(instance upperRightShrub of Prop
    (properties
        x 260
        noun 13
        view 270
        loop 2
        cycleSpeed 10
        detailLevel 2
    )

    (method (init)
        (super:init())
        (if (> (send gGame:detailLevel()) 2)
            (self:setScript((sBreezeShrubs:new())))
        )
    )

)
(instance dummyCredits of Prop
    (properties
        x -10
        y -10
        view 996
    )
)
(instance waterTower of Feature
    (properties
        x 100
        y 195
        noun 1
    )
)
(instance train of Feature
    (properties
        x 300
        y 198
        noun 3
    )
)
(instance swamp of Feature
    (properties
        x 1
        y 1
        noun 4
    )
)
(instance swampLine of Feature
    (properties
        x 115
        y 189
        noun 1
        nsTop 78
        nsLeft 71
        nsBottom 143
        nsRight 160
    )
)
(instance mine of Feature
    (properties
        x 300
        y 20
        noun 6
    )
)
(instance house1 of Feature
    (properties
        x 100
        y 20
        noun 2
    )
)
(instance house2 of Feature
    (properties
        x 100
        y 20
        noun 14
    )
)
(instance tracks of Feature
    (properties
        x 100
        y 20
        noun 15
    )
)
(instance bubbleSound of FPSound
    (properties
        flags $0001
        number 2270
    )
)
