ScummVM API documentation
animmanager.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 TRECISION_ANIMMANAGER_H
23 #define TRECISION_ANIMMANAGER_H
24 
25 #include "trecision/fastfile.h"
26 #include "trecision/struct.h"
27 
28 namespace Trecision {
29 
30 #define MAXANIM 750
31 #define MAXACTIVEANIM 3
32 
33 // SMACKER ANIMATION FLAGS
34 #define SMKANIM_BKG 1
35 #define SMKANIM_ICON 2
36 #define SMKANIM_LOOP 4
37 #define SMKANIM_OLD 8
38 #define SMKANIM_ON 16
39 
40 enum SmackerType {
41  kSmackerBackground = 0, // Scene background animations
42  kSmackerAction = 1, // Main character action animations
43  kSmackerIcon = 2 // Smacker inventory animations
44 };
45 
46 class TrecisionEngine;
47 class NightlongVideoDecoder;
48 
49 class AnimManager {
50 public:
52  ~AnimManager();
53 
54 private:
55  TrecisionEngine *_vm;
56 
57  NightlongVideoDecoder *_animations[MAXACTIVEANIM];
58  uint16 _playingAnims[MAXACTIVEANIM];
59 
60  FastFile _animFile[MAXACTIVEANIM]; // nlanim.cd1 / nlanim.cd2 / nlanim.cd3
61  int _curCD;
62  bool _bgAnimRestarted;
63 
64  void openSmk(int slot, const Common::Path &name);
65  void openSmkAnim(int slot, const Common::Path &name);
66  void toggleMuteBgAnim(uint16 animation);
67  void closeSmk(int slot);
68  void drawFrame(NightlongVideoDecoder *smkDecoder, uint16 x, uint16 y, bool updateScreen);
69  void drawFrameSubtitles(Graphics::Surface *surface, int frameNum);
70  void setVideoRange(NightlongVideoDecoder *smkDecoder, int &startFrame, int &endFrame);
71  void refreshSmkAnim(uint16 animation);
72  void handleEndOfVideo(int animation, int slot);
73  bool shouldShowAnim(int animation, Common::Rect curRect);
74 
75  void drawSmkBackgroundFrame(int animation);
76  void drawSmkIconFrame(uint16 startIcon, uint16 iconNum);
77  void drawSmkActionFrame();
78  void swapCD(int cd);
79  void patchAnimTab();
80 
81 public:
82  Common::Rect _animRect;
83  SAnim _animTab[MAXANIM];
84 
85  void smkGoto(int slot, int frame);
86  void smkToggleAudio(int slot, bool on);
87  void smkToggleTrackAudio(int slot, int track, bool on);
88  int16 smkCurFrame(int slot);
89  void smkStop(uint16 slot);
90  void refreshActionAnimation() { refreshSmkAnim(_playingAnims[kSmackerAction]); }
91  bool isActionActive() const { return _playingAnims[kSmackerAction] != 0; }
92  void playMovie(const Common::Path &filename, int startFrame = 0, int endFrame = -1, bool singleChoice = false);
93  void startFullMotion();
94  void stopFullMotion();
95 
96  void refreshAnim(int box);
97  void startSmkAnim(uint16 animation);
98  void stopAllSmkAnims();
99 
100  void syncGameStream(Common::Serializer &ser);
101  void loadAnimTab(Common::SeekableReadStreamEndian *stream);
102 };
103 
104 } // End of namespace Trecision
105 #endif
106 
Definition: surface.h:67
Definition: fastfile.h:38
Definition: trecision.h:112
Definition: video.h:35
Definition: rect.h:144
Definition: path.h:52
Definition: serializer.h:79
Definition: actor.h:29
Definition: animmanager.h:49
Definition: stream.h:944
Definition: struct.h:131