Menu-FN: disable models/spray widgets in m_customize if we've got none.

This commit is contained in:
Marco Cawthorne 2021-06-26 17:14:00 +02:00
parent b9644915ae
commit fc63f9af55
11 changed files with 43 additions and 24 deletions

View File

@ -5,7 +5,8 @@
nomipmaps
surfaceParm nodraw2
vmap_surfaceLight 1000
surfaceParm trans
vmap_surfaceLight 5000
vmap_lightImage "textures/lights/k_1000.tga"
}

View File

@ -5,7 +5,8 @@
nomipmaps
surfaceParm nodraw2
vmap_surfaceLight 10000
surfaceParm trans
vmap_surfaceLight 5000
vmap_lightImage "textures/lights/k_10000.tga"
}

View File

@ -5,7 +5,8 @@
nomipmaps
surfaceParm nodraw2
vmap_surfaceLight 2000
surfaceParm trans
vmap_surfaceLight 5000
vmap_lightImage "textures/lights/k_2000.tga"
}

View File

@ -5,7 +5,8 @@
nomipmaps
surfaceParm nodraw2
vmap_surfaceLight 3000
surfaceParm trans
vmap_surfaceLight 5000
vmap_lightImage "textures/lights/k_3000.tga"
}

View File

@ -5,7 +5,8 @@
nomipmaps
surfaceParm nodraw2
vmap_surfaceLight 4000
surfaceParm trans
vmap_surfaceLight 5000
vmap_lightImage "textures/lights/k_4000.tga"
}

View File

@ -5,6 +5,7 @@
nomipmaps
surfaceParm nodraw2
surfaceParm trans
vmap_surfaceLight 5000
vmap_lightImage "textures/lights/k_5000.tga"
}

View File

@ -5,7 +5,8 @@
nomipmaps
surfaceParm nodraw2
vmap_surfaceLight 6000
surfaceParm trans
vmap_surfaceLight 5000
vmap_lightImage "textures/lights/k_6000.tga"
}

View File

@ -5,7 +5,8 @@
nomipmaps
surfaceParm nodraw2
vmap_surfaceLight 7000
surfaceParm trans
vmap_surfaceLight 5000
vmap_lightImage "textures/lights/k_7000.tga"
}

View File

@ -5,7 +5,8 @@
nomipmaps
surfaceParm nodraw2
vmap_surfaceLight 8000
surfaceParm trans
vmap_surfaceLight 5000
vmap_lightImage "textures/lights/k_8000.tga"
}

View File

@ -5,7 +5,8 @@
nomipmaps
surfaceParm nodraw2
vmap_surfaceLight 9000
surfaceParm trans
vmap_surfaceLight 5000
vmap_lightImage "textures/lights/k_9000.tga"
}

View File

@ -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);