(version 2)
(include "sci.sh")
(exports
    0 titleScreen
    1 showTitle
)
(use "Main")
(use "n958")
(use "Extra")
(use "Game")
(use "MenuBar")
(use "PicView")
(use "Obj")
(script 86)


(local
    local0
    local1[10]
    local11[8] = (61 160 264 130 208 169 184 97 )
    local19[8] = (29 70 32 20 54 140 21 59 )
    local27[8] = (1 3 0 2 1 0 2 1 )

)
(procedure (localproc_000e)
    = local0 0
    (while (< local0 8)
        (send (= local1[local0] Clone(Extra)):
            view(950)
            setLoop(0)
            cel(5)
            posn(local11[local0] local19[local0])
            cycleSpeed(local27[local0])
            cycleType(2)
            pauseCel(5)
            hesitation(Random(0 10))
            ignoreActors()
            isExtra(1)
            init()
        )
        ++local0
    )
)


(instance public titleScreen of Rm
    (properties
        picture 902
        style $0007
    )

    (method (init)
        proc0_2()
        = global107 1
        Load(rsSOUND 1)
        proc958_0(128 913 950)
        Load(rsSCRIPT 87)
        (super:init())
        (MenuBar:
            hide()
            state(0)
        )
        (send (ScriptID(0 23)):
            number(1)
            loop(1)
            play()
        )
        (if (<> global101 0)
            localproc_000e()
        )
        (if (<> gGNumber 777)
            (showTitle:start(2))
            (self:setScript(showTitle))
        )(else
            (QUEST:init())
            (FOR:init())
            (CROWN:init())
            (copyright:init())
            (self:setScript(showTitle))
        )
    )


    (method (dispose)
        (super:dispose())
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )
        (super:handleEvent(pEvent))
        (if (== (send pEvent:type) 1)
            (if ((showTitle:seconds))
                (showTitle:cue())
            )(else
                (send pEvent:claimed(1))
            )
        )
        (if (== (send pEvent:type) 4)
            (switch ((send pEvent:message))
                (case 13
                    (if ((showTitle:seconds))
                        (showTitle:cue())
                    )(else
                        (send pEvent:claimed(1))
                    )
                )
                (case 15360
                    (MenuBar:
                        state(1)
                        handleEvent(pEvent)
                        state(0)
                    )
                )
                (default 
                    (send pEvent:claimed(1))
                )
            )
        )
    )

)
(instance public showTitle of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = seconds 
                    (if (>= global101 1)
                        10
                    )(else
                        5
                    )
            )
            (case 1
                = seconds 0
                (QUEST:dispose())
                (FOR:dispose())
                (CROWN:dispose())
                (copyright:dispose())
                = cycles 1
            )
            (case 2
                = global107 0
                (if (<> global101 0)
                    (send local1[5]:hide())
                )
                (self:setScript(ScriptID(87 0)))
            )
            (case 3
                (if (<> global101 0)
                    = local0 0
                    (while (< local0 8)
                        (send local1[local0]:dispose())
                        ++local0
                    )
                )
                (send (ScriptID(0 23)):fade())
                = cycles 2
            )
            (case 4
                (send (ScriptID(87 0)):changeState(3))
            )
        )
    )

)
(instance QUEST of View
    (properties
        x 67
        y 167
        view 913
    )
)
(instance FOR of View
    (properties
        x 133
        y 169
        view 913
        cel 1
    )
)
(instance CROWN of View
    (properties
        x 226
        y 164
        view 913
        cel 2
    )
)
(instance copyright of View
    (properties
        x 164
        y 181
        view 913
        loop 1
    )
)
