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 SCI_GRAPHICS_PORTRAITS_H
24 #define SCI_GRAPHICS_PORTRAITS_H
25 
26 #include "sci/util.h"
27 
28 namespace Sci {
29 
30 struct PortraitBitmap {
31 	int16 width, height;
32 	int16 extraBytesPerLine;
33 	uint16 displaceX, displaceY;
34 	SciSpan<const byte> rawBitmap;
35 };
36 
37 /**
38  * This class is used to handle all the hi-res portraits used in the Windows
39  * release of KQ6. These are all in external data files, and handled separately
40  * from the rest of the engine (originally, inside rave.dll)
41  */
42 class Portrait {
43 public:
44 	Portrait(ResourceManager *resMan, EventManager *event, GfxScreen *screen, GfxPalette *palette, AudioPlayer *audio, Common::String resourceName);
45 
46 	void setupAudio(uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq);
47 	void doit(Common::Point position, uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq);
48 
getResourceName()49 	Common::String getResourceName() { return _resourceName; }
50 
51 private:
52 	void init();
53 	void drawBitmap(uint16 bitmapNr);
54 	void bitsShow();
55 
56 	int16 raveGetTicks(Resource *resource, uint *offset);
57 	uint16 raveGetID(Resource *resource, uint *offset);
58 	SciSpan<const byte> raveGetLipSyncData(const uint16 raveID);
59 
60 	ResourceManager *_resMan;
61 	EventManager *_event;
62 	GfxPalette *_palette;
63 	GfxScreen *_screen;
64 	AudioPlayer *_audio;
65 
66 	uint16 _height;
67 	uint16 _width;
68 	Palette _portraitPalette;
69 
70 	Common::Array<PortraitBitmap> _bitmaps;
71 
72 	Common::String _resourceName;
73 
74 	Common::SpanOwner<SciSpan<const byte> > _fileData;
75 
76 	uint32 _lipSyncIDCount;
77 	SciSpan<const byte> _lipSyncIDTable;
78 
79 	SciSpan<const byte> _lipSyncData;
80 	Common::Array<uint16> _lipSyncDataOffsetTable;
81 
82 	Common::Point _position;
83 };
84 
85 } // End of namespace Sci
86 
87 #endif
88