00001 /* 00002 * Copyright (C) 2003-2005 The Pentagram Team 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #include "pent_include.h" 00020 00021 #include "MainShapeArchive.h" 00022 #include "TypeFlags.h" 00023 #include "ShapeInfo.h" 00024 #include "AnimDat.h" 00025 00026 DEFINE_RUNTIME_CLASSTYPE_CODE(MainShapeArchive,ShapeArchive); 00027 00028 00029 MainShapeArchive::~MainShapeArchive() 00030 { 00031 if (typeFlags) { 00032 delete typeFlags; 00033 typeFlags = 0; 00034 } 00035 00036 if (animdat) { 00037 delete animdat; 00038 animdat = 0; 00039 } 00040 } 00041 00042 void MainShapeArchive::loadTypeFlags(IDataSource *ds) 00043 { 00044 if (typeFlags) { 00045 delete typeFlags; 00046 typeFlags = 0; 00047 } 00048 00049 typeFlags = new TypeFlags; 00050 typeFlags->load(ds); 00051 } 00052 00053 ShapeInfo* MainShapeArchive::getShapeInfo(uint32 shapenum) 00054 { 00055 assert(typeFlags); 00056 00057 return typeFlags->getShapeInfo(shapenum); 00058 } 00059 00060 void MainShapeArchive::loadAnimDat(IDataSource *ds) 00061 { 00062 if (animdat) { 00063 delete animdat; 00064 animdat = 0; 00065 } 00066 00067 animdat = new AnimDat; 00068 animdat->load(ds); 00069 } 00070 00071 ActorAnim* MainShapeArchive::getAnim(uint32 shape) const 00072 { 00073 assert(animdat); 00074 00075 return animdat->getAnim(shape); 00076 } 00077 00078 AnimAction* MainShapeArchive::getAnim(uint32 shape, uint32 action) const 00079 { 00080 assert(animdat); 00081 00082 return animdat->getAnim(shape, action); 00083 }