(version 2)
(include "sci.sh")
(exports
    0 rm610
)
(use "Main")
(use "FPRoom")
(use "Inset")
(use "Scaler")
(use "PolyPath")
(use "Polygon")
(use "CueObj")
(use "StopWalk")
(use "Cycle")
(use "View")
(use "Obj")
(script 610)



(instance public rm610 of FPRoom
    (properties
        noun 1
        picture 610
        style $000a
        south 600
    )

    (method (init)
        (send gEgo:
            init()
            setScale(Scaler 116 86 155 128)
            normalize()
        )
        (switch (gGNumber)
            (case south
                (send global2:setScript(sEnterFrom600))
            )
            (case 620
                (send gEgo:
                    x(163)
                    y(136)
                    setHeading(180)
                )
                (send gGame:handsOn())
            )
            (case 630
                (send gEgo:
                    x(264)
                    y(117)
                )
                (send global2:setScript(sEnterFrom630))
            )
            (case 200
                (send gEgo:
                    x(187)
                    y(148)
                    setHeading(270)
                )
                (if (== global119 12)
                    (srini:
                        init()
                        setCycle(StopWalk -1)
                        setScale(Scaler 116 86 155 128)
                    )
                    (send global2:
                        style(7)
                        setScript(sBriefSrini)
                    )
                )(else
                    (send gGame:handsOn())
                )
            )
            (case 680
                (send gGame:handsOn())
            )
            (default 
                (send gEgo:
                    x(160)
                    y(150)
                )
                (send gGame:handsOn())
            )
        )
        (if (((<> gGNumber 200) and (<> global119 12)) and (<> global119 14))
            (send gGameMusic1:
                number(610)
                loop(-1)
                play()
            )
        )
        (super:init())
        (send global2:addObstacle((send ((Polygon:new())):
                type(3)
                init(225 144 226 136 116 136 75 174 0 175 0 189 319 189 319 174 247 174)
                yourself()
            )
))
        (stairs:
            init()
            setOnMeCheck(1 2)
        )
        (lamp:
            init()
            setOnMeCheck(1 8)
        )
        (leftPicture:
            init()
            setOnMeCheck(1 16)
        )
        (rightPicture:
            init()
            setOnMeCheck(1 32)
        )
        (bookShelf:
            init()
            setOnMeCheck(1 64)
        )
        (carpet:
            init()
            setOnMeCheck(1 128)
        )
        (chair:
            init()
            setOnMeCheck(1 256)
        )
        (pitcher:
            init()
            setOnMeCheck(1 512)
        )
        (desk:
            init()
            setOnMeCheck(1 1024)
        )
        (closet:
            init()
            setOnMeCheck(1 2048)
        )
        (table:
            init()
            setOnMeCheck(1 4096)
        )
        (labScreen:
            init()
            setOnMeCheck(26505)
        )
        (deskDrawer:
            setCel(
                (if (proc0_2(49))
                    (deskDrawer:lastCel())
                )(else
                    0
                )
)
            init()
            approachVerbs(4 45 1)
        )
        (deskRollTop:
            setCel(
                (if (proc0_2(48))
                    (deskRollTop:lastCel())
                )(else
                    0
                )
)
            init()
            approachVerbs(4 45 1)
        )
    )


    (method (doit)
        (super:doit())
        (if (script)
        )(else
            (if (proc0_1(gEgo 4))
                (send global2:setScript(sExitTo600))
            )
        )
    )


    (method (dispose)
        (if (<> global119 14)
            (send gGameMusic1:fade())
        )
        (send gOldWH:delete(stairs))
        (send gOldWH:delete(closet))
        (super:dispose())
    )

)
(instance sBriefSrini of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = seconds 3
            )
            (case 1
                (send gFpMessager:say(19 0 0))
                = cycles 1
            )
            (case 2
                (srini:setMotion(MoveTo 170 250 self))
                (send gGameMusic1:fade(0 30 12 1))
            )
            (case 3
                (send gGameMusic1:
                    number(610)
                    loop(-1)
                    play()
                )
                = global138 0
                = global119 13
                proc0_4(84)
                (send (ScriptID(0 13)):setReal(ScriptID(0 13) 0 15))
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance sExitTo600 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                (send gEgo:setMotion(MoveTo 170 250 self))
            )
            (case 1
                (send global2:newRoom(600))
            )
        )
    )

)
(instance sEnterFrom600 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:
                    x(170)
                    y(250)
                    setMotion(MoveTo 170 150 self)
                )
            )
            (case 1
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance sExitTo620 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:setMotion(PolyPath 163 136 self))
            )
            (case 1
                (send gEgo:setHeading(0 self))
            )
            (case 2
                = cycles 5
            )
            (case 3
                (send global2:newRoom(620))
            )
        )
    )

)
(instance sExitTo630 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:setMotion(PolyPath 215 138 self))
            )
            (case 1
                (send gGame:handsOff())
                (send gEgo:setMotion(MoveTo 245 138 self))
            )
            (case 2
                (send gEgo:setMotion(MoveTo 261 126 self))
            )
            (case 3
                (send global2:newRoom(630))
            )
        )
    )

)
(instance sEnterFrom630 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:
                    x(261)
                    y(126)
                    setMotion(MoveTo 245 138 self)
                )
            )
            (case 1
                (send gEgo:setMotion(MoveTo 215 138 self))
            )
            (case 2
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance srini of Actor
    (properties
        x 151
        y 148
        view 801
        loop 4
    )
)
(instance deskRollTop of Prop
    (properties
        x 62
        y 120
        z 21
        noun 20
        approachX 115
        approachY 155
        view 610
        loop 1
        priority 8
        signal $0011
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (proc0_2(46))
                    (if (proc0_2(48))
                        (self:setCycle(Beg self))
                        proc0_4(48)
                    )(else
                        (self:setCycle(End self))
                        proc0_3(48)
                    )
                    (rolltopSound:play())
                )(else
                    (send gFpMessager:say(noun 4 1))
                )
            )
            (case 45
                (if (== (deskRollTop:cel) 0)
                    (if (proc0_2(46))
                        proc0_4(46)
                        (send gFpMessager:say(noun 45 2))
                    )(else
                        proc0_3(46)
                        (send gFpMessager:say(noun 45 3))
                    )
                )(else
                    (send gFpMessager:say(noun 45 4))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )


    (method (cue)
        (self:stopUpd())
    )

)
(instance deskDrawer of Prop
    (properties
        x 85
        y 111
        noun 21
        approachX 115
        approachY 155
        view 610
        loop 2
        signal $0001
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (proc0_2(47))
                    (if (proc0_2(49))
                        (self:setCycle(Beg self))
                        proc0_4(49)
                    )(else
                        (self:setCycle(End self))
                        proc0_3(49)
                    )
                    (drawerSound:play())
                )(else
                    (send gFpMessager:say(noun 4 1))
                )
            )
            (case 1
                (if (not (send gEgo:has(31)) and proc0_2(49))
                    (send gEgo:stopUpd())
                    (send global2:setInset(inLetterInset))
                )(else
                    (if (proc0_2(49))
                        (send gFpMessager:say(noun 1 4))
                    )(else
                        (send gFpMessager:say(noun 1 0))
                    )
                )
            )
            (case 45
                (if (== (deskDrawer:cel) 0)
                    (if (proc0_2(47))
                        proc0_4(47)
                        (send gFpMessager:say(noun 45 2))
                    )(else
                        proc0_3(47)
                        (send gFpMessager:say(noun 45 3))
                    )
                )(else
                    (send gFpMessager:say(noun 45 4))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )


    (method (cue)
        (self:stopUpd())
    )

)
(instance labScreen of Feature
    (properties
        x 161
        y 90
        noun 2
        nsTop 50
        nsLeft 133
        nsBottom 130
        nsRight 189
        sightAngle 40
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 4
                (send global2:setScript(sExitTo620))
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance stairs of Feature
    (properties
        x 243
        y 116
        noun 3
    )

    (method (init)
        (send gOldWH:add(stairs))
        (super:init())
    )


    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 3
                (send global2:setScript(sExitTo630))
            )
            (case 4
                (send global2:setScript(sExitTo630))
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance lamp of Feature
    (properties
        x 53
        y 64
        noun 4
    )
)
(instance leftPicture of Feature
    (properties
        x 78
        y 70
        noun 5
    )
)
(instance rightPicture of Feature
    (properties
        x 218
        y 77
        noun 6
    )
)
(instance bookShelf of Feature
    (properties
        x 161
        y 50
        noun 7
    )
)
(instance carpet of Feature
    (properties
        x 168
        y 154
        noun 8
    )
)
(instance chair of Feature
    (properties
        x 116
        y 108
        noun 13
    )
)
(instance pitcher of Feature
    (properties
        x 219
        y 95
        noun 9
    )
)
(instance desk of Feature
    (properties
        x 101
        y 100
        noun 10
    )
)
(instance closet of Feature
    (properties
        x 276
        y 101
        noun 11
    )

    (method (init)
        (send gOldWH:add(closet))
        (super:init())
    )


    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 3
                (send global2:setScript(sExitTo630))
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance table of Feature
    (properties
        x 219
        y 110
        noun 12
    )
)
(instance inLetterInset of Inset
    (properties
        view 610
        loop 3
        x 62
        y 87
        priority 15
        disposeNotOnMe 1
        noun 18
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (send gEgo:get(31 inLetterInset))
                (send gGame:points(1))
                (self:dispose())
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance rolltopSound of FPSound
    (properties
        flags $0001
        number 2611
    )
)
(instance drawerSound of FPSound
    (properties
        flags $0001
        number 2126
    )
)
