ScummVM API documentation
secondaryvideo.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_ACTION_SECONDARYVIDEO_H
23#define NANCY_ACTION_SECONDARYVIDEO_H
24
25#include "engines/nancy/cursor.h"
26#include "engines/nancy/nancy.h"
27#include "engines/nancy/movieplayer.h"
28#include "engines/nancy/action/actionrecord.h"
29
30namespace Nancy {
31namespace Action {
32
33// Shows an (optionally) looping AVF video, which can move around
34// the screen with the background frame. When hovered, the video can
35// play a special animation instead of the normal looping one.
36// Used for character animations _outside_ of conversations.
38public:
39 static const byte kNoVideoHotspots = 1;
40 static const byte kVideoHotspots = 2;
41
42 enum HoverState { kNoHover, kHover, kEndHover };
43
45 virtual ~PlaySecondaryVideo() { _decoder.close(); }
46
47 void init() override;
48 void updateGraphics() override;
49 void onPause(bool pause) override;
50 void handleInput(NancyInput &input) override;
51
52 void readData(Common::SeekableReadStream &stream) override;
53 void execute() override;
54
55 Common::Path _filename;
56 Common::Path _paletteFilename;
57 // Common::Path _bitmapOverlayFilename
58
59 // TVD only
60 uint16 _videoFormat = kLargeVideoFormat;
61 uint16 _videoHotspots = kVideoHotspots;
62
63 uint16 _loopFirstFrame = 0;
64 uint16 _loopLastFrame = 0;
65 uint16 _onHoverFirstFrame = 0;
66 uint16 _onHoverLastFrame = 0;
67 uint16 _onHoverEndFirstFrame = 0;
68 uint16 _onHoverEndLastFrame = 0;
69 SceneChangeDescription _sceneChange;
70
71 // Nancy 10+: push current scene before the sceneChange target.
72 bool _pushSceneOnTrigger = false;
73
74 // Nancy 10+: set an event flag when playback reaches frameID.
75 struct FlagAtFrame {
76 int16 frameID;
77 FlagDescription flagDesc;
78 };
80
82
83 bool canHaveHotspot() const override { return true; }
84 bool isViewportRelative() const override { return true; }
85 // Ambient character animations stay on screen across a NO_ART_SCENE change
86 // (e.g. while a phone-call conversation is overlaid in front of them).
87 bool survivesSceneChange(bool nextSceneIsNoArt) const override { return nextSceneIsNoArt; }
88
89 CursorManager::CursorType getHoverCursor() const override {
90 return g_nancy->getGameType() >= kGameTypeNancy10 ? CursorManager::kHotspotTalk : CursorManager::kHotspot;
91 }
92
93 Common::String getRecordExtraInfo() const override {
94 return Common::String::format("Scene %d, file %s", _sceneChange.sceneID, _filename.baseName().c_str());
95 }
96
97protected:
98 Common::String getRecordTypeName() const override { return "PlaySecondaryVideo"; }
99
100 Graphics::ManagedSurface _fullFrame;
101 HoverState _hoverState = kNoHover;
102 MoviePlayer _decoder;
103 int _currentViewportFrame = -1;
104 int _currentViewportScroll = -1;
105 bool _isInFrame = false;
106 bool _isHovered = false;
107};
108
109} // End of namespace Action
110} // End of namespace Nancy
111
112#endif // NANCY_ACTION_SECONDARYVIDEO_H
Definition: array.h:52
Definition: path.h:52
String baseName() const
Definition: stream.h:745
Definition: str.h:59
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
Definition: managed_surface.h:51
Definition: secondaryvideo.h:37
Definition: actionrecord.h:169
Definition: actionmanager.h:32
Definition: secondaryvideo.h:75
Definition: commontypes.h:201
Definition: input.h:41
Definition: commontypes.h:186