(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "Sound")
(use "Cycle")
(use "Game")
(use "User")
(use "PV")
(script 37)


(local
    newAct
    newAct_2

)
(instance fairieTheme of Sound
    (properties)
)
(instance door of Prop
    (properties)

    (method (cue)
        (self:ignoreActors())
        proc0_11()
        (send global2:newRoom(47))
    )

)
(instance public Room37 of Rm
    (properties
        picture 37
    )

    (method (init)
        = north 47
        = south 40
        = east 38
        = west 36
        = horizon 93
        = global101 0
        (if (global100)
            = picture 137
        )
        (send gEgo:edgeHit(0))
        (super:init())
        (self:setRegions(505))
        Load(rsVIEW 613)
        Load(rsVIEW 2)
        Load(rsVIEW 114)
        (door:
            view(613)
            loop(0)
            cel(0)
            posn(158 94)
            setPri(5)
            init()
            stopUpd()
        )
        (if (<= (send gEgo:y()) horizon)
            (send gEgo:y((+ horizon 2)))
        )
        (switch (gPicture)
            (case 47
                ((send gEgo:posn(159 (+ horizon 3)))  )
            )
            (case 36
                ((send gEgo:posn(1 (send gEgo:y())))  )
            )
            (case 38
                ((send gEgo:posn(317 (send gEgo:y())))  )
            )
            (case 40
                ((send gEgo:posn(157 188)) )
            )
        )
        (send gEgo:
            view(2)
            xStep(2)
            yStep(1)
            init()
        )
        = newAct (Act:new())
        (send newAct:
            ignoreHorizon()
            posn(186 36)
            view(110)
            setMotion(Wander 10)
            illegalBits(32768)
            setCycle(Fwd)
            setPri(15)
            xStep(1)
            yStep(1)
            init()
        )
        = newAct_2 (Act:new())
        (send newAct_2:
            ignoreHorizon()
            posn(107 37)
            view(114)
            setMotion(Wander 10)
            illegalBits(32768)
            setCycle(Fwd)
            setPri(15)
            xStep(1)
            yStep(1)
            init()
        )
        Print(37 0)
        (fairieTheme:
            number(33)
            priority(-1)
            play()
        )
    )


    (method (dispose)
        (send gSounds:eachElementDo(172))
        (super:dispose())
    )


    (method (handleEvent pEvent)
        (var gInvSaidMe)
        (if (== (send pEvent:type()) 128)
            (if (Said('look>'))
                (if (Said('/bush'))
                    Print(37 1)
                )(else
                    (if (Said('/dirt'))
                        Print(37 2)
                    )(else
                        (if (Said('/grass'))
                            Print(37 3)
                        )(else
                            (if (Said('/flora'))
                                Print(37 4)
                            )(else
                                (if (Said('/blossom'))
                                    Print(37 5)
                                )(else
                                    (if (Said('/forest'))
                                        Print(37 6)
                                    )(else
                                        (if (Said('/garden'))
                                            Print(37 7)
                                        )(else
                                            (if (Said('/castle'))
                                                Print(37 8)
                                            )(else
                                                (if (Said('/beach'))
                                                    Print(37 9)
                                                )(else
                                                    (if (Said('/ocean,water'))
                                                        Print(37 10)
                                                    )(else
                                                        (if (Said('/door'))
                                                            Print(37 11)
                                                        )(else
                                                            (if (Said('/fairies'))
                                                                Print(37 12)
                                                            )(else
                                                                (if (Said('/bird'))
                                                                    Print(37 13)
                                                                )(else
                                                                    (if (Said('/path'))
                                                                        Print(37 14)
                                                                    )(else
                                                                        (if (Said('[<around][/room,island]'))
                                                                            Print(37 15)
                                                                        )
                                                                    )
                                                                )
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )(else
                (if (Said('get/blossom'))
                    Print(37 16)
                )(else
                    (if (Said('open/door'))
                        (if ((send gEgo:inRect(140 93 180 103)))
                            (send gEgo:setMotion(0))
                            proc0_10()
                            (send ((Sound:new())):
                                number(300)
                                priority(999)
                                loop(1)
                                play(door)
                            )
                            (door:setCycle(End))
                        )(else
                            proc0_15()
                        )
                    )(else
                        (if (Said('kiss[/!*]') or Said('kiss/fairies'))
                            Print(37 17)
                        )(else
                            (if (Said('converse/fairies') or Said('converse[/!*]'))
                                Print(37 18)
                            )(else
                                (if (Said('bang'))
                                    (if ((send gEgo:inRect(141 94 175 103)))
                                        Print(37 19)
                                    )(else
                                        Print(37 20)
                                    )
                                )(else
                                    (if (Said('get,capture/fairies'))
                                        Print(37 21)
                                    )(else
                                        (if (Said('deliver>') and (= gInvSaidMe (send gInv:saidMe())))
                                            (if ((send gEgo:has((send gInv:indexOf((= gInvSaidMe (send gInv:saidMe())))))))
                                                Print(37 22)
                                            )(else
                                                proc0_19()
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
    )


    (method (newRoom param1)
        (User:canControl(1))
        (super:newRoom(param1))
    )

)
