Game Development Reference
In-Depth Information
When a new ToonFile is available we must clear any existing data. The
control stores all the data inside a single variable, ' m_toon3d' . This is a
CToon3Ddoc class, which has a Clear function that takes care of deleting
any existing data.
void CToon3DAXCtrl::ToonFileAvailable()
{
toon3d.Clear();
}
Most of the work of a data file load takes place within the function call
ToonFileLoading . The purpose of this call is to inform the control of the
current load status, so the user can be kept informed of the progress. If a
control has just cleared the document file, then the 'm_init' member
variable will return FALSE. The first section of this function tests for this.
If the document is not initialized then we send the current ToonFile back
to the start and attempt to initialize the document using this file.
Initialization will be successful if the entire file header is successfully
parsed, that is from 'T3DX' up to all the scene section lengths. If this is the
case, then the control will know how to handle the remaining data and can
be regarded as initialized. One feature of the Initialize call is the setting of
the scene that is currently loading. This information is stored in the
member variable m_sceneLoading .
The next section of the function is a loop that checks the current data
file position against the bytes required for the loading scene. If we have
sufficient bytes to initialize a scene then the current file position is set to
the start of the current scene and the scene is initialized. If the control
wants to display this scene then it is set as the current movie scene; if not,
then loading continues and the display scene remains set to the
previously displayed scene. If scene initialization was successful then the
member variable m_sceneLoading is incremented. If this exceeds the
total number of scenes in the file then we can set the fully loaded member
variable m_loaded to TRUE.
If the control cannot display the required scene then we update the load
screen using either scene 1 if this is a load screen or the internal load
screen. Toon3D has its own loader that is used if scene 1 is not set as the
load screen.
void CToon3DAXCtrl::ToonFileLoading()
{
//Set the progress bar
CToon3DScene *scn;
Search Nedrilad ::




Custom Search