Moved ArjFile to drascula.

svn-id: r47999
This commit is contained in:
Nicola Mettifogo 2010-02-08 17:48:35 +00:00
parent 16438e5c4d
commit 0aefdb7826
5 changed files with 72 additions and 41 deletions

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -10,6 +10,7 @@ MODULE_OBJS := \
interface.o \
objects.o \
palette.o \
resource.o \
rooms.o \
saveload.o \
sound.o \

View File

@ -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