aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorMatthew Hoops2007-03-22 22:03:21 +0000
committerMatthew Hoops2007-03-22 22:03:21 +0000
commita722b767a8a24906b512a0381fb49b1bcd59aa92 (patch)
treea566489e001d00301015ac3d73a85bbc41fe2c58 /engines/agi
parent3daa442c82f0820493dc4e7bb078f44d9f5f0571 (diff)
downloadscummvm-rg350-a722b767a8a24906b512a0381fb49b1bcd59aa92.tar.gz
scummvm-rg350-a722b767a8a24906b512a0381fb49b1bcd59aa92.tar.bz2
scummvm-rg350-a722b767a8a24906b512a0381fb49b1bcd59aa92.zip
- adding support for saving AGIPAL games
- adding debug comment when using a new AGIPAL palette - changing so that only pal.101-109 files are used and not pal.100, as AGIPAL starts at 101 svn-id: r26277
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/graphics.cpp14
-rw-r--r--engines/agi/graphics.h3
-rw-r--r--engines/agi/op_cmd.cpp4
-rw-r--r--engines/agi/savegame.cpp11
4 files changed, 28 insertions, 4 deletions
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index 1b696dd333..d2a686d298 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -378,7 +378,12 @@ void GfxMgr::gfxSetPalette() {
//Gets AGIPAL Data
void GfxMgr::setAGIPal(int p0) {
- //report("Using AGIPAL hack\n");
+ //If 0 from savefile, do not use
+ if (p0 == 0)
+ return;
+
+ _agipalFileNum = p0;
+
Common::File agipal;
char filename[15];
@@ -406,10 +411,17 @@ void GfxMgr::setAGIPal(int p0) {
initPalette(_agipalPalette);
gfxSetPalette();
+
+ debug(1, "Using AGIPAL palette from pal.%d", p0);
+
free(palData);
palData = 0;
}
+int GfxMgr::getAGIPalFileNum() {
+ return _agipalFileNum;
+}
+
/* 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 3212f3cbbe..9c9dba0cb0 100644
--- a/engines/agi/graphics.h
+++ b/engines/agi/graphics.h
@@ -47,12 +47,14 @@ private:
uint8 *_shakeH, *_shakeV;
uint8 _agipalPalette[16 * 3];
+ int _agipalFileNum;
public:
GfxMgr(AgiEngine *vm) {
_vm = vm;
_shakeH = NULL;
_shakeV = NULL;
+ _agipalFileNum = 0;
}
void gfxPutBlock(int x1, int y1, int x2, int y2);
@@ -83,6 +85,7 @@ public:
void restoreBlock(int, int, int, int, uint8 *);
void initPalette(uint8 *);
void setAGIPal(int);
+ int getAGIPalFileNum();
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 d1f7053818..f9017da320 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -1227,10 +1227,10 @@ cmd(mouse_posn) {
cmd(shake_screen) {
int i;
- /* AGIPAL uses shake.screen values between 100 and 109 to
+ /* AGIPAL uses shake.screen values between 101 and 109 to
* set the palette.
*/
- if ((g_agi->getFeatures() & GF_AGIPAL) && p0 >= 100 && p0 < 110) {
+ if ((g_agi->getFeatures() & GF_AGIPAL) && p0 >= 101 && p0 < 110) {
g_gfx->setAGIPal(p0);
return;
} else
diff --git a/engines/agi/savegame.cpp b/engines/agi/savegame.cpp
index 8a58d67f58..566f2945b0 100644
--- a/engines/agi/savegame.cpp
+++ b/engines/agi/savegame.cpp
@@ -36,12 +36,13 @@
#include "agi/keyboard.h"
#include "agi/menu.h"
-#define SAVEGAME_VERSION 2
+#define SAVEGAME_VERSION 3
/*
* Version 0 (Sarien): view table has 64 entries
* Version 1 (Sarien): view table has 256 entries (needed in KQ3)
* Version 2 (ScummVM): first ScummVM version
+ * Version 3 (ScummVM): adding AGIPAL save/load support
*/
namespace Agi {
@@ -200,6 +201,10 @@ int AgiEngine::saveGame(const char *fileName, const char *description) {
}
out->writeByte(0);
+ //Write which file number AGIPAL is using (0 if not being used)
+ if ((getFeatures() & GF_AGIPAL))
+ out->writeSint16BE(_gfx->getAGIPalFileNum());
+
out->finalize();
if (out->ioFailed())
warning("Can't write file '%s'. (Disk full?)", fileName);
@@ -434,6 +439,10 @@ int AgiEngine::loadGame(const char *fileName) {
parm[3], parm[4], parm[5], parm[6]);
}
+ //Load AGIPAL Data
+ if ((getFeatures() & GF_AGIPAL) && (saveVersion >= 3))
+ _gfx->setAGIPal(in->readSint16BE());
+
delete in;
debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName);