-rtexture_t *loadtextureimagemask (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags)
-{
- qbyte *data;
- rtexture_t *rt;
- if (!(data = loadimagepixelsmask (filename, complain, matchwidth, matchheight)))
- return 0;
- rt = R_LoadTexture2D(pool, filename, image_width, image_height, data, TEXTYPE_RGBA, flags, NULL);
- Mem_Free(data);
- return rt;
-}
-
-rtexture_t *image_masktex;
-rtexture_t *image_nmaptex;
-rtexture_t *loadtextureimagewithmask (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags)
-{
- qbyte *data;
- rtexture_t *rt;
- image_masktex = NULL;
- image_nmaptex = NULL;
- if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight)))
- return 0;
-
- rt = R_LoadTexture2D(pool, filename, image_width, image_height, data, TEXTYPE_RGBA, flags, NULL);
-
- if (flags & TEXF_ALPHA && image_makemask(data, data, image_width * image_height))
- image_masktex = R_LoadTexture2D(pool, va("%s_mask", filename), image_width, image_height, data, TEXTYPE_RGBA, flags, NULL);
-
- Mem_Free(data);
- return rt;
-}
-
-rtexture_t *loadtextureimagewithmaskandnmap (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags, float bumpscale)
-{
- qbyte *data, *data2;
- rtexture_t *rt;
- image_masktex = NULL;
- image_nmaptex = NULL;
- if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight)))
- return 0;
-
- data2 = Mem_Alloc(tempmempool, image_width * image_height * 4);
-
- rt = R_LoadTexture2D(pool, filename, image_width, image_height, data, TEXTYPE_RGBA, flags, NULL);
-
- Image_HeightmapToNormalmap(data, data2, image_width, image_height, (flags & TEXF_CLAMP) != 0, bumpscale);
- image_nmaptex = R_LoadTexture2D(pool, va("%s_nmap", filename), image_width, image_height, data2, TEXTYPE_RGBA, flags, NULL);
-
- if (flags & TEXF_ALPHA && image_makemask(data, data2, image_width * image_height))
- image_masktex = R_LoadTexture2D(pool, va("%s_mask", filename), image_width, image_height, data2, TEXTYPE_RGBA, flags, NULL);
-
- Mem_Free(data2);
-
- Mem_Free(data);
- return rt;
-}
-
-rtexture_t *loadtextureimagebumpasnmap (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags, float bumpscale)
-{
- qbyte *data, *data2;
- rtexture_t *rt;
- if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight)))
- return 0;
- data2 = Mem_Alloc(tempmempool, image_width * image_height * 4);
-
- Image_HeightmapToNormalmap(data, data2, image_width, image_height, (flags & TEXF_CLAMP) != 0, bumpscale);
- rt = R_LoadTexture2D(pool, filename, image_width, image_height, data2, TEXTYPE_RGBA, flags, NULL);
-
- Mem_Free(data2);
- Mem_Free(data);
- return rt;
-}
-
-qboolean Image_WriteTGARGB_preflipped (const char *filename, int width, int height, const qbyte *data)