[Scummvm-cvs-logs] scummvm master -> f33810a8c0617641d16953fd026b8598bd090a50

scott-t s at sthomas.id.au
Fri Apr 15 14:26:15 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:
8e9dbe5c3d GROOVIE: Use uint32 when searching for a video id by name
f33810a8c0 GROOVIE: Implement resource search-by-name for v2 games


Commit: 8e9dbe5c3dfde9e180cd1008cb888618f77c64fa
    https://github.com/scummvm/scummvm/commit/8e9dbe5c3dfde9e180cd1008cb888618f77c64fa
Author: Scott Thomas (scott_t at users.sourceforge.net)
Date: 2011-04-15T05:16:06-07:00

Commit Message:
GROOVIE: Use uint32 when searching for a video id by name

This brings ResMan::getRef into line with the rest of the engine.

Changed paths:
    engines/groovie/resource.cpp
    engines/groovie/resource.h
    engines/groovie/script.cpp
    engines/groovie/script.h



diff --git a/engines/groovie/resource.cpp b/engines/groovie/resource.cpp
index 5d4ccf7..179d746 100644
--- a/engines/groovie/resource.cpp
+++ b/engines/groovie/resource.cpp
@@ -92,7 +92,7 @@ ResMan_t7g::ResMan_t7g(Common::MacResManager *macResFork) : _macResFork(macResFo
 	}
 }
 
