[Scummvm-cvs-logs] SF.net SVN: scummvm: [26270] scummvm/trunk/engines/agi

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Wed Mar 21 21:13:40 CET 2007


Revision: 26270
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26270&view=rev
Author:   mthreepwood
Date:     2007-03-21 13:13:40 -0700 (Wed, 21 Mar 2007)

Log Message:
-----------
adding AGIPAL support (for changing palettes in some fan games) Patch:1684685

Modified Paths:
--------------
    scummvm/trunk/engines/agi/graphics.cpp
    scummvm/trunk/engines/agi/graphics.h
    scummvm/trunk/engines/agi/op_cmd.cpp

Modified: scummvm/trunk/engines/agi/graphics.cpp
===================================================================
--- scummvm/trunk/engines/agi/graphics.cpp	2007-03-21 19:42:09 UTC (rev 26269)
+++ scummvm/trunk/engines/agi/graphics.cpp	2007-03-21 20:13:40 UTC (rev 26270)
@@ -22,6 +22,7 @@
  *
  */
 
+#include "common/file.h"
 #include "common/stdafx.h"
 
 #include "graphics/cursorman.h"
@@ -375,6 +376,40 @@
 	g_system->setPalette(pal, 0, 32);
 }
 
+//Gets AGIPAL Data
+void GfxMgr::setAGIPal(int p0) {
+	//report("Using AGIPAL hack\n");
+	Common::File agipal;
+
+	char filename[15];
+	uint32 fileSize;
+	sprintf(filename, "pal.%d", p0);
+	agipal.open(filename);
+	fileSize = agipal.size();
+	byte *palData = (byte *)malloc(fileSize);
+	agipal.read(palData, fileSize);
+	agipal.close();
+
+	//Chunk0 holds colors 0-7
+	for (int i = 0; i < 8 * 3; i++)
+		_agipalPalette[i] = palData[i];
+	
+
+	//Chunk1 is the same as the chunk0
+	//Chunk2 chunk holds colors 8-15
+	int pos = 8 * 3;
+	for (int i = 24; i < 8 * 3 * 2; i++)
+		_agipalPalette[i] = palData[pos + i];
+
+	//Chunk3 is the same as the chunk2
+	//Chunks4-7 are duplicates of chunks0-3
+
+	initPalette(_agipalPalette);
+	gfxSetPalette();
+	free(palData);
+	palData = 0;
+}
+
 /* put a block onto the screen */
 void GfxMgr::gfxPutBlock(int x1, int y1, int x2, int y2) {
 	if (x1 >= GFX_WIDTH)

Modified: scummvm/trunk/engines/agi/graphics.h
===================================================================
--- scummvm/trunk/engines/agi/graphics.h	2007-03-21 19:42:09 UTC (rev 26269)
+++ scummvm/trunk/engines/agi/graphics.h	2007-03-21 20:13:40 UTC (rev 26270)
@@ -46,6 +46,8 @@
 
 	uint8 *_shakeH, *_shakeV;
 
+	uint8 _agipalPalette[16 * 3];
+
 public:
 	GfxMgr(AgiEngine *vm) {
 		_vm = vm;
@@ -80,6 +82,7 @@
 	void saveBlock(int, int, int, int, uint8 *);
 	void restoreBlock(int, int, int, int, uint8 *);
 	void initPalette(uint8 *);
+	void setAGIPal(int);
 	void drawFrame(int x1, int y1, int x2, int y2, int c1, int c2);
 
 	void putPixel(int, int, int);

Modified: scummvm/trunk/engines/agi/op_cmd.cpp
===================================================================
--- scummvm/trunk/engines/agi/op_cmd.cpp	2007-03-21 19:42:09 UTC (rev 26269)
+++ scummvm/trunk/engines/agi/op_cmd.cpp	2007-03-21 20:13:40 UTC (rev 26270)
@@ -1231,7 +1231,7 @@
 	 * set the palette.
 	 */
 	if ((g_agi->getFeatures() & GF_AGIPAL) && p0 >= 100 && p0 < 110) {
-		report("not implemented: AGIPAL palettes\n");
+		g_gfx->setAGIPal(p0);
 		return;
 	} else
 		g_gfx->shakeStart();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list