Doom3world

The world is yours! Doom 3 - Quake 4 - ET:QW - Prey - Rage
It is currently Sat May 25, 2013 2:20 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: .dds files fail to load when in path 4 or more levels deep.
PostPosted: Wed Nov 23, 2011 2:27 pm 
Offline
picked up 200 ammo

Joined: Tue Jan 12, 2010 1:01 pm
Posts: 261
Location: The Ylside Bunker
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" );
}

_________________
Arx - End Of Sun TC.
Arx - End Of Sun TC. (ModDB)
Hexen:Edge of Chaos TC.


Top
 Profile E-mail  
 
 Post subject: Re: .dds files fail to load when in path 4 or more levels deep.
PostPosted: Thu Nov 24, 2011 12:40 am 
Offline
picked up 75 health

Joined: Mon Feb 07, 2011 4:19 am
Posts: 81
Nice one, it's always a good thing to get rid of a bug 8)


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group