(version 2)
(include "sci.sh")
(exports
    0 rm812
)
(use "Main")
(use "Cycle")
(use "Game")
(use "View")
(use "Obj")
(script 812)

(instance public rm812 of Rm
    (properties
        picture 812
        style $000a
    )

    (method (init)
        (super:init())
        (sparkle:init())
        (send gLongSong2:
            number(
                (if (> global113 11)
                    100
                )(else
                    1200
                )
)
            flags(1)
            loop(1)
            play()
        )
        (self:setScript(sLogoCartoon))
    )


    (method (dispose)
        (send gMH:delete(sLogoCartoon))
        (send gKH:delete(sLogoCartoon))
        (send gLongSong2:fade(0 10 30 1))
        (super:dispose())
    )

)
(instance sLogoCartoon of Script
    (properties)

    (method (doit param1)
        Palette(palANIMATE 112 223 -1)
        (send global1:setCursor(996))
        (super:doit(rest param1))
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send global1:handsOff())
                Palette(palSET_INTENSITY 0 254 0)
                (send gMH:addToFront(sLogoCartoon))
                (send gKH:addToFront(sLogoCartoon))
                = seconds 6
            )
            (case 1
                (if (== (send gLongSong2:prevSignal) 20)
                    (sparkle:setCycle(End self))
                )(else
                    --state
                    = cycles 1
                )
            )
            (case 2
                (if (== (send gLongSong2:prevSignal) 30)
                    (sparkle:
                        x(60)
                        y(155)
                        loop(1)
                        setCel(0)
                        setCycle(End self)
                    )
                )(else
                    --state
                    = cycles 1
                )
            )
            (case 3
                (if ((== (sparkle:cel) (sparkle:lastCel())) and (== (send gLongSong2:prevSignal) -1))
                    = cycles 2
                )(else
                    --state
                    = cycles 1
                )
            )
            (case 4
                (send global2:newRoom(13))
            )
        )
    )


    (method (handleEvent)
        (send global1:handsOn())
        (send global2:newRoom(13))
    )

)
(instance sparkle of Prop
    (properties
        x 131
        y 54
        view 10
        priority 15
        signal $0010
    )
)
