In order to extract information from the TOC, you must first read it. This is done in the same way as for all RenderWare Graphics' stream chunks, and using the RtTOCStreamRead function.
In the utils.c file, add the function RwsLoadTOC.
RtTOC * RwsLoadTOC( RwChar *filename ) { RwChar *pathName; RwStream *stream; RtTOC *rwsTOC; pathName = RsPathnameCreate( filename ); if ( NULL == pathName ) { return (void *)NULL; } rwsTOC = (RtTOC *)NULL; /* try to read the stream */ stream = RwStreamOpen( rwSTREAMFILENAME, rwSTREAMREAD, pathName ); if ( NULL != stream ) { /* find and read the TOC */ if ( FALSE != RwStreamFindChunk( stream, rwID_TOC, NULL, NULL ) ) { rwsTOC = RtTOCStreamRead( stream ); } RwStreamClose( stream, NULL ); } RsPathnameDestroy( pathName );
return rwsTOC;
}
utils.h.
The interface to the TOC is very simple: get the number of entries, and get individual entries. The number of entries in the TOC can be found with RtTOCGetNumEntries. An individual entry, identified by it's zero-based index, can be obtained with RtTOCGetEntry. This returns a pointer to an RtTOCEntry object.
© 1993-2004 Criterion Software Limited. All rights reserved. Built Thu Feb 12 13:47:00 2004.
Send Feedback