[Scummvm-cvs-logs] CVS: scummvm/sword1 resman.cpp,1.7,1.8 resman.h,1.4,1.5

Robert G?ffringmann lavosspawn at users.sourceforge.net
Sat Dec 20 08:32:00 CET 2003


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1:/tmp/cvs-serv12960/sword1

Modified Files:
	resman.cpp resman.h 
Log Message:
I hope this fixes the control panel for other BS1 versions.

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/resman.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- resman.cpp	20 Dec 2003 09:12:54 -0000	1.7
+++ resman.cpp	20 Dec 2003 16:30:58 -0000	1.8
@@ -92,6 +92,10 @@
 		} else
 			_prj.clu[clusCnt] = NULL;
 	free(cluIndex);
+	
+	if (_prj.clu[3]->grp[5]->noRes == 29)
+        for (uint8 cnt = 0; cnt < 29; cnt++)
+			_srIdList[cnt] = 0x04050000 | cnt;
 }
 
 void ResMan::freeCluDescript(void) {
@@ -236,6 +240,8 @@
 BsMemHandle *ResMan::resHandle(uint32 id) {
 	uint8 cluster = (uint8)((id >> 24) - 1);
 	uint8 group = (uint8)(id >> 16);
+	if ((id >> 16) == 0x0405)
+		id = _srIdList[id & 0xFFFF];
 
 	return &(_prj.clu[cluster]->grp[group]->resHandle[id & 0xFFFF]);
 }
@@ -243,6 +249,8 @@
 uint32 ResMan::resLength(uint32 id) {
 	uint8 cluster = (uint8)((id >> 24) - 1);
 	uint8 group = (uint8)(id >> 16);
+	if ((id >> 16) == 0x0405)
+		id = _srIdList[id & 0xFFFF];
 
 	return _prj.clu[cluster]->grp[group]->length[id & 0xFFFF];
 }
@@ -250,6 +258,8 @@
 uint32 ResMan::resOffset(uint32 id) {
 	uint8 cluster = (uint8)((id >> 24) - 1);
 	uint8 group = (uint8)(id >> 16);
+	if ((id >> 16) == 0x0405)
+		id = _srIdList[id & 0xFFFF];
 
 	return _prj.clu[cluster]->grp[group]->offset[id & 0xFFFF];
 }
@@ -313,3 +323,35 @@
 		data++;
 	}
 }
+
+uint32 ResMan::_srIdList[29] = { // the file numbers differ for the control panel file IDs, so we need this array
+	0,
+	0x04050000,
+	0,
+	0x04050001,
+	0x04050002,
+	0x04050003,
+	0x04050004,
+	0x04050005,
+	0x04050006,
+	0x04050007,
+	0x04050000,
+	0x04050009,
+	0x0405000A,
+	0x0405000B,
+	0x0405000C,
+	0x0405000D,
+	0x0405000E,
+	0x0405000F,
+	0x04050010,
+	0x04050011,
+	0x04050012,
+	0x04050013,
+	0x04050014,
+	0x04050015,
+	0x04050016,
+	0x04050017,
+	0x04050018,
+	0x04050019,
+	0,
+};

Index: resman.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/resman.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- resman.h	20 Dec 2003 09:12:54 -0000	1.4
+++ resman.h	20 Dec 2003 16:30:58 -0000	1.5
@@ -61,9 +61,9 @@
 	Header *lockScript(uint32 scrID);
 	void unlockScript(uint32 scrID);
 	FrameHeader *fetchFrame(void *resourceData, uint32 frameNo);
-	uint32 resLength(uint32 id); // this should be private. it's used in SwordSound for endian conversion, though 
-							     // make it private again when the mixer supports little endian data.
 private:
+	uint32 filesInGroup(uint32 id);
+	uint32 resLength(uint32 id);
 	BsMemHandle *resHandle(uint32 id);
 	uint32 resOffset(uint32 id);
 	void openCptResourceBigEndian(uint32 id);
@@ -76,6 +76,7 @@
 	BsPrj _prj;
 	MemMan *_memMan;
 	static const uint32 _scriptList[TOTAL_SECTIONS];	//a table of resource tags
+	static uint32 _srIdList[29];
 };
 
 #endif //RESMAN_H





More information about the Scummvm-git-logs mailing list