diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dreamweb/dreamweb.h | 1 | ||||
-rw-r--r-- | engines/dreamweb/structs.h | 6 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 8 |
3 files changed, 10 insertions, 5 deletions
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h index c67dfb3660..f49c38371d 100644 --- a/engines/dreamweb/dreamweb.h +++ b/engines/dreamweb/dreamweb.h @@ -76,6 +76,7 @@ const unsigned int kSymbolx = 64; const unsigned int kSymboly = 56; const unsigned int kLengthofvars = 68; const unsigned int kFrameBlocksize = 2080; +const unsigned int kGraphicsFileFrameSize = 347; // ceil(2080 / sizeof(Frame)) const unsigned int kNumexobjects = 114; const unsigned int kNumExTexts = kNumexobjects + 2; const uint16 kExtextlen = 18000; diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index cedf2b6d76..24b67e317a 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -339,9 +339,9 @@ struct TextFile { }; struct GraphicsFile { - GraphicsFile() : _data(0) { } + GraphicsFile() : _data(0), _frames(0) { } - Frame _frames[347]; + Frame *_frames; uint8 *_data; const uint8 *getFrameData(unsigned int i) const { @@ -351,6 +351,8 @@ struct GraphicsFile { return _data + _frames[i].ptr(); } void clear() { + delete[] _frames; + _frames = 0; delete[] _data; _data = 0; } diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 4178fb489a..763bcb88fe 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -843,17 +843,18 @@ void DreamWebEngine::loadGraphicsFile(GraphicsFile &file, const char *fileName) uint16 sizeInBytes = header.len(0); assert(sizeInBytes >= kFrameBlocksize); - delete[] file._data; + file.clear(); file._data = new uint8[sizeInBytes - kFrameBlocksize]; - + file._frames = new Frame[kGraphicsFileFrameSize]; f.read((uint8 *)file._frames, kFrameBlocksize); f.read(file._data, sizeInBytes - kFrameBlocksize); } void DreamWebEngine::loadGraphicsSegment(GraphicsFile &file, Common::File &inFile, unsigned int len) { assert(len >= kFrameBlocksize); - delete[] file._data; + file.clear(); file._data = new uint8[len - kFrameBlocksize]; + file._frames = new Frame[kGraphicsFileFrameSize]; inFile.read((uint8 *)file._frames, kFrameBlocksize); inFile.read(file._data, len - kFrameBlocksize); } @@ -2257,6 +2258,7 @@ void DreamWebEngine::drawFloor() { void DreamWebEngine::allocateBuffers() { _exFrames.clear(); _exFrames._data = new uint8[kExframeslen]; + _exFrames._frames = new Frame[kGraphicsFileFrameSize]; _exText.clear(); _exText._text = new char[kExtextlen]; } |