(version 2)
(include "sci.sh")
(exports
    0 rm060
)
(use "Main")
(use "Class_255_0")
(use "Cycle")
(use "Game")
(use "TheMenuBar")
(use "Feature")
(use "Obj")
(script 60)



(instance public rm060 of Rm
    (properties
        picture 60
        horizon 77
        east 61
        south 66
    )

    (method (init)
        (var temp0[50])
        proc0_3()
        (self:setRegions(600))
        Load(128 96)
        (super:init())
        (bigBub:init())
        (smallBub:init())
        (switch (gNorth)
            (case 61
                (send gEgo:
                    posn(317 (send gEgo:y))
                    init()
                )
            )
            (case 66
                (send gEgo:
                    posn(
                        (if (< (send gEgo:x) 125)
                            125
                        )(else
                            (send gEgo:x)
                        )
 187)
                    init()
                )
            )
        )
        (TheMenuBar:draw())
        (SL:enable())
    )


    (method (doit)
        (var gEgoOnControl, temp1[50])
        (super:doit())
        (if (not (send global2:script))
            = gEgoOnControl (send gEgo:onControl())
            (if (((== gEgoOnControl 3) or (== gEgoOnControl 2)) or (== gEgoOnControl 7))
                (send gEgo:
                    setPri(3)
                    posn((send gEgo:x) - (send gEgo:y) 2)
                )
                = global180 1
            )(else
                (if ((== gEgoOnControl 5) or (== gEgoOnControl 13))
                    (send gEgo:
                        setPri(5)
                        posn(- (send gEgo:x) 6 (send gEgo:y))
                    )
                    = global180 1
                )(else
                    (if (== gEgoOnControl 9)
                        (send gEgo:
                            setPri(7)
                            posn((send gEgo:x) - (send gEgo:y) 2)
                        )
                        = global180 1
                    )
                )
            )
        )
    )


    (method (handleEvent pEvent)
        (super:handleEvent(pEvent))
        (if ((<> (send pEvent:type) 128) or (send pEvent:claimed))
            return 
        )
        (if (Said('look/bubble'))
            proc255_0(60 0)
        )
    )


    (method (newRoom newRoomNumber)
        (if (not script)
            (if (global256)
                ++global593
            )
            (super:newRoom(newRoomNumber))
        )
    )

)
(instance BigBubble of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = seconds Random(1 2)
            )
            (case 1
                (bigBub:
                    posn(Random(14 320) Random(132 194))
                    setCycle(End self)
                )
            )
            (case 2
                (bigBub:setCel(0))
                (self:changeState(0))
            )
        )
    )

)
(instance SmallBubble of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = seconds 1
            )
            (case 1
                (smallBub:
                    posn(Random(143 320) Random(81 106))
                    setCycle(End self)
                )
            )
            (case 2
                (smallBub:setCel(0))
                (self:changeState(0))
            )
        )
    )

)
(instance bigBub of Prop
    (properties)

    (method (init)
        (super:init())
        (self:
            view(96)
            setLoop(0)
            setCel(0)
            setPri(2)
            setScript(BigBubble)
            ignoreActors(1)
        )
    )

)
(instance smallBub of Prop
    (properties)

    (method (init)
        (super:init())
        (self:
            view(96)
            setLoop(1)
            setCel(0)
            setPri(2)
            setScript(SmallBubble)
            ignoreActors(1)
        )
    )

)
