(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "Gauge")
(use "Sound")
(use "InvI")
(use "User")
(script 997)



(class TheMenuBar of Class_255_1
    (properties
        state 0
    )

    (method (init)
        AddMenu("  " "About KQ4`^a:Help`#1")
        AddMenu(" File " "Save`#5:Restore`#7:-!:Restart`#9:Quit`^q")
        AddMenu(" Action " "Pause`^p:Inventory`^i:Retype`#3")
        AddMenu(" Speed " "Speed`^s:-!:Faster`+:Normal`=:Slower`-")
        AddMenu(" Sound " "Volume`^v:-!:Turn Off=1`#2")
        SetMenu(1283 110 
            (if (DoSound(4))
                "Turn Off"
            )(else
                "Turn On"
            )
)
        SetMenu(513 109 ',[/game]')
        SetMenu(514 109 'restore[/game]')
        SetMenu(516 109 'restart[/game]')
        SetMenu(517 109 'quit[/game]')
        SetMenu(769 109 'pause[/game]')
        SetMenu(770 109 'inventory')
    )


    (method (handleEvent pEvent)
        (var temp0, temp1, temp2[4], temp6, temp7[288])
        (switch (= temp0 (super:handleEvent(pEvent)))
            (case 257
                (= temp6 (Sound:pause(1)) Print(Format(@temp7 997 0 global28) 160 "A Ken Williams Production" 66 global23 60 1 134 20 22 140 260) (Sound:pause(temp6))  )
            )
            (case 258
                (= temp6 (Sound:pause(1)) Print(997 1 66 global23) (Sound:pause(temp6))  )
            )
            (case 513
                ((send gGame:save())  )
            )
            (case 514
                ((send gGame:restore())  )
            )
            (case 516
                (= temp6 (Sound:pause(1)) 
                (if (Print(997 2 164 100 0 0 66 0 162 " Restart " 1 162 "Continue" 0))
                    (send gGame:restart())
                )
 (Sound:pause(temp6))  )
            )
            (case 517
                (= temp6 (Sound:pause(1)) = global4 Print(997 3 164 100 0 0 66 0 162 "    Quit    " 1 162 " Continue " 0) (Sound:pause(temp6))  )
            )
            (case 769
                (= temp6 (Sound:pause(1)) Print(997 4 66 0 60 1 162 " Continue " 0) (Sound:pause(temp6))  )
            )
            (case 770
                (
                (if (not proc0_14(2048))
                    Print(997 5)
                )(else
                    = temp6 (Sound:pause(1))
                    (Inv:showSelf(gEgo))
                    (Sound:pause(temp6))
                )
 )
            )
            (case 771
                ((send pEvent:message((User:echo()))) (User:getInput(pEvent))  )
            )
            (case 1025
                (
                (if (not proc0_14(2048))
                    Print(997 6)
                )(else
                    = temp1 (send ((Gauge:new())):
                            description("Use the mouse or the left and right arrow keys to change the speed of moving characters.")
                            text("Animation Speed")
                            minimum(0)
                            normal(10)
                            maximum(15)
                            higher("Faster")
                            lower("Slower")
                            doit((- 16 global3))
                        )
                    (send gGame:setSpeed((- 16 temp1)))
                    DisposeScript(987)
                )
 )
            )
            (case 1027
                (
                (if (> global3 1)
                    (send gGame:setSpeed(--global3))
                )
 )
            )
            (case 1028
                ((send gGame:setSpeed(6))  )
            )
            (case 1029
                ((send gGame:setSpeed(++global3))  )
            )
            (case 1281
                (
                (if (not proc0_14(2048))
                    Print(997 7)
                )(else
                    = temp6 DoSound(6 1)
                    = temp1 (send ((Gauge:new())):
                            description("Use the mouse or left and right arrow keys to change the volume.")
                            text("Sound Volume")
                            minimum(0)
                            normal(12)
                            maximum(15)
                            higher("Louder")
                            lower("Softer")
                            doit(DoSound(8))
                        )
                    DoSound(6 temp6)
                    DoSound(8 temp1)
                    DisposeScript(987)
                )
 )
            )
            (case 1283
                (
                (if (= temp1 DoSound(4))
                    SetMenu(1283 110 "Turn On")
                )(else
                    SetMenu(1283 110 "Turn Off")
                )
 DoSound(4 not temp1)  )
            )
            (default 
                (
                (if (global202)
                    (send global202:doit(temp0))
                )
 )
            )
        )
    )

)
