This may just help someone one day. Wasted several hours trying to figure out why the .dds images for a model were not loading. Much trial and error later I descovered that if you put a .dds file in a folder that is 4 or more directory levels deep the game will just not load it.
Now that the Doom 3 engine has been release, this seems to be caused by code in Image_load.cpp. For reasons not yet apparent, when depth reaches 4 or more then the directory seperator is replaced with a space.
Anyway, hopefully this will help someone one day from wasting hours trying to figure out why their .dss is not loading!
Code:
/*
================
ImageProgramStringToFileCompressedFileName
================
*/
void idImage::ImageProgramStringToCompressedFileName( const char *imageProg, char *fileName ) const {
const char *s;
char *f;
strcpy( fileName, "dds/" );
f = fileName + strlen( fileName );
int depth = 0;
// convert all illegal characters to underscores
// this could conceivably produce a duplicated mapping, but we aren't going to worry about it
for ( s = imageProg ; *s ; s++ ) {
if ( *s == '/' || *s == '\\' || *s == '(') {
if ( depth < 4 ) {
*f = '/';
depth ++;
} else {
*f = ' ';
}
f++;
} else if ( *s == '<' || *s == '>' || *s == ':' || *s == '|' || *s == '"' || *s == '.' ) {
*f = '_';
f++;
} else if ( *s == ' ' && *(f-1) == '/' ) { // ignore a space right after a slash
} else if ( *s == ')' || *s == ',' ) { // always ignore these
} else {
*f = *s;
f++;
}
}
*f++ = 0;
strcat( fileName, ".dds" );
}