]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix ISWORLD and ISSPRITE texture flags (making r_picmipworld actually work again)
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 15 Jul 2010 19:11:48 +0000 (19:11 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 15 Jul 2010 19:11:48 +0000 (19:11 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10332 d7cf8633-e32d-0410-b094-e92efae38249

model_shared.c

index 482cfe791b6a7b2bcacbdccf86564f9a1c1b65ed..a14951a9762ea5154f7080ada82436b2cdd85e5d 100644 (file)
@@ -2236,7 +2236,7 @@ q3shaderinfo_t *Mod_LookupQ3Shader(const char *name)
 qboolean Mod_LoadTextureFromQ3Shader(texture_t *texture, const char *name, qboolean warnmissing, qboolean fallback, int defaulttexflags)
 {
        int j;
-       int texflagsmask;
+       int texflagsmask, texflagsor;
        qboolean success = true;
        q3shaderinfo_t *shader;
        if (!name)
@@ -2249,6 +2249,11 @@ qboolean Mod_LoadTextureFromQ3Shader(texture_t *texture, const char *name, qbool
                texflagsmask &= ~TEXF_PICMIP;
        if(!(defaulttexflags & TEXF_COMPRESS))
                texflagsmask &= ~TEXF_COMPRESS;
+       texflagsor = 0;
+       if(defaulttexflags & TEXF_ISWORLD)
+               texflagsor |= TEXF_ISWORLD;
+       if(defaulttexflags & TEXF_ISSPRITE)
+               texflagsor |= TEXF_ISSPRITE;
        // unless later loaded from the shader
        texture->offsetmapping = (mod_q3shader_default_offsetmapping.value) ? OFFSETMAPPING_DEFAULT : OFFSETMAPPING_OFF;
        texture->offsetscale = 1;
@@ -2265,7 +2270,7 @@ qboolean Mod_LoadTextureFromQ3Shader(texture_t *texture, const char *name, qbool
                texture->surfaceparms = shader->surfaceparms;
 
                // allow disabling of picmip or compression by defaulttexflags
-               texture->textureflags = shader->textureflags & texflagsmask;
+               texture->textureflags = (shader->textureflags & texflagsmask) | texflagsor;
 
                if (shader->surfaceparms & Q3SURFACEPARM_SKY)
                {
@@ -2353,7 +2358,7 @@ nothing                GL_ZERO GL_ONE
                                {
                                        texture->skinframes[j] = NULL;
                                }
-                               else if (!(texture->skinframes[j] = R_SkinFrame_LoadExternal(primarylayer->texturename[j], primarylayer->texflags & texflagsmask, false)))
+                               else if (!(texture->skinframes[j] = R_SkinFrame_LoadExternal(primarylayer->texturename[j], (primarylayer->texflags & texflagsmask) | texflagsor, false)))
                                {
                                        Con_Printf("^1%s:^7 could not load texture ^3\"%s\"^7 (frame %i) for shader ^2\"%s\"\n", loadmodel->name, primarylayer->texturename[j], j, texture->name);
                                        texture->skinframes[j] = R_SkinFrame_LoadMissing();
@@ -2374,7 +2379,7 @@ nothing                GL_ZERO GL_ONE
                                {
                                        texture->skinframes[j] = NULL;
                                }
-                               else if (!(texture->backgroundskinframes[j] = R_SkinFrame_LoadExternal(backgroundlayer->texturename[j], backgroundlayer->texflags & texflagsmask, false)))
+                               else if (!(texture->backgroundskinframes[j] = R_SkinFrame_LoadExternal(backgroundlayer->texturename[j], (backgroundlayer->texflags & texflagsmask) | texflagsor, false)))
                                {
                                        Con_Printf("^1%s:^7 could not load texture ^3\"%s\"^7 (background frame %i) for shader ^2\"%s\"\n", loadmodel->name, backgroundlayer->texturename[j], j, texture->name);
                                        texture->backgroundskinframes[j] = R_SkinFrame_LoadMissing();