[Scummvm-cvs-logs] SF.net SVN: scummvm: [24284] scummvm/trunk/engines/agos
kirben at users.sourceforge.net
kirben at users.sourceforge.net
Fri Oct 13 04:22:42 CEST 2006
Revision: 24284
http://svn.sourceforge.net/scummvm/?rev=24284&view=rev
Author: kirben
Date: 2006-10-12 19:22:33 -0700 (Thu, 12 Oct 2006)
Log Message:
-----------
Fix display of icons in Elvira 1
Modified Paths:
--------------
scummvm/trunk/engines/agos/agos.cpp
scummvm/trunk/engines/agos/icons.cpp
scummvm/trunk/engines/agos/window.cpp
Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp 2006-10-12 05:54:18 UTC (rev 24283)
+++ scummvm/trunk/engines/agos/agos.cpp 2006-10-13 02:22:33 UTC (rev 24284)
@@ -800,7 +800,7 @@
if (subUserFlag == NULL)
return 0;
- if (a < 0 || a > 3)
+ if (a < 0 || a > 7)
return 0;
return subUserFlag->userFlags[a];
@@ -814,8 +814,10 @@
subUserFlag = (SubUserFlag *) allocateChildBlock(item, 9, sizeof(SubUserFlag));
}
- if (a >= 0 && a <= 3)
- subUserFlag->userFlags[a] = b;
+ if (a < 0 || a > 7)
+ return;
+
+ subUserFlag->userFlags[a] = b;
}
int AGOSEngine::getUserItem(Item *item, int n) {
@@ -1300,14 +1302,18 @@
}
uint AGOSEngine::itemGetIconNumber(Item *item) {
- SubObject *child = (SubObject *)findChildOfType(item, 2);
- uint offs;
+ if (getGameType() == GType_ELVIRA1) {
+ return getUserFlag(item, 7);
+ } else {
+ SubObject *child = (SubObject *)findChildOfType(item, 2);
+ uint offs;
- if (child == NULL || !(child->objectFlags & kOFIcon))
- return 0;
+ if (child == NULL || !(child->objectFlags & kOFIcon))
+ return 0;
- offs = getOffsetOfChild2Param(child, 0x10);
- return child->objectFlagValue[offs];
+ offs = getOffsetOfChild2Param(child, 0x10);
+ return child->objectFlagValue[offs];
+ }
}
void AGOSEngine::hitarea_stuff() {
Modified: scummvm/trunk/engines/agos/icons.cpp
===================================================================
--- scummvm/trunk/engines/agos/icons.cpp 2006-10-12 05:54:18 UTC (rev 24283)
+++ scummvm/trunk/engines/agos/icons.cpp 2006-10-13 02:22:33 UTC (rev 24284)
@@ -63,40 +63,44 @@
// Thanks to Stuart Caie for providing the original
// C conversion upon which this function is based.
-void decompressIconAmiga (byte *dst, byte *src, byte base, uint pitch) {
+static void decompressIconAmiga(byte *dst, byte *src, byte base, uint pitch, bool decompress = true) {
byte icon_pln[288];
- byte *i, *o, x, y;
+ byte *i, *o, *srcPtr, x, y;
- // Decode RLE planar icon data
- i = src;
- o = icon_pln;
- while (o < &icon_pln[288]) {
- x = *i++;
- if (x < 128) {
- do {
- *o++ = *i++;
- *o++ = *i++;
- *o++ = *i++;
- } while (x-- > 0);
- } else {
- x = 256 - x;
- do {
- *o++ = i[0];
- *o++ = i[1];
- *o++ = i[2];
- } while (x-- > 0);
- i += 3;
+ srcPtr = src;
+ if (decompress) {
+ // Decode RLE planar icon data
+ i = src;
+ o = icon_pln;
+ while (o < &icon_pln[288]) {
+ x = *i++;
+ if (x < 128) {
+ do {
+ *o++ = *i++;
+ *o++ = *i++;
+ *o++ = *i++;
+ } while (x-- > 0);
+ } else {
+ x = 256 - x;
+ do {
+ *o++ = i[0];
+ *o++ = i[1];
+ *o++ = i[2];
+ } while (x-- > 0);
+ i += 3;
+ }
}
+ srcPtr = icon_pln;
}
// Translate planar data to chunky (very slow method)
for (y = 0; y < 24; y++) {
for (x = 0; x < 24; x++) {
byte pixel =
- (icon_pln[(( y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 1 : 0)
- | (icon_pln[((24 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 2 : 0)
- | (icon_pln[((48 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 4 : 0)
- | (icon_pln[((72 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 8 : 0);
+ (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);
if (pixel)
dst[x] = pixel | base;
}
@@ -171,7 +175,6 @@
dst = getFrontBuf();
if (getGameType() == GType_SIMON2) {
- // Simon 2
dst += 110;
dst += x;
dst += (y + window->y) * _dxSurfacePitch;
@@ -184,19 +187,25 @@
src += READ_LE_UINT16(&((uint16 *)src)[icon * 2 + 1]);
decompressIcon(dst, src, 20, 10, 208, _dxSurfacePitch);
} else if (getGameType() == GType_SIMON1) {
- // Simon 1
dst += (x + window->x) * 8;
dst += (y * 25 + window->y) * _dxSurfacePitch;
if (getPlatform() == Common::kPlatformAmiga) {
src = _iconFilePtr;
src += READ_BE_UINT32(&((uint32 *)src)[icon]);
- decompressIconAmiga (dst, src, 16, _dxSurfacePitch);
+ decompressIconAmiga(dst, src, 16, _dxSurfacePitch);
} else {
src = _iconFilePtr;
src += READ_LE_UINT16(&((uint16 *)src)[icon]);
decompressIcon(dst, src, 24, 12, 224, _dxSurfacePitch);
}
+ } else if (getGameType() == GType_ELVIRA1) {
+ dst += (x + window->x) * 8;
+ dst += (y * 8 + window->y) * _dxSurfacePitch;
+
+ src = _iconFilePtr;
+ src += icon * 288;
+ decompressIconAmiga(dst, src, 16, _dxSurfacePitch, false);
} else {
// TODO
}
Modified: scummvm/trunk/engines/agos/window.cpp
===================================================================
--- scummvm/trunk/engines/agos/window.cpp 2006-10-12 05:54:18 UTC (rev 24283)
+++ scummvm/trunk/engines/agos/window.cpp 2006-10-13 02:22:33 UTC (rev 24284)
@@ -59,6 +59,10 @@
window->textColumnOffset = 0;
window->textMaxLength = window->width * 8 / 6; // characters are 6 pixels
window->scrollY = 0;
+
+ if (getGameType() == GType_ELVIRA1)
+ clearWindow(window);
+
return window;
}
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