[Scummvm-cvs-logs] CVS: scummvm/scumm/smush chunk.cpp,1.26,1.27 chunk.h,1.13,1.14 smush_player.cpp,1.126,1.127 smush_player.h,1.31,1.32

Max Horn fingolfin at users.sourceforge.net
Sun Jun 27 14:53:02 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm/smush
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15023/smush

Modified Files:
	chunk.cpp chunk.h smush_player.cpp smush_player.h 
Log Message:
Thanks to File::setDefaultDirectory(), in most cases it is *not* necessary to pass getGameDataPath() on to File::open()

Index: chunk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/chunk.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- chunk.cpp	28 Jan 2004 04:07:54 -0000	1.26
+++ chunk.cpp	27 Jun 2004 21:52:24 -0000	1.27
@@ -32,11 +32,11 @@
 	Common::String _filename;
 	int32 _refcount;
 public:
-	FilePtr(const char *fname, const char *directory) :
+	FilePtr(const char *fname) :
 		_filename(fname),
 		_refcount(1) {
 			debug(9, "FilePtr created for %s", fname);
-			open(fname, directory);
+			open(fname);
 			if (isOpen() == false)
 				error("FilePtr unable to read file %s", fname);
 		}
@@ -115,8 +115,8 @@
 	_data(0) {
 }
 
-FileChunk::FileChunk(const char *fname, const char *directory) {
-	_data = new FilePtr(fname, directory);
+FileChunk::FileChunk(const char *fname) {
+	_data = new FilePtr(fname);
 	_type = _data->readUint32BE();
 	_size = _data->readUint32BE();
 	_offset = sizeof(Chunk::type) + sizeof(uint32);

Index: chunk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/chunk.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- chunk.h	25 Jan 2004 05:25:50 -0000	1.13
+++ chunk.h	27 Jun 2004 21:52:25 -0000	1.14
@@ -74,7 +74,7 @@
 	FileChunk();
 
 public:
-	FileChunk(const char *fname, const char *directory);
+	FileChunk(const char *fname);
 	virtual ~FileChunk();
 	Chunk *subBlock();
 	bool read(void *buffer, uint32 size);

Index: smush_player.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.cpp,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- smush_player.cpp	27 Jun 2004 21:06:04 -0000	1.126
+++ smush_player.cpp	27 Jun 2004 21:52:25 -0000	1.127
@@ -171,11 +171,11 @@
 	}
 };
 
