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  void init() override;
55  void updateGraphics() override;
56 
57  void onSceneChange();
58  void afterSceneChange();
59 
60  bool isDone() const;
61  bool isInitialized() const { return _initialized; }
62 
63 protected:
64  bool _initialized = false;
65 
66  uint32 _nextFrameTime = 0;
67  uint32 _fadeToBlackEndTime = 0;
68 
69  Graphics::ManagedSurface _fadeFrom;
71 
72  byte _type = 1;
73  uint16 _fadeToBlackTime = 0;
74  uint32 _frameTime = 0;
75  uint32 _totalTime = 0;
76  Common::Rect _rect;
77 
78  int _currentFrame = 0;
79  uint _numFrames = 0;
80  uint32 _startTime = 0;
81  bool _throughBlackStarted2nd = false;
82 };
83 
84 } // End of namespace Misc
85 } // End of namespace Nancy
86 
87 #endif // NANCY_MISC_SPECIALEFFECT_H
Definition: managed_surface.h:51
Definition: rect.h:144
Definition: specialeffect.h:34
Definition: renderobject.h:36
Definition: actionmanager.h:32