From 3585e02993ac1a807f88da77f584d19886a0c15b Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 23 May 2019 16:32:18 +1000 Subject: [PATCH] [client] egl: add options for maximum NV level and initial level Adds options: * egl:nvGain * egl:nvGainMax Fixes #153 --- VERSION | 2 +- client/renderers/EGL/desktop.c | 8 ++++++-- client/renderers/EGL/egl.c | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index a62f971e..9ff5545d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -a12-216-g666a6a218f+1 \ No newline at end of file +a12-217-gf946117dac+1 \ No newline at end of file diff --git a/client/renderers/EGL/desktop.c b/client/renderers/EGL/desktop.c index 16e0ff0e..ffd19685 100644 --- a/client/renderers/EGL/desktop.c +++ b/client/renderers/EGL/desktop.c @@ -19,6 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA #include "desktop.h" #include "common/debug.h" +#include "common/option.h" #include "utils.h" #include "texture.h" @@ -63,7 +64,7 @@ struct EGL_Desktop // night vision KeybindHandle kbNV; - bool nv; + int nvMax; int nvGain; }; @@ -141,6 +142,9 @@ bool egl_desktop_init(EGL_Desktop ** desktop) (*desktop)->kbNV = app_register_keybind(SDL_SCANCODE_N, egl_desktop_toggle_nv, *desktop); + (*desktop)->nvMax = option_get_int("egl", "nvGainMax"); + (*desktop)->nvGain = option_get_int("egl", "nvGain" ); + return true; } @@ -148,7 +152,7 @@ bool egl_desktop_init(EGL_Desktop ** desktop) void egl_desktop_toggle_nv(SDL_Scancode key, void * opaque) { EGL_Desktop * desktop = (EGL_Desktop *)opaque; - if (++desktop->nvGain == 4) + if (desktop->nvGain++ == desktop->nvMax) desktop->nvGain = 0; if (desktop->nvGain == 0) app_alert(LG_ALERT_INFO, "NV Disabled"); diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index 0c89dd1f..53a8cd5f 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -101,6 +101,20 @@ static struct Option egl_options[] = .type = OPTION_TYPE_BOOL, .value.x_bool = false }, + { + .module = "egl", + .name = "nvGainMax", + .description = "The maximum night vision gain", + .type = OPTION_TYPE_INT, + .value.x_int = 1 + }, + { + .module = "egl", + .name = "nvGain", + .description = "The initial night vision gain at startup", + .type = OPTION_TYPE_INT, + .value.x_int = 0 + }, {0} };