Game Development Reference
return count + 1;
A final utility function for parsing ASE files is the function FindToken that
iterates through the file looking for a specific token that is supplied.
BOOL C3DSAscii::FindToken(CStdioFile &file, CString &line, const ↵
char *token, int start, int end)
if (start!=-1) file.Seek(start,CFile::begin);
if (!file.ReadString(line)) return FALSE;
if (line.Find(token)!=-1) break;
if (end!=-1 && file.GetPosition()>(UINT)end) return FALSE;
The top level loop for parsing an ASE file
When dealing with an ASE file we need to first open a text file, then check
the first line for the tag 3DSMAX_ASCIIEXPORT. If this is not present,
then this is not a suitable file and any parsing must be abandoned. If this
is an appropriate file then the function Load enters an infinite loop
checking for the tags SCENE, MATERIAL_LIST, GEOMOBJECT, CAM-
ERAOBJECT and LIGHTOBJECT. In the loop, a single line is read from
the file until the end of the file is reached; at this stage the loop is exited.
Each tag is handled by a separate function, which we will examine later.
If the loading is successful then the next part of this function is to set up
the parent pointers based on the parent name loaded in the ReadObject
function. An ASE file does not necessarily contain a light; if no light
is loaded then a default light is created using the function
BOOL C3DSAscii::Load(CString &filename)