ScummVM API documentation
animations.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_SCENE_ANIMATIONS_H
23 #define TWINE_SCENE_ANIMATIONS_H
24 
25 #include "common/scummsys.h"
26 #include "twine/parser/anim.h"
27 
28 namespace TwinE {
29 
30 struct AnimTimerDataStruct;
31 class BodyData;
32 class TwinEEngine;
33 
34 class Animations {
35 private:
36  TwinEEngine *_engine;
37  int16 patchInterAngle(int32 deltaTime, int32 keyFrameLength, int16 newAngle1, int16 lastAngle1) const;
38  int16 patchInterStep(int32 deltaTime, int32 keyFrameLength, int16 newPos, int16 lastPos) const;
39 
46  bool setInterDepObjet(int32 keyframeIdx, const AnimData &animData, AnimTimerDataStruct *animTimerDataPtr);
47 
48  void copyKeyFrameToState(const KeyFrame *keyframe, BodyData &bodyData, int32 numBones) const;
49  void copyStateToKeyFrame(KeyFrame *keyframe, const BodyData &bodyData) const;
50 
51  bool doSetInterAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPt, bool global);
52 
53  int _animKeyframeBufIdx = 0;
54  KeyFrame _animKeyframeBuf[32];
55 
57  int16 _animMasterRot = 0;
59  int16 _animStepBeta = 0;
60  int16 _animStepAlpha = 0;
61  int16 _animStepGamma = 0;
62 
64  IVec3 _animStep;
65 
66 public:
67  Animations(TwinEEngine *engine);
68 
70  AnimationTypes _currentActorAnimExtraPtr = AnimationTypes::kAnimNone;
71 
79  void setAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr);
80 
88  bool setInterAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr) {
89  return doSetInterAnimObjet(keyframeIdx, animData, bodyData, animTimerDataPtr, true);
90  }
91 
92  bool setInterAnimObjet2(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr) {
93  return doSetInterAnimObjet(keyframeIdx, animData, bodyData, animTimerDataPtr, false);
94  }
95 
101  int32 searchAnim(AnimationTypes animIdx, int32 actorIdx = OWN_ACTOR_SCENE_INDEX);
102 
108  void stockInterAnim(const BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr);
109 
117  bool initAnim(AnimationTypes newAnim, AnimType animType, AnimationTypes animExtra, int32 actorIdx); // InitAnim
118 
123  void processAnimActions(int32 actorIdx);
124 
129  void doAnim(int32 actorIdx);
130 };
131 
132 } // namespace TwinE
133 #endif
void stockInterAnim(const BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr)
void processAnimActions(int32 actorIdx)
bool initAnim(AnimationTypes newAnim, AnimType animType, AnimationTypes animExtra, int32 actorIdx)
Definition: shared.h:122
Definition: actor.h:55
void setAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr)
Definition: animations.h:34
AnimationTypes _currentActorAnimExtraPtr
Definition: animations.h:70
Definition: anim.h:58
Definition: twine.h:207
Definition: achievements_tables.h:27
bool setInterAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr)
Definition: animations.h:88
void doAnim(int32 actorIdx)
Definition: anim.h:46
int32 searchAnim(AnimationTypes animIdx, int32 actorIdx=OWN_ACTOR_SCENE_INDEX)
Definition: body.h:35