
////  Main > Settings  ////

newmenu Settings
menuitem "Video settings\i\3"           [ showmenu "\fsVideo" ]
menuitem "Head-Up Display settings\i\3" [ showmenu HUD ]
menuitem "Console settings\i\3"         [ showmenu Console ]
menuitem "Gameplay settings\i\3"        [ showmenu "\fsGameplay" ]
menuitem "Scoreboard settings\i\3"      [ showmenu Scoreboard ]
menuitem "Keyboard settings\i\3"        [ showmenu Keyboard ]
menuitem "Mouse settings\i\3"           [ showmenu Mouse ]
menuitem "Sound settings\i\3"           [ showmenu "\fsSound" ]
menuitem "Misc settings\i\3"            [ showmenu Misc ]
menuitem "Mod package settings\i\3"     [ showmenu "Mod package" ]
menuitem "" -1
menuitem "Reset all settings\i\3"       [ showmenu [Reset settings] ]


////  Main > Settings > Video  ////

newmenu "\fsVideo"
menuitemtextinput [Screen width:                 ] "$scr_w" [ scr_w $arg1 ] [] 11
menuitemtextinput [Screen height:                ] "$scr_h" [ scr_h $arg1 ] [] 11
menuitem (concatword "\f2Set\f5 resolution as in desktop (" $desktopw "x" $desktoph ")") [ scr_w $desktopw ; scr_h $desktoph ; refreshcurmenudelayed ]
menuitem "Choose resolution from list\i\3" [ showmenu [Display resolutions] ]
menuitem "" -1
menuitemslider "Graphics detail: " 1 6 "$gfxqualityalias" [Horrible Low Medium Good High "INSANE! (May perform slowly on older gfx)"] [ new_gfx_quality $arg1 ]
menuitem "" -1
menuitemslider "Field of view: " 75 120 "$fov" 2 [ fov $arg1 ] 1
menuitemcheckbox "Fullscreen: " "$fullscreen" [ fullscreen $arg1 ]
menuitemcheckbox [Fullscreen is always using desktop resolution: ] "$fullscreendesktop"               [ fullscreendesktop $arg1 ]
menuitemradio "Vsync: " -1 1 "$vsync" [Default Disabled Enabled] [ vsync $arg1 ]
menuitem "" -1
menuitemslider "Set temporary gamma for this map: " 30 300 "$gamma" 5 [ gamma $arg1 ]
menuitemtextinput "Set default gamma for this map: " [$gamma] [setgamma $arg1]
menuitemtextinput "Set default gamma for maps without own default: " [$defaultgamma] [ defaultgamma = $arg1 ]
menuitem "" -1
menuitem "Advanced video settings\i\3"     [ showmenu [Advanced video settings] ]
menuitem "" -1
menuitem "\f2\t\t\t  [ Apply now! ]"       [ resetgl ]
alias defaultgamma 100

////  Main > Settings > Video > Display resolutions  ////

newmenu [Display resolutions]
push __getar [
    push n (findlist [1250 1333 1777 1600] (div (* 1000 $arg1) $arg2))
    if (>= $n 0) [
        n = (at [5:4 4:3 16:9 16:10] $n)
    ][
        n = (at (concat (concatword "~16:" (div (+ (div (* 160 $arg2) $arg1) 5) 10))) ~5:4 ~4:3) (+ (findlist [125 133] (div (* 100 $arg1) $arg2)) 1))
    ]
    pop n
]
push reslist (getdisplayresolutions)
if (strlen $reslist) [
    menuitem "\f4Preferred resolutions:" -1
    looplist $reslist [w h] [
        menuitem (concatword (at ["" " "] (< $w 1000)) $w x $h "\t(" (__getar $w $h) ")") (concat scr_w $w ";" scr_h $h ";" closecurmenu)
    ]
    menuitem "" -1
    menuitem "\f4More resolutions:" -1
][
    reslist = "17001 17001"
]
looplist [640 480  800 600  1024 768  1280 720  1280 800  1280 1024  1360 768  1366 768  1440 900  1600 900  1680 1050  1920 1080  1920 1200] [w h] [
    push d (&& (< $w (at $reslist 0)) (< $h (at $reslist 1)))
    looplist $reslist [rw rh] [
        if (&& (= $w $rw) (= $h $rh)) [d = 0]
    ]
    if (pop d) [
        menuitem (concatword (at ["" " "] (< $w 1000)) $w x $h "\t(" (__getar $w $h) ")") (concat scr_w $w ";" scr_h $h ";" closecurmenu)
    ]
]
pop reslist __getar

////  Main > Settings > Video > Advanced video settings  ////

newmenu [Advanced video settings]
const __getshadowq [
  if (&& $stencilshadow (>= $stencilbits 8)) [result 2] [
    if $dynshadow [result 1] [result 0]
  ]
]
const __setshadowq_0 [ stencilshadow 0  ; stencilbits 0 ; dynshadow 0  ]  // Off
const __setshadowq_1 [ stencilshadow 0  ; stencilbits 0 ; dynshadow 40 ]  // Blob
const __setshadowq_2 [ stencilshadow 40 ; stencilbits 8 ; dynshadow 40 ]  // Stencil
const __fsaa_valuemap [-1 0 2 4 8 16]
const __aniso_valuemap [0 2 4 8 16]
const __minlod_valuemap [60 100 200 250]
const __watersubdiv_valuemap [16 8 4 2 1]
menuitemslider [Scope FOV: ] 5 60 "$scopefov" 5 [ scopefov $arg1 ] 1
menuitemslider [Antialiasing (FSAA): ] 0 5 "(findlist $__fsaa_valuemap $fsaa)" [Default Off 2 4 8 16] [ fsaa (at $__fsaa_valuemap $arg1) ]
menuitemslider [Anisotropic filtering: ] 0 4 "(findlist $__aniso_valuemap $aniso)" [Off 2 4 8 16] [ aniso (at $__aniso_valuemap $arg1) ]
menuitemslider [Minimal level of detail: ] 0 3 "(findlist $__minlod_valuemap $minlod)" [Low Decent Good Best] [ minlod (at $__minlod_valuemap $arg1) ]
menuitemslider [Light error: ] 1 100 "$lighterror" 5 [ lighterror $arg1 ]
menuitemslider [Water subdivision: ] 0 4 "(findlist $__watersubdiv_valuemap $watersubdiv)" ["Lowest quality" "Low quality" "Medium quality" "High quality" "Highest quality"] [ watersubdiv (at $__watersubdiv_valuemap $arg1) ]
menuitemslider [Dynamic shadows: ] 0 2 __getshadowq [Off Blob Stencil] [ (concatword __setshadowq_ $arg1) ] 1
menuitemslider [Tex-reduce: ] -1 3 "$texreduce" 1 [ texreduce $arg1 ]
menuitemcheckbox [Water reflection: ] "$waterreflect" [ waterreflect $arg1 ]
menuitemcheckbox [Dynamic lights: ] "$dynlight" [ dynlight $arg1 ]
menuitemcheckbox [Bulletholes: ] "$bullethole"  [ bullethole $arg1 ]
menuitemcheckbox [Scorch: ] "$scorch"           [ scorch $arg1 ]
menuitemcheckbox  "Ignore map override: Disable water reflection" "$ignoreoverride_nowaterreflect" [ ignoreoverride_nowaterreflect $arg1 ]
menuitemcheckbox  "Ignore map override: Limit water waveheight" "$ignoreoverride_limitwaveheight" [ ignoreoverride_limitwaveheight $arg1 ]
menuitemcheckbox  "Ignore map override: Disable stencil shadows" "$ignoreoverride_nostencilshadows" [ ignoreoverride_nostencilshadows $arg1 ]
menuitem "" -1
menuitem "FPS Range\i\3" [ showmenu [FPS Range] ]
menuitem "" -1
menuitem "\f2\t\t        [ Apply now! ]" [ resetgl ]

