aboutsummaryrefslogtreecommitdiff
path: root/engines/cge/bitmap.cpp
diff options
context:
space:
mode:
authorStrangerke2011-09-11 23:57:55 +0200
committerStrangerke2011-09-12 00:30:46 +0200
commitae9985163997eaa87d37bc53f9084b189ef6c37c (patch)
tree67a752553264ded9e857a8421a9c4481e6dcb8b7 /engines/cge/bitmap.cpp
parente073fab21131cae6bb0d9919b741ec0b440a948a (diff)
downloadscummvm-rg350-ae9985163997eaa87d37bc53f9084b189ef6c37c.tar.gz
scummvm-rg350-ae9985163997eaa87d37bc53f9084b189ef6c37c.tar.bz2
scummvm-rg350-ae9985163997eaa87d37bc53f9084b189ef6c37c.zip
CGE: Remove VFile class
Diffstat (limited to 'engines/cge/bitmap.cpp')
-rw-r--r--engines/cge/bitmap.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
index 3d2ca70868..c54ba09245 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