[Scummvm-cvs-logs] CVS: scummvm/sword2 anims.cpp,1.60,1.61 build_display.cpp,1.60,1.61 function.cpp,1.62,1.63 header.h,1.10,1.11

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Tue Jun 8 23:34:05 CEST 2004


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

Modified Files:
	anims.cpp build_display.cpp function.cpp header.h 
Log Message:
Cleaned up the palette handling a bit. Renamed _palCopy to _palette since I
found the old name misleading (there is only one array that stores the
palette in the engine, though it could be argued that it's a copy of the
one used by the backend), and removed some code that I'm almost certain was
never used. (I've added assert()s to trigger in the cases where it would
have been used.)


Index: anims.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/anims.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- anims.cpp	7 May 2004 19:56:18 -0000	1.60
+++ anims.cpp	9 Jun 2004 06:33:25 -0000	1.61
@@ -588,10 +588,10 @@
 
 	// zero the entire palette in case we're about to fade up!
 
-	PalEntry pal[256];
+	byte pal[4 * 256];
 
-	memset(pal, 0, 256 * sizeof(PalEntry));
-	_vm->_graphics->setPalette(0, 256, (byte *) pal, RDPAL_INSTANT);
+	memset(pal, 0, sizeof(pal));
+	_vm->_graphics->setPalette(0, 256, pal, RDPAL_INSTANT);
 
 	debug(5, "fnPlaySequence FINISHED");
 	return IR_CONT;

Index: build_display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/build_display.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- build_display.cpp	24 Apr 2004 12:29:35 -0000	1.60
+++ build_display.cpp	9 Jun 2004 06:33:27 -0000	1.61
@@ -119,8 +119,8 @@
  */
 
 void Sword2Engine::displayMsg(byte *text, int time) {
-	PalEntry pal[256];
-	PalEntry oldPal[256];
+	byte pal[256 * 4];
+	byte oldPal[256 * 4];
 
 	debug(2, "DisplayMsg: %s", text);
 	
@@ -159,14 +159,14 @@
 	if (rv)
 		error("Driver Error %.8x (in DisplayMsg)", rv);
 
-	memcpy((char *) oldPal, (char *) _graphics->_palCopy, 256 * sizeof(PalEntry));
+	memcpy(oldPal, _graphics->_palette, sizeof(oldPal));
+	memset(pal, 0, sizeof(pal));
 
-	memset(pal, 0, 256 * sizeof(PalEntry));
-	pal[187].red = 255;
-	pal[187].green = 255;
-	pal[187].blue = 255;
+	pal[187 * 4 + 0] = 255;
+	pal[187 * 4 + 1] = 255;
+	pal[187 * 4 + 2] = 255;
 
-	_graphics->setPalette(0, 256, (byte *) pal, RDPAL_FADE);
+	_graphics->setPalette(0, 256, pal, RDPAL_FADE);
 	_graphics->fadeUp();
 	free(text_spr);
 	_graphics->waitForFade();
@@ -174,7 +174,8 @@
 	uint32 targetTime = _system->get_msecs() + (time * 1000);
 
 	sleepUntil(targetTime);
-	_graphics->setPalette(0, 256, (byte *) oldPal, RDPAL_FADE);
+	_graphics->setPalette(0, 256, oldPal, RDPAL_FADE);
+	_graphics->fadeUp();
 }
 
 /**

Index: function.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/function.cpp,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- function.cpp	9 May 2004 13:32:03 -0000	1.62
+++ function.cpp	9 Jun 2004 06:33:27 -0000	1.63
@@ -433,7 +433,7 @@
 	uint16 logoWidth = 0;
 	uint16 logoHeight = 0;
 	byte *logoData = NULL;
-	byte palette[1024];
+	byte palette[256 * 4];
 
 	if (f.open("credits.bmp")) {
 		logoWidth = f.readUint16LE();

Index: header.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/header.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- header.h	23 Apr 2004 07:01:38 -0000	1.10
+++ header.h	9 Jun 2004 06:33:28 -0000	1.11
@@ -194,15 +194,6 @@
 	uint32 maskOffset;
 } GCC_PACK;
 
-// Palette Data
-
-struct PalEntry {
-	uint8 red;
-	uint8 green;
-	uint8 blue;
-	uint8 alpha;
-} GCC_PACK;
-
 // Screen Header
 
 struct ScreenHeader {





More information about the Scummvm-git-logs mailing list