aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2007-05-16 12:58:47 +0000
committerTravis Howell2007-05-16 12:58:47 +0000
commitbf3b58e7cf1d896ffc3ce957d9ed826789558a22 (patch)
tree04605f2607cbe82006a0095e35911a82103fc3c6
parent2783526b714e28be62bf335de6c5b66e9835f121 (diff)
downloadscummvm-rg350-bf3b58e7cf1d896ffc3ce957d9ed826789558a22.tar.gz
scummvm-rg350-bf3b58e7cf1d896ffc3ce957d9ed826789558a22.tar.bz2
scummvm-rg350-bf3b58e7cf1d896ffc3ce957d9ed826789558a22.zip
Add code for handling special walls in Elvira 1/2.
svn-id: r26853
-rw-r--r--engines/agos/draw.cpp91
-rw-r--r--engines/agos/icons.cpp31
2 files changed, 111 insertions, 11 deletions
diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp
index d5345c9071..5b5b42cbbb 100644
--- a/engines/agos/draw.cpp
+++ b/engines/agos/draw.cpp
@@ -164,6 +164,29 @@ void AGOSEngine::animateSprites() {
_vgaSpriteChanged++;
}
+ if ((getGameType() == GType_ELVIRA1 && !_variableArray[293] ||
+ getGameType() == GType_ELVIRA2 && !_variableArray[71]) &&
+ _wallOn) {
+
+ VC10_state state;
+ state.srcPtr = getBackGround() + 504;
+ state.height = 127;
+ state.width = 14;
+ state.y = 0;
+ state.x = 0;
+ state.palette = 0;
+ state.paletteMod = 0;
+ state.flags = kDFNonTrans;
+
+ _windowNum = 4;
+
+ _backFlag = 1;
+ drawImage(&state);
+ _backFlag = 0;
+
+ _vgaSpriteChanged++;
+ }
+
if (!_scrollFlag && !_vgaSpriteChanged) {
return;
}
@@ -201,6 +224,74 @@ void AGOSEngine::animateSprites() {
vsp++;
}
+ if (getGameType() == GType_ELVIRA1 && _variableArray[293]) {
+ debug(0, "Using special wall");
+
+ uint8 color, h, len;
+ byte *dst = _window4BackScn;
+
+ color = (_variableArray[293] & 1) ? 13 : 15;
+ _wallOn = 2;
+
+ h = 127;
+ while (h) {
+ len = 112;
+ while (len--) {
+ *dst++ = color;
+ dst++;
+ }
+
+ h--;
+ if (h == 0)
+ break;
+
+ len = 112;
+ while (len--) {
+ dst++;
+ *dst++ = color;
+ }
+ h--;
+ }
+
+ _window4Flag = 1;
+ setMoveRect(0, 224, 0, 127);
+ } else if (getGameType() == GType_ELVIRA2 && _variableArray[71] & 2) {
+ debug(0, "Using special wall");
+
+ uint8 color, h, len;
+ byte *dst = _window4BackScn;
+
+ color = 1;
+ _wallOn = 2;
+
+ h = 43;
+ while (h) {
+ len = 56;
+ while (len--) {
+ *dst++ = color;
+ dst += 3;
+ }
+
+ h--;
+ if (h == 0)
+ break;
+
+ dst += 448;
+
+ len = 56;
+ while (len--) {
+ dst += 2;
+ *dst++ = color;
+ dst++;
+ }
+ dst += 448;
+ h--;
+ }
+
+ _window4Flag = 1;
+ setMoveRect(0, 224, 0, 127);
+ }
+
if (_window6Flag == 1)
_window6Flag++;
diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp
index 1e83420d8f..85c8ae57a5 100644
--- a/engines/agos/icons.cpp
+++ b/engines/agos/icons.cpp
@@ -64,6 +64,8 @@ void AGOSEngine::loadIconData() {
// Thanks to Stuart Caie for providing the original
// C conversion upon which this function is based.
static void decompressIconPlanar(byte *dst, byte *src, uint width, uint height, byte base, uint pitch, bool decompress = true) {
+ printf("decompressIconPlanar\n");
+
byte icon_pln[288];
byte *i, *o, *srcPtr, x, y;
@@ -72,7 +74,7 @@ static void decompressIconPlanar(byte *dst, byte *src, uint width, uint height,
// Decode RLE planar icon data
i = src;
o = icon_pln;
- while (o < &icon_pln[288]) {
+ while (o < &icon_pln[width * height / 2]) {
x = *i++;
if (x < 128) {
do {
@@ -93,14 +95,16 @@ static void decompressIconPlanar(byte *dst, byte *src, uint width, uint height,
srcPtr = icon_pln;
}
+ printf("decompressIconPlanar: Decompressed\n");
+
// Translate planar data to chunky (very slow method)
- for (y = 0; y < 24; y++) {
- for (x = 0; x < 24; x++) {
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
byte pixel =
- (srcPtr[(( y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 1 : 0)
- | (srcPtr[((24 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 2 : 0)
- | (srcPtr[((48 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 4 : 0)
- | (srcPtr[((72 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 8 : 0);
+ (srcPtr[((height * 0 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 1 : 0)
+ | (srcPtr[((height * 1 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 2 : 0)
+ | (srcPtr[((height * 2 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 4 : 0)
+ | (srcPtr[((height * 3 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 8 : 0);
if (pixel)
dst[x] = pixel | base;
}
@@ -207,7 +211,7 @@ void AGOSEngine_Simon1::drawIcon(WindowBlock *window, uint icon, uint x, uint y)
} else {
src = _iconFilePtr;
src += READ_LE_UINT16(&((uint16 *)src)[icon]);
- decompressIcon(dst, src, 24, 12, 224, _dxSurfacePitch);
+ decompressIcon(dst, src, 24, 24, 224, _dxSurfacePitch);
}
_lockWord &= ~0x8000;
@@ -225,8 +229,13 @@ void AGOSEngine_Waxworks::drawIcon(WindowBlock *window, uint icon, uint x, uint
uint8 color = dst[0] & 0xF0;
if (getPlatform() == Common::kPlatformAmiga) {
- // TODO
- return;
+ src = _iconFilePtr;
+ src += READ_BE_UINT16(&((uint16 *)src)[icon]);
+
+
+ //decompressIcon(dst, src, 24, 10, color, _dxSurfacePitch);
+
+ decompressIconPlanar(dst, src, 24, 24, color, _dxSurfacePitch);
} else {
src = _iconFilePtr;
src += READ_LE_UINT16(&((uint16 *)src)[icon]);
@@ -254,7 +263,7 @@ void AGOSEngine_Elvira2::drawIcon(WindowBlock *window, uint icon, uint x, uint y
} else {
src = _iconFilePtr;
src += READ_LE_UINT16(&((uint16 *)src)[icon]);
- decompressIcon(dst, src, 24, 12, color, _dxSurfacePitch);
+ decompressIcon(dst, src, 24, 24, color, _dxSurfacePitch);
}
_lockWord &= ~0x8000;