Rename MohawkFile to MohawkArchive and OldMohawkFile to LivingBooksArchive_v1 (the latter originally having an ambiguous meaning) and move them to resource.* Also, renaming the Living Books game types to remove the ambiguous old/new.

svn-id: r47429
This commit is contained in:
Matthew Hoops 2010-01-22 03:43:57 +00:00
parent 716a2bf242
commit c04f8d00b1
17 changed files with 78 additions and 78 deletions

View file

@ -630,11 +630,11 @@ bool LivingBooksConsole::Cmd_DrawImage(int argc, const char **argv) {
return true;
}
if (_vm->getGameType() == GType_OLDLIVINGBOOKS)
if (_vm->getGameType() == GType_LIVINGBOOKSV1)
DebugPrintf("This isn't supported in the old Living Books games (yet)!\n");
_vm->_gfx->copyImageToScreen((uint16)atoi(argv[1]));
return _vm->getGameType() != GType_OLDLIVINGBOOKS;
return _vm->getGameType() != GType_LIVINGBOOKSV1;
}
} // End of namespace Mohawk

View file

@ -581,7 +581,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_NO_FLAGS,
Common::GUIO_NONE
},
GType_NEWLIVINGBOOKS,
GType_LIVINGBOOKSV3,
0,
0
},
@ -597,7 +597,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_NO_FLAGS,
Common::GUIO_NONE
},
GType_NEWLIVINGBOOKS,
GType_LIVINGBOOKSV3,
0,
0
},
@ -660,7 +660,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_DEMO,
Common::GUIO_NONE
},
GType_OLDLIVINGBOOKS,
GType_LIVINGBOOKSV1,
GF_DEMO,
0
},
@ -675,7 +675,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_DEMO,
Common::GUIO_NONE
},
GType_OLDLIVINGBOOKS,
GType_LIVINGBOOKSV1,
GF_DEMO,
0
},
@ -690,7 +690,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_NO_FLAGS,
Common::GUIO_NONE
},
GType_OLDLIVINGBOOKS,
GType_LIVINGBOOKSV1,
0,
0
},
@ -705,7 +705,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_DEMO,
Common::GUIO_NONE
},
GType_OLDLIVINGBOOKS,
GType_LIVINGBOOKSV1,
GF_DEMO,
0
},
@ -720,7 +720,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_DEMO,
Common::GUIO_NONE
},
GType_OLDLIVINGBOOKS,
GType_LIVINGBOOKSV1,
GF_DEMO,
0
},
@ -735,7 +735,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_DEMO,
Common::GUIO_NONE
},
GType_OLDLIVINGBOOKS,
GType_LIVINGBOOKSV1,
GF_DEMO,
0
},
@ -750,7 +750,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_DEMO,
Common::GUIO_NONE
},
GType_OLDLIVINGBOOKS,
GType_LIVINGBOOKSV1,
GF_DEMO,
0
},
@ -765,7 +765,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_DEMO,
Common::GUIO_NONE
},
GType_OLDLIVINGBOOKS,
GType_LIVINGBOOKSV1,
GF_DEMO,
0
},
@ -780,7 +780,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_DEMO,
Common::GUIO_NONE
},
GType_OLDLIVINGBOOKS,
GType_LIVINGBOOKSV1,
GF_DEMO,
0
},
@ -795,7 +795,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_DEMO,
Common::GUIO_NONE
},
GType_OLDLIVINGBOOKS,
GType_LIVINGBOOKSV1,
GF_DEMO,
0
},
@ -810,7 +810,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_DEMO,
Common::GUIO_NONE
},
GType_OLDLIVINGBOOKS,
GType_LIVINGBOOKSV1,
GF_DEMO,
0
},
@ -825,7 +825,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_DEMO,
Common::GUIO_NONE
},
GType_OLDLIVINGBOOKS,
GType_LIVINGBOOKSV1,
GF_DEMO,
0
},
@ -840,7 +840,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_NO_FLAGS,
Common::GUIO_NONE
},
GType_NEWLIVINGBOOKS,
GType_LIVINGBOOKSV3,
0,
0
},
@ -856,7 +856,7 @@ static const MohawkGameDescription gameDescriptions[] = {
ADGF_NO_FLAGS,
Common::GUIO_NONE
},
GType_NEWLIVINGBOOKS,
GType_LIVINGBOOKSV3,
0,
0
},
@ -1047,8 +1047,8 @@ bool MohawkMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGa
case Mohawk::GType_RIVEN:
*engine = new Mohawk::MohawkEngine_Riven(syst, gd);
break;
case Mohawk::GType_OLDLIVINGBOOKS:
case Mohawk::GType_NEWLIVINGBOOKS:
case Mohawk::GType_LIVINGBOOKSV1:
case Mohawk::GType_LIVINGBOOKSV3:
*engine = new Mohawk::MohawkEngine_LivingBooks(syst, gd);
break;
case Mohawk::GType_ZOOMBINI:

