(include "sci.sh")
(use "Main")
(use "SQRoom")
(use "n958")
(use "Cycle")
(use "User")
(use "PicView")
(use "Obj")
(script 21)


(local
    local0[4]
    local4
    local5 = 5825

)
(procedure (localproc_01d6 param1)
    TextSize(@local0 param1 0 315)
    return / (- 180 (- local0[2] local0[0])) 2
)


(procedure (localproc_01f7 param1)
    (var temp0)
    (send global2:drawPic(803 42))
    Display(param1 102 global131 100 3 = temp0 localproc_01d6(param1) 106 315 105 0 101 1)
)


(procedure (localproc_022b param1)
    (var temp0)
    (send global2:drawPic(803 42))
    Display(param1 102 global149 100 3 = temp0 localproc_01d6(param1) 106 315 105 7 101 1)
)


(instance public rm021 of SQRoom
    (properties
        picture 21
    )

    (method (init)
        (super:init())
        Load(rsSOUND 823)
        Load(rsVIEW 24)
        proc958_0(129 803 21)
        proc958_0(135 0 7)
        (p1:
            init()
            setCycle(Fwd)
        )
        (p2:
            init()
            setCycle(Fwd)
        )
        (p3:
            init()
            setCycle(Fwd)
        )
        proc0_14(4)
        (if (<> global12 540)
            (self:setRegions(707))
        )
        (switch (global12)
            (case 20
                (send gLongSong:
                    number(823)
                    loop(-1)
                    play()
                )
                (self:setScript(rmScript))
            )
            (case 540
                (self:setScript(endScript 0 450))
            )
            (default 
                (send gLongSong:
                    number(823)
                    loop(-1)
                    play()
                )
                (self:setScript(rmScript))
            )
        )
    )

)
(instance rmScript of Script
    (properties)

    (method (changeState newState)
        (var temp0)
        (switch (= state newState)
            (case 0
                = register 700
                = cycles 2
            )
            (case 1
                (while (--register and (== global13 global11))
                    (if (== register 100)
                        (send gLongSong:fade())
                    )
                    (User:doit())
                    Palette(6 176 207 1)
                    Animate((send global5:elements) 1)
                )
                (send global2:newRoom(59))
            )
        )
    )

)
(instance endScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = cycles 1
            )
            (case 1
                (while (--register)
                    Palette(6 176 207 1)
                    Animate((send global5:elements) 1)
                )
                (send global5:eachElementDo(156))
                (send global2:drawPic(803 6))
                = cycles 10
            )
            (case 2
                localproc_01f7("\"So many unanswered questions. The future will be most interesting for Roger - if he can stay out of trouble long enough to see it. We're glad you could help Roger get through it all. Thank you for playing Space Quest IV. We hope it's been as entertaining as you have.\"")
                = seconds 15
            )
            (case 3
                = start 3
                (if (== local4 1)
                    (send gIconBar:enable())
                    proc0_2()
                )
                = cycles 1
            )
            (case 4
                (if (== global194 0)
                    = cycles 1
                )(else
                    (self:setScript(studScript self))
                )
            )
            (case 5
                localproc_01f7("Animators:\n\nJon Bock\nJane Cardinal\nJeff Crowe\nMark Crowe\nDesie Hartman\nEric Kasner\nJim Larsen\nNathan Larsen\nSuzi LivenGood\nCheryl Loyd\nMichael A. Milo\nGerald Moore\nCheryl Sweeney\nWillis Wong")
                = seconds 15
            )
            (case 6
                localproc_01f7("Background Artists:\n\nJon Bock\nJane Cardinal\nMark Crowe\nJennifer Shontz\nCheryl Sweeney")
                = seconds 8
            )
            (case 7
                (if (<> global194 0)
                    = cycles 1
                )(else
                    localproc_01f7("Programmers:\n\nOliver Brelsford\nCarlos Escobar\nBrian K. Hughes\nMike Larsen\nRandy MacNeill\nScott Murphy\nDoug Oldfield\nRaoul Said\nJerry Shaw")
                    = seconds 20
                )
            )
            (case 8
                localproc_01f7("Composers:\n\nKen Allen\nRob Atesalp\nMark Seibert")
                = seconds 7
            )
            (case 9
                localproc_01f7("System Development:\n\nJeff Stephenson\nRobert E. Heitman\nPablo Ghenis\nDan Foy\nLarry Scott\nTerry McHenry\nJohn Rettig\nCorey Cole\nJ. Mark Hood\nEric Hart\nJohn Hartin\nMark Wilden")
                = seconds 15
            )
            (case 10
                localproc_01f7("Sound Effects:\n\nKen Allen\nRob Atesalp\nMark Seibert")
                = seconds 5
            )
            (case 11
                localproc_01f7("Additional Material:\n\nJosh Mandel")
                = seconds 3
            )
            (case 12
                localproc_01f7("Quality Assurance:\n\nMike Harian\nDan Scott")
                = seconds 3
            )
            (case 13
                = local4 1
                (self:init())
            )
        )
    )

)
(instance studScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                localproc_022b("Programming Studs:")
                = seconds 5
            )
            (case 1
                localproc_022b("Oliver Brelsford")
                = seconds 5
            )
            (case 2
                localproc_022b("Carlos Escobar")
                = seconds 5
            )
            (case 3
                localproc_022b("Brian K. Hughes")
                = seconds 5
            )
            (case 4
                localproc_022b("Mike Larsen")
                = seconds 5
            )
            (case 5
                localproc_022b("Randy MacNeill")
                = seconds 5
            )
            (case 6
                localproc_022b("Scott Murphy")
                = seconds 5
            )
            (case 7
                localproc_022b("Doug Oldfield")
                = seconds 5
            )
            (case 8
                localproc_022b("Raoul Said")
                = seconds 5
            )
            (case 9
                localproc_022b("Jerry Shaw")
                = seconds 5
            )
            (case 10
                (self:dispose())
            )
        )
    )

)
(instance p1 of Prop
    (properties
        x 155
        y 81
        view 24
        cycleSpeed 1
    )
)
(instance p2 of Prop
    (properties
        x 214
        y 86
        view 24
        loop 1
        cel 2
        cycleSpeed 1
    )
)
(instance p3 of Prop
    (properties
        x 85
        y 146
        view 24
        loop 2
        cel 2
        cycleSpeed 1
    )
)
