diff --git a/include/QF/model.h b/include/QF/model.h index 27b226cf4..dd4778db0 100644 --- a/include/QF/model.h +++ b/include/QF/model.h @@ -455,6 +455,7 @@ mleaf_t *Mod_PointInLeaf (const vec3_t p, model_t *model); byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model); model_t *Mod_FindName (const char *name); void Mod_ProcessTexture(miptex_t *mt, texture_t *tx); +void Mod_LoadExternalTextures (model_t * mod); void Mod_LoadLighting (lump_t *l); int Mod_CalcFullbright (byte *in, byte *out, int pixels); int Mod_Fullbright (byte * skin, int width, int height, char *name); diff --git a/libs/models/brush/gl_model_brush.c b/libs/models/brush/gl_model_brush.c index 99339dd80..261e0fdf9 100644 --- a/libs/models/brush/gl_model_brush.c +++ b/libs/models/brush/gl_model_brush.c @@ -43,6 +43,8 @@ static const char rcsid[] = #include "QF/model.h" #include "QF/qendian.h" #include "QF/sys.h" +#include "QF/texture.h" +#include "QF/tga.h" #include "QF/vfs.h" #include "QF/GL/qf_textures.h" @@ -63,6 +65,33 @@ Mod_ProcessTexture (miptex_t *mt, texture_t *tx) true, false, 1); } +void +Mod_LoadExternalTextures (model_t *mod) +{ + texture_t *tx; + char filename[MAX_QPATH + 4]; + VFile *f; + tex_t *targa; + int i; + + for (i = 0; i < mod->numtextures; i++) + { + tx = mod->textures[i]; + snprintf (filename, sizeof (filename), "maps/%s.tga", tx->name); + COM_FOpenFile (filename, &f); + if (f) { + targa = LoadTGA (f); + Qclose (f); + if (targa->format < 4) + tx->gl_texturenum = GL_LoadTexture (tx->name, targa->width, + targa->height, targa->data, true, false, 3); + else + tx->gl_texturenum = GL_LoadTexture (tx->name, targa->width, + targa->height, targa->data, true, true, 4); + } + } +} + void Mod_LoadLighting (lump_t *l) { diff --git a/libs/models/brush/sw_model_brush.c b/libs/models/brush/sw_model_brush.c index 0613c6b3a..767f27016 100644 --- a/libs/models/brush/sw_model_brush.c +++ b/libs/models/brush/sw_model_brush.c @@ -56,6 +56,11 @@ Mod_ProcessTexture (miptex_t *mt, texture_t *tx) { } +void +Mod_LoadExternalTextures (model_t *mod) +{ +} + void Mod_LoadLighting (lump_t *l) { diff --git a/libs/models/model.c b/libs/models/model.c index d70959446..627a121ab 100644 --- a/libs/models/model.c +++ b/libs/models/model.c @@ -225,6 +225,7 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator) default: Mod_LoadBrushModel (mod, buf); + Mod_LoadExternalTextures (mod); break; } diff --git a/nq/source/sv_model.c b/nq/source/sv_model.c index 59e6b6fdb..13807b646 100644 --- a/nq/source/sv_model.c +++ b/nq/source/sv_model.c @@ -67,6 +67,11 @@ Mod_ProcessTexture (miptex_t *mx, texture_t *tx) { } +void +Mod_LoadExternalTextures (model_t *mod) +{ +} + void GL_SubdivideSurface (msurface_t *fa) { diff --git a/qw/source/sv_model.c b/qw/source/sv_model.c index 08a3998c4..de9ca5ce5 100644 --- a/qw/source/sv_model.c +++ b/qw/source/sv_model.c @@ -67,6 +67,11 @@ Mod_ProcessTexture (miptex_t *mx, texture_t *tx) { } +void +Mod_LoadExternalTextures (model_t *mod) +{ +} + void GL_SubdivideSurface (msurface_t *fa) {