From fc63f9af55c63e71428be0f34ec2444cda7cea6e Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Sat, 26 Jun 2021 17:14:00 +0200 Subject: [PATCH] Menu-FN: disable models/spray widgets in m_customize if we've got none. --- .../textures/lights/k_1000.mat | 3 +- .../textures/lights/k_10000.mat | 3 +- .../textures/lights/k_2000.mat | 3 +- .../textures/lights/k_3000.mat | 3 +- .../textures/lights/k_4000.mat | 3 +- .../textures/lights/k_5000.mat | 1 + .../textures/lights/k_6000.mat | 3 +- .../textures/lights/k_7000.mat | 3 +- .../textures/lights/k_8000.mat | 3 +- .../textures/lights/k_9000.mat | 3 +- src/menu-fn/m_customize.qc | 39 ++++++++++++------- 11 files changed, 43 insertions(+), 24 deletions(-) diff --git a/platform/vmap_tex.pk3dir/textures/lights/k_1000.mat b/platform/vmap_tex.pk3dir/textures/lights/k_1000.mat index 90b85013..29a9d05d 100644 --- a/platform/vmap_tex.pk3dir/textures/lights/k_1000.mat +++ b/platform/vmap_tex.pk3dir/textures/lights/k_1000.mat @@ -5,7 +5,8 @@ nomipmaps surfaceParm nodraw2 - vmap_surfaceLight 1000 + surfaceParm trans + vmap_surfaceLight 5000 vmap_lightImage "textures/lights/k_1000.tga" } diff --git a/platform/vmap_tex.pk3dir/textures/lights/k_10000.mat b/platform/vmap_tex.pk3dir/textures/lights/k_10000.mat index 367e3363..0ece6d64 100644 --- a/platform/vmap_tex.pk3dir/textures/lights/k_10000.mat +++ b/platform/vmap_tex.pk3dir/textures/lights/k_10000.mat @@ -5,7 +5,8 @@ nomipmaps surfaceParm nodraw2 - vmap_surfaceLight 10000 + surfaceParm trans + vmap_surfaceLight 5000 vmap_lightImage "textures/lights/k_10000.tga" } diff --git a/platform/vmap_tex.pk3dir/textures/lights/k_2000.mat b/platform/vmap_tex.pk3dir/textures/lights/k_2000.mat index ddbb086b..352f32f1 100644 --- a/platform/vmap_tex.pk3dir/textures/lights/k_2000.mat +++ b/platform/vmap_tex.pk3dir/textures/lights/k_2000.mat @@ -5,7 +5,8 @@ nomipmaps surfaceParm nodraw2 - vmap_surfaceLight 2000 + surfaceParm trans + vmap_surfaceLight 5000 vmap_lightImage "textures/lights/k_2000.tga" } diff --git a/platform/vmap_tex.pk3dir/textures/lights/k_3000.mat b/platform/vmap_tex.pk3dir/textures/lights/k_3000.mat index 653c8330..c8bdb3b6 100644 --- a/platform/vmap_tex.pk3dir/textures/lights/k_3000.mat +++ b/platform/vmap_tex.pk3dir/textures/lights/k_3000.mat @@ -5,7 +5,8 @@ nomipmaps surfaceParm nodraw2 - vmap_surfaceLight 3000 + surfaceParm trans + vmap_surfaceLight 5000 vmap_lightImage "textures/lights/k_3000.tga" } diff --git a/platform/vmap_tex.pk3dir/textures/lights/k_4000.mat b/platform/vmap_tex.pk3dir/textures/lights/k_4000.mat index bc3f0739..4acc211d 100644 --- a/platform/vmap_tex.pk3dir/textures/lights/k_4000.mat +++ b/platform/vmap_tex.pk3dir/textures/lights/k_4000.mat @@ -5,7 +5,8 @@ nomipmaps surfaceParm nodraw2 - vmap_surfaceLight 4000 + surfaceParm trans + vmap_surfaceLight 5000 vmap_lightImage "textures/lights/k_4000.tga" } diff --git a/platform/vmap_tex.pk3dir/textures/lights/k_5000.mat b/platform/vmap_tex.pk3dir/textures/lights/k_5000.mat index d6b689fe..b2b16ada 100644 --- a/platform/vmap_tex.pk3dir/textures/lights/k_5000.mat +++ b/platform/vmap_tex.pk3dir/textures/lights/k_5000.mat @@ -5,6 +5,7 @@ nomipmaps surfaceParm nodraw2 + surfaceParm trans vmap_surfaceLight 5000 vmap_lightImage "textures/lights/k_5000.tga" } diff --git a/platform/vmap_tex.pk3dir/textures/lights/k_6000.mat b/platform/vmap_tex.pk3dir/textures/lights/k_6000.mat index d6c1fe06..5b48507f 100644 --- a/platform/vmap_tex.pk3dir/textures/lights/k_6000.mat +++ b/platform/vmap_tex.pk3dir/textures/lights/k_6000.mat @@ -5,7 +5,8 @@ nomipmaps surfaceParm nodraw2 - vmap_surfaceLight 6000 + surfaceParm trans + vmap_surfaceLight 5000 vmap_lightImage "textures/lights/k_6000.tga" } diff --git a/platform/vmap_tex.pk3dir/textures/lights/k_7000.mat b/platform/vmap_tex.pk3dir/textures/lights/k_7000.mat index e9a92f79..c2994cf6 100644 --- a/platform/vmap_tex.pk3dir/textures/lights/k_7000.mat +++ b/platform/vmap_tex.pk3dir/textures/lights/k_7000.mat @@ -5,7 +5,8 @@ nomipmaps surfaceParm nodraw2 - vmap_surfaceLight 7000 + surfaceParm trans + vmap_surfaceLight 5000 vmap_lightImage "textures/lights/k_7000.tga" } diff --git a/platform/vmap_tex.pk3dir/textures/lights/k_8000.mat b/platform/vmap_tex.pk3dir/textures/lights/k_8000.mat index 0e10a963..b2aaaf9b 100644 --- a/platform/vmap_tex.pk3dir/textures/lights/k_8000.mat +++ b/platform/vmap_tex.pk3dir/textures/lights/k_8000.mat @@ -5,7 +5,8 @@ nomipmaps surfaceParm nodraw2 - vmap_surfaceLight 8000 + surfaceParm trans + vmap_surfaceLight 5000 vmap_lightImage "textures/lights/k_8000.tga" } diff --git a/platform/vmap_tex.pk3dir/textures/lights/k_9000.mat b/platform/vmap_tex.pk3dir/textures/lights/k_9000.mat index b7dd800d..56242bde 100644 --- a/platform/vmap_tex.pk3dir/textures/lights/k_9000.mat +++ b/platform/vmap_tex.pk3dir/textures/lights/k_9000.mat @@ -5,7 +5,8 @@ nomipmaps surfaceParm nodraw2 - vmap_surfaceLight 9000 + surfaceParm trans + vmap_surfaceLight 5000 vmap_lightImage "textures/lights/k_9000.tga" } diff --git a/src/menu-fn/m_customize.qc b/src/menu-fn/m_customize.qc index 4c64e63d..77842f97 100644 --- a/src/menu-fn/m_customize.qc +++ b/src/menu-fn/m_customize.qc @@ -177,30 +177,39 @@ menu_customize_init(void) } } - /* only allocate what we truly need */ - g_sprays = memalloc(sizeof(string) * g_sprayscount); - for (int i = 0; i < search_getsize(searchy); i++) { - string full = search_getfilename(searchy, i); - string filename = substring(full, 0, -5); - string extension = substring(full, strlen(full) - 3, 3); + if (g_sprayscount) { + /* only allocate what we truly need */ + g_sprays = memalloc(sizeof(string) * g_sprayscount); + for (int i = 0; i < search_getsize(searchy); i++) { + string full = search_getfilename(searchy, i); + string filename = substring(full, 0, -5); + string extension = substring(full, strlen(full) - 3, 3); - if (extension == "bmp" || extension == "png" || extension == "jpg") { - g_sprays[sid] = precache_pic(full); - sid++; + if (extension == "bmp" || extension == "png" || extension == "jpg") { + g_sprays[sid] = precache_pic(full); + sid++; + } } + search_end(searchy); + } else { + games[gameinfo_current].nosprays = 1; } - search_end(searchy); /* scan and cache the models */ searchy = search_begin("models/player/*/*.bmp:models/player/*/*.tga:models/players/*/icon_blue.tga", SEARCH_MULTISEARCH | SEARCH_NAMESORT, TRUE); g_modelcount = search_getsize(searchy); - g_models = memalloc(sizeof(string) * g_modelcount); - for (int i = 0; i < g_modelcount; i++) { - g_models[i] = substring(search_getfilename(searchy, i), 0, -5); - precache_pic(g_models[i]); + + if (g_modelcount) { + g_models = memalloc(sizeof(string) * g_modelcount); + for (int i = 0; i < g_modelcount; i++) { + g_models[i] = substring(search_getfilename(searchy, i), 0, -5); + precache_pic(g_models[i]); + } + search_end(searchy); + } else { + games[gameinfo_current].nomodels = 1; } - search_end(searchy); fn_customize = spawn(CWidget); cz_btnDone = spawn(CMainButton);