Nuclide
Software Development Kit for id Technology (BETA)
materials.h
1
2/* Some games want to read from textures/, others from materials/ */
3var string autocvar_material_pathPrefix = "textures";
4
5
11string
12precache_material(string materialName)
13{
14 string newPath = "";
15
16 if (STRING_SET(autocvar_material_pathPrefix)) {
17 float prefixLength = strlen(autocvar_material_pathPrefix);
18
19 /* avoid recursion! */
20 if (substring(materialName, 0, prefixLength) != autocvar_material_pathPrefix) {
21 newPath = strcat(autocvar_material_pathPrefix, "/", materialName);
22 } else {
23 newPath = materialName;
24 }
25 } else {
26 newPath = materialName;
27 }
28
29#ifdef SERVER
30 return newPath;
31#else
32 return precache_pic(newPath, 0);
33#endif
34}