ScummVM API documentation
anim.h
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 modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (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, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef TWINE_PARSER_ANIM_H
23#define TWINE_PARSER_ANIM_H
24
25#include "common/array.h"
26#include "common/stream.h"
27#include "twine/parser/parser.h"
28#include "twine/shared.h"
29
30namespace TwinE {
31
32enum BoneType : uint16 {
33 TYPE_ROTATE = 0,
34 TYPE_TRANSLATE = 1,
35 TYPE_ZOOM = 2,
36};
37
38struct BoneFrame { // T_GROUP_INFO
39 BoneType type = BoneType::TYPE_ROTATE;
40 int16 x = 0; // alpha
41 int16 y = 0; // beta
42 int16 z = 0; // gamma
43};
44using T_GROUP_INFO = BoneFrame; // (lba2)
45
46struct KeyFrame {
47 uint16 length = 0;
48 int16 x = 0;
49 int16 y = 0;
50 int16 z = 0;
51 int16 animMasterRot = 0;
52 int16 animStepAlpha = 0;
53 int16 animStepBeta = 0;
54 int16 animStepGamma = 0;
55 Common::Array<BoneFrame> boneframes;
56};
57
58class AnimData : public Parser {
59private:
60 Common::Array<KeyFrame> _keyframes;
61
62 void loadBoneFrame(KeyFrame &keyframe, Common::SeekableReadStream &stream);
63 void loadKeyFrames(Common::SeekableReadStream &stream);
64
65 uint16 _numKeyframes;
66 uint16 _numBoneframes;
67 uint16 _loopFrame;
68
69protected:
70 void reset() override;
71
72public:
73 bool loadFromStream(Common::SeekableReadStream &stream, bool lba1) override;
74
75 const KeyFrame *getKeyframe(uint index) const;
76 const Common::Array<KeyFrame> &getKeyframes() const;
77 uint getNbFramesAnim() const;
78 uint16 getLoopFrame() const;
79 uint16 getNumBoneframes() const;
80};
81
82inline uint AnimData::getNbFramesAnim() const {
83 return getKeyframes().size();
84}
85
86} // End of namespace TwinE
87
88#endif
Definition: array.h:52
Definition: stream.h:745
Definition: anim.h:58
Definition: parser.h:32
Definition: anim.h:38
Definition: anim.h:46