(include "sci.sh")
(use "Main")
(use "sewer")
(use "SQRoom")
(use "Polygon")
(use "Cycle")
(use "Obj")
(script 75)



(instance public rm075 of SQRoom
    (properties
        picture 75
        east 80
        south 90
        picAngle 70
        vanishingX 319
        vanishingY 65496
    )

    (method (init)
        (sewer:roomVer(22891))
        Load(rsVIEW 80)
        (switch (global12)
            (case east
                proc0_3()
                (send gEgo:y(100))
                (self:style(40))
            )
            (case south
                proc0_2()
                (if ((== (sewer:status) 3) and (== (sewer:location) 75))
                    (send (ScriptID(702 2)):
                        init()
                        hide()
                        posn(120 116)
                        setLoop(0)
                        setScript(ScriptID(702 4))
                    )
                )
                (self:
                    setScript(enterScript)
                    style(30)
                )
            )
            (default 
                (send gLongSong:
                    number(805)
                    vol(127)
                    loop(-1)
                    playBed()
                )
                (self:
                    setScript(enterScript)
                    style(30)
                )
            )
        )
        (send gEgo:init())
        (send (ScriptID(702 5)):
            init()
            setLoop(0)
            posn(37 122)
            setScript(daDripScript)
        )
        (send (ScriptID(702 6)):
            init()
            setLoop(1)
            posn(219 46)
            cycleSpeed(1)
            setCycle(Fwd)
        )
        (super:init())
        (send (ScriptID(702 2)):show())
        (self:
            setRegions(702)
            addObstacle((send ((Polygon:new())):
                    type(2)
                    init(153 95 36 189 0 189 0 0 319 0 319 95)
                    yourself()
                )
 (send ((Polygon:new())):
                    type(2)
                    init(319 101 319 189 50 189 159 101)
                    yourself()
                )
)
        )
        (if ((<> (sewer:location) 75) and (<> global12 90))
            (sewer:status(1))
        )
    )


    (method (doit param1)
        (if (script)
            0
        )(else
            (if (== (send gEgo:edgeHit) 3)
                proc0_2()
                (send global2:setScript(exitScript))
            )(else
                (if ((== (sewer:location) 90) and ((> (sewer:rmTimer) 7) or (< (send gEgo:y) 129)))
                    (sewer:
                        location(0)
                        status(0)
                    )
                )
            )
        )
        (super:doit(rest param1))
        (if (((> (send gEgo:y) 170) and (== (sewer:status) 1)) and (<> (sewer:location) 75))
            (send (ScriptID(702 3)):
                init()
                hide()
                setScript(dripScript)
            )
            (sewer:location(75))
        )
    )

)
(instance enterScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:
                    x(65520)
                    y(246)
                    setLoop(6)
                    setMotion(MoveTo 50 181 self)
                )
                (sewer:rmTimer(0))
            )
            (case 1
                proc0_1()
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance exitScript of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                (send gEgo:
                    setHeading(225 self)
                    setMotion(0)
                )
            )
            (case 1
                (send gEgo:setMotion(MoveTo 65520 246 self))
            )
            (case 2
                (if (== (sewer:status) 2)
                    (sewer:status(3))
                )
                (send global2:newRoom(90))
            )
        )
    )

)
(instance dripScript of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                = cycles 1
            )
            (case 1
                (send (ScriptID(702 3)):
                    show()
                    setLoop(5)
                    posn(82 90)
                    cel(0)
                    cycleSpeed(2)
                    setCycle(CT 9 1 self)
                )
                (send gLongSong:
                    vol(0)
                    changeState()
                )
                (send gLongSong2:
                    vol(127)
                    number(806)
                    loop(1)
                    play()
                )
                (send (ScriptID(702 2)):posn(109 125))
                (sewer:status(2))
            )
            (case 2
                (send (ScriptID(702 3)):setCycle(End))
                (send (ScriptID(702 2)):
                    init()
                    setLoop(7)
                    cycleSpeed(1)
                    setCycle(End self)
                )
            )
            (case 3
                (send gLongSong2:
                    vol(127)
                    number(819)
                    loop(-1)
                    playBed()
                )
                (sewer:status(3))
                (send (ScriptID(702 2)):
                    setLoop(0)
                    setCycle(Fwd)
                    cycleSpeed(0)
                    setScript(ScriptID(702 4))
                )
                (self:dispose())
            )
        )
    )

)
(instance daDripScript of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                (send (ScriptID(702 5)):setCycle(End self))
            )
            (case 1
                = cycles Random(5 20)
            )
            (case 2
                (self:init())
            )
        )
    )

)
