(include "sci.sh")
(use "Main")
(use "Blink")
(use "n958")
(use "Cycle")
(use "Sounds")
(use "View")
(use "Obj")
(script 1041)


(local
    local0 = 1
    local1 = 13
    local2
    local3[500]

)
(instance public rm1041 of Rm
    (properties
        picture 132
        style 32778
    )

    (method (init)
        proc958_0(128 715 716)
        proc958_0(129 136 1)
        (lights1:init())
        (bea:init())
        (send gSq5Music2:
            number(654)
            setLoop(-1)
            play()
        )
        (super:init())
        (send gRoom:setScript(sFinale))
    )

)
(instance sFinale of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gSQ5:handsOff()) = seconds 3  )
            )
            (case 1
                ((send gTestMessager:say(2 0 0 0 self))  )
            )
            (case 2
                ((bea:setCycle(End self))  )
            )
            (case 3
                ((send gSq5Music2:
                    number(709)
                    setLoop(1)
                    play()
                )
 = seconds 1  )
            )
            (case 4
                ((bea:setCycle(Beg self))  )
            )
            (case 5
                ((send gSq5Music2:
                    number(163)
                    setLoop(1)
                    play()
                )
 (bea:dispose()) (lights1:dispose()) (lights2:dispose()) (lights3:dispose()) (lights4:dispose()) (lights5:dispose()) (lights6:dispose()) = cycles 1  )
            )
            (case 6
                (DrawPic(136 100) = seconds 3  )
            )
            (case 7
                (Joystick(3) Joystick(0 2100 1) = seconds 5  )
            )
            (case 8
                (= next sClosing (self:dispose()) )
            )
        )
    )

)
(instance sClosing of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                ((send gKeyDownHandler:addToFront(self)) (send gMouseDownHandler:addToFront(self)) (send gSq5Music2:fade()) Joystick(3) DrawPic(1 32768) proc0_11() = seconds 3  )
            )
            (case 1
                (GetMessage(0 1041 3 0 0 1 @local3) Display(@local3 100 40 65 101 1 102 207 105 1307 106 240)  )
            )
            (case 2
                (= seconds 0 DrawPic(1 2) = seconds 2  )
            )
            (case 3
                (GetMessage(0 1041 3 0 0 2 @local3) Display(@local3 100 40 65 101 1 102 207 105 1307 106 240)  )
            )
            (case 4
                (= seconds 0 DrawPic(1 2) = seconds 2  )
            )
            (case 5
                (Palette(4 231 232 0) = ticks 5  )
            )
            (case 6
                (GetMessage(0 1041 1 0 0 local0 @local3) Display(@local3 100 40 65 101 1 102 231 105 1307 106 240) = cycles 1  )
            )
            (case 7
                (Palette(4 231 232 local2) 
                (if (< (= local2 (+ local2 10)) 101)
                    --state
                )
 = ticks 5  )
            )
            (case 8
                (
                (if (== local0 12)
                    (sprintLogo:init())
                )
 = seconds 4  )
            )
            (case 9
                (
                (if (== local0 12)
                    (sprintLogo:dispose())
                )
 Palette(4 231 232 local2) 
                (if (> (= local2 (- local2 10)) 0)
                    --state
                )
 = ticks 5  )
            )
            (case 10
                (Display(@local3 100 40 65 101 1 102 0 105 1307 106 240) 
                (if (< ++local0 local1)
                    = state (- state 6)
                )
 = seconds 2  )
            )
            (case 11
                ((send gTestMessager:say(19 1 0 4 self 0))  )
            )
            (case 12
                ((send gKeyDownHandler:delete(self)) (send gMouseDownHandler:delete(self)) = global4 1 (self:dispose()) )
            )
        )
    )


    (method (handleEvent pEvent)
        (if (((== state 1) or (== state 3)) and (& (send pEvent:type) $4005))
            (self:cue())
            (send pEvent:claimed(1))
            return 
        )(else
            (super:handleEvent(pEvent))
        )
    )

)
(instance bea of Prop
    (properties
        x 92
        y 39
        view 715
    )
)
(instance lights1 of Prop
    (properties
        x 165
        y 60
        view 715
        loop 8
    )

    (method (init param1)
        (super:init(rest param1))
        (self:setCycle(Fwd))
        (lights2:
            init()
            setCycle(Fwd)
        )
        (lights3:
            init()
            setCycle(Fwd)
        )
        (lights4:
            init()
            setCycle(Fwd)
        )
        (lights5:
            init()
            setCycle(Fwd)
        )
        (lights6:
            init()
            setCycle(Fwd)
        )
    )

)
(instance lights2 of Prop
    (properties
        x 227
        y 20
        view 715
        loop 7
    )
)
(instance lights3 of Prop
    (properties
        x 231
        y 31
        view 715
        loop 5
    )
)
(instance lights4 of Prop
    (properties
        x 232
        y 43
        view 715
        loop 3
    )
)
(instance lights5 of Prop
    (properties
        x 232
        y 45
        view 715
        loop 4
        cel 3
    )
)
(instance lights6 of Prop
    (properties
        x 315
        y 71
        view 715
        loop 6
    )
)
(instance floEyes of Actor
    (properties
        x 304
        y 89
        view 716
    )
)
(instance drooleMouth of Actor
    (properties
        x 11
        y 10
        view 716
        loop 1
    )
)
(instance rogMouth of Actor
    (properties
        nsTop 30
        nsLeft 12
        view 715
        loop 1
    )
)
(instance beaMouth of Actor
    (properties
        nsTop 17
        nsLeft 31
        view 715
        loop 2
    )
)
(instance public beaTalker of Talker
    (properties
        x 80
        y 14
        view 715
        talkWidth 150
    )

    (method (init param1)
        = font gFont
        (send (= gSq5Win gNewSpeakWindow):
            tailX(160)
            tailY(37)
            xOffset(60)
            isBottom(0)
        )
        (super:init(0 0 beaMouth rest param1))
    )


    (method (dispose param1)
        = gSq5Win gSq5Win_2
        (super:dispose(rest param1))
    )

)
(instance public rogTalker of Talker
    (properties
        x 80
        y 14
        view 715
        talkWidth 150
    )

    (method (init param1)
        = font gFont
        (send (= gSq5Win gNewSpeakWindow):
            tailX(160)
            tailY(38)
            xOffset(60)
            isBottom(1)
        )
        (super:init(0 0 rogMouth rest param1))
    )


    (method (dispose param1)
        = gSq5Win gSq5Win_2
        (super:dispose(rest param1))
    )

)
(instance public drooleTalker of Talker
    (properties
        x 18
        y 108
        view 715
        loop 9
        talkWidth 150
    )

    (method (init param1)
        = font gFont
        (send (= gSq5Win gNewSpeakWindow):
            tailX(115)
            tailY(122)
            xOffset(40)
            isBottom(1)
        )
        (super:init(0 0 drooleMouth rest param1))
    )


    (method (dispose param1)
        = gSq5Win gSq5Win_2
        (super:dispose(rest param1))
    )

)
(instance public floTalker of Narrator
    (properties)

    (method (init param1)
        = font gFont
        (send (= gSq5Win gNewSpeakWindow):
            tailX(210)
            tailY(100)
            xOffset(65486)
        )
        (super:init(rest param1))
    )


    (method (dispose param1)
        = gSq5Win gSq5Win_2
        (super:dispose(rest param1))
    )

)
(instance sprintLogo of View
    (properties
        x 50
        y 80
        view 925
    )
)