-uint16 ResMan_t7g::getRef(Common::String name, Common::String scriptname) {
+uint32 ResMan_t7g::getRef(Common::String name, Common::String scriptname) {
 	// Get the name of the RL file
 	Common::String rlFileName(t7g_gjds[_lastGjd]);
 	rlFileName += ".rl";
@@ -110,7 +110,7 @@ uint16 ResMan_t7g::getRef(Common::String name, Common::String scriptname) {
 	if (!rlFile)
 		error("Groovie::Resource: Couldn't open %s", rlFileName.c_str());
 
-	uint16 resNum;
+	uint32 resNum;
 	bool found = false;
 	for (resNum = 0; !found && !rlFile->err() && !rlFile->eos(); resNum++) {
 		// Read the resource name
@@ -134,7 +134,7 @@ uint16 ResMan_t7g::getRef(Common::String name, Common::String scriptname) {
 	// Verify we really found the resource
 	if (!found) {
 		error("Groovie::Resource: Couldn't find resource %s in %s", name.c_str(), rlFileName.c_str());
-		return (uint16)-1;
+		return (uint32)-1;
 	}
 
 	return (_lastGjd << 10) | (resNum - 1);
@@ -217,7 +217,7 @@ ResMan_v2::ResMan_v2() {
 	indexfile.close();
 }
 
-uint16 ResMan_v2::getRef(Common::String name, Common::String scriptname) {
+uint32 ResMan_v2::getRef(Common::String name, Common::String scriptname) {
 	return 0;
 }
 
diff --git a/engines/groovie/resource.h b/engines/groovie/resource.h
index ca2ea17..37fa50f 100644
--- a/engines/groovie/resource.h
+++ b/engines/groovie/resource.h
@@ -43,7 +43,7 @@ public:
 	virtual ~ResMan() {}
 
 	Common::SeekableReadStream *open(uint32 fileRef);
-	virtual uint16 getRef(Common::String name, Common::String scriptname = "") = 0;
+	virtual uint32 getRef(Common::String name, Common::String scriptname = "") = 0;
 
 protected:
 	Common::Array<Common::String> _gjds;
@@ -57,7 +57,7 @@ public:
 	ResMan_t7g(Common::MacResManager *macResFork = 0);
 	~ResMan_t7g() {}
 
-	uint16 getRef(Common::String name, Common::String scriptname);
+	uint32 getRef(Common::String name, Common::String scriptname);
 	bool getResInfo(uint32 fileRef, ResInfo &resInfo);
 
 private:
@@ -69,7 +69,7 @@ public:
 	ResMan_v2();
 	~ResMan_v2() {}
 
-	uint16 getRef(Common::String name, Common::String scriptname);
+	uint32 getRef(Common::String name, Common::String scriptname);
 	bool getResInfo(uint32 fileRef, ResInfo &resInfo);
 };
 
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index 175a41b..9b58f8b 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -320,7 +320,7 @@ uint8 Script::readScriptChar(bool allow7C, bool limitVal, bool limitVar) {
 	return result;
 }
 
-uint16 Script::getVideoRefString() {
+uint32 Script::getVideoRefString() {
 	Common::String str;
 	byte c;
 
@@ -1015,7 +1015,7 @@ void Script::o_add() {
 
 void Script::o_videofromstring1() {
 	uint16 instStart = _currentInstruction;
-	uint16 fileref = getVideoRefString();
+	uint32 fileref = getVideoRefString();
 
 	// Show the debug information just when starting the playback
 	if (fileref != _videoRef) {
@@ -1031,7 +1031,7 @@ void Script::o_videofromstring1() {
 
 void Script::o_videofromstring2() {
 	uint16 instStart = _currentInstruction;
-	uint16 fileref = getVideoRefString();
+	uint32 fileref = getVideoRefString();
 
 	// Show the debug information just when starting the playback
 	if (fileref != _videoRef) {
diff --git a/engines/groovie/script.h b/engines/groovie/script.h
index cda87a8..b959810 100644
--- a/engines/groovie/script.h
+++ b/engines/groovie/script.h
@@ -137,7 +137,7 @@ private:
 	uint16 readScript8or16bits();
 	uint8 readScriptChar(bool allow7C, bool limitVal, bool limitVar);
 	uint8 readScriptVar();
-	uint16 getVideoRefString();
+	uint32 getVideoRefString();
 
 	bool hotspot(Common::Rect rect, uint16 addr, uint8 cursor);
 


Commit: f33810a8c0617641d16953fd026b8598bd090a50
    https://github.com/scummvm/scummvm/commit/f33810a8c0617641d16953fd026b8598bd090a50
Author: Scott Thomas (scott_t at users.sourceforge.net)
Date: 2011-04-15T05:16:08-07:00

Commit Message:
GROOVIE: Implement resource search-by-name for v2 games

Changed paths:
    engines/groovie/resource.cpp



diff --git a/engines/groovie/resource.cpp b/engines/groovie/resource.cpp
index 179d746..9c4e6fb 100644
--- a/engines/groovie/resource.cpp
+++ b/engines/groovie/resource.cpp
@@ -218,7 +218,41 @@ ResMan_v2::ResMan_v2() {
 }
 
 uint32 ResMan_v2::getRef(Common::String name, Common::String scriptname) {
-	return 0;
+	// Open the RL file
+	Common::File rlFile;
+	if (!rlFile.open("dir.rl")) {
+		error("Groovie::Resource: Couldn't open dir.rl");
+		return false;
+	}
+
+	uint32 resNum;
+	bool found = false;
+	for (resNum = 0; !found && !rlFile.err() && !rlFile.eos(); resNum++) {
+		// Seek past metadata
+		rlFile.seek(14, SEEK_CUR);
+
+		// Read the resource name
+		char readname[18];
+		rlFile.read(readname, 18);
+
+		// Test whether it's the resource we're searching
+		Common::String resname(readname, 18);
+		if (resname.hasPrefix(name.c_str())) {
+			debugC(2, kGroovieDebugResource | kGroovieDebugAll, "Groovie::Resource: Resource %12s matches %s", readname, name.c_str());
+			found = true;
+		}
+	}
+
+	// Close the RL file
+	rlFile.close();
+
+	// Verify we really found the resource
+	if (!found) {
+		error("Groovie::Resource: Couldn't find resource %s", name.c_str());
+		return (uint32)-1;
+	}
+
+	return resNum;
 }
 
 bool ResMan_v2::getResInfo(uint32 fileRef, ResInfo &resInfo) {






More information about the Scummvm-git-logs mailing list