Game Development Community

Small improvement to map2dif

by Desmond Fletcher · in Torque Game Engine · 12/15/2003 (2:40 pm) · 0 replies

I have noticed a large number of map2dif problems in the forums lately, some related to conversion of Q3 maps. There have been lengthy discussions to resolve importing Q3 maps to Torque, but I have run across a small but very annoying problem with respect to converted maps: sometimes there are extra texture parameters that stay after the conversion (in particular...134217728 0 0) at the end of plane descriptions. Below is a fix. If this should be a resource OR someone would get this into CVS, please let me know.

In csgBrush.cc (around line 255) replace:

pToker->advanceToken(true);
   } //end while loop
with:
//Advance once for planes without extra Q3 parameters;
	  //for planes with parameters,this advances to first one
      pToker->advanceToken(true);

     //Check for additional line arguments (like 134217728 0 0 in Q3A)
     if (pToker->getToken()[0] != '(' 
      && pToker->getToken()[0] != '}' 
      && pToker->getToken()[0] != '/')
	  {
        pToker->advanceToken(true);  //advance to second parameter
        pToker->advanceToken(true);  //advance to third parameter
        pToker->advanceToken(true);  //advance to new brush, end of section, or comment
	  } 
   } //end while loop

Ok, and for those that get annoyed with error messages that run into each other, here are some new line (\n)cleanups:

In editGeometry.cc (around line 350) replace:
EntityError:
   dPrintf("Error processing entity on or near line: %s: %d", pToker->getFileName(),
           pToker->getCurrentLine());
   return false;

EntityBrushlistError:
   dPrintf("Error processing entity brushlist on or near line: %s: %d", pToker->getFileName(),
           pToker->getCurrentLine());
   return false;
with:
EntityError:
   dPrintf("\nError processing entity on or near line: %d\n", pToker->getCurrentLine());
   return false;

EntityBrushlistError:
   dPrintf("\nError processing entity brushlist on or near line: %d\n", pToker->getCurrentLine());
   return false;
This makes the display print nicer; We don't need the fileName stuff in there anyway, it's already displayed (and if you con't know what map you're working on, then you were in trouble to begin with) :)