[Scummvm-cvs-logs] CVS: scummvm/scumm palette.cpp,2.31,2.32 room.cpp,1.4,1.5 script_v100he.cpp,2.125,2.126 script_v6.cpp,1.431,1.432 script_v6he.cpp,2.154,2.155 script_v72he.cpp,2.260,2.261 script_v8.cpp,2.288,2.289 scumm.h,1.579,1.580

kirben kirben at users.sourceforge.net
Sun Apr 17 05:56:25 CEST 2005


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

Modified Files:
	palette.cpp room.cpp script_v100he.cpp script_v6.cpp 
	script_v6he.cpp script_v72he.cpp script_v8.cpp scumm.h 
Log Message:

Add separate function for loading palette from choosen room.
Avoid pointer problems.


Index: palette.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/palette.cpp,v
retrieving revision 2.31
retrieving revision 2.32
diff -u -d -r2.31 -r2.32
--- palette.cpp	10 Apr 2005 12:58:56 -0000	2.31
+++ palette.cpp	17 Apr 2005 12:55:41 -0000	2.32
@@ -857,14 +857,24 @@
 	setDirtyColors(idx, idx);
 }
 
-void ScummEngine::setPalette(int palindex, int room) {
+void ScummEngine::setPalette(int palindex) {
 	const byte *pals;
 
 	_curPalIndex = palindex;
-	pals = getPalettePtr(_curPalIndex, room);
+	pals = getPalettePtr(_curPalIndex, _roomResource);
 	setPaletteFromPtr(pals);
 }
 
+void ScummEngine::setRoomPalette(int palindex, int room) {
+	const byte *roomptr = getResourceAddress(rtRoom, room);
+	assert(roomptr);
+	const byte *pals = findResource(MKID('PALS'), roomptr);
+	assert(pals);
+	const byte *rgbs = findPalInPals(pals, palindex);
+	assert(rgbs);
+	setPaletteFromPtr(rgbs);
+}
+
 const byte *ScummEngine::findPalInPals(const byte *pal, int idx) {
 	const byte *offs;
 	uint32 size;

Index: room.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/room.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- room.cpp	10 Apr 2005 22:43:46 -0000	1.4
+++ room.cpp	17 Apr 2005 12:55:41 -0000	1.5
@@ -519,7 +519,7 @@
 	}
 
 	if (_PALS_offs || _CLUT_offs)
-		setPalette(0, _roomResource);
+		setPalette(0);
 
 	initBGBuffers(_roomHeight);
 }

Index: script_v100he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v100he.cpp,v
retrieving revision 2.125
retrieving revision 2.126
diff -u -d -r2.125 -r2.126
--- script_v100he.cpp	14 Apr 2005 06:06:58 -0000	2.125
+++ script_v100he.cpp	17 Apr 2005 12:55:41 -0000	2.126
@@ -1573,13 +1573,13 @@
 
 	case 134:		// SO_ROOM_NEW_PALETTE
 		a = pop();
-		setPalette(a, _roomResource);
+		setPalette(a);
 		break;
 
 	case 135:
 		b = pop();
 		a = pop();
-		setPalette(a, b);
+		setRoomPalette(a, b);
 		break;
 
 	case 136:		// SO_ROOM_SAVEGAME

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.431
retrieving revision 1.432
diff -u -d -r1.431 -r1.432
--- script_v6.cpp	16 Apr 2005 10:26:49 -0000	1.431
+++ script_v6.cpp	17 Apr 2005 12:55:41 -0000	1.432
@@ -1757,7 +1757,7 @@
 		if (_gameId == GID_SAMNMAX && vm.slot[_currentScript].number == 64)
 			setDirtyColors(0, 255);
 		else
-			setPalette(a, _roomResource);
+			setPalette(a);
 		break;
 	default:
 		error("o6_roomOps: default case %d", op);

Index: script_v6he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6he.cpp,v
retrieving revision 2.154
retrieving revision 2.155
diff -u -d -r2.154 -r2.155
--- script_v6he.cpp	16 Apr 2005 11:01:30 -0000	2.154
+++ script_v6he.cpp	17 Apr 2005 12:55:42 -0000	2.155
@@ -526,7 +526,7 @@
 
 	case 213:		// SO_ROOM_NEW_PALETTE
 		a = pop();
-		setPalette(a, _roomResource);
+		setPalette(a);
 		break;
 	case 220:
 		a = pop();
@@ -549,7 +549,7 @@
 	case 236:		// HE 7.2
 		b = pop();
 		a = pop();
-		setPalette(a, b);
+		setRoomPalette(a, b);
 		break;
 	default:
 		error("o60_roomOps: default case %d", op);

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.260
retrieving revision 2.261
diff -u -d -r2.260 -r2.261
--- script_v72he.cpp	16 Apr 2005 15:26:19 -0000	2.260
+++ script_v72he.cpp	17 Apr 2005 12:55:42 -0000	2.261
@@ -1043,7 +1043,7 @@
 
 	case 213:		// SO_ROOM_NEW_PALETTE
 		a = pop();
-		setPalette(a, _roomResource);
+		setPalette(a);
 		break;
 
 	case 220:
@@ -1068,7 +1068,7 @@
 	case 236:
 		b = pop();
 		a = pop();
-		setPalette(a, b);
+		setRoomPalette(a, b);
 		break;
 
 	default:

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.288
retrieving revision 2.289
diff -u -d -r2.288 -r2.289
--- script_v8.cpp	9 Apr 2005 09:57:54 -0000	2.288
+++ script_v8.cpp	17 Apr 2005 12:55:42 -0000	2.289
@@ -868,7 +868,7 @@
 		break;
 	case 0x5C:		// SO_ROOM_NEW_PALETTE New palette
 		a = pop();
-		setPalette(a, _roomResource);
+		setPalette(a);
 		break;
 	case 0x5D:		// SO_ROOM_SAVE_GAME Save game
 		_saveTemporaryState = true;

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.579
retrieving revision 1.580
diff -u -d -r1.579 -r1.580
--- scumm.h	16 Apr 2005 14:59:15 -0000	1.579
+++ scumm.h	17 Apr 2005 12:55:42 -0000	1.580
@@ -978,7 +978,8 @@
 	void setupEGAPalette();
 	void setupV1ManiacPalette();
 	void setupV1ZakPalette();
-	void setPalette(int pal, int room);
+	void setPalette(int pal);
+	void setRoomPalette(int pal, int room);
 	virtual void setPaletteFromPtr(const byte *ptr, int numcolor = -1);
 	virtual void setPalColor(int index, int r, int g, int b);
 	void setDirtyColors(int min, int max);





More information about the Scummvm-git-logs mailing list