[Scummvm-cvs-logs] scummvm master -> cc9a5ec8abe9b9660177e70cfdbc6fce8b6dfbbf
Strangerke
Strangerke at scummvm.org
Mon Sep 12 00:03:07 CEST 2011
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
cc9a5ec8ab CGE: Remove VFile class
Commit: cc9a5ec8abe9b9660177e70cfdbc6fce8b6dfbbf
https://github.com/scummvm/scummvm/commit/cc9a5ec8abe9b9660177e70cfdbc6fce8b6dfbbf
Author: Strangerke (strangerke at scummvm.org)
Date: 2011-09-11T14:57:55-07:00
Commit Message:
CGE: Remove VFile class
Changed paths:
engines/cge/bitmap.cpp
engines/cge/bitmap.h
engines/cge/fileio.cpp
engines/cge/fileio.h
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
index 3d2ca70..c54ba09 100644
--- a/engines/cge/bitmap.cpp
+++ b/engines/cge/bitmap.cpp
@@ -50,8 +50,10 @@ Bitmap::Bitmap(const char *fname) : _m(NULL), _v(NULL), _map(0) {
forceExt(pat, fname, ".VBM");
if (_cat->exist(pat)) {
- VFile file(pat);
- if ((file._error == 0) && (!loadVBM(&file)))
+ EncryptedStream file(pat);
+ if (file.err())
+ error("Unable to find VBM [%s]", fname);
+ if (!loadVBM(&file))
error("Bad VBM [%s]", fname);
} else {
error("Bad VBM [%s]", fname);
@@ -341,27 +343,27 @@ bool Bitmap::solidAt(int16 x, int16 y) {
}
}
-bool Bitmap::loadVBM(VFile *f) {
+bool Bitmap::loadVBM(EncryptedStream *f) {
debugC(5, kCGEDebugBitmap, "Bitmap::loadVBM(f)");
uint16 p = 0, n = 0;
- if (f->_error == 0)
+ if (!f->err())
f->read((uint8 *)&p, sizeof(p));
p = FROM_LE_16(p);
- if (f->_error == 0)
+ if (!f->err())
f->read((uint8 *)&n, sizeof(n));
n = FROM_LE_16(n);
- if (f->_error == 0)
+ if (!f->err())
f->read((uint8 *)&_w, sizeof(_w));
_w = FROM_LE_16(_w);
- if (f->_error == 0)
+ if (!f->err())
f->read((uint8 *)&_h, sizeof(_h));
_h = FROM_LE_16(_h);
- if (f->_error == 0) {
+ if (!f->err()) {
if (p) {
if (_pal) {
// Read in the palette
@@ -375,17 +377,17 @@ bool Bitmap::loadVBM(VFile *f) {
_pal[idx]._b = *(srcP + 2);
}
} else
- f->seek(f->mark() + kPalSize);
+ f->seek(f->pos() + kPalSize);
}
}
if ((_v = new uint8[n]) == NULL)
return false;
- if (f->_error == 0)
+ if (!f->err())
f->read(_v, n);
_b = (HideDesc *)(_v + n - _h * sizeof(HideDesc));
- return (f->_error == 0);
+ return (!f->err());
}
} // End of namespace CGE
diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h
index fbaeead..bc37591 100644
--- a/engines/cge/bitmap.h
+++ b/engines/cge/bitmap.h
@@ -50,7 +50,7 @@ struct HideDesc {
#include "common/pack-end.h"
class Bitmap {
- bool loadVBM(VFile *f);
+ bool loadVBM(EncryptedStream *f);
public:
static Dac *_pal;
uint16 _w;
diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp
index 024ea77..888437c 100644
--- a/engines/cge/fileio.cpp
+++ b/engines/cge/fileio.cpp
@@ -331,54 +331,6 @@ bool BtFile::exist(const char *name) {
}
/*-----------------------------------------------------------------------
- * VFile
- *-----------------------------------------------------------------------*/
-VFile::VFile(const char *name) : IoBuf(NULL) {
- debugC(3, kCGEDebugFile, "VFile::VFile(%s)", name);
-
- if (_dat->_error || _cat->_error)
- error("Bad volume data");
- BtKeypack *kp = _cat->find(name);
- if (scumm_stricmp(kp->_key, name) != 0)
- _error = 1;
- _endMark = (_bufMark = _begMark = kp->_mark) + kp->_size;
-}
-
-VFile::~VFile() {
-}
-
-void VFile::readBuf() {
- debugC(3, kCGEDebugFile, "VFile::readBuf()");
-
- _dat->seek(_bufMark + _lim);
- _bufMark = _dat->mark();
- long n = _endMark - _bufMark;
- if (n > kBufferSize)
- n = kBufferSize;
- _lim = _dat->read(_buff, (uint16) n);
- _ptr = 0;
-}
-
-long VFile::mark() {
- debugC(5, kCGEDebugFile, "VFile::mark()");
-
- return (_bufMark + _ptr) - _begMark;
-}
-
-long VFile::size() {
- debugC(1, kCGEDebugFile, "VFile::size()");
-
- return _endMark - _begMark;
-}
-
-long VFile::seek(long pos) {
- debugC(1, kCGEDebugFile, "VFile::seek(%ld)", pos);
-
- _lim = 0;
- return (_bufMark = _begMark + pos);
-}
-
-/*-----------------------------------------------------------------------
* EncryptedStream
*-----------------------------------------------------------------------*/
EncryptedStream::EncryptedStream(const char *name) {
@@ -422,6 +374,10 @@ int32 EncryptedStream::size() {
return _readStream->size();
}
+int32 EncryptedStream::pos() {
+ return _readStream->pos();
+}
+
EncryptedStream::~EncryptedStream() {
}
diff --git a/engines/cge/fileio.h b/engines/cge/fileio.h
index f6f0a98..8e5779c 100644
--- a/engines/cge/fileio.h
+++ b/engines/cge/fileio.h
@@ -132,21 +132,6 @@ public:
bool exist(const char *name);
};
-class VFile : public IoBuf {
-private:
- long _begMark;
- long _endMark;
-
- void readBuf();
-public:
- VFile(const char *name);
- ~VFile();
-
- long mark();
- long size();
- long seek(long pos);
-};
-
class EncryptedStream {
private:
Common::SeekableReadStream *_readStream;
@@ -157,6 +142,7 @@ public:
bool err();
bool eos();
bool seek(int32 offset);
+ int32 pos();
int32 size();
uint32 read(void *dataPtr, uint32 dataSize);
Common::String readLine();
More information about the Scummvm-git-logs
mailing list