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 public:
48  void freeAnimationData();
49  void loadAnimations(Resource *res);
50 
51  Animation *findAnimation(int animId);
52  Animation *setAnimation(int animId);
53 
54  void animate(int animId);
55 
59  void clearTimers();
60 
64  void setAnimTimer(Animation *anim);
65 
69  void updateTimers();
70 
74  void popBackTimer() { if (_animationTimers.size()) _animationTimers.pop_back(); }
75 
79  bool hasTimer() const { return !_animationTimers.empty(); };
80 };
81 
83 private:
84  Common::Array<Animation *> _animations;
85 public:
88 
89  int getCount() const { return _animations.size(); }
90  Animation *getAnimation(int idx) { return _animations[idx]; }
91 };
92 
93 class Animation : public Manager {
94 private:
96 
97  void anim0();
98  void anim1();
99  void anim2();
100  void anim3();
101  void anim4();
102  void animNone();
103  void anim7();
104  void anim8();
105  void anim9();
106  void anim10();
107  void anim11();
108  void anim12();
109 
110  const AnimationFrame *calcFrame();
111  const AnimationFrame *calcFrame1();
112  void setFrame(const AnimationFrame *frame);
113  void setFrame1(const AnimationFrame *frame, int16 xoff = 0, int16 yoff = 0);
114 public:
115  int _type;
116  int _scaling;
117  int _frameNumber;
118  int _initialTicks;
119  int _loopCount;
120  int _countdownTicks;
121  int _currentLoopCount;
122 public:
124  ~Animation();
125 
126  void animate();
127 };
128 
130 public:
131  int _baseX, _baseY;
132  int _frameDelay;
134 public:
135  AnimationFrame(Common::SeekableReadStream *stream, int startOffset);
136  ~AnimationFrame();
137 };
138 
140 public:
141  byte _flags;
142  int _spritesIndex;
143  int _frameIndex;
144  Common::Point _position;
145  int _offsetY;
146 public:
148 };
149 
150 } // End of namespace Access
151 
152 #endif /* ACCESS_ANIMATION_H */
void setAnimTimer(Animation *anim)
Definition: data.h:37
Definition: access.h:141
Definition: array.h:52
void popBackTimer()
Definition: animation.h:74
Definition: animation.h:93
bool hasTimer() const
Definition: animation.h:79
Definition: stream.h:745
Definition: files.h:55
bool empty() const
Definition: array.h:352
Definition: animation.h:129
Definition: animation.h:139
Definition: rect.h:144
Definition: animation.h:38
void pop_back()
Definition: array.h:200
Definition: animation.h:82
size_type size() const
Definition: array.h:316
Definition: access.h:62