(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "Cycle")
(use "Game")
(use "PV")
(script 64)


(local
    local0[3]

)
(instance public Room64 of Rm
    (properties
        picture 64
        style 16
    )

    (method (init)
        (self:setRegions(603))
        (super:init())
        (send ((View:new())):
            view(536)
            loop(3)
            cel(0)
            posn(154 81)
            setPri(15)
            addToPic()
        )
        (send ((View:new())):
            view(536)
            loop(3)
            cel(0)
            posn(167 81)
            setPri(15)
            addToPic()
        )
        (send ((View:new())):
            view(536)
            loop(3)
            cel(0)
            posn(179 81)
            setPri(15)
            addToPic()
        )
        (if (global100)
            (send ((View:new())):
                view(648)
                loop(3)
                cel(0)
                posn(219 89)
                setPri(5)
                addToPic()
            )
            (send ((View:new())):
                view(648)
                loop(4)
                cel(0)
                posn(266 105)
                setPri(6)
                addToPic()
            )
            (send ((Prop:new())):
                view(536)
                loop(2)
                cel(2)
                posn(154 76)
                setPri(15)
                init()
                setCycle(Fwd)
            )
            (send ((Prop:new())):
                view(536)
                loop(1)
                cel(1)
                posn(166 76)
                setPri(15)
                init()
                setCycle(Fwd)
            )
            (send ((Prop:new())):
                view(536)
                loop(2)
                cel(4)
                posn(179 76)
                setPri(15)
                init()
                setCycle(Fwd)
            )
        )
        (if (== gPicture 68)
            (send gEgo:
                posn(51 131)
                view(4)
                xStep(4)
                yStep(1)
                init()
            )
        )
        (if (== gPicture 65)
            (send gEgo:
                posn(210 116)
                view(4)
                xStep(4)
                yStep(1)
                init()
            )
        )
        (if (((< 0 global134) and (< global134 255)) and (== global133 gGNewPropX))
            proc0_12(603 -1)
        )
    )


    (method (doit)
        (super:doit())
        (if (& (send gEgo:onControl(0)) $0040)
            (send global2:newRoom(68))
        )
        (if (& (send gEgo:onControl(0)) $0020)
            (send global2:newRoom(65))
        )
    )


    (method (handleEvent pEvent)
        return 
            (if ((send pEvent:claimed()))
                return 1
            )(else
                (if (== (send pEvent:type()) 128)
                    (if (Said('look[<around][/!*]') or Said('look/room'))
                        Print(64 0)
                    )(else
                        (if (Said('look>'))
                            (if (Said('<under/table'))
                                Print(64 1)
                            )(else
                                (if (Said('/table'))
                                    Print(64 2)
                                )(else
                                    (if (Said('/chair'))
                                        Print(64 3)
                                    )(else
                                        (if (Said('/window'))
                                            (if ((send gEgo:inRect(231 118 278 139)))
                                                Print(64 4)
                                            )(else
                                                Print(800 1)
                                            )
                                        )(else
                                            (if (Said('/cabinet'))
                                                Print(64 5)
                                            )(else
                                                (if (Said('/chandelier'))
                                                    Print(64 6)
                                                )(else
                                                    (if (Said('/wall'))
                                                        Print(64 7)
                                                    )(else
                                                        (if (Said('/dirt') or Said('<down'))
                                                            Print(64 8)
                                                        )(else
                                                            (if (Said('/crumbs'))
                                                                Print(64 9)
                                                            )(else
                                                                (send pEvent:claimed(0))
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )(else
                            (if (Said('sit>'))
                                Print(64 10)
                                (send pEvent:claimed(1))
                            )(else
                                (if (Said('get>'))
                                    (if (Said('/crumbs'))
                                        Print(64 11)
                                    )(else
                                        (send pEvent:claimed(0))
                                    )
                                )
                            )
                        )
                    )
                )
            )
    )

)
