mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-29 20:20:43 +00:00
only load tgas for texture names that end in backslash
This commit is contained in:
parent
7227ab4363
commit
31a98f0f80
1 changed files with 17 additions and 3 deletions
|
@ -69,15 +69,29 @@ void
|
||||||
Mod_LoadExternalTextures (model_t *mod)
|
Mod_LoadExternalTextures (model_t *mod)
|
||||||
{
|
{
|
||||||
texture_t *tx;
|
texture_t *tx;
|
||||||
char filename[MAX_QPATH + 4];
|
char filename[MAX_QPATH + 8];
|
||||||
VFile *f;
|
VFile *f;
|
||||||
tex_t *targa;
|
tex_t *targa;
|
||||||
int i;
|
int i, length;
|
||||||
|
|
||||||
for (i = 0; i < mod->numtextures; i++)
|
for (i = 0; i < mod->numtextures; i++)
|
||||||
{
|
{
|
||||||
tx = mod->textures[i];
|
tx = mod->textures[i];
|
||||||
snprintf (filename, sizeof (filename), "maps/%s.tga", tx->name);
|
length = strlen (tx->name) - 1;
|
||||||
|
|
||||||
|
// backslash at the end of texture name indicates external texture
|
||||||
|
if (tx->name[length] != '\\')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// replace special flag characters with underscores
|
||||||
|
if (tx->name[0] == '+' || tx->name[0] == '*')
|
||||||
|
snprintf (filename, sizeof (filename), "maps/_%s", tx->name + 1);
|
||||||
|
else
|
||||||
|
snprintf (filename, sizeof (filename), "maps/%s", tx->name);
|
||||||
|
|
||||||
|
length += 5; // add "maps/" to the string length calculation
|
||||||
|
snprintf (filename + length, sizeof (filename) - length, ".tga");
|
||||||
|
|
||||||
COM_FOpenFile (filename, &f);
|
COM_FOpenFile (filename, &f);
|
||||||
if (f) {
|
if (f) {
|
||||||
targa = LoadTGA (f);
|
targa = LoadTGA (f);
|
||||||
|
|
Loading…
Reference in a new issue