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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef SWORD1_ANIMATION_H
24 #define SWORD1_ANIMATION_H
25 
26 #include "common/list.h"
27 
28 #include "sword1/screen.h"
29 #include "sword1/sound.h"
30 
31 namespace Graphics {
32 struct Surface;
33 }
34 
35 namespace Video {
36 class VideoDecoder;
37 }
38 
39 namespace Sword1 {
40 
41 enum DecoderType {
42 	kVideoDecoderDXA = 0,
43 	kVideoDecoderSMK = 1,
44 	kVideoDecoderPSX = 2,
45 	kVideoDecoderMP2 = 3
46 };
47 
48 class MovieText {
49 public:
50 	uint16 _startFrame;
51 	uint16 _endFrame;
52 	uint16 _color;
53 	Common::String _text;
MovieText(int startFrame,int endFrame,const Common::String & text,int color)54 	MovieText(int startFrame, int endFrame, const Common::String &text, int color) {
55 		_startFrame = startFrame;
56 		_endFrame = endFrame;
57 		_text = text;
58 		_color = color;
59 	}
60 };
61 
62 class MoviePlayer {
63 public:
64 	MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, OSystem *system, Video::VideoDecoder *decoder, DecoderType decoderType);
65 	virtual ~MoviePlayer();
66 	bool load(uint32 id);
67 	void play();
68 
69 protected:
70 	SwordEngine *_vm;
71 	Text *_textMan;
72 	ResMan *_resMan;
73 	OSystem *_system;
74 	Common::List<MovieText> _movieTexts;
75 	int _textX, _textY, _textWidth, _textHeight;
76 	int _textColor;
77 	uint32 _black;
78 	uint32 _c1Color, _c2Color, _c3Color, _c4Color;
79 	DecoderType _decoderType;
80 
81 	Video::VideoDecoder *_decoder;
82 
83 	bool playVideo();
84 	void performPostProcessing(byte *screen);
85 	void drawFramePSX(const Graphics::Surface *frame);
86 
87 	uint32 getBlackColor();
88 	uint32 findTextColor();
89 	void convertColor(byte r, byte g, byte b, float &h, float &s, float &v);
90 };
91 
92 MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *resMan, OSystem *system);
93 
94 } // End of namespace Sword1
95 
96 #endif
97