////  Main > Settings > Video > Advanced video settings > FPS Range  ////

newmenu [FPS Range]
menuitem [My 486 0wnz y00       (8-10 FPS)]   [ closecurmenu; fpsrange 8 10 ]
menuitem [Slow machine           (20-25 FPS)] [ closecurmenu; fpsrange 20 25 ]
menuitem [Sensible default       (30-40 FPS)] [ closecurmenu; fpsrange 30 40 ]
menuitem [FPS whore           (60-60 FPS)]    [ closecurmenu; fpsrange 60 60 ]
menuitem [I don't understand LOD (100+ FPS)]  [ closecurmenu; fpsrange 100 1000 ]


////  Main > Settings > HUD  ////

newmenu HUD
alias wallclockformat "" // strftime formatting
alias wallclockformatlist ["" %H:%M %H:%M:%S %I:%M%p %I:%M:%S%p U%H:%M U%H:%M:%S] //"U" at beginning means UTC/GMT time
menuitem [Show:] -1
menuitemcheckbox [   Gun ] "$hudgun"                                           [ hudgun $arg1 ]
menuitemcheckbox [   Team icon ] "(= $hideteam 0)"                             [ hideteam (= $arg1 0) ]
menuitemcheckbox [   Icons ] "(= $hidehudequipment 0)"                         [ hidehudequipment (= $arg1 0) ]
menuitemcheckbox [   Console ] "(= $hideconsole 0)"                            [ hideconsole (= $arg1 0) ]
menuitemcheckbox [   Player names ] "$showtargetname"                          [ showtargetname $arg1 ]
menuitemcheckbox [   Spectator info ] "(= $hidespecthud 0)"                    [ hidespecthud (= $arg1 0) ]
menuitemcheckbox [   Quick messages ] "(= $hidehudmsgs 0)"                     [ hidehudmsgs (= $arg1 0) ]
menuitemcheckbox [   Damage direction indicator ] "(= $hidedamageindicator 0)" [ hidedamageindicator (= $arg1 0) ]
menuitemcheckbox [   Damage screen flash    ] "$damagescreen"                  [ damagescreen $arg1 ]
menuitemslider   [   Damage maxroll: ] 0 (getvarrange max maxrolleffect) "$maxrolleffect" 1 [ maxrolleffect $arg1 ]
menuitemcheckbox [   Team score counters ] "(= $hideteamscorehud 0)"           [ hideteamscorehud (= $arg1 0) ]
menuitemcheckbox [   KTF flag direction indicator ] "(! $hidektfindicator)"    [ hidektfindicator (! $arg1) ]
menuitemcheckbox [   Radar ] "(= $hideradar 0)"                                [ hideradar (= $arg1 0) ]
menuitemslider   [   Radar zoom: ] 5 500                                       [ $radarheight ] 5 [ radarheight $arg1 ] 1
menuitemslider   [   Votes: ] 0 2 "$hidevote" ["Always show" "Show until you vote" "Never show"] [ hidevote $arg1 ] 1
menuitemradio    [   Graphics statistics: ] 0 2 "$showstats" [None "FPS Only" All] [ showstats $arg1 ] 1
menuitemslider   [   Game time: ] 0 2 "$gametimedisplay" [None "Count backward" "Count forward"] [ gametimedisplay $arg1 ] 1
menuitemslider   [   Wall clock: ] 0 6 [findlist $wallclockformatlist $wallclockformat] [None "HH:MM (local, 24h)" "HH:MM:SS (local, 24h)" "HH:MM (local, 12h)" "HH:MM:SS (local, 12h)" "HH:MM (UTC/GMT)" "HH:MM:SS (UTC/GMT)"] [ alias wallclockformat (at $wallclockformatlist $arg1)] 1
menuitemslider   [   Extra messages: ] 0 3 "$hudextras" ["No extra messages" "Show extra messages in console" "Pop up extra messages!" "SPAM EXTRA MESSAGES!"] [ hudextras $arg1 ]
menuitemradio    [   Hand alignment: ] 0 1 "$righthanded" [Left-handed Right-handed] [ righthanded $arg1 ] 1
menuitemslider   [   Max-roll: ] 0 (getvarrange max maxroll) "$maxroll" 1 [ maxroll $arg1 ]
menuitemslider   [   Spectator max-roll: ] 0 (getvarrange max maxrollremote) "$maxrollremote" 2 [ maxrollremote $arg1 ]


////  Main > Settings > Console  ////

newmenu Console
menuitem "\f4Regular console:" -1
menuitemslider "Console size (lines): " 0 20 "$consize" 1 [ consize $arg1 ]
menuitemslider "Console fade time (seconds until lines disappear): " 5 60 "$confade" 5 [ confade $arg1 ]
menuitemslider "Console transparency: " 120 255 "$conalpha" 15 [ conalpha $arg1 ]
menuitem "\f4Full consoles:" -1
menuitemslider "Full console size (percent screen height): " 0 100 "$fullconsize" 5 [ fullconsize $arg1 ]
menuitemslider "2nd full console size (percent screen height): " 0 100 "$altconsize" 5 [ altconsize $arg1 ]
menuitem "\f4Keys:" -1
menuitemkeyinput "Toggle (full-)console key: "  key_toggleconsole
menuitemkeyinput "Rewind console key: "  key_console_rewind
menuitemkeyinput "Forward console key: " key_console_forward
menuitemkeyinput "End of console key: "  key_console_end
menuitemkeyinput "Scroll console key (+ mousewheel): " key_console_scroll
menuitem "\f4Inlined console graphics settings:" -1
menuitemslider (concatword "Igraph size (" (getigraph ")") "): ") 80 300 "$igraphsize" 5 [ igraphsize $arg1 ] 1
menuitemslider "Igraph size for menu icons (\i\1): " 80 160 "$igraphsizehardcoded" 5 [ igraphsizehardcoded $arg1 ] 1
menuitemcheckbox "Stop igraph animation: " "! $igraphanimate" [ igraphanimate (! $arg1) ]
menuitemcheckbox "Disable igraphs: " "$hideigraphs" [ hideigraphs $arg1 ]


////  Main > Settings > Gameplay  ////

newmenu "\fsGameplay"
alias nickhighlight 0
alias __gibsgore 1
menuitemtextinput "Nickname:        " "result $curname" [ name $arg1 ]
menuitemslider "Player skins: " 0 2 "$teamdisplaymode" [Normal "Colored vests" "Full color"] [ teamdisplaymode $arg1 ] 1
menuitemslider "Custom player skins: " 0 2 "$hidecustomskins" ["Always show" "Show in non-team modes" "Never show"] [ hidecustomskins $arg1 ] 1
menuitem "" -1
menuitemcheckbox "Reduced violence mode: " "$poniesmodeon" [ reducedviolencemode $arg1 ]
menuitemslider "Gib gore: " 0 4 "$__gibsgore" [Off Normal Good Messy Unrealistic] [ gibsgore $arg1 ]
menuitemslider "Name highlight color: " 0 9 "$nickhighlight" [ "\f0green \f5(default)" "\f1blue" "\f2yellow" "\f3red" "\f4gray" "white" "\f6dark brown" "\f7dark red" "\f8purple" "\f9orange" ] [ nickhighlight = $arg1; HIGHLIGHT = (concatword "\f" $nickhighlight) ]
menuitemcheckbox "Show scores on death: " "$showscoresondeath" [ showscoresondeath $arg1 ]
menuitem "Change to the enemy team"    changeteam
menuitem "Change weapon\i\3"           [ showmenu Weapons ]
menuitem "Change player skin\i\3"      [ showmenu (at [CLA RVSF] (player1 team)) ]
menuitem "Weapon settings\i\3"         [ showmenu [Weapon Settings] ]
menuitem "Edit kill messages\i\3"      [ showmenu [Kill Messages] ]
menuitem "Bot settings\i\3"            [ showmenu [Bot settings] ]
menuitem "" -1
menuitemcheckbox "Use high-res player skins" "(>= (findlist (zipmodlist active) protox_hq_reskin) 0)" [ if $arg1 [addzipmod protox_hq_reskin; resetgl] [zipmodremove protox_hq_reskin; resetgl] ]

////  Main > Settings > Gameplay > Weapons  ////

newmenu Weapons
menuinit [ menuselection (curmenu) (findlist "assault subgun sniper shotgun carbine" $nextprimary) ]
looplist [
  assault "MTP-57 Assault Rifle"
  subgun  "A-ARD/10 Submachine Gun"
  sniper  "Precision Tech AD-81 Sniper Rifle"
  shotgun "V-19 Combat Shotgun"
  carbine "TMP-M&A Carbine"
] [ w desc ] [execute (format [menuitem [%2] [nextprimary %1 ; echo %2 selected] [menumdl Weapons weapons/%1/menu mapmodel 75 12] ] $w $desc) ]

////  Main > Settings > Gameplay > CLA  ////

newmenu CLA
menuinit [ menuselection CLA (player1 skin_cla) ]
menuitem [Comandante] [ skin_cla 0 ] [ menumdl CLA playermodels/CLA/01 all 50 4 ]
menuitem [Psycho]     [ skin_cla 1 ] [ menumdl CLA playermodels/CLA/02 all 50 4 ]
menuitem [Bomber]     [ skin_cla 2 ] [ menumdl CLA playermodels/CLA/03 all 50 4 ]
menuitem [Ripper]     [ skin_cla 3 ] [ menumdl CLA playermodels/CLA/04 all 50 4 ]

////  Main > Settings > Gameplay > RVSF  ////

newmenu RVSF
menuinit [menuselection RVSF (player1 skin_rvsf)]
menuitem [Alpha]  [ skin_rvsf 0 ] [ menumdl RVSF playermodels/RVSF/01 all 50 4 ]
menuitem [Tango]  [ skin_rvsf 1 ] [ menumdl RVSF playermodels/RVSF/02 all 50 4 ]
menuitem [Cobra]  [ skin_rvsf 2 ] [ menumdl RVSF playermodels/RVSF/03 all 50 4 ]
menuitem [Viper]  [ skin_rvsf 3 ] [ menumdl RVSF playermodels/RVSF/04 all 50 4 ]
menuitem [Swat]   [ skin_rvsf 4 ] [ menumdl RVSF playermodels/RVSF/05 all 50 4 ]
menuitem [Police] [ skin_rvsf 5 ] [ menumdl RVSF playermodels/RVSF/06 all 50 4 ]

////  Main > Settings > Gameplay > Weapon Settings  ////

newmenu [Weapon Settings]
looplist [ subgun 3 assault 2 akimbo 2 ] [ g n ] [ alias (concatword __burstshots_ $g) $n ]
menuitemslider   [Play hit sounds: ] 0 2 "$hitsound" [Off "When server detects hits" "When client detects hits"] [ hitsound $arg1 ]
menuitemcheckbox [Auto weapon reload: ] "$autoreload" [ autoreload $arg1 ]
menuitemcheckbox [Auto switch to akimbo upon pickup: ] "$akimboautoswitch" [ akimboautoswitch $arg1 ]
menuitemslider   [Akimbo end action: ] 0 3 "$akimboendaction" ["Switch to knife" "Stay with pistol" "Switch to grenades" "Switch to primary"] [ akimboendaction $arg1 ] 1
menuitemcheckbox [SMG - Full Auto?] "(= (burstshots SUBGUN -1) 0)" [ if (= $arg1 0) [ burstshots SUBGUN $__burstshots_subgun ] [ burstshots SUBGUN 0 ]; refreshcurmenu ]
menuitemcheckbox [AR - Full Auto?] "(= (burstshots ASSAULT -1) 0)" [ if (= $arg1 0) [ burstshots ASSAULT $__burstshots_assault ] [ burstshots ASSAULT 0 ]; refreshcurmenu ]
menuitemcheckbox [Akimbo - Full Auto?] "(= (burstshots AKIMBO -1) 0)" [ if (= $arg1 0) [ burstshots AKIMBO $__burstshots_akimbo ] [ burstshots AKIMBO 0 ]; refreshcurmenu ]
menuitemslider   [SMG - Shots per burst: ] 0 29 "$__burstshots_subgun" 1 [ burstshots SUBGUN $arg1; __burstshots_subgun = $arg1 ; refreshcurmenu ]
menuitemslider   [AR - Shots per burst: ] 0 19 "$__burstshots_assault" 1 [ burstshots ASSAULT $arg1; __burstshots_assault = $arg1 ; refreshcurmenu ]
menuitemslider   [Akimbo - Shots per burst: ] 0 19 "$__burstshots_akimbo" 1 [ burstshots AKIMBO $arg1; __burstshots_akimbo = $arg1 ; refreshcurmenu ]

////  Main > Settings > Gameplay > Kill Messages  ////

newmenu [Kill Messages]
menuitem "\f9Frag messages: " -1
menuitemtextinput "Pistol: "  [ fragmessage PISTOL ]  [ fragmessage PISTOL $arg1 ] [] 15
menuitemtextinput "Carbine: " [ fragmessage CARBINE ] [ fragmessage CARBINE $arg1 ] [] 15
menuitemtextinput "Shotgun: " [ fragmessage SHOTGUN ] [ fragmessage SHOTGUN $arg1 ] [] 15
menuitemtextinput "SMG: "     [ fragmessage SUBGUN ]  [ fragmessage SUBGUN $arg1 ] [] 15
menuitemtextinput "Sniper: "  [ fragmessage SNIPER ]  [ fragmessage SNIPER $arg1 ] [] 15
menuitemtextinput "AR: "      [ fragmessage ASSAULT ] [ fragmessage ASSAULT $arg1 ] [] 15
//menuitemtextinput "CPistol: " [ fragmessage CPISTOL ] [ fragmessage CPISTOL $arg1 ] [] 15
menuitemtextinput "Akimbo: "  [ fragmessage AKIMBO ]  [ fragmessage AKIMBO $arg1 ] [] 15
menuitem [] -1
menuitem "\f9Gib messages: " -1
menuitemtextinput "Knife: "    [ gibmessage KNIFE ]   [ gibmessage KNIFE $arg1 ] [] 15
menuitemtextinput "Shotgun: "  [ gibmessage SHOTGUN ] [ gibmessage SHOTGUN $arg1 ] [] 15
menuitemtextinput "Sniper: "   [ gibmessage SNIPER ]  [ gibmessage SNIPER $arg1 ] [] 15
menuitemtextinput "Grenades: " [ gibmessage GRENADE ] [ gibmessage GRENADE $arg1 ] [] 15

////  Main > Settings > Gameplay > Bot settings  ////
// see menus_bot.cfg


////  Main > Settings > Scoreboard  ////

newmenu Scoreboard
const __DEFAULT_SCOREBOARD [
    sc_flags     Flags
    sc_frags     Frags
    sc_deaths    Deaths
    sc_ratio     Ratio
    sc_score     Score
    sc_lag       Lag
    sc_clientnum "Client number"
    sc_name      Name
]
menuitem "\f40 has the highest priority" -1
menuitem "\f4-1 disables the item entirely" -1
menuitem "" -1
looplist $__DEFAULT_SCOREBOARD [ var desc ] [
    menuitemslider (concatword $desc ": ") (getvarrange min $var) 7 (concatword "$" $var) 1 (concat $var "$arg1")
]
menuitem "" -1
menuitem "Reset to default scoreboard" [ looplist $__DEFAULT_SCOREBOARD [ var desc ] [ $var (getvarrange default $var) ] ; refreshcurmenudelayed ]


////  Main > Settings > Keyboard  ////

newmenu Keyboard
menuitem "General keys\i\3"         [ showmenu [General keys] ]
menuitem "Edit mode keys\i\3"       [ showmenu [Editing keys] ]
menuitem "Spectate mode keys\i\3"   [ showmenu [Spectating keys] ]
menuitem "" -1
menuitem "Reset all keybinds to default settings\i\3" [ showmenu [Reset Binds] ]

////  Main > Settings > Keyboard > General keys  ////

newmenu [General keys]
menuitem [Select an action and press ENTER to bind a new key:] -1
menuitem "" -1
menuitem "\f2Movement:" -1
menuitemkeyinput [Forwards: ]        forward
menuitemkeyinput [Left: ]            left
menuitemkeyinput [Backwards: ]       backward
menuitemkeyinput [Right: ]           right
menuitemkeyinput [Jump: ]            jump
menuitemkeyinput [Crouch: ]          crouch
menuitem "" -1
menuitem "\f2Weapon:" -1
menuitemkeyinput [Attack: ]              attack
menuitemkeyinput [Special action: ]      altaction
menuitemkeyinput [Knife attack: ]        key_knifeattack
menuitemkeyinput [Quick grenade throw: ] quicknadethrow
menuitemkeyinput [Reload: ]              reload
menuitemkeyinput [Weapon menu: ]         key_showmenuweapons
menuitemkeyinput [Primary weapon: ]      primary
menuitemkeyinput [Secondary weapon: ]    secondary
menuitemkeyinput [Grenades: ]            grenades
menuitemkeyinput [Knife: ]               melee
menuitemkeyinput [Next weapon: ]         key_universaldelta_plus
menuitemkeyinput [Previous weapon: ]     key_universaldelta_minus
menuitemkeyinput [Last weapon: ]         key_prevweapon
menuitem "" -1
menuitem "\f2Gameplay:" -1
menuitemkeyinput [Show scores: ]     key_showscores
menuitemkeyinput [Map overview: ]    key_showmap
menuitemkeyinput [Drop flag: ]       dropflag
menuitemkeyinput [Chat: ]            saycommand
menuitemkeyinput [Team chat: ]       key_teamchat
menuitemkeyinput [Quick answer to private message: ] quickanswer
menuitemkeyinput [Voice menu: ]      key_showmenuvoicecom
menuitem "" -1
menuitem "\f2Console:" -1
menuitemkeyinput [Toggle console: ]  key_toggleconsole
menuitemkeyinput [Rewind console: ]  key_console_rewind
menuitemkeyinput [Forward console: ] key_console_forward
menuitemkeyinput [End of console: ]  key_console_end
menuitem "" -1
menuitem "\f2Mousewheel actions (need holding the key):" -1
menuitemkeyinput [Scroll console: ]  key_console_scroll
menuitemkeyinput [Adjust gamma: ]    key_domodifier_1
menuitemkeyinput [Adjust FOV: ]      key_domodifier_2
menuitem "" -1
menuitem "\f2Misc keys:" -1
menuitemkeyinput [Commandline: ]     key_commandline
menuitemkeyinput [Screenshot: ]      screenshot
menuitemkeyinput [Fullscreen: ]      fullscreentoggle
menuitemkeyinput [Enter edit mode: ] edittoggle
menuitemkeyinput [Pause game: ]      key_pause
menuitem "" -1
menuitemtextinput [Lookup a keybind: ] [] [
    if (strlen $arg1) [
        echo (concatword "\f9Contents of keybind " (addpunct $arg1) :)
        if (strcmp (result (keybind $arg1)) "") [
            echo (addpunct $arg1) is not bound
        ][
            echo (keybind $arg1)
        ]
     ]
] [] 256
menuitem "" -1

////  Main > Settings > Keyboard > Editing keys  ////
// see menus_edit.cfg

////  Main > Settings > Keyboard > Spectating keys  ////

newmenu [Spectating keys]
menuitem "Select an action and press ENTER to bind a new key:" -1
menuitem "" -1
menuitem "\f2Demo watching:" -1
menuitemspectkeyinput [Toggle game speed: ]   speckey_demo_togglespeed
menuitemspectkeyinput [Increase game speed: ] speckey_demo_gamespeedup
menuitemspectkeyinput [Decrease game speed: ] speckey_demo_gamespeeddown
menuitemspectkeyinput [Reset game speed: ]    speckey_demo_gamespeedreset
menuitem "" -1
menuitem "\f2Misc spectating keys:" -1
menuitemspectkeyinput [Whois spectated player: ] speckey_whois_spectatecn
menuitem "" -1
menuitemtextinput [Lookup a keyspecbind: ] [] [
    if (strlen $arg1) [
        echo (concatword "\f9Contents of keyspecbind " (addpunct $arg1) :)
        if (strcmp (result (keyspecbind $arg1)) "") [
            echo (addpunct $arg1) is not bound
        ][
            echo (keyspecbind $arg1)
        ]
     ]
] [] 256
menuitem "" -1

////  Main > Settings > Keyboard > Reset Binds  ////

newmenu [Reset Binds]
menuitemcheckbox [Yes, reset all binds: ] [ tempalias __resetbindsyes 0 ] [ __resetbindsyes = $arg1 ]
menuitem "\f2         [ Apply! ]        " [ if $__resetbindsyes resetbinds [ showmenu [] ] ]


////  Main > Settings > Mouse  ////

newmenu Mouse
menuinit [
    resetcurmenu
    menuitemcheckbox  "Invert mouse:"                "$invmouse"       [ invmouse $arg1 ]
    menuitemtextinput "Mouse Sensitivity:"           "$sensitivity"    [ sensitivity $arg1 ]
    menuitemtextinput "Mouse Acceleration:"          "$mouseaccel"     [ mouseaccel $arg1 ]
    menuitemtextinput "Filter mouse (for bad ones):" "$mfilter"        [ mfilter $arg1 ]
    menuitem "" -1
    menuitemradio     "Sniper-scope sensitivity: " 0 1 "$autoscopesens" [manual automatic] [ autoscopesens $arg1 ; refreshcurmenu]
    menuitemgreyedout (! $autoscopesens)
    menuitemtextinput "Sniper-scope sensitivity scale: " "$scopesensscale" [ scopesensscale $arg1 ]
    menuitemgreyedout 0
    menuitem "" -1
    menuitem          "Customize crosshairs\i\3"     [ showmenu [Customize crosshairs] ]
]

////  Main > Settings > Mouse > Customize crosshairs  ////

newmenu [Customize crosshairs]
tempalias __crosshairset teammate
menuinit [
    resetcurmenu
    menuitemslider   "Crosshair size: " 0 50 "$crosshairsize" 5 [ crosshairsize $arg1 ]
    menuitem         "Change default crosshair\i\3"             [ tempalias __crosshairset default ; showmenu Crosshairs ]
    menuitem         "Change scope crosshair\i\3"               [ tempalias __crosshairset scope ; showmenu Crosshairs ]
    menuitem "" -1
    menuitemslider   "Choose crosshair: " 0 -1 [findlist (listoptions crosshairnames) $__crosshairset] (listoptions crosshairnames) [ tempalias __crosshairset (at (listoptions crosshairnames) $arg1) ; refreshcurmenu ]
    menuitem         (concat "Change" $__crosshairset "crosshair\i\3") [ showmenu Crosshairs ]
    menuitem "" -1
    menuitemcheckbox "Crosshair effect: change color for low health"        [ (at "0 1 1 0" $crosshairfx) ] [ crosshairfx (at (if $arg1 ["2 1 2 1"] ["0 3 0 3"]) $crosshairfx) ]
    menuitemcheckbox "Crosshair effect: show assault rifle spread increase" [ (at "0 1 0 1" $crosshairfx) ] [ crosshairfx (at (if $arg1 ["3 1 1 3"] ["0 2 2 0"]) $crosshairfx) ]
    menuitemcheckbox "Crosshair effect: show team-sign when aiming at teammates " "$crosshairteamsign" [ crosshairteamsign $arg1 ]
    menuitem "" -1
    menuitem         "Reset all crosshairs to defaults" [ loadcrosshair reset ]
]

////  Main > Settings > Mouse > Customize crosshairs > Crosshairs  ////

newmenu Crosshairs
menuinit [
    resetcurmenu
    menuheader "" ['@[__crosshairset]' crosshair]
    menudirlist "packages/crosshairs" png [ loadcrosshair @__crosshairset [@[arg1].png] ] 1
]


////  Main > Settings > Sound  ////

newmenu "\fsSound"
alias __soundquality  3
menuitemslider   "Sound volume: " 0 255 "$soundvol" 16 [ soundvol $arg1 ]
menuitemslider   "Music volume: " 0 255 "$musicvol" 16 [ musicvol $arg1 ]
menuitemslider   "Sound detail: " 1 3 "($__soundquality)" [Low Medium High] [ __set_sound_quality $arg1 ]
menuitem "" -1
menuitem         "Mute/Un-mute specific sounds\i\3" [ showmenu [Mute specific sounds] ]
menuitem "" -1
menuitem         "Advanced settings:" -1
menuitemslider   "   Sounds at once: " 0 100 "$maxsoundsatonce" 2             [ maxsoundsatonce $arg1 ]
menuitemslider   "   Voice-coms: " 0 2 "$voicecomsounds" [Off On "Team only"] [ voicecomsounds $arg1 ]
menuitemslider   "   Heartbeat: " 0 99 "$heartbeat" 5                         [ heartbeat $arg1 ]
menuitemcheckbox "   Footsteps: " "$footsteps"                                [ footsteps $arg1 ]
menuitemcheckbox "   Disable own footsteps: " "(= $localfootsteps)"           [ localfootsteps (! $arg1) ]
menuitemcheckbox "   Bullet hit: " "$bulletbouncesound"                       [ bulletbouncesound $arg1 ]
menuitemcheckbox "   Bullet near-miss: " "$bulletairsound"                    [ bulletairsound $arg1 ]

////  Main > Settings > Sound > Mute specific sounds  ////

newmenu [Mute specific sounds]
menuitem "Weapon sounds\i\3"           [ showmenu [Mute weapon sounds] ]
menuitem "Bullet/explosion sounds\i\3" [ showmenu [Mute bullet/explosion sounds] ]
menuitem "Pain/death sounds\i\3"       [ showmenu [Mute pain/death sounds] ]
menuitem "Pickup sounds\i\3"           [ showmenu [Mute pickup sounds] ]
menuitem "Movement sounds\i\3"         [ showmenu [Mute movement sounds] ]
menuitem "Voice-com sounds\i\3"        [ showmenu [Mute voice-coms] ]
menuitem "Other sounds\i\3"            [ showmenu [Mute other sounds] ]
menuitem "" -1
menuitem "Un-mute all sounds" [ unmuteallsounds ]

looplist [
    "Mute weapon sounds" WEAPON
    "Mute pickup sounds" PICKUP
    "Mute pain/death sounds" "PAIN OWNPAIN"
    "Mute movement sounds" MOVEMENT
    "Mute bullet/explosion sounds" BULLET
    "Mute other sounds" OTHER
    "Mute voice-coms" VOICECOM
    ] [ mt sc ] [
    newmenu $mt
    looplist (enumsounds $sc) [ idx desc ] [ menuitemcheckbox (concatword $desc ": ") (concat ! "(soundmuted" $idx ")") (concat mutesound $idx "$arg1") ]
]


////  Main > Settings > Misc  ////

newmenu Misc
alias askquit 1
alias showmenuonstartup 1
alias menufilesort_cgz 0
alias menufilesort_dmo 0
tempalias __fontlist [ default serif mono ]
tempalias __screenshottypes ["JPEG (Terrible Quality)" "JPEG (Bad Quality)" "JPEG (Good Quality)" "JPEG (Best Quality)" "PNG (Lossless)" "BMP (Lossless)"]
tempalias __getscreenshottype [
  tempalias __screenshottype (at "5 0 4" $screenshottype) // 0:BMP 1:JPG 2:PNG
  if (= $screenshottype 1) [
    looplist [50 70 85] q [ if (< $q $jpegquality) [ += __screenshottype 1 ] ]
  ]
  result $__screenshottype
]
menuitemcheckbox "Auto map download: " "$autogetmap"                 [ autogetmap $arg1 ]
menuitem         "Configure auto media download \i\1"                 [ showmenu "Autodownload config"]
menuitemradio "Show gamemode names " 0 1 "$modeacronyms" [ verbal abbreviated ] [ modeacronyms $arg1 ]
menuitemcheckbox "Show quit dialog when quitting: " "$askquit"       [ askquit = $arg1 ]
menuitemcheckbox "Show main menu when starting AC: " "$showmenuonstartup"   [ showmenuonstartup = $arg1 ]
menuitemcheckbox "Auto-screenshot: " "$autoscreenshot"               [ autoscreenshot $arg1 ]
menuitemcheckbox "Allow HUD echos: " "$allowhudechos"                [ allowhudechos $arg1 ]
menuitemslider "Servers to ping at once: " 0 50 "$maxservpings" 5 [ maxservpings $arg1 ]
menuitemslider "Milliseconds between pinging servers: " 1000 60000 "$servpingrate" 1000 [ servpingrate $arg1 ]
menuitemslider "Screenshot type: " 0 5 __getscreenshottype $__screenshottypes [ screenshottype (at "1 1 1 1 2 0" $arg1) ; if (< $arg1 4) [ jpegquality (at [50 70 85 100] $arg1) ] ]
menuitemslider "Font type: " 0 2 [findlist $__fontlist (curfont)] [Default Serif Monospace] [ setfont (at $__fontlist $arg1) ]
menuitemslider "Mini-map background style: " 0  2 "$showmapbackdrop" ["Fully Transparent" Black White/Transparent] [ showmapbackdrop $arg1 ]
menuitemslider "Menu map file sort order: "  0 -1 "$menufilesort_cgz" (listoptions menufilesortorders) [menufilesort_cgz = $arg1]
menuitemslider "Menu demo file sort order: " 0 -1 "$menufilesort_dmo" (listoptions menufilesortorders) [menufilesort_dmo = $arg1]
menuitem       "Edit hook script \i\1" [ showmenu "Edit cubescript hook" ]
menuitemcheckbox "Show command reference/documentation for console input: " "$docvisible"       [ docvisible $arg1 ]
menuitemcheckbox "Show related commands: " "$docrefvisible"       [ docrefvisible $arg1 ]
menuitemradio "Show docs detail: " 0 3 "$docidentverbose" [ default +ident verbose/debug +always] [ docidentverbose $arg1 ]

////  Main > Settings > Misc > Autodownload config  ////

newmenu "Autodownload config"
tempalias __pcksrv ""
menuinit [
    resetcurmenu
    push serverlist (getpckserver)
    push words (listlen $serverlist)
    if (! $words) [
        menuitem "no package servers configured" -1
    ] [
        if (= $words 1) [
            menuitem $serverlist -1
        ] [
            menuitem "\f2priority\tping\tstatus\thost address" -1
            looplist $serverlist [host priority ping resolved] [
                resolved = (at ["\f2no response" "\f0ok"] $resolved)
                if (<= $priority -1000) [ resolved = "\f2disabled" ]
                if (<= $priority -10000) [ resolved = "\f3deleted" ]
                menuitem (concatword (if (<= $priority -1000) "" $priority) "\t" $ping "\t\fs" $resolved "\fr\t" $host) (concat alias __pcksrv "[" (escape $host) $priority $ping (escape $resolved) "] ; showmenu  [Configure package server]")
            ]
        ]
    ]
    menuitem "" -1
    menuitemcheckbox "Enable auto media download: " "$autodownload" [ autodownload $arg1 ]
    menuitem "Add package server -->" [ inputcommand "" "addpckserver $cmdbuf" "enter host address:" ]
    menuitem "" -1
    menuitem "\f4you need to restart the game for changes to take effect" -1
    pop serverlist words
]

////  Main > Settings > Misc > Autodownload config > Configure package server  ////

newmenu "Configure package server"
menuinit [
    resetcurmenu
    if (!= (listlen $__pcksrv) 4) [
        menuitem "----- no server selected ------" -1
    ] [
        push priority (at $__pcksrv 1)
        menuitem (concatword "Host address \t\f2" (at $__pcksrv 0)) -1
        menuitemtextinput "Priority     \t" $priority [addpckserver (at $__pcksrv 0) $arg1]
        menuitem (concatword "Ping         \t" (at $__pcksrv 2)) -1
        menuitem (concatword "Status       \t" (at $__pcksrv 3)) -1
        menuitem "" -1
        if (<= $priority -1000) [
            menuitem "\f0[Enable server]" (concat addpckserver (at $__pcksrv 0) 0 "; closecurmenu")
        ] [
            menuitem "\f3[Disable server]" (concat addpckserver (at $__pcksrv 0) -1000 "; closecurmenu")
        ]
        if (> $priority -10000) [
            menuitem "\f3[Mark server for deletion]" (concat addpckserver (at $__pcksrv 0) -10000 "; closecurmenu")
        ]
        pop priority
    ]
]

////  Main > Settings > Misc > Edit cubescript hook  ////

newmenu "Edit cubescript hook"
menuinit [
    resetcurmenu
    looplist [
        autoexec "after autoexec.cfg"
        afterinit "after saved.cfg but before autoexec.cfg"
        mapstartalways "when a map was loaded"
        onLastMin "when the last minute of a game has started"
        start_intermission "when a game ended"
        onNewMap "when a new (empty) map was created"
        onPM "when you got a private message"
        onConnect "after a player connected"
        onDisconnect "after a player disconnected"
        onCallVote "when a vote was called"
        onVoteEnd "after voting ended"
        onChangeVote "when a vote is changed"
        updateeditinfopanel "during editing"
    ] [ cmd desc ] [
        menuitem (concatword "\fs\f2" $cmd ":\fr gets executed " $desc) (concat editalias $cmd) "" (if (checkalias $cmd) [ concatword "\fs\f4current: \fr" $$cmd ])
    ]
]


////  Main > Settings > Mod package  ////

newmenu "Mod package"
tempalias __zip ""
menuinit [
    resetcurmenu
    menurenderoffset -20 0
    push ecurmenu (escape (curmenu))
    push activezips (zipmodlist active)
    push inactivezips (zipmodlist inactive)
    if (strlen $activezips) [
        menuitem "\f2Currently used mod packages (highest priority listed first)" -1 (concat chmenutexture $ecurmenu "")
        looplist $activezips zip [
            menuitem (concatword "\fs\f9" $zip ":\fr " (at (zipmodgetdesc $zip) 0)) (concat alias __zip $zip "; showmenu  [Configure mod package]") (concatword chmenutexture " " $ecurmenu "../modpreviews/" $zip ".jpg " $zip)
        ]
        menuitem "" -1 (concat chmenutexture $ecurmenu "")
    ]
    if (strlen $inactivezips) [
        menuitem "\f2Unused mod packages" -1 (concat chmenutexture $ecurmenu "")
        looplist $inactivezips zip [
            menuitem (concatword "\fs\f9" $zip ":\fr " (at (zipmodgetdesc $zip) 0)) (concat alias __zip $zip "; showmenu  [Configure mod package]") (concatword chmenutexture " " $ecurmenu "../modpreviews/" $zip ".jpg " $zip)
        ]
        menuitem "" -1 (concat chmenutexture $ecurmenu "")
    ]
    if (|| (strlen $activezips) (strlen $inactivezips)) [ ] [ menuitem "--- no mod packages available ---" -1 ]
    if (strlen $activezips) [ menuitem "\f3Deactivate all mod packages" zipmodclear ]
    menuitem "\f3Refresh textures (has no effect on already loaded models)" [ resetgl ; updateigraphs ]
    pop activezips inactivezips ecurmenu
]

////  Main > Settings > Mod package > Configure mod package  ////

newmenu "Configure mod package"
menuinit [
    resetcurmenu
    menurenderoffset -20 0
    push ecurmenu (escape (curmenu))
    push activezips (zipmodlist active)
    if (strlen $__zip) [
        chmenutexture (curmenu) (concatword "../modpreviews/" $__zip ".jpg") $__zip
        push __c "\f2"
        looplist (zipmodgetdesc $__zip) desc [ if (strlen $desc) [ menuitem (concat $__c $desc) -1 ] ; alias __c "" ]
        pop __c
        menuitem (concat "\f4revision:" (zipmodgetrevision $__zip)) -1
        menuitem "" -1
        if (< (findlist $activezips $__zip) 0) [
            menuitem (concatword "\f0Add \f9" $__zip "\f0 to the list of used mod packages") (concat addzipmod $__zip)
        ] [
            menuitem (concatword "\f3Remove \f9" $__zip "\f0 from the list of used mod packages") (concat zipmodremove $__zip)
        ]
        menuitem "" -1
        menuitem "Show list of files in package" "showmenu [Show files in package]"
    ] [
        menuitem "no zip selected" -1
    ]
    pop activezips ecurmenu
]

////  Main > Settings > Mod package > Configure mod package > Show files in package  ////

newmenu "Show files in package"
menuinit [
    resetcurmenu
    if (strlen $__zip) [
        menuitem (concat "Files in package\f9" $__zip) -1
        menuitem "" -1
        looplist (zipmodgetfiles $__zip) aa [ menuitem $aa -1 ]
    ] [
        menuitem "no zip selected" -1
    ]
]


////  Main > Settings > Reset settings  ////

newmenu [Reset settings]
menuinit [ tempalias __resetyes 0 ]
menuitemcheckbox "Yes, reset all settings: " [ $__resetyes ] [ __resetyes = $arg1 ]
menuitem "\f2         [ Apply! ]        " [ if $__resetyes [ resetcfg 1; quit ] [ showmenu [] ] ] [ if $__resetyes [ echo "\f3Choose [Apply] and AssaultCube will now quit and your settings will be reset." ] ]


////  QUICK setup  ////

newmenu [QUICK setup]
menuitemtextinput "Nickname: " []                           [ name $arg1 ]
menuitemcheckbox  "Use high-res player skins" "(>= (findlist (zipmodlist active) protox_hq_reskin) 0)" [ if $arg1 [addzipmod protox_hq_reskin] [zipmodremove protox_hq_reskin] ]
menuitemtextinput "Resolution (width): "                            "$scr_w"             [ scr_w $arg1 ]
menuitemtextinput "Resolution (height): "                           "$scr_h"             [ scr_h $arg1 ]
menuitem (concatword "\f2Set\f5 resolution as in desktop (" $desktopw "x" $desktoph ")") [ scr_w $desktopw ; scr_h $desktoph ; refreshcurmenudelayed ]
menuitemcheckbox  "Fullscreen: "                                    "$fullscreen"        [ fullscreen $arg1 ]
menuitemcheckbox  "Fullscreen is always using desktop resolution: " "$fullscreendesktop" [ fullscreendesktop $arg1 ]
menuitemtextinput "Mouse sensitivity: "                             "$sensitivity"       [ sensitivity $arg1 ]
menuitemcheckbox  "Reduced violence mode: "                         "$poniesmodeon"      [ reducedviolencemode $arg1 ]
menuitemslider    "Graphics detail: " 1 6 "$gfxqualityalias" [Horrible Low Medium Good High "INSANE! (May perform slowly on older gfx)"] [ new_gfx_quality $arg1 ]
menuitemslider    "Sound detail: " 1 3 "$__soundquality" [Low Medium High] [ __set_sound_quality $arg1 ]
menuitemslider    "Field of view: " 75 120 "$fov" 2 [ fov $arg1 ] 1
menuitem "" -1
menuitem "\f0\t\t\t        [ OK; View FAQ ]" [ closecurmenu; resetgl; load_faq ; showmenu faq ]
menuitem "\f2\t\t\t        [ OK ]" [ closecurmenu; resetgl ]

const new_gfx_quality [
  if (= $arg1 6) [ // "INSANE!" gfx quality
    fsaa 8
    aniso 8
    minlod 250
    gfxqualityalias = 6
    fpsrange 100 1000
    watersubdiv 1
    dynlight 1
    waterreflect 1
    stencilbits 8
    stencilshadow 40
    dynshadow 40
    lighterror 1
    scorch 1
    bullethole 1
    blood 1
    gib 1
    shotline 1
    echo Be mighty careful! This setting puts any & every graphics setting as high as absolutely possible!
    trilinear 1
    waterrefract 1
    texreduce 0
    hidebigmenuimages 0
  ] [
    if (= $arg1 5) [ // High gfx quality
      fsaa 4
      aniso 4
      minlod 200
      gfxqualityalias = 5
      fpsrange 100 1000
      watersubdiv 2
      dynlight 1
      waterreflect 1
      stencilbits 8
      stencilshadow 40
      dynshadow 40
      lighterror 1
      scorch 1
      bullethole 1
      blood 1
      gib 1
      shotline 1
      trilinear 1
      waterrefract 0
      texreduce 0
      hidebigmenuimages 0
    ] [
      if (= $arg1 4) [ // Good gfx quality
        fsaa 0
        aniso 0
        minlod 100
        gfxqualityalias = 4
        fpsrange 60 60
        watersubdiv 2
        dynlight 1
        waterreflect 1
        stencilbits 8
        stencilshadow 40
        dynshadow 40
        lighterror 4
        scorch 1
        bullethole 1
        blood 1
        gib 1
        shotline 1
        trilinear 1
        waterrefract 0
        texreduce 0
        hidebigmenuimages 0
      ] [
        if (= $arg1 3) [ // Medium gfx quality (DEFAULT)
          fsaa 0
          aniso 0
          minlod 60
          gfxqualityalias = 3
          fpsrange 30 40
          watersubdiv 4
          dynlight 1
          // Makes sure the 3D card is powerful enough for water reflection/shadow stencils...
          if (glext "GL_ARB_fragment_program") [ waterreflect 1 ] [ waterreflect 0 ]
          if (|| (glext "GL_EXT_stencil_two_side") (glext "GL_ATI_separate_stencil")) [
            stencilbits 8
            stencilshadow 40
          ] [
            stencilbits 0
            stencilshadow 0 ]
            dynshadow 40
            lighterror 4
            scorch 1
            bullethole 1
            blood 1
            gib 1
            shotline 1
            trilinear 1
            waterrefract 0
            texreduce 0
            hidebigmenuimages 0
        ] [
          if (= $arg1 2) [ // Low gfx quality
            fsaa 0
            aniso 0
            minlod 60
            gfxqualityalias = 2
            fpsrange 20 25
            watersubdiv 16
            dynlight 0
            waterreflect 0
            stencilshadow 0
            stencilbits 0
            dynshadow 0
            lighterror 10
            scorch 0
            bullethole 0
            blood 0
            gib 0
            shotline 0
            trilinear 1
            waterrefract 0
            texreduce 1
            hidebigmenuimages 1
          ] [ // Horrible gfx quality
            fsaa 0
            aniso 0
            minlod 60
            gfxqualityalias = 1
            fpsrange 20 25
            watersubdiv 64
            dynlight 0
            waterreflect 0
            stencilshadow 0
            stencilbits 0
            dynshadow 0
            lighterror 16
            scorch 0
            bullethole 0
            blood 0
            gib 0
            if (> $gibnum (getvarrange default gibnum)) [gibnum (getvarrange default gibnum)]
            shotline 0
            trilinear 0
            waterrefract 0
            texreduce -1
            hidebigmenuimages 1
          ]
        ]
      ]
    ]
  ]
]

const __set_sound_quality [
    looplist [
        3 (getvarrange default maxsoundsatonce) 1 1 1
        2 (div (getvarrange default maxsoundsatonce) 2) 1 0 1
        1 (div (getvarrange default maxsoundsatonce) 4) 0 0 0
    ] [ idx maxsounds foots bullair bullbounce ] [
        if (= $arg1 $idx) [
            __soundquality = $idx
            maxsoundsatonce $maxsounds
            footsteps $foots
            bulletairsound $bullair
            bulletbouncesound $bullbounce
        ]
    ]
]

// Reduced game violence mode...
alias poniesmodeon 0

const reducedviolencemode [
  push x (! $arg1)
  poniesmodeon = (! $x)
  blood $x
  gib $x
  looplist (enumsounds PAIN) [i d] [ mutesound $i $x ] // (Un-) Mute pain sounds: 26 to 33 and 48
  echo "\f2OMG! \f8PW\f1NI\f3ES\f5! mode" (if $x [result "has been disabled."] [result "enabled - Violent game content has now been reduced."])
  pop x
]


// game account management menus

newmenu "enter password"
menuitemtextinput "please enter the password for your game account\t" "" [ echo "checking..." ; authsetup passd $arg1 checkaccount ] [] 64 1

newmenu "offer account"
menuitem "To create a game account, AC needs some entropy. To generate" -1
menuitem "that, you need to play against bots for 10 minutes first..." -1
menuitem "" -1
menuitem "\t\t\f0[Start]" [tmp_mode = 8; tmp_isbotteammode = 0; tmp_numbots = (+ 7 (rnd 4)) ; tmp_botmap = (at "ac_scaffold ac_desert2 ac_complex" (rnd 3)); sleep 605000 __createaccount 1 ; startbotmap]
menuitem "\t\t[Not now...]" closemenu

tempalias __createaccount [
  disconnect
  kickallbots
  showmenu "create account"
]

newmenu "create account"
menuinit [ authsetup genpre; authsetup genpriv; authsetup genpub; echo "\f4temp account created." ; tempalias ___ppass "" ; tempalias ___pass "" ]
menuitemtextinput "please enter a password for account restoration\t" "" [___ppass = $arg1] [] 64
menuitemtextinput "please enter a password for your game account\t" "" [___pass = $arg1] [] 64
menuitem "" -1
menuitem "\t\t\f0[Ok]" [ authsetup newppass $___ppass ; authsetup newpass $___pass ; ___ppass = "" ; ___pass = "" ; if (authsetup) [ echo "created account" (mypubkey)] checkaccount ]

const checkaccount [
  if (authsetup) [
    echo "\f0using account " (mypubkey)
  ] [
    if (authsetup needpass) [] [ exec config/authprivate.cfg ]
    if (authsetup needpass) [
      showmenu "enter password"
    ] [
      showmenu "offer account"
    ]
  ]
]
