1 /* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23 #include "ultima/ultima8/misc/pent_include.h"
24 #include "ultima/ultima8/graphics/main_shape_archive.h"
25 #include "ultima/ultima8/graphics/type_flags.h"
26 #include "ultima/ultima8/graphics/anim_dat.h"
27
28 namespace Ultima {
29 namespace Ultima8 {
30
~MainShapeArchive()31 MainShapeArchive::~MainShapeArchive() {
32 if (_typeFlags) {
33 delete _typeFlags;
34 }
35
36 if (_animDat) {
37 delete _animDat;
38 }
39 }
40
loadTypeFlags(Common::SeekableReadStream * rs)41 void MainShapeArchive::loadTypeFlags(Common::SeekableReadStream *rs) {
42 if (_typeFlags) {
43 delete _typeFlags;
44 _typeFlags = nullptr;
45 }
46
47 _typeFlags = new TypeFlags;
48 _typeFlags->load(rs);
49 }
50
loadDamageDat(Common::SeekableReadStream * rs)51 void MainShapeArchive::loadDamageDat(Common::SeekableReadStream *rs) {
52 assert(_typeFlags);
53 _typeFlags->loadDamageDat(rs);
54 }
55
getShapeInfo(uint32 shapenum)56 const ShapeInfo *MainShapeArchive::getShapeInfo(uint32 shapenum) {
57 assert(_typeFlags);
58
59 return _typeFlags->getShapeInfo(shapenum);
60 }
61
loadAnimDat(Common::SeekableReadStream * rs)62 void MainShapeArchive::loadAnimDat(Common::SeekableReadStream *rs) {
63 if (_animDat) {
64 delete _animDat;
65 _animDat = nullptr;
66 }
67
68 _animDat = new AnimDat;
69 _animDat->load(rs);
70 }
71
getAnim(uint32 shape) const72 const ActorAnim *MainShapeArchive::getAnim(uint32 shape) const {
73 assert(_animDat);
74
75 return _animDat->getAnim(shape);
76 }
77
getAnim(uint32 shape,uint32 action) const78 const AnimAction *MainShapeArchive::getAnim(uint32 shape, uint32 action) const {
79 assert(_animDat);
80
81 return _animDat->getAnim(shape, action);
82 }
83
84 } // End of namespace Ultima8
85 } // End of namespace Ultima
86