From c8bbb6140f05b14515f132481dbbe5af09bdd4aa Mon Sep 17 00:00:00 2001 From: Kari Salminen Date: Wed, 20 Jun 2007 23:56:08 +0000 Subject: Add AGI256-2 support (On top of already present AGI256 support). AGI256-2 means handling 256 color views/sprites (AGI256 means handling 256 color picture resources). The code can now handle both 16 color and 256 color views/sprites in the same game. FIXME: Background in AGI256-2 demo may be incorrect. svn-id: r27572 --- engines/agi/view.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'engines/agi/view.cpp') diff --git a/engines/agi/view.cpp b/engines/agi/view.cpp index f80e4b6447..48e3ca5e3f 100644 --- a/engines/agi/view.cpp +++ b/engines/agi/view.cpp @@ -151,6 +151,7 @@ int AgiEngine::decodeView(int n) { assert(v != NULL); + _game.views[n].agi256_2 = (READ_LE_UINT16(v) == 0xf00f); // Detect AGI256-2 views by their header bytes _game.views[n].descr = READ_LE_UINT16(v + 3) ? (char *)(v + READ_LE_UINT16(v + 3)) : (char *)(v + 3); /* if no loops exist, return! */ @@ -187,9 +188,18 @@ int AgiEngine::decodeView(int n) { vc->width = *(v + cofs); vc->height = *(v + cofs + 1); - vc->transparency = *(v + cofs + 2) & 0xf; - vc->mirrorLoop = (*(v + cofs + 2) >> 4) & 0x7; - vc->mirror = (*(v + cofs + 2) >> 7) & 0x1; + + if (!_game.views[n].agi256_2) { + vc->transparency = *(v + cofs + 2) & 0xf; + vc->mirrorLoop = (*(v + cofs + 2) >> 4) & 0x7; + vc->mirror = (*(v + cofs + 2) >> 7) & 0x1; + } else { + // Mirroring is disabled for AGI256-2 views because + // AGI256-2 uses whole 8 bits for the transparency variable. + vc->transparency = *(v + cofs + 2); + vc->mirrorLoop = 0; + vc->mirror = 0; + } /* skip over width/height/trans|mirror data */ cofs += 3; -- cgit v1.2.3