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  * Additional copyright for this file:
8  * Copyright (C) 1994-1998 Revolution Software Ltd.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef SWORD2_ANIMATION_H
25 #define SWORD2_ANIMATION_H
26 
27 #include "sword2/screen.h"
28 
29 namespace Graphics {
30 struct Surface;
31 }
32 
33 namespace Video {
34 class VideoDecoder;
35 }
36 
37 namespace Sword2 {
38 
39 enum DecoderType {
40  kVideoDecoderDXA = 0,
41  kVideoDecoderSMK = 1,
42  kVideoDecoderPSX = 2,
43  kVideoDecoderMP2 = 3
44 };
45 
46 struct MovieText {
47  uint16 _startFrame;
48  uint16 _endFrame;
49  uint32 _textNumber;
50  byte *_textMem;
51  SpriteInfo _textSprite;
52  uint16 _speechId;
53  bool _played;
54 
55  void reset() {
56  _textMem = nullptr;
57  _speechId = 0;
58  _played = false;
59  }
60 };
61 
62 class MoviePlayer {
63 public:
64  MoviePlayer(Sword2Engine *vm, OSystem *system, Video::VideoDecoder *decoder, DecoderType decoderType);
65  virtual ~MoviePlayer();
66 
67  bool load(const char *name);
68  void play(MovieText *movieTexts, uint32 numMovieTexts, uint32 leadIn, uint32 leadOut);
69 
70 protected:
71  Sword2Engine *_vm;
72  OSystem *_system;
73  MovieText *_movieTexts;
74  uint32 _numMovieTexts;
75  uint32 _currentMovieText;
76  byte *_textSurface;
77  int _textX, _textY;
78  byte _white, _black;
79  DecoderType _decoderType;
80 
81  Video::VideoDecoder *_decoder;
82 
83  uint32 _leadOut;
84  int _leadOutFrame;
85 
86  void performPostProcessing(Graphics::Surface *screen, uint16 pitch);
87  bool playVideo();
88  void drawFramePSX(const Graphics::Surface *frame);
89 
90  void openTextObject(uint32 index);
91  void closeTextObject(uint32 index, Graphics::Surface *screen, uint16 pitch);
92  void drawTextObject(uint32 index, Graphics::Surface *screen, uint16 pitch);
93 
94  uint32 getBlackColor();
95  uint32 getWhiteColor();
96 };
97 
98 MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, OSystem *system, uint32 frameCount);
99 
100 } // End of namespace Sword2
101 
102 #endif
Definition: surface.h:67
Definition: animation.h:37
Definition: animation.h:46
Definition: sword2.h:99
Definition: video_decoder.h:53
Definition: formatinfo.h:28
Definition: screen.h:160
Definition: animation.h:62
Definition: system.h:161
Definition: avi_frames.h:36