-static StringResource *getStrings(const char *file, const char *directory, bool is_encoded) {
+static StringResource *getStrings(const char *file, bool is_encoded) {
 	debug(7, "trying to read text ressources from %s", file);
 	File theFile;
 
-	theFile.open(file, directory);
+	theFile.open(file);
 	if (!theFile.isOpen()) {
 		return 0;
 	}
@@ -192,7 +192,7 @@
 
 		if (type != TYPE_ETRS) {
 			delete [] filebuffer;
-			return getStrings(file, directory, false);
+			return getStrings(file, false);
 		}
 
 		char *old = filebuffer;
@@ -601,7 +601,7 @@
 	return _strings->get(id);
 }
 
-bool SmushPlayer::readString(const char *file, const char *directory) {
+bool SmushPlayer::readString(const char *file) {
 	const char *i = strrchr(file, '.');
 	if (i == NULL) {
 		error("invalid filename : %s", file);
@@ -609,11 +609,11 @@
 	char fname[260];
 	memcpy(fname, file, i - file);
 	strcpy(fname + (i - file), ".trs");
-	if ((_strings = getStrings(fname, directory, false)) != 0) {
+	if ((_strings = getStrings(fname, false)) != 0) {
 		return true;
 	}
 
-	if ((_strings = getStrings("digtxt.trs", directory, true)) != 0) {
+	if ((_strings = getStrings("digtxt.trs", true)) != 0) {
 		return true;
 	}
 	return false;
@@ -913,21 +913,21 @@
 	}
 }
 
-void SmushPlayer::setupAnim(const char *file, const char *directory) {
+void SmushPlayer::setupAnim(const char *file) {
 	Chunk *sub;
 	int i;
 	char file_font[11];
 
-	_base = new FileChunk(file, directory);
+	_base = new FileChunk(file);
 	sub = _base->subBlock();
 	checkBlock(*sub, TYPE_AHDR);
 	handleAnimHeader(*sub);
 
 	if (_insanity) {
 		if (!((_vm->_features & GF_DEMO) && (_vm->_features & GF_PC)))
-			readString("mineroad.trs", directory);
+			readString("mineroad.trs");
 	} else
-		readString(file, directory);
+		readString(file);
 
 	if (_vm->_gameId == GID_FT) {
 		if (!((_vm->_features & GF_DEMO) && (_vm->_features & GF_PC))) {
@@ -935,17 +935,17 @@
 			_sf[1] = new SmushFont(true, false);
 			_sf[2] = new SmushFont(true, false);
 			_sf[3] = new SmushFont(true, false);
-			_sf[0]->loadFont("scummfnt.nut", directory);
-			_sf[1]->loadFont("techfnt.nut", directory);
-			_sf[2]->loadFont("titlfnt.nut", directory);
-			_sf[3]->loadFont("specfnt.nut", directory);
+			_sf[0]->loadFont("scummfnt.nut");
+			_sf[1]->loadFont("techfnt.nut");
+			_sf[2]->loadFont("titlfnt.nut");
+			_sf[3]->loadFont("specfnt.nut");
 		}
 	} else if (_vm->_gameId == GID_DIG) {
 		if (!(_vm->_features & GF_DEMO)) {
 			for (i = 0; i < 4; i++) {
 				sprintf(file_font, "font%d.nut", i);
 				_sf[i] = new SmushFont(i != 0, false);
-				_sf[i]->loadFont(file_font, directory);
+				_sf[i]->loadFont(file_font);
 			}
 		}
 	} else if (_vm->_gameId == GID_CMI) {
@@ -954,7 +954,7 @@
 				break;
 			sprintf(file_font, "font%d.nut", i);
 			_sf[i] = new SmushFont(false, true);
-			_sf[i]->loadFont(file_font, directory);
+			_sf[i]->loadFont(file_font);
 		}
 	} else {
 		error("SmushPlayer::setupAnim() Unknown font setup for game");
@@ -1077,7 +1077,7 @@
 	_insanity = flag;
 }
 
-void SmushPlayer::seekSan(const char *file, const char *directory, int32 pos, int32 contFrame) {
+void SmushPlayer::seekSan(const char *file, int32 pos, int32 contFrame) {
 	if(_smixer)
 		_smixer->stop();
 
@@ -1087,7 +1087,7 @@
 			delete _base;
 		}
 
-		_base = new FileChunk(file, directory);
+		_base = new FileChunk(file);
 		// In this case we need to get palette and number of frames
 		if (pos > 8) {
 			Chunk *sub = _base->subBlock();
@@ -1113,11 +1113,11 @@
 	_frame = contFrame;
 }
 
-void SmushPlayer::play(const char *filename, const char *directory, int32 offset, int32 startFrame) {
+void SmushPlayer::play(const char *filename, int32 offset, int32 startFrame) {
 
 	// Verify the specified file exists
 	File f;
-	f.open(filename, directory);
+	f.open(filename);
 	if (!f.isOpen()) {
 		warning("SmushPlayer::play() File not found %s", filename);
 		return;
@@ -1130,7 +1130,7 @@
 	bool oldMouseState = _vm->_system->showMouse(false);
 
 	// Load the video
-	setupAnim(filename, directory);
+	setupAnim(filename);
 	init();
 
 	if (offset) {

Index: smush_player.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- smush_player.h	1 May 2004 18:53:03 -0000	1.31
+++ smush_player.h	27 Jun 2004 21:52:25 -0000	1.32
@@ -75,7 +75,7 @@
 	SmushPlayer(ScummEngine_v6 *scumm, int speed);
 	~SmushPlayer();
 
-	void play(const char *filename, const char *directory, int32 offset = 0, int32 startFrame = 0);
+	void play(const char *filename, int32 offset = 0, int32 startFrame = 0);
 
 protected:
 	SmushFont *_sf[5];
@@ -84,7 +84,7 @@
 	void insanity(bool);
 	void setPalette(const byte *palette);
 	void setPaletteValue(int n, byte r, byte g, byte b);
-	void seekSan(const char *file, const char *directory, int32 pos, int32 contFrame);
+	void seekSan(const char *file, int32 pos, int32 contFrame);
 	const char *getString(int id);
 
 private:
@@ -92,10 +92,10 @@
 	void parseNextFrame();
 	void init();
 	void release();
-	void setupAnim(const char *file, const char *directory);
+	void setupAnim(const char *file);
 	void updateScreen();
 
-	bool readString(const char *file, const char *directory);
+	bool readString(const char *file);
 	void checkBlock(const Chunk &, Chunk::type, uint32 = 0);
 	void handleAnimHeader(Chunk &);
 	void handleFrame(Chunk &);





More information about the Scummvm-git-logs mailing list