aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/graphics/portrait.cpp19
-rw-r--r--engines/sci/graphics/portrait.h2
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;
};