BOOL mv_ParseObjectBlock(FILE *file_ptr, tLONG block_size, MV_OBJECT *pObj, MV_MODEL *pMesh) { tWORD id; tLONG size; tLONG end_of_block; end_of_block = ftell(file_ptr) + block_size; /* where the block should end... */ end_of_block -= sizeof(tWORD)+sizeof(tLONG); /*...ignoring the header */ mv_ReadString(file_ptr, pObj->szName, sizeof(pObj->szName)); do { if (mv_ReadChunk(file_ptr, &id, &size) == FALSE) return FALSE; switch(id) { case SMV_POLYGONDATA: mv_ParsePolygonData(file_ptr, size, pMesh); break; case SMV_MESHLIGHT: mv_SkipChunk(file_ptr, size); break; case SMV_MESHCAMERA: mv_SkipChunk(file_ptr, size); break; default: mv_SkipChunk(file_ptr, size); } } while(ftell(file_ptr) < end_of_block); return TRUE; }