diff --git a/config/defaults.cfg b/config/defaults.cfg index 16d03cb4..b72884f6 100644 --- a/config/defaults.cfg +++ b/config/defaults.cfg @@ -16,6 +16,5 @@ gfxqualityalias = 3 // Default GFX is medium. soundqualityalias = 3 // Default sound is best. poniesmodeon = 0 // Reduced violence mode. __gibsgore = 1 // Default value for gibs slider. -dyngamma = 0 nickhighlight = 0 menuBotGameLength = 15 diff --git a/config/dyngamma.cfg b/config/dyngamma.cfg deleted file mode 100644 index d09281eb..00000000 --- a/config/dyngamma.cfg +++ /dev/null @@ -1,38 +0,0 @@ -persistidents 0 - -// Initialize the list (if it doesn't already exist) using the current gamma as initial values. -if (! (checkalias ofc_gamma_list)) [ - ofc_gamma_list = [] - loop ogl (listlen $defaultmaps) [ - add2list ofc_gamma_list $gamma - ] -] - -// setgamma - allows clients to set custom gamma values for each official map, disabling/enabling the entire system -// can be done with the dyngamma variable. -const setgamma [ - if (checkrange $arg1 30 300) [ - if (strstr $defaultmaps (curmap 1)) [ - push tmp_gamma_list $ofc_gamma_list - ofc_gamma_list = [] - push cmapp (findlist $defaultmaps (curmap 1)) // Find the position in the list of the current map - loop sgl (listlen $defaultmaps) [ - if (= $sgl $cmapp) [ // Add the new gamma at the correct position in the list - add2list ofc_gamma_list $arg1 - ] [ - add2list ofc_gamma_list (at $tmp_gamma_list $sgl) - ] - ] - pop tmp_gamma_list cmapp - echo (blue)Note: (white) $arg1 has been set as your default gamma for (yellow) (curmap 1) - ] [ echo (red)Error: (white)You are not on a official map! ] - ] [ echo (red)Error: (white)gamma has a minimum value of 30 and maximum value of 300! ] -] - -const applygamma [ if (strstr $defaultmaps (curmap 1)) [ gamma (at $ofc_gamma_list (findlist $defaultmaps (curmap 1))) ] ] - -// Plugin to mapstartalways on every run if it doesn't already exist. -check2init dyngamma 0 -checkinit mapstartalways [if $dyngamma applygamma] - -persistidents 1 diff --git a/config/menus_settings.cfg b/config/menus_settings.cfg index 7c586352..b8b9f790 100644 --- a/config/menus_settings.cfg +++ b/config/menus_settings.cfg @@ -442,6 +442,7 @@ alias askquit 1 alias showmenuonstartup 1 alias menufilesort_cgz 0 alias menufilesort_dmo 0 +alias defaultgamma 100 newmenu Misc menuitemcheckbox [Auto map download: ] "$autogetmap" [ autogetmap $arg1 ] @@ -458,8 +459,8 @@ menuitemslider [Console size: ] 0 20 "$consize" 1 [] [ consize $arg1 ] menuitemslider [Font type: ] 0 2 "$__fontsetting" 1 [Default Serif Monospace] [ if (= $arg1 1) [ setfont serif ] [ if (= $arg1 2) [ setfont mono ] [ setfont default ] ] ] menuitemslider [Mini-map background style: ] 0 2 "$showmapbackdrop" 1 ["Fully Transparent" Black White/Transparent] [ showmapbackdrop $arg1 ] menuitemcheckbox [Enable compatibility with older cubescripts: ] "$compatibilitymode" [ compatibilitymode $arg1; echo (c 3) This setting requires a restart to take effect. ] -menuitemcheckbox [Enable per-official map dynamic gamma: ] "$dyngamma" [ dyngamma = $arg1 ] -menuitemtextinput [Set default gamma for this map: ] "(at $ofc_gamma_list (findlist $defaultmaps (curmap 1)))" [ setgamma $arg1 ] +menuitemtextinput [Set default gamma for this map: ] [$gamma] [setgamma $arg1] +menuitemtextinput [Set default gamma for maps without own default: ] [$defaultgamma] [ defaultgamma = $arg1 ] menuitemslider [Menu map file sort order: ] 0 (- (listlen (listoptions menufilesortorders)) 1) "$menufilesort_cgz" 1 (listoptions menufilesortorders) [menufilesort_cgz = $arg1] menuitemslider [Menu demo file sort order: ] 0 (- (listlen (listoptions menufilesortorders)) 1) "$menufilesort_dmo" 1 (listoptions menufilesortorders) [menufilesort_dmo = $arg1] diff --git a/config/scripts.cfg b/config/scripts.cfg index 63cb9266..57e8917e 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -498,13 +498,37 @@ const customclaimadminscript [ ] [ echo (red)Error: (white)you're not connected to $_CAS_servername servers ] ] +// manage per-map gamma values + +// setgamma sets a persistent gamma value for a map +const setgamma [ + push nn (concatword "__dyngamma_" (curmap 1)) + if (checkrange $arg1 30 300) [ + $nn = $arg1 + echo "gamma preset for map" (curmap 1) "set to" $arg1 + ] [ + if (&& (checkalias $nn) (strlen $$nn)) [ + $nn = "" + echo "gamma preset for map" (curmap 1) "deleted" + ] + ] + pop nn +] + +const applygamma [ + push nn (concatword "__dyngamma_" (curmap 1)) + if (&& [checkalias $nn] [strlen $$nn]) [ gamma $$nn ; echo "gamma set to" $$nn ] [ gamma $defaultgamma ] + pop nn +] + +addOnLoadAlways applygamma + // get optional scripts on demand tempalias load_survival [ run opt/survival ; alias load_survival [] ] tempalias load_parsestring [ run opt/parsestring ; alias load_parsestring [] ] tempalias load_faq [ run opt/faq ; alias load_faq [] ] // Execute other .cfgs/scripts. -run dyngamma run autosave persistidents 1