[Scummvm-cvs-logs] SF.net SVN: scummvm: [27045] scummvm/trunk/engines/agos
Kirben at users.sourceforge.net
Kirben at users.sourceforge.net
Sat Jun 2 07:27:35 CEST 2007
Revision: 27045
http://scummvm.svn.sourceforge.net/scummvm/?rev=27045&view=rev
Author: Kirben
Date: 2007-06-01 22:27:34 -0700 (Fri, 01 Jun 2007)
Log Message:
-----------
Fix inventory icons display in Amiga version of Waxworks.
Modified Paths:
--------------
scummvm/trunk/engines/agos/detection_tables.h
scummvm/trunk/engines/agos/icons.cpp
Modified: scummvm/trunk/engines/agos/detection_tables.h
===================================================================
--- scummvm/trunk/engines/agos/detection_tables.h 2007-06-01 23:12:22 UTC (rev 27044)
+++ scummvm/trunk/engines/agos/detection_tables.h 2007-06-02 05:27:34 UTC (rev 27045)
@@ -443,7 +443,6 @@
{ "icon.pkd", GAME_ICONFILE, "4822a91c18b1b2005ac17fc617f7dcbe", -1},
{ "menus.dat", GAME_MENUFILE, "3409eeb8ca8b46fc04da99de67573f5e", -1},
{ "start", GAME_RESTFILE, "b575b336e741dde1725edd4079d5ab67", -1},
- { "statelst", GAME_STATFILE, "469e98c69f00928a8366ba415d91902d", -1},
{ "stripped.txt", GAME_STRFILE, "6faaebff2786216900061eeb978f10af", -1},
{ "tbllist", GAME_TBLFILE, "95c44bfc380770a6b6dd0dfcc69e80a0", -1},
{ "xtbllist", GAME_XTBLFILE, "6c7b3db345d46349a5226f695c03e20f", -1},
Modified: scummvm/trunk/engines/agos/icons.cpp
===================================================================
--- scummvm/trunk/engines/agos/icons.cpp 2007-06-01 23:12:22 UTC (rev 27044)
+++ scummvm/trunk/engines/agos/icons.cpp 2007-06-02 05:27:34 UTC (rev 27045)
@@ -33,19 +33,32 @@
void AGOSEngine::loadIconFile() {
Common::File in;
- uint size;
+ uint32 srcSize;
in.open(getFileName(GAME_ICONFILE));
if (in.isOpen() == false)
error("Can't open icons file '%s'", getFileName(GAME_ICONFILE));
- size = in.size();
+ srcSize = in.size();
- _iconFilePtr = (byte *)malloc(size);
- if (_iconFilePtr == NULL)
- error("Out of icon memory");
+ if (getGameType() == GType_WW && getPlatform() == Common::kPlatformAmiga) {
+ byte *srcBuf = (byte *)malloc(srcSize);
+ in.read(srcBuf, srcSize);
- in.read(_iconFilePtr, size);
+ uint32 dstSize = READ_BE_UINT32(srcBuf + srcSize - 4);
+ _iconFilePtr = (byte *)malloc(dstSize);
+ if (_iconFilePtr == NULL)
+ error("Out of icon memory");
+
+ decrunchFile(srcBuf, _iconFilePtr, srcSize);
+ free(srcBuf);
+ } else {
+ _iconFilePtr = (byte *)malloc(srcSize);
+ if (_iconFilePtr == NULL)
+ error("Out of icon memory");
+
+ in.read(_iconFilePtr, srcSize);
+ }
in.close();
}
@@ -66,15 +79,19 @@
// 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) {
- byte icon_pln[288];
- byte *i, *o, *srcPtr, x, y;
+ byte *i, *icon_pln, *o, *srcPtr;
+ byte x, y;
+ icon_pln = 0;
srcPtr = src;
+
if (decompress) {
+ icon_pln = (byte *)calloc(width * height, 1);
+
// Decode RLE planar icon data
i = src;
o = icon_pln;
- while (o < &icon_pln[288]) {
+ while (o < &icon_pln[width * height]) {
x = *i++;
if (x < 128) {
do {
@@ -96,18 +113,20 @@
}
// Translate planar data to chunky (very slow method)
- for (y = 0; y < 24; y++) {
+ for (y = 0; y < height * 2; y++) {
for (x = 0; x < 24; 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 * 2 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 2 : 0)
+ | (srcPtr[((height * 4 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 4 : 0)
+ | (srcPtr[((height * 6 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 8 : 0);
if (pixel)
dst[x] = pixel | base;
}
dst += pitch;
}
+
+ free(icon_pln);
}
static void decompressIcon(byte *dst, byte *src, uint width, uint height, byte base, uint pitch) {
@@ -205,7 +224,7 @@
src = _iconFilePtr;
src += READ_BE_UINT32(&((uint32 *)src)[icon]);
uint8 color = (getFeatures() & GF_32COLOR) ? 16 : 240;
- decompressIconPlanar(dst, src, 24, 24, color, _dxSurfacePitch);
+ decompressIconPlanar(dst, src, 24, 12, color, _dxSurfacePitch);
} else {
src = _iconFilePtr;
src += READ_LE_UINT16(&((uint16 *)src)[icon]);
@@ -227,8 +246,9 @@
uint8 color = dst[0] & 0xF0;
if (getPlatform() == Common::kPlatformAmiga) {
- // TODO
- return;
+ src = _iconFilePtr;
+ src += READ_BE_UINT32(&((uint32 *)src)[icon]);
+ decompressIconPlanar(dst, src, 24, 10, color, _dxSurfacePitch);
} else {
src = _iconFilePtr;
src += READ_LE_UINT16(&((uint16 *)src)[icon]);
@@ -252,7 +272,7 @@
if (getFeatures() & GF_PLANAR) {
src = _iconFilePtr;
src += READ_BE_UINT32(&((uint32 *)src)[icon]);
- decompressIconPlanar(dst, src, 24, 24, color, _dxSurfacePitch);
+ decompressIconPlanar(dst, src, 24, 12, color, _dxSurfacePitch);
} else {
src = _iconFilePtr;
src += READ_LE_UINT16(&((uint16 *)src)[icon]);
@@ -275,11 +295,11 @@
if (getFeatures() & GF_PLANAR) {
src = _iconFilePtr;
src += READ_BE_UINT16(&((uint16 *)src)[icon]);
- decompressIconPlanar(dst, src, 24, 24, 16, _dxSurfacePitch);
+ decompressIconPlanar(dst, src, 24, 12, 16, _dxSurfacePitch);
} else {
src = _iconFilePtr;
src += icon * 288;
- decompressIconPlanar(dst, src, 24, 24, 16, _dxSurfacePitch, false);
+ decompressIconPlanar(dst, src, 24, 12, 16, _dxSurfacePitch, false);
}
_lockWord &= ~0x8000;
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