From 918d79f10494ba815d3e2a4ee69f3092486d4be4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 Sep 2011 22:07:22 +0200 Subject: CGE: Remove some more uses of VFile. Fix a shadowed variable --- engines/cge/fileio.cpp | 8 ++++++++ engines/cge/fileio.h | 2 ++ engines/cge/general.cpp | 2 +- engines/cge/sound.cpp | 6 +++--- engines/cge/sound.h | 2 +- engines/cge/text.cpp | 7 ++++--- 6 files changed, 19 insertions(+), 8 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp index 34c7c6510f..024ea77693 100644 --- a/engines/cge/fileio.cpp +++ b/engines/cge/fileio.cpp @@ -410,10 +410,18 @@ bool EncryptedStream::eos() { return _readStream->eos(); } +bool EncryptedStream::seek(int32 offset) { + return _readStream->seek(offset); +} + Common::String EncryptedStream::readLine() { return _readStream->readLine(); } +int32 EncryptedStream::size() { + return _readStream->size(); +} + EncryptedStream::~EncryptedStream() { } diff --git a/engines/cge/fileio.h b/engines/cge/fileio.h index 1f0756a276..f6f0a98d54 100644 --- a/engines/cge/fileio.h +++ b/engines/cge/fileio.h @@ -156,6 +156,8 @@ public: ~EncryptedStream(); bool err(); bool eos(); + bool seek(int32 offset); + int32 size(); uint32 read(void *dataPtr, uint32 dataSize); Common::String readLine(); }; diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp index 7db61818ab..5e32aa63aa 100644 --- a/engines/cge/general.cpp +++ b/engines/cge/general.cpp @@ -63,7 +63,7 @@ void sndSetVolume() { // USeless for ScummVM } -DataCk *loadWave(VFile *file) { +DataCk *loadWave(EncryptedStream *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 a7b2d34b0b..e83a210e3e 100644 --- a/engines/cge/sound.cpp +++ b/engines/cge/sound.cpp @@ -136,7 +136,7 @@ void Fx::preload(int ref0) { for (int ref = ref0; ref < ref0 + 10; ref++) { sprintf(filename, "FX%05d.WAV", ref); - VFile file = VFile(filename); + EncryptedStream file = filename; DataCk *wav = loadWave(&file); if (wav) { Handler *p = &_cache[find(0)]; @@ -154,7 +154,7 @@ DataCk *Fx::load(int idx, int ref) { char filename[12]; sprintf(filename, "FX%05d.WAV", ref); - VFile file = VFile(filename); + EncryptedStream file = filename; DataCk *wav = loadWave(&file); if (wav) { Handler *p = &_cache[idx]; @@ -222,7 +222,7 @@ void MusicPlayer::loadMidi(int ref) { killMidi(); // Read in the data for the file - VFile mid(filename.c_str()); + EncryptedStream mid(filename.c_str()); _dataSize = mid.size(); _data = (byte *)malloc(_dataSize); mid.read(_data, _dataSize); diff --git a/engines/cge/sound.h b/engines/cge/sound.h index 0a7d018c81..4441e24179 100644 --- a/engines/cge/sound.h +++ b/engines/cge/sound.h @@ -57,7 +57,7 @@ public: } }; -DataCk *loadWave(VFile *file); +DataCk *loadWave(EncryptedStream *file); class Sound { public: diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp index 71bb411f11..2b949ab701 100644 --- a/engines/cge/text.cpp +++ b/engines/cge/text.cpp @@ -65,7 +65,8 @@ int16 Text::count() { Common::String line; char tmpStr[kLineMax + 1]; - int n, count = 0; + + int n, counter = 0; for (line = tf.readLine(); !tf.eos(); line = tf.readLine()) { n = line.size(); @@ -77,9 +78,9 @@ int16 Text::count() { if (!isdigit(*s)) continue; - count++; + counter++; } - return count; + return counter; } void Text::clear() { -- cgit v1.2.3