(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "brain")
(use "SQRoom")
(use "PolyPath")
(use "Class_950_0")
(use "Cycle")
(use "PicView")
(use "Obj")
(script 510)



(instance public rm510 of SQRoom
    (properties
        picture 510
        style 30
        south 525
        west 505
        vanishingX 65526
        vanishingY 65506
    )

    (method (init)
        Load(rsVIEW 508)
        (send gEgo:init())
        (switch (gWest)
            (case south
                (self:setScript(enterScript 0 (brain:level)))
            )
            (default 
                proc0_3()
            )
        )
        (self:setRegions(704))
        (super:init())
        (if (== gWest 1)
            (send gEgo:
                x(100)
                y(100)
            )
            (brain:level(2))
            = gWest 525
        )
        (switch ((brain:level))
            (case 2
                (brain:
                    makePolygon(0 167 91 167 109 189 0 189)
                    makePolygon(0 0 319 0 319 189 154 189 119 149 0 149)
                )
            )
            (case 3
                (brain:
                    makePolygon(0 126 144 126 207 189 0 189)
                    makePolygon(0 0 319 0 319 189 260 189 156 105 0 108)
                )
            )
        )
        (send (ScriptID(704 5)):
            x(84)
            y(93)
            nsLeft(77)
            nsTop(88)
            nsBottom(98)
            nsRight(91)
            sightAngle(90)
            init()
        )
        (light:
            init()
            setCycle(Fwd)
        )
        (roomFeature:init())
    )


    (method (doit)
        (super:doit())
        (if (script)
        )(else
            (if (proc0_5(gEgo 8))
                (brain:exitDir(135))
            )
        )
    )

)
(instance enterScript of Script
    (properties)

    (method (changeState newState)
        (var temp0, temp1, temp2, temp3, temp4)
        (switch (= state newState)
            (case 0
                proc0_2()
                (switch (register)
                    (case 3
                        = temp1 279
                        = temp2 227
                        = temp3 229
                        = temp4 183
                    )
                    (default 
                        = temp1 150
                        = temp2 227
                        = temp3 125
                        = temp4 183
                    )
                )
                (send gEgo:
                    x(temp1)
                    y(temp2)
                    setMotion(PolyPath temp3 temp4 self)
                )
            )
            (case 1
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance light of Prop
    (properties
        x 209
        y 49
        description "light"
        lookStr "The strange light pulses toward the center structure."
        view 508
        loop 1
    )
)
(instance roomFeature of Feature
    (properties
        nsBottom 200
        nsRight 320
        description "super brain computer"
        lookStr "This maze of cables, ducts, pipes, and glowing panels give the super brain computer a sense of being alive..."
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 4
                Print("You'd better not.  Something might answer.")
            )
            (default 
                (super:doVerb(param1 rest param2))
            )
        )
    )

)
