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



(instance public Room62 of Rm
    (properties
        picture 62
        style 16
    )

    (method (init)
        (self:setRegions(603))
        Load(rsVIEW 536)
        (super:init())
        (if (global100)
            (send ((Prop:new())):
                view(536)
                loop(1)
                cel(0)
                posn(114 78)
                init()
                setPri(4)
                setCycle(Fwd)
            )
            (send ((Prop:new())):
                view(536)
                loop(2)
                cel(1)
                posn(205 78)
                init()
                setPri(4)
                setCycle(Fwd)
            )
        )
        (if (== gPicture 59)
            (send gEgo:
                posn(47 130)
                view(4)
                xStep(4)
                yStep(1)
                init()
            )
        )
        (if (== gPicture 68)
            (send gEgo:
                posn(244 158)
                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(59))
        )
    )


    (method (handleEvent pEvent)
        return 
            (if ((send pEvent:claimed()))
                return 1
            )(else
                (if (== (send pEvent:type()) 128)
                    (if (Said('look>'))
                        (if (Said('<under/bed'))
                            Print(62 0)
                        )(else
                            (if (Said('/bed'))
                                Print(62 1)
                            )(else
                                (if (Said('/window'))
                                    Print(62 2)
                                )(else
                                    (if (Said('<in/chest,dresser,drawer'))
                                        Print(62 3)
                                    )(else
                                        (if (Said('/chest,dresser'))
                                            (if (< (send gEgo:x()) 150)
                                                Print(62 4)
                                            )(else
                                                Print(62 5)
                                            )
                                        )(else
                                            (if (Said('/wall'))
                                                Print(62 6)
                                            )(else
                                                (if (Said('/chandelier'))
                                                    Print(62 7)
                                                )(else
                                                    (if (Said('/dirt') or Said('<down'))
                                                        Print(62 8)
                                                    )(else
                                                        (if (Said('/mirror'))
                                                            (if ((send gEgo:inRect(19 148 80 168)) or (send gEgo:inRect(191 133 271 162)))
                                                                Print(62 9)
                                                            )(else
                                                                Print(62 10)
                                                            )
                                                        )(else
                                                            (if (Said('/carpet'))
                                                                Print(62 11)
                                                            )(else
                                                                (if (Said('[<around][/room]'))
                                                                    Print(62 12)
                                                                )
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )(else
                        (if (Said('open/chest,dresser,drawer'))
                            Print(62 3)
                        )(else
                            (if (Said('get[<in,on]/bed') or Said('lay,sleep[<in,on,down]'))
                                Print(62 13)
                            )
                        )
                    )
                )
            )
    )

)
