diff options
author | Filippos Karapetis | 2010-01-11 10:37:32 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-01-11 10:37:32 +0000 |
commit | fc8fc3a664321b4cfce9f311fe9fb955372a74e3 (patch) | |
tree | 55ebbaa442c9c2ddce10806b73eec4eceb582119 /engines/sci/graphics | |
parent | 4996b7a7d4f6f910dcdf6c70bf1faf94f5ceb5d5 (diff) | |
download | scummvm-rg350-fc8fc3a664321b4cfce9f311fe9fb955372a74e3.tar.gz scummvm-rg350-fc8fc3a664321b4cfce9f311fe9fb955372a74e3.tar.bz2 scummvm-rg350-fc8fc3a664321b4cfce9f311fe9fb955372a74e3.zip |
The portrait file data is now freed after the portrait animation is done
svn-id: r47246
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r-- | engines/sci/graphics/portrait.cpp | 19 | ||||
-rw-r--r-- | engines/sci/graphics/portrait.h | 2 |
2 files changed, 11 insertions, 10 deletions
diff --git a/engines/sci/graphics/portrait.cpp b/engines/sci/graphics/portrait.cpp index 7085228ec2..1433a849dd 100644 --- a/engines/sci/graphics/portrait.cpp +++ b/engines/sci/graphics/portrait.cpp @@ -45,6 +45,7 @@ Portrait::Portrait(ResourceManager *resMan, SciEvent *event, SciGui *gui, Screen Portrait::~Portrait() { delete[] _bitmaps; + delete _fileData; } void Portrait::init(Common::String resourceName, SciPalette *palette) { @@ -66,7 +67,6 @@ void Portrait::init(Common::String resourceName, SciPalette *palette) { // -> 6 bytes unknown // height * width bitmap data // another animation count times bitmap header and data - byte *fileData = 0; int32 fileSize = 0; Common::SeekableReadStream *file = SearchMan.createReadStreamForMember("actors/" + resourceName + ".bin"); @@ -76,20 +76,20 @@ void Portrait::init(Common::String resourceName, SciPalette *palette) { error("portrait %s.bin not found", resourceName.c_str()); } fileSize = file->size(); - fileData = new byte[fileSize]; - file->read(fileData, fileSize); + _fileData = new byte[fileSize]; + file->read(_fileData, fileSize); delete file; - if (strncmp((char *)fileData, "WIN", 3)) { + if (strncmp((char *)_fileData, "WIN", 3)) { 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); + _width = READ_LE_UINT16(_fileData + 3); + _height = READ_LE_UINT16(_fileData + 5); + _bitmapCount = READ_LE_UINT16(_fileData + 7); _bitmaps = new PortraitBitmap[_bitmapCount]; - uint16 portraitPaletteSize = READ_LE_UINT16(fileData + 13); - byte *data = fileData + 17; + uint16 portraitPaletteSize = READ_LE_UINT16(_fileData + 13); + byte *data = _fileData + 17; // Read palette memset(&_portraitPalette, 0, sizeof(Palette)); uint16 palSize = 0, palNr = 0; @@ -131,7 +131,6 @@ void Portrait::init(Common::String resourceName, SciPalette *palette) { // Set the portrait palette palette->set(&_portraitPalette, 1); - delete fileData; } void Portrait::doit(Common::Point position, uint16 resourceId, uint16 noun, uint16 verb, uint16 cond, uint16 seq) { diff --git a/engines/sci/graphics/portrait.h b/engines/sci/graphics/portrait.h index 7b07677ae0..4bcaeb2654 100644 --- a/engines/sci/graphics/portrait.h +++ b/engines/sci/graphics/portrait.h @@ -61,6 +61,8 @@ private: uint16 _bitmapCount; PortraitBitmap *_bitmaps; + byte *_fileData; + Common::Point _position; }; |