[Scummvm-cvs-logs] SF.net SVN: scummvm: [26277] scummvm/trunk/engines/agi
mthreepwood at users.sourceforge.net
mthreepwood at users.sourceforge.net
Thu Mar 22 23:03:21 CET 2007
Revision: 26277
http://scummvm.svn.sourceforge.net/scummvm/?rev=26277&view=rev
Author: mthreepwood
Date: 2007-03-22 15:03:21 -0700 (Thu, 22 Mar 2007)
Log Message:
-----------
- 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
Modified Paths:
--------------
scummvm/trunk/engines/agi/graphics.cpp
scummvm/trunk/engines/agi/graphics.h
scummvm/trunk/engines/agi/op_cmd.cpp
scummvm/trunk/engines/agi/savegame.cpp
Modified: scummvm/trunk/engines/agi/graphics.cpp
===================================================================
--- scummvm/trunk/engines/agi/graphics.cpp 2007-03-22 19:49:15 UTC (rev 26276)
+++ scummvm/trunk/engines/agi/graphics.cpp 2007-03-22 22:03:21 UTC (rev 26277)
@@ -378,7 +378,12 @@
//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 @@
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)
Modified: scummvm/trunk/engines/agi/graphics.h
===================================================================
--- scummvm/trunk/engines/agi/graphics.h 2007-03-22 19:49:15 UTC (rev 26276)
+++ scummvm/trunk/engines/agi/graphics.h 2007-03-22 22:03:21 UTC (rev 26277)
@@ -47,12 +47,14 @@
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 @@
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);
Modified: scummvm/trunk/engines/agi/op_cmd.cpp
===================================================================
--- scummvm/trunk/engines/agi/op_cmd.cpp 2007-03-22 19:49:15 UTC (rev 26276)
+++ scummvm/trunk/engines/agi/op_cmd.cpp 2007-03-22 22:03:21 UTC (rev 26277)
@@ -1227,10 +1227,10 @@
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
Modified: scummvm/trunk/engines/agi/savegame.cpp
===================================================================
--- scummvm/trunk/engines/agi/savegame.cpp 2007-03-22 19:49:15 UTC (rev 26276)
+++ scummvm/trunk/engines/agi/savegame.cpp 2007-03-22 22:03:21 UTC (rev 26277)
@@ -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 @@
}
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 @@
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);
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