diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp index 42c1cc908d5..fee9eeeea1e 100644 --- a/engines/cge/bitmap.cpp +++ b/engines/cge/bitmap.cpp @@ -341,7 +341,7 @@ bool Bitmap::solidAt(int16 x, int16 y) { } } -bool Bitmap::loadVBM(XFile *f) { +bool Bitmap::loadVBM(VFile *f) { debugC(5, kCGEDebugBitmap, "Bitmap::loadVBM(f)"); uint16 p = 0, n = 0; diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h index cd4f8267d11..78907dc4d74 100644 --- a/engines/cge/bitmap.h +++ b/engines/cge/bitmap.h @@ -61,7 +61,7 @@ struct HideDesc { #include "common/pack-end.h" class Bitmap { - bool loadVBM(XFile *f); + bool loadVBM(VFile *f); public: static Dac *_pal; uint16 _w; diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp index e196a66d26c..7fc981070d3 100644 --- a/engines/cge/fileio.cpp +++ b/engines/cge/fileio.cpp @@ -51,12 +51,12 @@ uint16 XCrypt(void *buf, uint16 siz, uint16 seed) { /*----------------------------------------------------------------------- * IOHand *-----------------------------------------------------------------------*/ -IoHand::IoHand(Crypt *crypt) : XFile(), _crypt(crypt), _seed(kCryptSeed) { +IoHand::IoHand(Crypt *crypt) : _error(0), _crypt(crypt), _seed(kCryptSeed) { _file = new Common::File(); } IoHand::IoHand(const char *name, Crypt *crypt) - : XFile(), _crypt(crypt), _seed(kCryptSeed) { + : _error(0), _crypt(crypt), _seed(kCryptSeed) { _file = new Common::File(); _file->open(name); } @@ -248,21 +248,21 @@ long CFile::seek(long pos) { * BtPage *-----------------------------------------------------------------------*/ void BtPage::read(Common::ReadStream &s) { - _hea._count = s.readUint16LE(); - _hea._down = s.readUint16LE(); + _header._count = s.readUint16LE(); + _header._down = s.readUint16LE(); - if (_hea._down == kBtValNone) { + if (_header._down == kBtValNone) { // Leaf list for (int i = 0; i < kBtLeafCount; ++i) { - s.read(_lea[i]._key, kBtKeySize); - _lea[i]._mark = s.readUint32LE(); - _lea[i]._size = s.readUint16LE(); + s.read(_leaf[i]._key, kBtKeySize); + _leaf[i]._mark = s.readUint32LE(); + _leaf[i]._size = s.readUint16LE(); } } else { // Root index for (int i = 0; i < kBtInnerCount; ++i) { - s.read(_inn[i]._key, kBtKeySize); - _inn[i]._down = s.readUint16LE(); + s.read(_inner[i]._key, kBtKeySize); + _inner[i]._down = s.readUint16LE(); } } } @@ -321,24 +321,24 @@ BtKeypack *BtFile::find(const char *key) { while (!_error) { BtPage *pg = getPage(lev, nxt); // search - if (pg->_hea._down != kBtValNone) { + if (pg->_header._down != kBtValNone) { int i; - for (i = 0; i < pg->_hea._count; i++) { + for (i = 0; i < pg->_header._count; i++) { // Does this work, or does it have to compare the entire buffer? - if (scumm_strnicmp((const char *)key, (const char*)pg->_inn[i]._key, kBtKeySize) < 0) + if (scumm_strnicmp((const char *)key, (const char*)pg->_inner[i]._key, kBtKeySize) < 0) break; } - nxt = (i) ? pg->_inn[i - 1]._down : pg->_hea._down; + nxt = (i) ? pg->_inner[i - 1]._down : pg->_header._down; _buff[lev]._indx = i - 1; lev++; } else { int i; - for (i = 0; i < pg->_hea._count - 1; i++) { - if (scumm_stricmp((const char *)key, (const char *)pg->_lea[i]._key) <= 0) + for (i = 0; i < pg->_header._count - 1; i++) { + if (scumm_stricmp((const char *)key, (const char *)pg->_leaf[i]._key) <= 0) break; } _buff[lev]._indx = i; - return &pg->_lea[i]; + return &pg->_leaf[i]; } } return NULL; diff --git a/engines/cge/fileio.h b/engines/cge/fileio.h index 4ac8e132924..eee0332010e 100644 --- a/engines/cge/fileio.h +++ b/engines/cge/fileio.h @@ -52,33 +52,23 @@ struct BtKeypack { }; struct Inner { - uint8 _key[kBtKeySize]; + uint8 _key[kBtKeySize]; uint16 _down; }; -struct Hea { +struct Header { uint16 _count; uint16 _down; }; -class XFile { -public: - uint16 _error; - - XFile() : _error(0) { } - virtual ~XFile() { } - virtual uint16 read(void *buf, uint16 len) = 0; - virtual long mark() = 0; - virtual long size() = 0; - virtual long seek(long pos) = 0; -}; - -class IoHand : public XFile { +class IoHand { protected: Common::File *_file; uint16 _seed; Crypt *_crypt; public: + uint16 _error; + IoHand(const char *name, Crypt crypt); IoHand(Crypt *crypt); virtual ~IoHand(); @@ -116,14 +106,14 @@ public: }; struct BtPage { - Hea _hea; + Header _header; union { // dummy filler to make proper size of union uint8 _data[kBtSize - 4 /*sizeof(Hea) */]; // inner version of data: key + word-sized page link - Inner _inn[kBtInnerCount]; + Inner _inner[kBtInnerCount]; // leaf version of data: key + all user data - BtKeypack _lea[kBtLeafCount]; + BtKeypack _leaf[kBtLeafCount]; }; void read(Common::ReadStream &s); diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp index 5c113bd1e17..ec98db705ef 100644 --- a/engines/cge/general.cpp +++ b/engines/cge/general.cpp @@ -54,7 +54,7 @@ void sndSetVolume() { // USeless for ScummVM } -DataCk *loadWave(XFile *file) { +DataCk *loadWave(VFile *file) { byte *data = (byte *)malloc(file->size()); file->read(data, file->size()); diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp index 6deb7f50200..d8a9b7831ed 100644 --- a/engines/cge/sound.cpp +++ b/engines/cge/sound.cpp @@ -76,12 +76,12 @@ void Sound::play(DataCk *wav, int pan) { void Sound::sndDigiStart(SmpInfo *PSmpInfo) { // Create an audio stream wrapper for sound - Common::MemoryReadStream *stream = new Common::MemoryReadStream(PSmpInfo->_saddr, + Common::MemoryReadStream *stream = new Common::MemoryReadStream(PSmpInfo->_saddr, PSmpInfo->_slen, DisposeAfterUse::NO); _audioStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES); // Start the new sound - _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, + _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, Audio::makeLoopingAudioStream(_audioStream, (uint)PSmpInfo->_counter)); } diff --git a/engines/cge/sound.h b/engines/cge/sound.h index 71ef7c2db62..0a7d018c815 100644 --- a/engines/cge/sound.h +++ b/engines/cge/sound.h @@ -57,7 +57,7 @@ public: } }; -DataCk *loadWave(XFile *file); +DataCk *loadWave(VFile *file); class Sound { public: