ScummVM API documentation
animation.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 ACCESS_ANIMATION_H
23 #define ACCESS_ANIMATION_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/memstream.h"
28 #include "access/data.h"
29 #include "access/files.h"
30 
31 namespace Access {
32 
33 class AnimationResource;
34 class Animation;
35 class AnimationFrame;
36 class AnimationFramePart;
37 
38 class AnimationManager : public Manager {
39 private:
40  Common::Array<Animation *> _animationTimers;
41  AnimationResource *_animation;
42 public:
43  Animation *_animStart;
44  Common::Point _base;
45  int _frameScale;
46 public:
49  void freeAnimationData();
50  void loadAnimations(Resource *res);
51 
52  Animation *findAnimation(int animId);
53  Animation *setAnimation(int animId);
54 
55  void animate(int animId);
56 
60  void clearTimers();
61 
65  void setAnimTimer(Animation *anim);
66 
70  void updateTimers();
71 
75  void popBackTimer() { _animationTimers.pop_back(); }
76 };
77 
79 private:
80  Common::Array<Animation *> _animations;
81 public:
84 
85  int getCount() const { return _animations.size(); }
86  Animation *getAnimation(int idx) { return _animations[idx]; }
87 };
88 
89 class Animation : public Manager {
90 private:
92 
93  void anim0();
94  void anim1();
95  void anim2();
96  void anim3();
97  void anim4();
98  void animNone();
99  void anim7();
100 
101  const AnimationFrame *calcFrame();
102  const AnimationFrame *calcFrame1();
103  void setFrame(const AnimationFrame *frame);
104  void setFrame1(const AnimationFrame *frame);
105 public:
106  int _type;
107  int _scaling;
108  int _frameNumber;
109  int _initialTicks;
110  int _loopCount;
111  int _countdownTicks;
112  int _currentLoopCount;
113 public:
115  ~Animation();
116 
117  void animate();
118 };
119 
121 public:
122  int _baseX, _baseY;
123  int _frameDelay;
125 public:
126  AnimationFrame(Common::SeekableReadStream *stream, int startOffset);
127  ~AnimationFrame();
128 };
129 
131 public:
132  byte _flags;
133  int _spritesIndex;
134  int _frameIndex;
135  Common::Point _position;
136  int _offsetY;
137 public:
139 };
140 
141 } // End of namespace Access
142 
143 #endif /* ACCESS_ANIMATION_H */
void setAnimTimer(Animation *anim)
Definition: data.h:37
Definition: access.h:139
Definition: array.h:52
void popBackTimer()
Definition: animation.h:75
Definition: animation.h:89
Definition: stream.h:745
Definition: files.h:54
Definition: animation.h:120
Definition: animation.h:130
Definition: rect.h:144
Definition: animation.h:38
void pop_back()
Definition: array.h:200
Definition: animation.h:78
size_type size() const
Definition: array.h:316
Definition: access.h:62