[Scummvm-cvs-logs] scummvm master -> 4c28934e6d1c5828d2a40c23f71cba4afa5d484f

Strangerke Strangerke at scummvm.org
Mon Sep 12 00:37:11 CEST 2011


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ae99851639 CGE: Remove VFile class
4c28934e6d Merge branch 'master' of github.com:scummvm/scummvm


Commit: ae9985163997eaa87d37bc53f9084b189ef6c37c
    https://github.com/scummvm/scummvm/commit/ae9985163997eaa87d37bc53f9084b189ef6c37c
Author: Strangerke (strangerke at scummvm.org)
Date: 2011-09-11T15:30:46-07:00

Commit Message:
CGE: Remove VFile class

Changed paths:
    engines/cge/bitmap.cpp
    engines/cge/bitmap.h
    engines/cge/cge_main.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/cge_main.h b/engines/cge/cge_main.h
index d6f1a99..54258c7 100644
--- a/engines/cge/cge_main.h
+++ b/engines/cge/cge_main.h
@@ -61,9 +61,6 @@ namespace CGE {
 #define kGetNamePrompt 50
 #define kGetNameTitle  51
 #define kTSeq          96
-//Useless?
-//#define kBadSnd        97
-//#define kBadMidi       98
 #define kNoMusic       98
 #define kBadSVG        99
 #define kSeqHTalk      (kTSeq + 4)
@@ -87,7 +84,7 @@ namespace CGE {
 #define kStackSize     2048
 #define kSavegameCheckSum   (1956 + _now + _oldLev + _game + _music + _demoText)
 #define kSavegame0Name ("{{INIT}}" kSvgExt)
-#define kSavegame0File VFile
+#define kSavegame0File EncryptedStream
 #define kSavegameStrSize 11
 #define kGameFrameDelay (1000 / 50)
 #define kGameTickDelay  (1000 / 62)
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();


Commit: 4c28934e6d1c5828d2a40c23f71cba4afa5d484f
    https://github.com/scummvm/scummvm/commit/4c28934e6d1c5828d2a40c23f71cba4afa5d484f
Author: Strangerke (strangerke at scummvm.org)
Date: 2011-09-11T15:31:12-07:00

Commit Message:
Merge branch 'master' of github.com:scummvm/scummvm

Changed paths:









More information about the Scummvm-git-logs mailing list