/*=========================================================================== * * File: Dfarch3d.CPP * Author: Dave Humphrey (uesp@m0use.net) * Created On: Wednesday, June 20, 2001 * * Implements the CDFArch3dFile class. * *=========================================================================*/ /* Include Files */ #include "dfarch3d.h" /*=========================================================================== * * Begin Local Variable Definitions * *=========================================================================*/ DEFINE_FILE(); /*=========================================================================== * End of Local Variable Definitions *=========================================================================*/ /*=========================================================================== * * Class CDFArch3dFile Method - boolean LoadObject (ppObject, Index); * * Attempts to load the given index into a new 3D object which is returned * in the given pointer. Returns FALSE on any error. * *=========================================================================*/ boolean CDFArch3dFile::LoadObject (CDF3dObject** ppObject, const size_t Index) { DEFINE_FUNCTION("CDFArch3dFile::LoadObject()"); boolean Result; /* Ensure valid input */ ASSERT(IsValidIndex(Index) && ppObject != NULL); *ppObject = NULL; /* Create the new 3D object */ CreatePointer(*ppObject, CDF3dObject); /* Move the file pointer to the appropiate position */ Result = Seek(GetRecordOffset(Index), SEEK_SET); if (!Result) return (FALSE); /* Attempt to read 3D object data */ (*ppObject)->SetFileSize(GetRecordSize(Index)); Result = (*ppObject)->Read(GetHandle()); /* Delete the new object on failure */ if (!Result) { DestroyArrayPointer(*ppObject); return (FALSE); } /* Check to ensure the correct file position */ //ASSERT(Tell() - GetRecordOffset(Index) != GetRecordSize(Index)); return (TRUE); } /*=========================================================================== * End of Class Method CDFArch3dFile::LoadObject() *=========================================================================*/