ScummVM API documentation
specialeffect.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 NANCY_MISC_SPECIALEFFECT_H
23 #define NANCY_MISC_SPECIALEFFECT_H
24 
25 #include "engines/nancy/time.h"
26 #include "engines/nancy/renderobject.h"
27 
28 namespace Nancy {
29 
30 struct SPEC;
31 
32 namespace Misc {
33 
34 class SpecialEffect : public RenderObject {
35 public:
36  static const byte kBlackout = 1;
37  static const byte kCrossDissolve = 2;
38  static const byte kThroughBlack = 3;
39 
40  SpecialEffect(byte type, uint16 fadeToBlackTime, uint16 frameTime) :
41  RenderObject(16),
42  _type(type),
43  _fadeToBlackTime(fadeToBlackTime),
44  _frameTime(frameTime) {}
45 
46  SpecialEffect(byte type, uint32 totalTime, uint16 fadeToBlackTime, Common::Rect rect) :
47  RenderObject(16),
48  _type(type),
49  _totalTime(totalTime),
50  _fadeToBlackTime(fadeToBlackTime),
51  _rect(rect) {}
52  virtual ~SpecialEffect() {}
53 
54  SpecialEffect(SpecialEffect &&) = default;
55 
56  void init() override;
57  void updateGraphics() override;
58 
59  void onSceneChange();
60  void afterSceneChange();
61 
62  bool isDone() const;
63  bool isInitialized() const { return _initialized; }
64 
65 protected:
66  bool _initialized = false;
67 
68  uint32 _nextFrameTime = 0;
69  uint32 _fadeToBlackEndTime = 0;
70 
71  Graphics::ManagedSurface _fadeFrom;
73 
74  byte _type = 1;
75  uint16 _fadeToBlackTime = 0;
76  uint32 _frameTime = 0;
77  uint32 _totalTime = 0;
78  Common::Rect _rect;
79 
80  int _currentFrame = 0;
81  uint _numFrames = 0;
82  uint32 _startTime = 0;
83  bool _throughBlackStarted2nd = false;
84 };
85 
86 } // End of namespace Misc
87 } // End of namespace Nancy
88 
89 #endif // NANCY_MISC_SPECIALEFFECT_H
Definition: managed_surface.h:51
Definition: rect.h:524
Definition: specialeffect.h:34
Definition: renderobject.h:36
Definition: actionmanager.h:32