diff options
-rw-r--r-- | engines/sci/graphics/portrait.cpp | 26 | ||||
-rw-r--r-- | engines/sci/graphics/portrait.h | 5 | ||||
-rw-r--r-- | engines/sci/sound/softseq/adlib.cpp | 4 |
3 files changed, 14 insertions, 21 deletions
diff --git a/engines/sci/graphics/portrait.cpp b/engines/sci/graphics/portrait.cpp index 354c583012..40542962c0 100644 --- a/engines/sci/graphics/portrait.cpp +++ b/engines/sci/graphics/portrait.cpp @@ -39,15 +39,15 @@ namespace Sci { Portrait::Portrait(ResourceManager *resMan, SciEvent *event, SciGui *gui, Screen *screen, SciPalette *palette, AudioPlayer *audio, Common::String resourceName) - : _resMan(resMan), _event(event), _gui(gui), _screen(screen), _palette(palette), _audio(audio), _resourceName(resourceName) { - init(); + : _resMan(resMan), _event(event), _gui(gui), _screen(screen), _palette(palette), _audio(audio) { + init(resourceName); } Portrait::~Portrait() { delete[] _bitmaps; } -void Portrait::init() { +void Portrait::init(Common::String resourceName) { // .BIN files are loaded from actors directory and from .\ directory // header: // 3 bytes "WIN" @@ -66,14 +66,12 @@ void Portrait::init() { // -> 6 bytes unknown // height * width bitmap data // another animation count times bitmap header and data - Common::SeekableReadStream *file = 0; - _fileName = "actors/" + _resourceName + ".bin"; - file = SearchMan.createReadStreamForMember(_fileName); + Common::SeekableReadStream *file = + SearchMan.createReadStreamForMember("actors/" + resourceName + ".bin"); if (!file) { - _fileName = _resourceName + ".bin"; - file = SearchMan.createReadStreamForMember(_fileName); + file = SearchMan.createReadStreamForMember(resourceName + ".bin"); if (!file) - error("portrait %s.bin not found", _resourceName.c_str()); + error("portrait %s.bin not found", resourceName.c_str()); } _fileSize = file->size(); _fileData = new byte[_fileSize]; @@ -81,19 +79,19 @@ void Portrait::init() { delete file; if (strncmp((char *)_fileData, "WIN", 3)) { - error("portrait %s doesn't have valid header", _resourceName.c_str()); + error("portrait %s doesn't have valid header", resourceName.c_str()); } _width = READ_LE_UINT16(_fileData + 3); _height = READ_LE_UINT16(_fileData + 5); _bitmapCount = READ_LE_UINT16(_fileData + 7); _bitmaps = new PortraitBitmap[_bitmapCount]; - _portraitPaletteSize = READ_LE_UINT16(_fileData + 13); + uint16 portraitPaletteSize = READ_LE_UINT16(_fileData + 13); byte *data = _fileData + 17; // Read palette memset(&_portraitPalette, 0, sizeof(Palette)); uint16 palSize = 0, palNr = 0; - while (palSize < _portraitPaletteSize) { + while (palSize < portraitPaletteSize) { _portraitPalette.colors[palNr].b = *data++; _portraitPalette.colors[palNr].g = *data++; _portraitPalette.colors[palNr].r = *data++; @@ -128,6 +126,9 @@ void Portrait::init() { data += 14; curBitmap++; } + + // Set the portrait palette + _palette->set(&_portraitPalette, 1); } void Portrait::doit(Common::Point position, uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq) { @@ -143,7 +144,6 @@ void Portrait::doit(Common::Point position, uint16 resourceId, uint16 noun, uint error("kPortrait: Could not open sync resource %d %X", resourceId, audioNumber); // Draw base bitmap - _palette->set(&_portraitPalette, 1); drawBitmap(0); bitsShow(); diff --git a/engines/sci/graphics/portrait.h b/engines/sci/graphics/portrait.h index 27b055d1e1..07170fab1d 100644 --- a/engines/sci/graphics/portrait.h +++ b/engines/sci/graphics/portrait.h @@ -44,7 +44,7 @@ public: void doit(Common::Point position, uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq); private: - void init(); + void init(Common::String resourceName); void drawBitmap(uint16 bitmapNr); void bitsShow(); @@ -55,14 +55,11 @@ private: SciPalette *_palette; AudioPlayer *_audio; - Common::String _resourceName; - Common::String _fileName; byte *_fileData; int32 _fileSize; uint16 _height; uint16 _width; - uint16 _portraitPaletteSize; Palette _portraitPalette; uint16 _bitmapCount; diff --git a/engines/sci/sound/softseq/adlib.cpp b/engines/sci/sound/softseq/adlib.cpp index 5cca3561bf..c8c12040ec 100644 --- a/engines/sci/sound/softseq/adlib.cpp +++ b/engines/sci/sound/softseq/adlib.cpp @@ -827,8 +827,4 @@ MidiPlayer *MidiPlayer_Adlib_create() { return new MidiPlayer_Adlib(); } -MidiDriver *MidiDriver_Adlib_create() { - return new MidiDriver_Adlib(g_system->getMixer()); -} - } // End of namespace Sci |