View file

@ -23,7 +23,7 @@
*
*/
#include "mohawk/file.h"
#include "mohawk/resource.h"
#include "mohawk/graphics.h"
#include "mohawk/myst.h"
#include "mohawk/riven.h"
@ -671,7 +671,7 @@ void RivenGraphics::drawRect(Common::Rect rect, bool active) {
}
LBGraphics::LBGraphics(MohawkEngine_LivingBooks *vm) : _vm(vm) {
_bmpDecoder = (_vm->getGameType() == GType_OLDLIVINGBOOKS) ? new OldMohawkBitmap() : new MohawkBitmap();
_bmpDecoder = (_vm->getGameType() == GType_LIVINGBOOKSV1) ? new OldMohawkBitmap() : new MohawkBitmap();
_palette = new byte[256 * 4];
memset(_palette, 0, 256 * 4);
}
@ -682,7 +682,7 @@ LBGraphics::~LBGraphics() {
}
void LBGraphics::copyImageToScreen(uint16 image, uint16 left, uint16 right) {
if (_vm->getGameType() == GType_OLDLIVINGBOOKS) {
if (_vm->getGameType() == GType_LIVINGBOOKSV1) {
// Drawing images in the old format isn't supported (yet)
ImageData *imageData = _bmpDecoder->decodeImage(_vm->wrapStreamEndian(ID_BMAP, image));
delete imageData;
@ -708,7 +708,7 @@ void LBGraphics::setPalette(uint16 id) {
// Old Living Books gamnes use the old CTBL-style palette format while newer
// games use the better tPAL format which can store partial palettes.
if (_vm->getGameType() == GType_OLDLIVINGBOOKS) {
if (_vm->getGameType() == GType_LIVINGBOOKSV1) {
Common::SeekableSubReadStreamEndian *ctblStream = _vm->wrapStreamEndian(ID_CTBL, id);
uint16 colorCount = ctblStream->readUint16();

View file

@ -24,7 +24,7 @@
*/
#include "mohawk/livingbooks.h"
#include "mohawk/file.h"
#include "mohawk/resource.h"
#include "common/events.h"
@ -148,9 +148,9 @@ void MohawkEngine_LivingBooks::loadIntro() {
filename = getFileNameFromConfig("Intro", "Page1.r");
if (!filename.empty() && Common::File::exists(filename)) {
MohawkFile *introFile = createMohawkFile();
introFile->open(filename);
_mhk.push_back(introFile);
MohawkArchive *introArchive = createMohawkArchive();
introArchive->open(filename);
_mhk.push_back(introArchive);
}
filename = getFileNameFromConfig("Intro", "Page2");
@ -159,9 +159,9 @@ void MohawkEngine_LivingBooks::loadIntro() {
filename = getFileNameFromConfig("Intro", "Page2.r");
if (!filename.empty() && Common::File::exists(filename)) {
MohawkFile *coverFile = createMohawkFile();
coverFile->open(filename);
_mhk.push_back(coverFile);
MohawkArchive *coverArchive = createMohawkArchive();
coverArchive->open(filename);
_mhk.push_back(coverArchive);
}
}
@ -323,8 +323,8 @@ Common::String MohawkEngine_LivingBooks::convertWinFileName(Common::String strin
return filename;
}
MohawkFile *MohawkEngine_LivingBooks::createMohawkFile() const {
return (getGameType() == GType_NEWLIVINGBOOKS) ? new MohawkFile() : new OldMohawkFile();
MohawkArchive *MohawkEngine_LivingBooks::createMohawkArchive() const {
return (getGameType() == GType_LIVINGBOOKSV1) ? new LivingBooksArchive_v1() : new MohawkArchive();
}
} // End of namespace Mohawk

View file

@ -85,8 +85,8 @@ private:
Common::String getFileNameFromConfig(Common::String section, Common::String key);
// Platform/Version functions
bool isBigEndian() const { return getGameType() == GType_NEWLIVINGBOOKS || getPlatform() == Common::kPlatformMacintosh; }
MohawkFile *createMohawkFile() const;
bool isBigEndian() const { return getGameType() == GType_LIVINGBOOKSV3 || getPlatform() == Common::kPlatformMacintosh; }
MohawkArchive *createMohawkArchive() const;
};
} // End of namespace Mohawk

View file

@ -5,7 +5,6 @@ MODULE_OBJS = \
console.o \
detection.o \
dialogs.o \
file.o \
graphics.o \
livingbooks.o \
mohawk.o \
@ -15,6 +14,7 @@ MODULE_OBJS = \
myst_vars.o \
myst_saveload.o \
myst_scripts.o \
resource.o \
riven.o \
riven_external.o \
riven_saveload.o \

View file

@ -47,8 +47,8 @@ enum MohawkGameType {
GType_TREEHOUSE,
GType_1STDEGREE,
GType_CSUSA,
GType_OLDLIVINGBOOKS,
GType_NEWLIVINGBOOKS
GType_LIVINGBOOKSV1,
GType_LIVINGBOOKSV3
};
enum MohawkGameFeatures {
@ -61,7 +61,7 @@ enum MohawkGameFeatures {
struct MohawkGameDescription;
class Sound;
class PauseDialog;
class MohawkFile;
class MohawkArchive;
class VideoManager;
class MohawkEngine : public ::Engine {
@ -98,7 +98,7 @@ private:
protected:
// An array holding the main Mohawk archives require by the games
Common::Array<MohawkFile *> _mhk;
Common::Array<MohawkArchive *> _mhk;
};
} // End of namespace Mohawk

View file

@ -30,7 +30,7 @@
#include "mohawk/myst_scripts.h"
#include "mohawk/myst_saveload.h"
#include "mohawk/dialogs.h"
#include "mohawk/file.h"
#include "mohawk/resource.h"
#include "mohawk/video/video.h"
namespace Mohawk {
@ -223,7 +223,7 @@ Common::Error MohawkEngine_Myst::run() {
// Load Help System (Masterpiece Edition Only)
if (getFeatures() & GF_ME) {
MohawkFile *mhk = new MohawkFile();
MohawkArchive *mhk = new MohawkArchive();
mhk->open("help.dat");
_mhk.push_back(mhk);
}
@ -316,10 +316,10 @@ void MohawkEngine_Myst::changeToStack(uint16 stack) {
// If the array is empty, add a new one. Otherwise, delete the first
// entry which is the stack file (the second, if there, is the help file).
if (_mhk.empty())
_mhk.push_back(new MohawkFile());
_mhk.push_back(new MohawkArchive());
else {
delete _mhk[0];
_mhk[0] = new MohawkFile();
_mhk[0] = new MohawkArchive();
}
_mhk[0]->open(mystFiles[_curStack]);

View file

@ -23,19 +23,19 @@
*
*/
#include "mohawk/file.h"
#include "mohawk/resource.h"
#include "common/util.h"
namespace Mohawk {
MohawkFile::MohawkFile() {
MohawkArchive::MohawkArchive() {
_mhk = NULL;
_types = NULL;
_fileTable = NULL;
}
void MohawkFile::open(Common::String filename) {
void MohawkArchive::open(Common::String filename) {
Common::File *file = new Common::File();
if (!file->open(filename.c_str()))
error ("Could not open file \'%s\'", filename.c_str());
@ -45,7 +45,7 @@ void MohawkFile::open(Common::String filename) {
open(file);
}
void MohawkFile::close() {
void MohawkArchive::close() {
delete _mhk; _mhk = NULL;
delete[] _types; _types = NULL;
delete[] _fileTable; _fileTable = NULL;
@ -53,7 +53,7 @@ void MohawkFile::close() {
_curFile.clear();
}
void MohawkFile::open(Common::SeekableReadStream *stream) {
void MohawkArchive::open(Common::SeekableReadStream *stream) {
// Make sure no other file is open...
close();
_mhk = stream;
@ -167,7 +167,7 @@ void MohawkFile::open(Common::SeekableReadStream *stream) {
}
}
bool MohawkFile::hasResource(uint32 tag, uint16 id) {
bool MohawkArchive::hasResource(uint32 tag, uint16 id) {
if (!_mhk)
return false;
@ -179,7 +179,7 @@ bool MohawkFile::hasResource(uint32 tag, uint16 id) {
return (getIdIndex(typeIndex, id) >= 0);
}
uint32 MohawkFile::getOffset(uint32 tag, uint16 id) {
uint32 MohawkArchive::getOffset(uint32 tag, uint16 id) {
assert(_mhk);
int16 typeIndex = getTypeIndex(tag);
@ -191,9 +191,9 @@ uint32 MohawkFile::getOffset(uint32 tag, uint16 id) {
return _fileTable[_types[typeIndex].resTable.entries[idIndex].index - 1].offset;
}
Common::SeekableReadStream *MohawkFile::getRawData(uint32 tag, uint16 id) {
Common::SeekableReadStream *MohawkArchive::getRawData(uint32 tag, uint16 id) {
if (!_mhk)
error ("MohawkFile::getRawData - No File in Use");
error ("MohawkArchive::getRawData - No File in Use");
int16 typeIndex = getTypeIndex(tag);
@ -222,7 +222,7 @@ Common::SeekableReadStream *MohawkFile::getRawData(uint32 tag, uint16 id) {
return new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _fileTable[fileTableIndex].offset + _fileTable[fileTableIndex].dataSize);
}
void OldMohawkFile::open(Common::SeekableReadStream *stream) {
void LivingBooksArchive_v1::open(Common::SeekableReadStream *stream) {
close();
_mhk = stream;
@ -308,7 +308,7 @@ void OldMohawkFile::open(Common::SeekableReadStream *stream) {
}
uint32 OldMohawkFile::getOffset(uint32 tag, uint16 id) {
uint32 LivingBooksArchive_v1::getOffset(uint32 tag, uint16 id) {
assert(_mhk);
int16 typeIndex = getTypeIndex(tag);
@ -320,9 +320,9 @@ uint32 OldMohawkFile::getOffset(uint32 tag, uint16 id) {
return _types[typeIndex].resTable.entries[idIndex].offset;
}
Common::SeekableReadStream *OldMohawkFile::getRawData(uint32 tag, uint16 id) {
Common::SeekableReadStream *LivingBooksArchive_v1::getRawData(uint32 tag, uint16 id) {
if (!_mhk)
error ("OldMohawkFile::getRawData - No File in Use");
error ("LivingBooksArchive_v1::getRawData - No File in Use");
int16 typeIndex = getTypeIndex(tag);

View file

@ -30,8 +30,8 @@
#include "mohawk/sound.h"
#ifndef MOHAWK_FILE_H
#define MOHAWK_FILE_H
#ifndef MOHAWK_RESOURCE_H
#define MOHAWK_RESOURCE_H
namespace Mohawk {
@ -173,10 +173,10 @@ struct RSRC_Header {
uint16 file_table_size;
};
class MohawkFile {
class MohawkArchive {
public:
MohawkFile();
virtual ~MohawkFile() { close(); }
MohawkArchive();
virtual ~MohawkArchive() { close(); }
void open(Common::String filename);
virtual void open(Common::SeekableReadStream *stream);
@ -216,10 +216,10 @@ private:
}
};
class OldMohawkFile : public MohawkFile {
class LivingBooksArchive_v1 : public MohawkArchive {
public:
OldMohawkFile() : MohawkFile() {}
~OldMohawkFile() {}
LivingBooksArchive_v1() : MohawkArchive() {}
~LivingBooksArchive_v1() {}
void open(Common::SeekableReadStream *stream);
Common::SeekableReadStream *getRawData(uint32 tag, uint16 id);

View file

@ -83,7 +83,7 @@ Common::Error MohawkEngine_Riven::run() {
// Open extras.mhk for common images (non-existant in the demo)
if (!(getFeatures() & GF_DEMO)) {
_extrasFile = new MohawkFile();
_extrasFile = new MohawkArchive();
_extrasFile->open("extras.mhk");
}
@ -230,7 +230,7 @@ void MohawkEngine_Riven::changeToStack(uint16 n) {
for (int i = 0; i < ARRAYSIZE(endings); i++) {
Common::String filename = Common::String(prefix) + endings[i];
if (Common::File::exists(filename)) {
MohawkFile *mhk = new MohawkFile();
MohawkArchive *mhk = new MohawkArchive();
mhk->open(filename);
_mhk.push_back(mhk);
}

View file

@ -34,7 +34,7 @@
namespace Mohawk {
struct MohawkGameDescription;
class MohawkFile;
class MohawkArchive;
class RivenGraphics;
class RivenExternal;
class RivenConsole;
@ -120,7 +120,7 @@ public:
bool hasFeature(EngineFeature f) const;
private:
MohawkFile *_extrasFile; // We need a separate handle for the extra data
MohawkArchive *_extrasFile; // We need a separate handle for the extra data
RivenConsole *_console;
RivenSaveLoad *_saveLoad;
GUI::SaveLoadChooser *_loadDialog;

View file

@ -31,7 +31,7 @@
namespace Mohawk {
RivenSaveLoad::RivenSaveLoad(MohawkEngine_Riven *vm, Common::SaveFileManager *saveFileMan) : _vm(vm), _saveFileMan(saveFileMan) {
_loadFile = new MohawkFile();
_loadFile = new MohawkArchive();
}
RivenSaveLoad::~RivenSaveLoad() {

View file

@ -29,7 +29,7 @@
#include "common/savefile.h"
#include "common/str.h"
#include "mohawk/file.h"
#include "mohawk/resource.h"
namespace Mohawk {
@ -53,7 +53,7 @@ public:
private:
MohawkEngine_Riven *_vm;
Common::SaveFileManager *_saveFileMan;
MohawkFile *_loadFile;
MohawkArchive *_loadFile;
Common::MemoryWriteStreamDynamic *genVERSSection();
Common::MemoryWriteStreamDynamic *genNAMESection();

View file

@ -68,7 +68,7 @@ void Sound::loadRivenSounds(uint16 stack) {
static const char prefixes[] = { 'a', 'b', 'g', 'j', 'o', 'p', 'r', 't' };
if (!_rivenSoundFile)
_rivenSoundFile = new MohawkFile();
_rivenSoundFile = new MohawkArchive();
_rivenSoundFile->open(Common::String(prefixes[stack]) + "_Sounds.mhk");
}
@ -128,7 +128,7 @@ Audio::SoundHandle *Sound::playSound(uint16 id, bool mainSoundFile, byte volume)
else
audStream = getCSAmtrakMusic(id);
break;
case GType_OLDLIVINGBOOKS:
case GType_LIVINGBOOKSV1:
audStream = makeOldMohawkWaveStream(_vm->getRawData(ID_WAV, id));
break;
default:
@ -322,7 +322,7 @@ void Sound::resumeSLST() {
Audio::AudioStream *Sound::getCSAmtrakMusic(uint16 id) {
char filename[18];
sprintf(filename, "MUSIC/MUSIC%02d.MHK", id);
MohawkFile *file = new MohawkFile();
MohawkArchive *file = new MohawkArchive();
file->open(filename);
Audio::AudioStream *audStream = makeMohawkWaveStream(file->getRawData(ID_TWAV, 2000 + id));
delete file;

View file

@ -36,7 +36,7 @@
#include "sound/mixer.h"
#include "mohawk/mohawk.h"
#include "mohawk/file.h"
#include "mohawk/resource.h"
namespace Mohawk {
@ -134,7 +134,7 @@ public:
private:
MohawkEngine *_vm;
MohawkFile *_rivenSoundFile;
MohawkArchive *_rivenSoundFile;
MidiDriver *_midiDriver;
MidiParser *_midiParser;

View file

@ -23,7 +23,7 @@
*
*/
#include "mohawk/file.h"
#include "mohawk/resource.h"
#include "mohawk/video/video.h"
#include "mohawk/video/qt_player.h"