diff --git a/source/src/command.cpp b/source/src/command.cpp index 5b483cbd..f8ea0ee9 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -128,6 +128,19 @@ void setvar(const char *name, int i) { *idents->access(name)->storage.i = i; } int getvar(const char *name) { return *idents->access(name)->storage.i; } bool identexists(const char *name) { return idents->access(name)!=NULL; } +void touchvar(const char *name) +{ + ident *id = idents->access(name); + if(id) switch(id->type) + { + case ID_VAR: + case ID_FVAR: + case ID_SVAR: + if(id->fun) ((void (__cdecl *)())id->fun)(); // call trigger function if available + break; + } +} + const char *getalias(const char *name) { ident *i = idents->access(name); diff --git a/source/src/main.cpp b/source/src/main.cpp index f63d9d2b..ab9c8c7a 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -297,6 +297,8 @@ void resetgl() setupscreen(usedcolorbits, useddepthbits, usedfsaa); gl_init(scr_w, scr_h, usedcolorbits, useddepthbits, usedfsaa); + touchvar("gamma"); + extern void reloadfonts(); extern void reloadtextures(); c2skeepalive(); diff --git a/source/src/protos.h b/source/src/protos.h index 1315932b..35da3894 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -23,6 +23,7 @@ struct color extern bool persistidents; extern int variable(const char *name, int min, int cur, int max, int *storage, void (*fun)(), bool persist); extern void setvar(const char *name, int i); +extern void touchvar(const char *name); extern int getvar(const char *name); extern bool identexists(const char *name); extern bool addcommand(const char *name, void (*fun)(), int narg);