From d2727a14f608764b8fd1be7b713b1a5ff14284f1 Mon Sep 17 00:00:00 2001 From: Konstantin Nosov Date: Thu, 11 Jul 2019 15:38:18 +0300 Subject: [PATCH] More video modes available. Modes are described in renderer now, and UI polls renderer for list of modes. No more 2 places where mode descriptions are located, --- client/menu.cpp | 33 ++++++++++++++++++++++----------- win32/vid_dll.cpp | 6 ++++-- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/client/menu.cpp b/client/menu.cpp index 60369ca7..781d2209 100644 --- a/client/menu.cpp +++ b/client/menu.cpp @@ -2627,26 +2627,37 @@ struct videoMenu_t : menuFramework_t bool Init () { - static const char *resolutions[] = { - "[320 240 ]", "[400 300 ]", "[512 384 ]", "[640 480 ]", - "[800 600 ]", "[960 720 ]", "[1024 768 ]", "[1152 864 ]", - "[1280 700 ]", "[1280 960 ]", "[1280 1024]", "[1600 900 ]", - "[1600 1200]", "[1680 1050]", "[1920 1200]", "[2048 1536]", - NULL - }; - static const char *overbrightNames[] = { + static const char* resolutions[32]; + + static const char* overbrightNames[] = { "no", "yes", "auto", NULL }; - static const char *bits[] = { + static const char* bits[] = { "default", "16 bit", "32 bit", NULL }; - static const char *lighting[] = { + static const char* lighting[] = { "lightmap", "vertex", NULL }; - static const char *filters[] = { + static const char* filters[] = { "bilinear", "trilinear", NULL }; + // Init video modes + if (resolutions[0] == NULL) + { + for (int mode = 0; /* empty */; mode++) + { + int w, h; + if (!Vid_GetModeInfo(&w, &h, mode)) + break; + assert(mode < ARRAY_COUNT(resolutions)-1); + char buf[32]; + appSprintf(ARRAY_ARG(buf), "[%4dx%4d]", w, h); + resolutions[mode] = appStrdup(buf); // not releasing string + resolutions[mode+1] = NULL; + } + } + // init cvars CVAR_BEGIN(vars) // CVAR_GET(gl_driver, opengl32, CVAR_ARCHIVE), diff --git a/win32/vid_dll.cpp b/win32/vid_dll.cpp index 054e476e..3476edb9 100644 --- a/win32/vid_dll.cpp +++ b/win32/vid_dll.cpp @@ -488,9 +488,11 @@ static const struct { {1280, 1024}, {1600, 900}, {1600, 1200}, - {1680, 1050}, + {1920, 1080}, {1920, 1200}, - {2560, 1600} + {2560, 1440}, + {2560, 1600}, + {3840, 2160} };