mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +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)
|
||||
{
|
||||
texture_t *tx;
|
||||
char filename[MAX_QPATH + 4];
|
||||
char filename[MAX_QPATH + 8];
|
||||
VFile *f;
|
||||
tex_t *targa;
|
||||
int i;
|
||||
int i, length;
|
||||
|
||||
for (i = 0; i < mod->numtextures; 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);
|
||||
if (f) {
|
||||
targa = LoadTGA (f);
|
||||
|
|
Loading…
Reference in a new issue