(version 2)
(include "sci.sh")
(exports
    0 rm59
)
(use "Main")
(use "Class_255_0")
(use "cloudRoom")
(use "n958")
(use "Cycle")
(use "User")
(use "Obj")
(script 59)



(procedure (localproc_0558)
    (if (proc0_12(1))
        (send gEgo:view(42))
    )(else
        (send gEgo:view(56))
    )
)


(instance public rm59 of cloudRoom
    (properties
        picture 59
        horizon 102
        east 69
        south 62
        west 58
    )

    (method (init)
        (self:style(
            (switch (gGNumber)
                (case west
                    3
                )
                (case east
                    2
                )
                (case south
                    4
                )
            )
))
        proc958_0(128 42 56)
        (super:init())
        proc0_10(0)
        (send gEgo:init())
        proc0_1()
        (switch (gGNumber)
            (case south
                (send gEgo:posn(proc0_17(242 (send gEgo:x) 38) 188))
            )
            (case west
                (send gEgo:posn(26 proc0_17(175 (send gEgo:y) (+ horizon 2))))
            )
            (default 
                (send global2:setScript(fadeIn))
            )
        )
    )


    (method (doit)
        (var temp0)
        (if (script)
            (send script:doit())
        )(else
            (if ((& (send gEgo:onControl(1)) $4000) and (< (send gEgo:y) 90))
                (send (ScriptID(0 23)):
                    loop(1)
                    fade()
                )
                (self:newRoom(east))
            )(else
                (if (& (send gEgo:onControl(1)) $4000)
                    (self:setScript(fadeOut))
                )(else
                    = temp0 
                        (switch ((send ((User:alterEgo)):edgeHit))
                            (case 1
                                north
                            )
                            (case 2
                                east
                            )
                            (case 3
                                south
                            )
                            (case 4
                                west
                            )
                        )
                    (if (temp0)
                        proc0_11(0)
                        (self:newRoom(temp0))
                    )
                )
            )
        )
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((super:handleEvent(pEvent)))
                return 
            )(else
                (if (Said('look,look[<at,around][/room]'))
                    proc255_0(59 0)
                )(else
                    (if (Said('look,look<in/cave'))
                        (if ((send gEgo:inRect(195 95 230 120)))
                            proc255_0(59 1)
                        )(else
                            proc255_0(59 2)
                        )
                    )(else
                        (if (Said('look,look/cave') or proc0_14(pEvent 201 68 226 101))
                            proc255_0(59 3)
                        )(else
                            (if ((((((Said('look,look/boulder') or proc0_14(pEvent 205 74 305 130)) or proc0_14(pEvent 174 52 257 73)) or proc0_14(pEvent 136 75 205 105)) or proc0_14(pEvent 260 131 307 175)) or proc0_14(pEvent 164 65 205 76)) or proc0_14(pEvent 115 102 134 111))
                                proc255_0(59 4)
                            )(else
                                (if (((((((Said('look,look/ceder') or proc0_14(pEvent 112 29 135 48)) or proc0_14(pEvent 0 0 169 21)) or proc0_14(pEvent 0 22 86 53)) or proc0_14(pEvent 0 54 26 94)) or proc0_14(pEvent 0 95 33 180)) or proc0_14(pEvent 204 0 271 49)) or proc0_14(pEvent 299 50 320 173))
                                    proc255_0(59 5)
                                )(else
                                    (if (((Said('look,look/cloud') or proc0_14(pEvent 150 15 203 48)) or proc0_14(pEvent 192 173 243 183)) or proc0_14(pEvent 266 183 320 189))
                                        proc255_0(59 6)
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
    )

)
(instance fadeOut of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                localproc_0558()
                (send gEgo:
                    illegalBits(0)
                    setLoop(1)
                    cel(0)
                    cycleSpeed(1)
                    setCycle(End self)
                )
            )
            (case 1
                (send gEgo:
                    loop(0)
                    cel(0)
                    setMotion(MoveTo 245 87 self)
                )
            )
            (case 2
                proc0_1()
                (send gEgo:setPri(-1))
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance fadeIn of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:
                    setPri(7)
                    posn(218 100)
                )
                (self:cue())
            )
            (case 1
                localproc_0558()
                (send gEgo:
                    illegalBits(0)
                    setLoop(0)
                    cel(0)
                    setCycle(0)
                    setMotion(MoveTo 213 109 self)
                )
            )
            (case 2
                (send gEgo:
                    cycleSpeed(1)
                    setCycle(End self)
                )
            )
            (case 3
                (send gEgo:
                    setLoop(-1)
                    setPri(-1)
                    loop(2)
                )
                proc0_1()
                proc0_3()
                (self:dispose())
            )
        )
    )

)
