(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "Sound")
(use "Cycle")
(use "Game")
(use "InvI")
(use "PV")
(use "Obj")
(script 70)


(local
    newView
    local1
    local2
    newProp_8
    newProp
    newProp_2
    newProp_3
    newProp_4
    newProp_5
    newProp_6
    newProp_7
    local11

)
(instance public Room70 of Rm
    (properties
        picture 70
    )

    (method (init)
        = global101 1
        = newProp (Prop:new())
        = newProp_2 (Prop:new())
        = newProp_3 (Prop:new())
        = newProp_4 (Prop:new())
        = newProp_5 (Prop:new())
        = newProp_6 (Prop:new())
        = newProp_7 (Prop:new())
        (send newProp:
            view(668)
            loop(0)
            cel(2)
            posn(120 43)
            setPri(1)
            setCycle(Fwd)
            cycleSpeed(1)
            ignoreActors()
            init()
        )
        (send newProp_2:
            view(668)
            loop(1)
            cel(0)
            posn(171 40)
            setPri(0)
            setCycle(Fwd)
            cycleSpeed(1)
            ignoreActors()
            init()
        )
        (send newProp_3:
            view(668)
            loop(2)
            cel(1)
            posn(142 98)
            setPri(6)
            setCycle(Fwd)
            cycleSpeed(1)
            ignoreActors()
            init()
        )
        (send newProp_4:
            view(668)
            loop(3)
            cel(1)
            posn(121 103)
            setPri(6)
            setCycle(Fwd)
            cycleSpeed(1)
            ignoreActors()
            init()
        )
        (send newProp_5:
            view(668)
            loop(4)
            cel(1)
            posn(131 123)
            setPri(0)
            setCycle(Fwd)
            cycleSpeed(1)
            ignoreActors()
            init()
        )
        (send newProp_6:
            view(668)
            loop(5)
            cel(2)
            posn(105 123)
            setPri(0)
            setCycle(Fwd)
            cycleSpeed(1)
            ignoreActors()
            init()
        )
        (send newProp_7:
            view(668)
            loop(6)
            cel(0)
            posn(145 119)
            setPri(0)
            setCycle(Fwd)
            cycleSpeed(1)
            ignoreActors()
            init()
        )
        Load(rsVIEW 7)
        Load(rsVIEW 8)
        Load(rsVIEW 377)
        Load(rsVIEW 378)
        Load(rsVIEW 680)
        Load(rsVIEW 21)
        Load(rsVIEW 10)
        (if (== gPicture 24)
            (send gEgo:
                setScript(swimIn)
                illegalBits(32768)
            )
        )(else
            (send gEgo:
                view(2)
                setStep(2 1)
                illegalBits(32768)
                posn(225 114)
                init()
            )
        )
        (if ((send ((Inv:at(22))):ownedBy(70)))
            (send (= newView (View:new())):
                view(515)
                posn(195 113)
                loop(1)
                cel(0)
                init()
                stopUpd()
            )
        )
        (super:init())
        (send gEgo:init())
        = global205 0
    )


    (method (doit)
        (super:doit())
        = local2 (send gEgo:onControl(1))
        (if (== (send gEgo:script()) 0)
            (if ((send gEgo:inRect(142 110 166 125)) or (send gEgo:inRect(49 117 111 128)))
                (send gEgo:setScript(sweptOut))
            )(else
                (if (& local2 $0001)
                    = global105 0
                    (send gEgo:setCycle(Walk))
                    (send gEgo:view(2))
                )(else
                    (if (& local2 $0800)
                        (send gEgo:setCycle(Walk))
                        (send gEgo:view(7))
                        = global105 3
                    )(else
                        (if (& local2 $0002)
                            (send gEgo:view(8))
                            = global105 4
                            (send gEgo:setCycle(Fwd))
                        )
                    )
                )
            )
            (if ((send gEgo:inRect(209 112 225 120)))
                (send gEgo:baseSetter(ScriptID(0 1)))
            )(else
                (send gEgo:baseSetter(0))
            )
        )
        (if (& (send gEgo:onControl()) $0040)
            (send global2:newRoom(71))
        )
    )


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


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed()))
            return 1
        )
        return 
            (if (== (send pEvent:type()) 128)
                (if (Said('look>'))
                    (if (Said('/falls'))
                        Print(70 0)
                    )(else
                        (if (Said('/cliff'))
                            Print(70 1)
                        )(else
                            (if (Said('/cave'))
                                Print(70 2)
                            )(else
                                (if (Said('/boulder'))
                                    Print(70 3)
                                )(else
                                    (if (Said('/flora'))
                                        Print(70 4)
                                    )(else
                                        (if (Said('/dirt'))
                                            (if ((send ((Inv:at(22))):ownedBy(70)))
                                                Print(70 5)
                                            )(else
                                                Print(70 6)
                                            )
                                        )(else
                                            (if (Said('<under/water,pool'))
                                                (if (== (send gEgo:view()) 2)
                                                    Print(70 7)
                                                )(else
                                                    Print(70 8)
                                                )
                                            )(else
                                                (if (Said('<in,in/water,pool'))
                                                    Print(70 9)
                                                )(else
                                                    (if (Said('/falls'))
                                                        Print(70 10)
                                                    )(else
                                                        (if (Said('<in/pool,water'))
                                                            Print(70 11)
                                                        )(else
                                                            (if (Said('/pool,water'))
                                                                Print(70 12)
                                                            )(else
                                                                (if (Said('[<around][/room]'))
                                                                    Print(Format(@global300 70 13 
                                                                            (if ((send ((Inv:at(22))):ownedBy(70)))
                                                                                "You see an old board lying by the cave entrance."
                                                                            )(else
                                                                                ""
                                                                            )
))
                                                                )
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )(else
                    (if (Said('climb/cliff'))
                        Print(70 14)
                    )(else
                        (if (Said('climb/boulder'))
                            Print(70 15)
                        )(else
                            (if (Said('get/board'))
                                (if ((send ((Inv:at(22))):ownedBy(70)))
                                    (if (< (send gEgo:distanceTo(newView)) 12)
                                        (send gEgo:setScript(boardActions))
                                        (boardActions:changeState(1))
                                        (send gGame:changeScore(2))
                                    )(else
                                        Print(800 1)
                                    )
                                )(else
                                    Print(70 16)
                                )
                            )(else
                                (if (Said('drink') or Said('get/drink'))
                                    (if (== (send gEgo:view()) 2)
                                        (if ((((& (= local1 proc0_2(gEgo 10)) $0008) or (& local1 $0800)) or (& local1 $0002)) or (& local1 $0200))
                                            (send gEgo:setScript(drinking))
                                        )(else
                                            Print(800 1)
                                        )
                                    )(else
                                        Print(70 17)
                                    )
                                )(else
                                    (if (Said('get/water'))
                                        Print(70 18)
                                    )(else
                                        (if (Said('dive,bathe[<enter]'))
                                            (if (== (send gEgo:view()) 2)
                                                Print(70 19)
                                            )(else
                                                Print(70 20)
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )(else
                0
            )
    )


    (method (newRoom param1)
        proc0_11()
        (send gEgo:baseSetter(0))
        (super:newRoom(param1))
    )

)
(instance swimIn of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (proc0_10() (send gEgo:
                    view(377)
                    posn(158 120)
                    setCycle(Walk)
                    setMotion(MoveTo 167 123 self)
                )
  )
            )
            (case 1
                ((send gEgo:setMotion(MoveTo 167 123 self))  )
            )
            (case 2
                ((send gEgo:setMotion(MoveTo 183 122 self))  )
            )
            (case 3
                ((send gEgo:
                    view(378)
                    cel(0)
                    setCycle(End)
                    setMotion(MoveTo 207 120 self)
                )
  )
            )
            (case 4
                ((send ((Sound:new())):
                    number(59)
                    play()
                )
 = newProp_8 (Prop:new()) (send newProp_8:
                    view(680)
                    posn((send gEgo:x()) (send gEgo:y()))
                    loop(1)
                    setPri(+ (send gEgo:priority()) 1)
                    cel(9)
                    setCycle(CT 2 -1 self)
                    init()
                )
  )
            )
            (case 5
                ((send gEgo:
                    view(2)
                    setCycle(Walk)
                )
 (send newProp_8:setCycle(Beg self))  )
            )
            (case 6
                ((send newProp_8:dispose()) Print(70 21 166) (send gEgo:setScript(0)) proc0_11() )
            )
        )
    )

)
(instance boardActions of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 1
                (proc0_10() proc0_3(gEgo newView) (send gEgo:
                    view(21)
                    cel(0)
                    setMotion(0)
                    setCycle(End self)
                )
  )
            )
            (case 2
                (= global182 1 (send newView:dispose()) (send gEgo:get(22)) (send gEgo:setCycle(Beg self))  )
            )
            (case 3
                ((send gEgo:
                    view(2)
                    setCycle(Walk)
                )
 proc0_11() (send gEgo:setScript(0)) )
            )
        )
    )

)
(instance drinking of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (proc0_10() (send gEgo:
                    view(21)
                    cel(0)
                    setCycle(End self)
                )
  )
            )
            (case 1
                ((Timer:setReal(self 5)) Print(70 22 134 -1 20 172)  )
            )
            (case 2
                ((send gEgo:setCycle(Beg self))  )
            )
            (case 3
                (
                (if (gTheNewDialog)
                    (send gTheNewDialog:dispose())
                )
 proc0_11() (send gEgo:
                    view(2)
                    setCycle(Walk)
                    setScript(0)
                )
 )
            )
        )
    )

)
(instance sweptOut of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (proc0_10() = global205 1 
                (if ((send gEgo:inRect(142 110 166 125)))
                    (send gEgo:setMotion(MoveTo 152 113))
                )(else
                    (send gEgo:setMotion(MoveTo 80 118))
                )
 (send gEgo:
                    view(10)
                    cel(0)
                    loop(0)
                    setCycle(End self)
                )
  )
            )
            (case 1
                ((send gEgo:hide()) (send global2:newRoom(24)) )
            )
        )
    )

)
