aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorMatthew Hoops2007-03-21 20:13:40 +0000
committerMatthew Hoops2007-03-21 20:13:40 +0000
commit080a76503b28ef794ff654a9642c83bb4b67389a (patch)
tree4d94670025ec03725ed30c4d129c04d314f03b01 /engines/agi
parent89ea1f3abf2281d1f8786c1eb5cce31c7d5404e0 (diff)
downloadscummvm-rg350-080a76503b28ef794ff654a9642c83bb4b67389a.tar.gz
scummvm-rg350-080a76503b28ef794ff654a9642c83bb4b67389a.tar.bz2
scummvm-rg350-080a76503b28ef794ff654a9642c83bb4b67389a.zip
adding AGIPAL support (for changing palettes in some fan games) Patch:1684685
svn-id: r26270
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/graphics.cpp35
-rw-r--r--engines/agi/graphics.h3
-rw-r--r--engines/agi/op_cmd.cpp2
3 files changed, 39 insertions, 1 deletions
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index ca2c13c2bf..1b696dd333 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -22,6 +22,7 @@
*
*/
+#include "common/file.h"
#include "common/stdafx.h"
#include "graphics/cursorman.h"
@@ -375,6 +376,40 @@ void GfxMgr::gfxSetPalette() {
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)
diff --git a/engines/agi/graphics.h b/engines/agi/graphics.h
index 1fdfbf7d97..3212f3cbbe 100644
--- a/engines/agi/graphics.h
+++ b/engines/agi/graphics.h
@@ -46,6 +46,8 @@ private:
uint8 *_shakeH, *_shakeV;
+ uint8 _agipalPalette[16 * 3];
+
public:
GfxMgr(AgiEngine *vm) {
_vm = vm;
@@ -80,6 +82,7 @@ public:
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);
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 39f45a1105..d1f7053818 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -1231,7 +1231,7 @@ cmd(shake_screen) {
* 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();