diff options
-rw-r--r-- | common/unarj.cpp | 22 | ||||
-rw-r--r-- | common/unarj.h | 18 | ||||
-rw-r--r-- | engines/drascula/drascula.h | 20 | ||||
-rw-r--r-- | engines/drascula/module.mk | 1 | ||||
-rw-r--r-- | engines/drascula/resource.cpp | 52 |
5 files changed, 72 insertions, 41 deletions
diff --git a/common/unarj.cpp b/common/unarj.cpp index 641e205bae..fa966eeeaa 100644 --- a/common/unarj.cpp +++ b/common/unarj.cpp @@ -819,26 +819,4 @@ SeekableReadStream *ArjArchive::createReadStreamForMember(const String &name) co return new Common::MemoryReadStream(uncompressedData, hdr->origSize, DisposeAfterUse::YES); } -#pragma mark ArjFile implementation - -ArjFile::ArjFile() { - _fallBack = false; -} - -ArjFile::~ArjFile() { -} - -void ArjFile::registerArchive(const String &filename) { - add(filename, new ArjArchive(filename)); -} - -SeekableReadStream *ArjFile::open(const Common::String &filename) { - if (_fallBack && SearchMan.hasFile(filename)) { - return SearchMan.createReadStreamForMember(filename); - } - - return createReadStreamForMember(filename); -} - - } // End of namespace Common diff --git a/common/unarj.h b/common/unarj.h index 92ca4a8354..f44828baca 100644 --- a/common/unarj.h +++ b/common/unarj.h @@ -54,24 +54,6 @@ public: virtual SeekableReadStream *createReadStreamForMember(const String &name) const; }; -// TODO: Get rid of this class, by implementing an ArjArchive subclass of Common::Archive. -// Then ArjFile can be substituted by a SearchSet full of ArjArchives plus SearchMan. -class ArjFile : public SearchSet { -public: - ArjFile(); - ~ArjFile(); - - void enableFallback(bool val) { _fallBack = val; } - - void registerArchive(const String &filename); - - SeekableReadStream *open(const Common::String &filename); - -private: - bool _fallBack; - -}; - } // End of namespace Common #endif diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index e4ff03ffc0..86642319de 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -36,6 +36,7 @@ #include "common/events.h" #include "common/keyboard.h" #include "common/unarj.h" +#include "common/archive.h" #include "sound/mixer.h" @@ -251,6 +252,22 @@ struct CharInfo { byte charType; // 0 - letters, 1 - signs, 2 - accented }; +class ArjFile : public Common::SearchSet { +public: + ArjFile(); + ~ArjFile(); + + void enableFallback(bool val) { _fallBack = val; } + + void registerArchive(const Common::String &filename); + + Common::SeekableReadStream *open(const Common::String &filename); + +private: + bool _fallBack; + +}; + #define NUM_SAVES 10 #define NUM_FLAGS 50 #define DIF_MASK 55 @@ -365,7 +382,7 @@ public: byte cPal[768]; - Common::ArjFile _arj; + ArjFile _arj; int actorFrames[8]; @@ -754,6 +771,7 @@ private: void freeTexts(char **ptr); }; + } // End of namespace Drascula #endif /* DRASCULA_H */ diff --git a/engines/drascula/module.mk b/engines/drascula/module.mk index 8e0a133c3d..a9fa257549 100644 --- a/engines/drascula/module.mk +++ b/engines/drascula/module.mk @@ -10,6 +10,7 @@ MODULE_OBJS := \ interface.o \ objects.o \ palette.o \ + resource.o \ rooms.o \ saveload.o \ sound.o \ diff --git a/engines/drascula/resource.cpp b/engines/drascula/resource.cpp new file mode 100644 index 0000000000..abe68ef86b --- /dev/null +++ b/engines/drascula/resource.cpp @@ -0,0 +1,52 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "drascula/drascula.h" + +namespace Drascula { + +#pragma mark ArjFile implementation + +ArjFile::ArjFile() { + _fallBack = false; +} + +ArjFile::~ArjFile() { +} + +void ArjFile::registerArchive(const Common::String &filename) { + add(filename, new Common::ArjArchive(filename)); +} + +Common::SeekableReadStream *ArjFile::open(const Common::String &filename) { + if (_fallBack && SearchMan.hasFile(filename)) { + return SearchMan.createReadStreamForMember(filename); + } + + return createReadStreamForMember(filename); +} + +} // End of namespace Drascula + |