Game Development Community

InitMMXBlender possible goof up?

by Gregory "Centove" McLean · in Torque Game Engine · 11/19/2004 (2:56 pm) · 0 replies

While chasing the terrain texture loading stuff to work around the issue of the texture materials being saved as full paths to the texture in the terrain file I stumbled across this lil bit of code (around line 625) and I'm not sure what its intent is, it generates some rather interesting paths...

//dStrcpyl(fileBuf, sizeof(fileBuf), mFile.getFilePath(), "/", fn, NULL);
      GBitmap* pBitmap = TextureManager::loadBitmapInstance(fn);
      if (!pBitmap)  {
         dStrcpyl(fileBuf, sizeof(fileBuf), mFile.getFilePath(), "/", fn, NULL);
         pBitmap = TextureManager::loadBitmapInstance(fileBuf);

In my case I was winding up with paths such as:
game/data/missions/starter.RTS/data/terrains/grassland/sand

I _suspect_ what it is supposed to be trying to build (and make a touch more sense) a path like:

game/data/missions/sand

Changing the above to:
//dStrcpyl(fileBuf, sizeof(fileBuf), mFile.getFilePath(), "/", fn, NULL);
      GBitmap* pBitmap = TextureManager::loadBitmapInstance(fn);
      if (!pBitmap)  {
         dStrcpyl(fileBuf, sizeof(fileBuf), mFile.getFilePath(), dStrrchr(fn, '/'), NULL);
         pBitmap = TextureManager::loadBitmapInstance(fileBuf);

Will build a path that has some hope of loading and is closer (I'm guessing here) to what was orginally intended.

Thoughts?