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 NEVERHOOD_SMACKERPLAYER_H
24 #define NEVERHOOD_SMACKERPLAYER_H
25 
26 #include "video/smk_decoder.h"
27 #include "neverhood/neverhood.h"
28 #include "neverhood/entity.h"
29 
30 namespace Neverhood {
31 
32 class Scene;
33 class Palette;
34 
35 class SmackerSurface : public BaseSurface {
36 public:
37 	SmackerSurface(NeverhoodEngine *vm);
38 	void draw() override;
39 	void setSmackerFrame(const Graphics::Surface *smackerFrame);
40 	void unsetSmackerFrame();
41 protected:
42 	const Graphics::Surface *_smackerFrame;
43 };
44 
45 class SmackerDoubleSurface : public SmackerSurface {
46 public:
47 	SmackerDoubleSurface(NeverhoodEngine *vm);
48 	void draw() override;
49 };
50 
51 class NeverhoodSmackerDecoder : public Video::SmackerDecoder {
52 public:
53 	void forceSeekToFrame(uint frame);
54 };
55 
56 class SmackerPlayer : public Entity {
57 public:
58 	SmackerPlayer(NeverhoodEngine *vm, Scene *scene, uint32 fileHash, bool doubleSurface, bool flag, bool paused = false);
59 	~SmackerPlayer() override;
getSurface()60 	BaseSurface *getSurface() { return _smackerSurface; }
61 	void open(uint32 fileHash, bool keepLastFrame);
62 	void close();
63 	void gotoFrame(int frameNumber);
64 	uint32 getFrameCount();
65 	uint32 getFrameNumber();
66 	uint getStatus();
67 	void setDrawPos(int16 x, int16 y);
68 	void rewind();
isDone()69 	bool isDone() { return getFrameNumber() + 1 == getFrameCount(); }
getSmackerDecoder()70 	NeverhoodSmackerDecoder *getSmackerDecoder() const { return _smackerDecoder; }
71 protected:
72 	Scene *_scene;
73 	Palette *_palette;
74 	NeverhoodSmackerDecoder *_smackerDecoder;
75 	SmackerSurface *_smackerSurface;
76 	uint32 _fileHash;
77 	bool _smackerFirst;
78 	bool _doubleSurface;
79 	Common::SeekableReadStream *_stream;
80 	bool _keepLastFrame;
81 	bool _videoDone;
82 	bool _paused;
83 	int _drawX, _drawY;
84 	void update();
85 	void updateFrame();
86 	void updatePalette();
87 };
88 
89 } // End of namespace Neverhood
90 
91 #endif /* NEVERHOOD_SMACKERPLAYER_H */
92