diff --git a/config/defaults.cfg b/config/defaults.cfg
index ae33dacb..0e37c245 100644
--- a/config/defaults.cfg
+++ b/config/defaults.cfg
@@ -28,4 +28,13 @@ askquit = 1
gfxqualityalias = 3 // Default GFX is medium.
soundqualityalias = 3 // Default sound is best.
poniesmodeon = 0 // Reduced violence mode.
-__gibsgore = 1 // Default value for gibs slider.
\ No newline at end of file
+__gibsgore = 1 // Default value for gibs slider.
+
+// The code used below is for initializing the dynamic gamma system "ofc_gamma_list" alias to be stored in saved.cfg
+// 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
+ ]
+]
\ No newline at end of file
diff --git a/config/docs.cfg b/config/docs.cfg
index 762d7022..cae502a6 100644
--- a/config/docs.cfg
+++ b/config/docs.cfg
@@ -166,6 +166,10 @@ docargument [W] [the width] [] [0];
docargument [V] [the number] [] [0];
docexample [echo (l0 5 1000)] [Output: 01000];
docexample [echo (l0 3 1000)] [Output: 1000];
+docident [add2list] [Appends a new element to a list.];
+docargument [A] [the alias (list) to add to] [] [0];
+docargument [E] [the new element to add] [] [0];
+docexample [tmp_list = []; add2list tmp_list Hello; add2list tmp_list world!; echo $tmp_list] [Output: Hello world!];
docsection [General]
docident [addserver] [Adds a server to the list of server to query in the server list menu.];
docargument [S] [the address of the server (hostname or IP)] [] [0];
@@ -1078,6 +1082,12 @@ docremark [Not supported on Windows and Mac.];
docident [gamma] [Sets the hardware gamma value.];
docargument [N] [the gamma value] [min 30/max 300/default 100];
docremark [May not work if your card/driver doesn't support it.];
+docident [dyngamma] [Enables or disables the per official map dynamic gamma system.];
+docexample [dyngamma = 0] [disables the system];
+docexample [dyngamma = 1] [enables the system];
+docident [setgamma] [Sets the current map's default dynamic gamma.];
+docargument [G] [the gamma value] [min 30/max 300/default 100] [0];
+docremark [The setting will take affect automatically if dyngamma is enabled, upon future loads of that map. This command only works on official maps!];
docident [gib] [Enables or disables the gib animation entirely.];
docargument [B] [off OR on] [0 (false), 1 (true)];
docident [gibnum] [Sets the number of gibs to display when performing a "messy" kill (grenade, knife, sniper headshot).];
diff --git a/config/dyngamma.cfg b/config/dyngamma.cfg
new file mode 100644
index 00000000..0f5f957d
--- /dev/null
+++ b/config/dyngamma.cfg
@@ -0,0 +1,40 @@
+// 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.
+setgamma = [
+ if (&& (<= $arg1 300) (>= $arg1 30)) [
+ if (strstr $defaultmaps (curmap 1)) [
+ tmp_gamma_list = $ofc_gamma_list
+ ofc_gamma_list = [ ]
+ 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)
+ ]
+ ]
+ echo (c 1)Note: (c 5) $arg1 has been set as your default gamma for (c 2) (curmap 1)
+ ] [
+ echo (c 3)Error: (c 5)You are not on a official map!
+ ]
+ ] [
+ echo (c 3)Error: (c 5)gamma has a minimum value of 30 and maximum value of 300!
+ ]
+]
+
+// Plugin to mapstartalways on every run if it doesn't already exist.
+if (! (checkalias dyngamma)) [ dyngamma = 0 ]
+if (! (checkalias mapstartalways)) [ mapstartalways = [ ] ]
+if (! (strstr $mapstartalways dyngamma)) [
+ add2alias mapstartalways [
+ if $dyngamma [ gamma (at $ofc_gamma_list (findlist $defaultmaps (curmap 1))) ]
+ ]
+]
\ No newline at end of file
diff --git a/config/menus_settings.cfg b/config/menus_settings.cfg
index 850f44ae..7cd2a6ba 100644
--- a/config/menus_settings.cfg
+++ b/config/menus_settings.cfg
@@ -394,6 +394,8 @@ menuitemslider "Screenshot type: " -1 4 "$__screenshottype" 1 [ "JPEG (Terrible
menuitemslider "Console size: " 0 20 "$consize" 1 "" [ consize $arg1 ]
menuitemslider "Font type: " 0 2 "$__fontsetting" 1 [ "Default" "v104" "Mono" ] [ if (= $arg1 1) [ setfont v104; __fontsetting = 1 ] [ if (= $arg1 2) [ setfont mono; __fontsetting = 2 ] [ setfont default; __fontsetting = 0 ] ] ]
menuitemslider "Mini-map background style: " 0 2 "$showmapbackdrop" 1 [ "Fully Transparent" "Black" "White/Transparent" ] [ showmapbackdrop $arg1 ]
+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 ]
// Reduced game violence mode...
reducedviolencemode = [
diff --git a/config/scripts.cfg b/config/scripts.cfg
index f68cff80..2ebdbf83 100644
--- a/config/scripts.cfg
+++ b/config/scripts.cfg
@@ -259,7 +259,8 @@ addOnLoadOnce = [ add2alias mapstartonce $arg1 ]
addOnLoadAlways = [ add2alias mapstartalways $arg1 ]
addOnQuit = [ add2alias onQuit $arg1 ]
-run tutorial
+// add2list - Quickly append an element to a list without add2alias'es ";"
+add2list = [ if (strcmp "" (getalias $arg1)) [ $arg1 = $arg2 ] [ $arg1 = (concat (getalias $arg1) $arg2) ] ]
// copyent & pasteent - Quickly copy/paste the current closest entity.
ent_type = none
@@ -324,4 +325,8 @@ customclaimadminscript = [
] [
echo (concat (c 3)Error: (c 5)you're not connected to $_CAS_servername servers)
]
-]
\ No newline at end of file
+]
+
+run dyngamma
+
+run tutorial
\ No newline at end of file
diff --git a/docs/reference.xml b/docs/reference.xml
index 3c4fbcf3..4d9e9ec7 100644
--- a/docs/reference.xml
+++ b/docs/reference.xml
@@ -617,6 +617,20 @@
+
+
+ Appends a new element to a list.
+
+
+
+ Output: Hello world!
+
+
+
+
+
+
+
@@ -4228,6 +4242,38 @@ Output:
+
+
+ Enables or disables the per official map dynamic gamma system.
+
+
+
+ Output: disables the system
+
+
+
+ Output: enables the system
+
+
+
+
+
+
+
+
+
+ Sets the current map's default dynamic gamma.
+
+
+
+
+ The setting will take affect automatically if dyngamma is enabled, upon future loads of that map. This command only works on official maps!
+
+
+
+
+
+
Allows to finetune the amount of "error" the mipmapper/stripifier allow themselves for changing lightlevels.