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


(local
    newView
    newProp

)
(instance public Room67 of Rm
    (properties
        picture 67
        style 16
    )

    (method (init)
        Load(rsVIEW 510)
        (self:setRegions(603))
        (super:init())
        = global101 1
        (if (global100)
            (send ((Prop:new())):
                view(536)
                loop(1)
                cel(0)
                ignoreActors(1)
                posn(205 130)
                init()
                setPri(12)
                setCycle(Fwd)
            )
        )
        (if (== gPicture 66)
            (send gEgo:
                posn(85 124)
                view(4)
                xStep(4)
                yStep(1)
                init()
            )
        )
        (if (== gPicture 68)
            (send gEgo:
                posn(264 131)
                view(4)
                xStep(4)
                yStep(1)
                init()
            )
        )
        (if (== (send ((send gInv:at(18))):owner()) 67)
            (send (= newView (View:new())):
                view(510)
                loop(0)
                cel(0)
                posn(207 75)
                stopUpd()
                init()
            )
        )
        (send (= newProp (Prop:new())):
            view(510)
            loop(2)
            cel(0)
            ignoreActors(1)
            stopUpd()
            posn(74 102)
            init()
            setPri(8)
        )
        (if (global131)
            (send newProp:
                setCel(255)
                stopUpd()
            )
            (send gEgo:illegalBits(32768))
        )(else
            (send gEgo:illegalBits(32772))
        )
        (if (((< 0 global134) and (< global134 255)) and (== global133 gGNewPropX))
            proc0_12(603 -1)
        )
    )


    (method (doit)
        (super:doit())
        (if (& (send gEgo:onControl(0)) $0040)
            (send gEgo:illegalBits(32768))
            (send global2:newRoom(68))
        )
        (if ((& (send gEgo:onControl(1)) $0004) and global131)
            (send gEgo:illegalBits(32768))
            (send global2:newRoom(66))
        )
        (if ((& (send gEgo:onControl()) $0020) and global131)
            (send gEgo:setPri(8))
        )(else
            (send gEgo:setPri(-1))
        )
    )


    (method (handleEvent pEvent)
        return 
            (if ((send pEvent:claimed()))
                return 1
            )(else
                (if (== (send pEvent:type()) 128)
                    (if (Said('look[<around][/!*]') or Said('look/room,parlor'))
                        Print(67 0)
                    )(else
                        (if (Said('look>'))
                            (if ((<> (send ((send gInv:at(18))):owner()) 67) and Said('/book'))
                                (send ((send gInv:at(18))):showSelf())
                            )(else
                                (if (Said('/book,shelf,bookshelf'))
                                    (if (> (send gEgo:x()) 160)
                                        (if (== (send ((send gInv:at(18))):owner()) 67)
                                            Print(67 1)
                                            = global128 1
                                        )(else
                                            Print(67 2)
                                        )
                                    )(else
                                        Print(67 3)
                                    )
                                )(else
                                    (if (Said('<behind,under/painting'))
                                        Print(67 4)
                                    )(else
                                        (if (Said('/painting'))
                                            Print(67 5)
                                            = global129 1
                                        )(else
                                            (if (Said('/wall<left'))
                                                (if (global131)
                                                    Print(67 6)
                                                )(else
                                                    (if (global129)
                                                        Print(67 7)
                                                        = global130 1
                                                    )(else
                                                        Print(67 8)
                                                    )
                                                )
                                            )(else
                                                (if (Said('/wall<right'))
                                                    Print(67 9)
                                                )(else
                                                    (if (Said('/wall'))
                                                        (if (global131)
                                                            Print(67 6)
                                                        )(else
                                                            (if (global129)
                                                                Print(67 7)
                                                                = global130 1
                                                            )(else
                                                                Print(67 10)
                                                            )
                                                        )
                                                    )(else
                                                        (if (Said('/latch'))
                                                            (if (global131)
                                                                Print(67 11)
                                                            )(else
                                                                (if (global129)
                                                                    (if (global130)
                                                                        (if (& (send gEgo:onControl()) $0020)
                                                                            Print(67 12)
                                                                        )(else
                                                                            Print(67 13)
                                                                        )
                                                                    )
                                                                )(else
                                                                    Print(67 14)
                                                                )
                                                            )
                                                        )(else
                                                            (if (Said('<in/fireplace'))
                                                                Print(67 15)
                                                            )(else
                                                                (if (Said('/fireplace'))
                                                                    Print(67 16)
                                                                )(else
                                                                    (if (Said('/chandelier'))
                                                                        Print(67 17)
                                                                    )(else
                                                                        (if (Said('/couch'))
                                                                            Print(67 18)
                                                                        )(else
                                                                            (if (Said('/door'))
                                                                                (if (global131)
                                                                                    Print(67 19)
                                                                                )(else
                                                                                    Print(67 20)
                                                                                )
                                                                            )(else
                                                                                (if (Said('/cabinet,cabinet'))
                                                                                    Print(67 21)
                                                                                )(else
                                                                                    (if (Said('/table,chair,chest,furniture'))
                                                                                        Print(67 22)
                                                                                    )(else
                                                                                        (if (Said('/dirt,carpet,carpet') or Said('<down'))
                                                                                            Print(67 23)
                                                                                        )
                                                                                    )
                                                                                )
                                                                            )
                                                                        )
                                                                    )
                                                                )
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )(else
                            (if (Said('find/door'))
                                (if (global131)
                                    Print(67 19)
                                )(else
                                    Print(67 20)
                                )
                            )(else
                                (if (Said('sit'))
                                    Print(67 24)
                                )(else
                                    (if (Said('get/book') or Said('get/shakespeare'))
                                        (if ((send gEgo:inRect(83 119 127 127)))
                                            Print(67 25)
                                        )(else
                                            (if (& (send gEgo:onControl()) $0010)
                                                (if (<> (send ((send gInv:at(18))):owner()) 67)
                                                    Print(67 26)
                                                )(else
                                                    (if (global128)
                                                        Print(67 27)
                                                        (send gEgo:get(18))
                                                        (send gGame:changeScore(2))
                                                        (send newView:dispose())
                                                        = global182 1
                                                    )(else
                                                        Print(67 28)
                                                        (send gEgo:get(18))
                                                        = global182 1
                                                        (send gGame:changeScore(2))
                                                        (send newView:dispose())
                                                    )
                                                )
                                            )(else
                                                Print(800 1)
                                            )
                                        )
                                    )(else
                                        (if (Said('get/painting'))
                                            Print(67 4)
                                        )(else
                                            (if (Said('open/door'))
                                                (if (global131)
                                                    Print(67 29)
                                                )(else
                                                    Print(67 30)
                                                )
                                            )(else
                                                (if (Said('open/cabinet,cabinet'))
                                                    Print(67 21)
                                                )(else
                                                    (if (Said('close/door'))
                                                        (if (global131)
                                                            Print(67 31)
                                                        )(else
                                                            Print(67 32)
                                                        )
                                                    )(else
                                                        (if (Said('flip,move,lift/latch'))
                                                            (if (global130)
                                                                (if (global131)
                                                                    Print(67 33)
                                                                )(else
                                                                    (if (& (send gEgo:onControl()) $0020)
                                                                        Print(67 34)
                                                                        (send gEgo:setMotion(0))
                                                                        (send newProp:setCycle(End))
                                                                        = global131 1
                                                                        (send gGame:changeScore(4))
                                                                        (send gEgo:illegalBits(32768))
                                                                    )(else
                                                                        Print(800 1)
                                                                    )
                                                                )
                                                            )(else
                                                                Print(67 14)
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
    )


    (method (newRoom param1)
        (send gEgo:setPri(-1))
        (super:newRoom(param1))
    )

)
