diff options
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/smush/chunk.cpp | 18 | ||||
-rw-r--r-- | engines/scumm/smush/chunk.h | 29 | ||||
-rw-r--r-- | engines/scumm/smush/smush_player.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/smush/smush_player.h | 2 |
4 files changed, 22 insertions, 29 deletions
diff --git a/engines/scumm/smush/chunk.cpp b/engines/scumm/smush/chunk.cpp index 2a797d459b..aa7bb4a9df 100644 --- a/engines/scumm/smush/chunk.cpp +++ b/engines/scumm/smush/chunk.cpp @@ -66,7 +66,8 @@ bool Chunk::seek(int32 delta, int dir) { return true; } -FileChunk::FileChunk(BaseScummFile *data, int offset) { +Chunk::Chunk(BaseScummFile *data, int offset) + : _type(0), _size(0), _curPos(0) { _data = data; _deleteData = false; @@ -77,11 +78,12 @@ FileChunk::FileChunk(BaseScummFile *data, int offset) { _curPos = 0; } -FileChunk::FileChunk(const Common::String &name, int offset) { +Chunk::Chunk(const Common::String &name, int offset) + : _type(0), _size(0), _curPos(0) { _data = new ScummFile(); _deleteData = true; if (!g_scumm->openFile(*_data, name)) - error("FileChunk: Unable to open file %s", name.c_str()); + error("Chunk: Unable to open file %s", name.c_str()); _data->seek(offset, SEEK_SET); _type = _data->readUint32BE(); @@ -91,22 +93,22 @@ FileChunk::FileChunk(const Common::String &name, int offset) { _name = name; } -FileChunk::~FileChunk() { +Chunk::~Chunk() { if (_deleteData) delete _data; } -Chunk *FileChunk::subBlock() { - FileChunk *ptr = new FileChunk(_data, _offset + _curPos); +Chunk *Chunk::subBlock() { + Chunk *ptr = new Chunk(_data, _offset + _curPos); skip(sizeof(Chunk::type) + sizeof(uint32) + ptr->size()); return ptr; } -void FileChunk::reseek() { +void Chunk::reseek() { _data->seek(_offset + _curPos, SEEK_SET); } -uint32 FileChunk::read(void *buffer, uint32 dataSize) { +uint32 Chunk::read(void *buffer, uint32 dataSize) { if (dataSize <= 0 || (_curPos + dataSize) > _size) error("invalid buffer read request"); diff --git a/engines/scumm/smush/chunk.h b/engines/scumm/smush/chunk.h index 76ea56c12c..d1e6413978 100644 --- a/engines/scumm/smush/chunk.h +++ b/engines/scumm/smush/chunk.h @@ -34,7 +34,6 @@ namespace Scumm { class BaseScummFile; -// Common functionality for concrete chunks (FileChunk, MemoryChunk) class Chunk : public Common::SeekableReadStream { public: typedef uint32 type; @@ -45,32 +44,24 @@ protected: uint32 _curPos; Common::String _name; - Chunk() : _type(0), _size(0), _curPos(0) {} + BaseScummFile *_data; + bool _deleteData; + uint32 _offset; + Chunk(BaseScummFile *data, int offset); public: + Chunk(const Common::String &name, int offset = 0); + virtual ~Chunk(); + Chunk::type getType() const { return _type; } + Chunk *subBlock(); + void reseek(); + int32 size() const { return _size; } bool eos() const { return _curPos >= _size; } int32 pos() const { return _curPos; } bool seek(int32 delta, int dir); - - virtual Chunk *subBlock() = 0; - virtual void reseek() = 0; -}; - -class FileChunk : public Chunk { -private: - BaseScummFile *_data; - bool _deleteData; - uint32 _offset; - - FileChunk(BaseScummFile *data, int offset); -public: - FileChunk(const Common::String &name, int offset = 0); - virtual ~FileChunk(); - Chunk *subBlock(); - void reseek(); uint32 read(void *buffer, uint32 size); }; diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp index 9100d95e5d..70359cfcb3 100644 --- a/engines/scumm/smush/smush_player.cpp +++ b/engines/scumm/smush/smush_player.cpp @@ -992,7 +992,7 @@ void SmushPlayer::parseNextFrame() { if (_seekFile.size() > 0) { delete _base; - _base = new FileChunk(_seekFile); + _base = new Chunk(_seekFile); if (_seekPos > 0) { assert(_seekPos > 8); diff --git a/engines/scumm/smush/smush_player.h b/engines/scumm/smush/smush_player.h index 29a2397d58..d725a5539a 100644 --- a/engines/scumm/smush/smush_player.h +++ b/engines/scumm/smush/smush_player.h @@ -51,7 +51,7 @@ private: StringResource *_strings; Codec37Decoder *_codec37; Codec47Decoder *_codec47; - FileChunk *_base; + Chunk *_base; byte *_frameBuffer; byte *_specialBuffer; |