Ticket #7365: wip.diff

File wip.diff, 22.0 KB (added by Kirben, 17 years ago)

Convert images when drawing

  • engines/agos/agos.h

     
    479479        uint8 _currentPalette[1024];
    480480        uint8 _displayPalette[1024];
    481481
    482         byte _videoBuf1[32000];
     482        byte _videoBuf1[64000];
    483483        uint16 _videoWindows[128];
    484484
    485485        VgaTimerEntry _vgaTimerList[205];
     
    558558        void setUserItem(Item *item, int n, int m);
    559559
    560560        void paletteFadeOut(byte *palPtr, uint num, uint size);
    561        
     561
    562562        byte *allocateItem(uint size);
    563563        byte *allocateTable(uint size);
    564564        void alignTableMem();
     
    796796        void drawIconArray_Simon(uint i, Item *item_ptr, int line, int classMask);
    797797        void removeIconArray(uint num);
    798798
    799         void loadIconData();   
     799        void loadIconData();
    800800        void loadIconFile();
    801801        void loadMenuFile();
    802802
     
    11191119        void oe1_printPlayerHit();
    11201120        void oe1_printMonsterHit();
    11211121
    1122         int16 levelOf(Item *item); 
     1122        int16 levelOf(Item *item);
    11231123        int16 moreText(Item *i);
    11241124        void lobjFunc(Item *i, const char *f);
    11251125        uint confirmQuit();
     
    12781278
    12791279        void drawImages(VC10_state *state);
    12801280        void drawImages_Simon(VC10_state *state);
     1281        void drawImages_SimonAmiga(VC10_state *state);
    12811282        void drawImages_Feeble(VC10_state *state);
    12821283
    12831284        void scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY);
     
    13351336        byte *getBackGround();
    13361337        byte *getScaleBuf();
    13371338
    1338         void convertAmiga(byte *srcBuf, int32 fileSize);
     1339        byte *convertclip(const byte *src, bool is32Colors, uint height, uint width, byte flags);
     1340
    13391341        bool decrunchFile(byte *src, byte *dst, uint32 size);
    13401342        void loadVGABeardFile(uint id);
    13411343        void loadVGAVideoFile(uint id, uint type);
  • engines/agos/intern.h

     
    210210        GF_CRUNCHED_GAMEPC = 1 << 3,
    211211        GF_ZLIBCOMP        = 1 << 4,
    212212        GF_32COLOR         = 1 << 5,
    213         GF_DEMO            = 1 << 6
     213        GF_PLANAR          = 1 << 6,
     214        GF_DEMO            = 1 << 7
    214215};
    215216
    216217enum GameFileTypes {
  • engines/agos/vga.cpp

     
    541541}
    542542
    543543byte *AGOSEngine::vc10_flip(const byte *src, uint w, uint h) {
    544         w *= 8;
    545 
    546544        byte *dstPtr;
    547545        uint i;
    548546
    549         dstPtr = _videoBuf1 + w;
    550 
    551         do {
    552                 byte *dst = dstPtr;
    553                 for (i = 0; i != w; ++i) {
    554                         byte b = src[i];
    555                         b = (b >> 4) | (b << 4);
    556                         *--dst = b;
     547        if (getFeatures() & GF_32COLOR) {
     548                const uint flipw = w * 16;
     549                for (uint y = 0; y < h; ++y) {
     550                        dstPtr = _videoBuf1 + y * flipw;
     551                        for (i = 0; i < flipw; ++i) {
     552                                *--dstPtr = *src++;
     553                        }
    557554                }
     555        } else {
     556                w *= 8;
     557                dstPtr = _videoBuf1 + w;
    558558
    559                 src += w;
    560                 dstPtr += w;
    561         } while (--h);
     559                do {
     560                        byte *dst = dstPtr;
     561                        for (i = 0; i != w; ++i) {
     562                                byte b = src[i];
     563                                b = (b >> 4) | (b << 4);
     564                                *--dst = b;
     565                        }
    562566
     567                        src += w;
     568                        dstPtr += w;
     569                } while (--h);
     570        }
     571
    563572        return _videoBuf1;
    564573}
    565574
     
    620629        if (_dumpImages)
    621630                dumpSingleBitmap(_vgaCurZoneNum, state.image, state.depack_src, width, height,
    622631                                                                                         state.palette);
     632        if (getFeatures() & GF_PLANAR) {
     633                bool is32Colors = (getFeatures() & GF_32COLOR);
     634                if ((((_lockWord & 0x20) && !state.palette) || state.palette == 0xC0) &&
     635                getGameType() == GType_SIMON1) {
     636                        is32Colors = true;
     637                }
     638
     639                state.depack_src = convertclip(state.depack_src, is32Colors, height, width * 16, flags);
     640                flags &= ~0x80;
     641        }
     642
    623643        // Check if image is compressed
    624644        if (getGameType() == GType_FF || getGameType() == GType_PP) {
    625645                if (flags & 0x80) {
     
    654674                return;
    655675        }
    656676
     677        state.surf2_addr = getFrontBuf();
     678        state.surf2_pitch = _dxSurfacePitch;
     679
     680        state.surf_addr = getBackBuf();
     681        state.surf_pitch = _dxSurfacePitch;
     682
    657683        if (getGameType() != GType_FF && getGameType() != GType_PP) {
    658                 if (state.flags & kDFCompressedFlip) {
     684                if (state.flags & kDFCompressed && state.flags & kDFCompressedFlip) {
    659685                        state.depack_src = vc10_uncompressFlip(state.depack_src, width, height);
    660                 } else if (state.flags & kDFFlip) {
     686                } else if (state.flags & kDFCompressedFlip || state.flags & kDFFlip) {
    661687                        state.depack_src = vc10_flip(state.depack_src, width, height);
    662688                }
    663689        }
    664690
    665         state.surf2_addr = getFrontBuf();
    666         state.surf2_pitch = _dxSurfacePitch;
    667 
    668         state.surf_addr = getBackBuf();
    669         state.surf_pitch = _dxSurfacePitch;
    670 
    671691        if (getGameType() == GType_FF || getGameType() == GType_PP) {
    672692                drawImages_Feeble(&state);
     693        } else if (getFeatures() & GF_32COLOR) {
     694                drawImages_SimonAmiga(&state);
    673695        } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
    674                 drawImages_Simon(&state);
     696                if ((((_lockWord & 0x20) && state.palette == 0) || state.palette == 0xC0)) {
     697                        drawImages_SimonAmiga(&state);
     698                } else {
     699                        drawImages_Simon(&state);
     700                }
    675701        } else {
    676702                drawImages(&state);
    677703        }
     
    11071133
    11081134        if (num == 3) {
    11091135                memset(getBackBuf(), 0, _screenWidth * _screenHeight);
    1110         } else { 
     1136        } else {
    11111137                const uint16 *vlut = &_videoWindows[num * 4];
    11121138                byte *dst = getBackBuf() + vlut[0] * 16 + vlut[1] * _dxSurfacePitch;
    11131139
  • engines/agos/res.cpp

     
    718718                                error("loadVGAVideoFile: Read failed");
    719719
    720720                        dstSize = READ_BE_UINT32(srcBuffer + srcSize - 4);
    721                         if (type == 2) {
    722                                 dst = (byte *)malloc(dstSize);
    723                                 decrunchFile(srcBuffer, dst, srcSize);
    724                                 convertAmiga(dst, dstSize);
    725                                 free(dst);
    726                         } else {
    727                                 dst = allocBlock (dstSize + extraBuffer);
    728                                 decrunchFile(srcBuffer, dst, srcSize);
    729                         }
     721                        dst = allocBlock (dstSize + extraBuffer);
     722                        decrunchFile(srcBuffer, dst, srcSize);
    730723                        free(srcBuffer);
    731724                } else {
    732                         if (getGameId() == GID_SIMON1CD32 && type == 2) {
    733                                 dst = (byte *)malloc(dstSize);
    734                                 if (in.read(dst, dstSize) != dstSize)
    735                                         error("loadVGAVideoFile: Read failed");
    736                                 convertAmiga(dst, dstSize);
    737                                 free(dst);
    738                         } else {
    739                                 dst = allocBlock(dstSize + extraBuffer);
    740                                 if (in.read(dst, dstSize) != dstSize)
    741                                         error("loadVGAVideoFile: Read failed");
    742                         }
     725                        dst = allocBlock(dstSize + extraBuffer);
     726                        if (in.read(dst, dstSize) != dstSize)
     727                                error("loadVGAVideoFile: Read failed");
    743728                }
    744729                in.close();
    745730        } else {
  • engines/agos/res_ami.cpp

     
    2929
    3030namespace AGOS {
    3131
    32 byte *buffer;
    33 byte *bufptr;
    34 byte *bufferout;
    35 byte *bufptrout;
    36 uint32 bufoutend;
    37 byte *clipptr;
    38 byte *clipoutptr;
    39 int clipnumber;
    40 
    41 static void uncompressplane(byte *plane, byte *outptr, uint16 length) {
    42         debug(10, "uncompressplane: length %d", length);
    43 
    44         char x;
    45         byte y, z;
    46         while (length) {
    47                 x = *plane++;
     32static void uncompressplane(const byte *plane, byte *outptr, uint16 length) {
     33        debug(0, "uncompressplane: length %d", length);
     34        while (length != 0) {
     35                char x = *plane++;
    4836                if (x >= 0) {
    49                         x += 1;
    50                         y = *plane++;
    51                         z = *plane++;
    52                         while (x) {
     37                        x++;
     38                        byte y = *plane++;
     39                        byte z = *plane++;
     40                        while (x != 0) {
    5341                                *outptr++ = y;
    5442                                *outptr++ = z;
    55                                 length--;
    56                                 if (length == 0)
     43                                if (--length == 0)
    5744                                        break;
    5845                                x--;
    5946                        }
    6047                } else {
    61                         while (x) {
     48                        while (x != 0) {
    6249                                *outptr++ = *plane++;
    6350                                *outptr++ = *plane++;
    64                                 length--;
    65                                 if (length == 0)
     51                                if (--length == 0)
    6652                                        break;
    6753                                x++;
    6854                        }
     
    7056        }
    7157}
    7258
    73 static void convertcompressedclip(uint16 height, uint16 width) {
    74         debug(10, "convertcompressedclip: height %d width %d", height, width);
     59static void decodeBitPlaneData(uint16 *w, bool is32Colors, uint8 *&dst) {
     60        for (int j = 0; j < 8; j++) {
     61                byte color1 = 0;
     62                byte color2 = 0;
     63                for (int p = 0; p < 5; ++p) {
     64                        if (w[p] & 0x8000) {
     65                                color1 |= 1 << p;
     66                        }
     67                        if (w[p] & 0x4000) {
     68                                color2 |= 1 << p;
     69                        }
     70                        w[p] <<= 2;
     71                }
     72                if (is32Colors) {
     73                        *dst++ = color1;
     74                        *dst++ = color2;
     75                } else {
     76                        *dst++ = color1 * 16 + color2;
     77                }
     78        }
     79}
    7580
    76         byte *plane0;
    77         byte *plane1;
    78         byte *plane2;
    79         byte *plane3;
     81static void convertcompressedclip(const byte *src, byte *dst, bool is32Colors, uint16 height, uint16 width) {
     82        debug(0, "convertcompressedclip: height %d width %d", height, width);
     83
     84        const byte *plane0;
     85        const byte *plane1;
     86        const byte *plane2;
     87        const byte *plane3;
     88        const byte *plane4;
    8089        byte *uncbuffer;
    8190        byte *uncptr0;
    8291        byte *uncptr1;
    8392        byte *uncptr2;
    8493        byte *uncptr3;
     94        byte *uncptr4;
    8595        byte *uncbfrout;
    8696        byte *uncbfroutptr;
    87         uint16 length, i, j, k, word1, word2, word3, word4, cliplength;
    88         byte outbyte, outbyte1, x, y;
    89         char n;
    90         uncbuffer = (byte *)malloc(height * width * 4);
    91         uncbfrout = (byte *)malloc(height * width * 4);
    92        
     97        uint32 length, i, j;
     98        uint16 w[5];
     99        uncbuffer = (byte *)malloc(height * width * 5);
     100        uncbfrout = (byte *)malloc(height * width * 5);
     101
    93102        byte *free_uncbuffer = uncbuffer;
    94103        byte *free_uncbfrout = uncbfrout;
    95        
    96         length = width / 16;
    97         length *= height;
    98         plane0 = READ_BE_UINT16(clipptr) + READ_BE_UINT16(clipptr + 2) + clipptr; clipptr += 4; plane0 += 4;
    99         plane1 = READ_BE_UINT16(clipptr) + READ_BE_UINT16(clipptr + 2) + clipptr; clipptr += 4; plane1 += 4;
    100         plane2 = READ_BE_UINT16(clipptr) + READ_BE_UINT16(clipptr + 2) + clipptr; clipptr += 4; plane2 += 4;
    101         plane3 = READ_BE_UINT16(clipptr) + READ_BE_UINT16(clipptr + 2) + clipptr; clipptr += 4; plane3 += 4;
    102         plane0 -= 4;
    103         plane1 -= 8;
    104         plane2 -= 12;
    105         plane3 -= 16;
     104
     105        length = (width + 15) / 16 * height;
     106
     107        plane0 = src + READ_BE_UINT16(src + 0) + READ_BE_UINT16(src + 2);
     108        plane1 = src + READ_BE_UINT16(src + 4) + READ_BE_UINT16(src + 6);
     109        plane2 = src + READ_BE_UINT16(src + 8) + READ_BE_UINT16(src + 10);
     110        plane3 = src + READ_BE_UINT16(src + 12) + READ_BE_UINT16(src + 14);
     111        if (is32Colors) {
     112                plane4 = src + READ_BE_UINT16(src + 16) + READ_BE_UINT16(src + 18);
     113        }
     114
    106115        uncptr0 = uncbuffer;
    107116        uncptr1 = uncptr0+(length*2);
    108117        uncptr2 = uncptr1+(length*2);
    109118        uncptr3 = uncptr2+(length*2);
     119        if (is32Colors) {
     120                uncptr4 = uncptr3+(length*2);
     121        }
    110122        uncompressplane(plane0, uncptr0, length);
    111123        uncompressplane(plane1, uncptr1, length);
    112124        uncompressplane(plane2, uncptr2, length);
    113125        uncompressplane(plane3, uncptr3, length);
     126        if (is32Colors) {
     127                uncompressplane(plane4, uncptr4, length);
     128        }
    114129        uncbfroutptr = uncbfrout;
     130
    115131        for (i = 0; i < length; i++) {
    116                 word1=READ_BE_UINT16(uncptr0); uncptr0 += 2;
    117                 word2=READ_BE_UINT16(uncptr1); uncptr1 += 2;
    118                 word3=READ_BE_UINT16(uncptr2); uncptr2 += 2;
    119                 word4=READ_BE_UINT16(uncptr3); uncptr3 += 2;
    120                 for (j = 0; j < 8; j++) {
    121                         outbyte = ((word1 / 32768) + ((word2 / 32768) * 2) + ((word3 / 32768) * 4) + ((word4 / 32768) * 8));
    122                         word1 <<= 1;
    123                         word2 <<= 1;
    124                         word3 <<= 1;
    125                         word4 <<= 1;
    126                         outbyte1 = ((word1 / 32768) + ((word2 / 32768) * 2) + ((word3 / 32768) * 4) + ((word4 / 32768) * 8));
    127                         word1 <<= 1;
    128                         word2 <<= 1;
    129                         word3 <<= 1;
    130                         word4 <<= 1;
    131                         *uncbfroutptr++ = (outbyte * 16 + outbyte1);
     132                w[0] = READ_BE_UINT16(uncptr0); uncptr0 += 2;
     133                w[1] = READ_BE_UINT16(uncptr1); uncptr1 += 2;
     134                w[2] = READ_BE_UINT16(uncptr2); uncptr2 += 2;
     135                w[3] = READ_BE_UINT16(uncptr3); uncptr3 += 2;
     136                if (is32Colors) {
     137                        w[4] = READ_BE_UINT16(uncptr4); uncptr4 += 2;
     138                } else {
     139                        w[4] = 0;
    132140                }
     141                decodeBitPlaneData(w, is32Colors, uncbfroutptr);
    133142        }
    134         uncptr0 = uncbuffer;
    135         uncptr1 = uncbfrout;
    136         uncptr2 = uncbfrout;
    137         uncptr3 = uncbfrout;
    138         for (i = 0; i < (width / 16); i++) {
    139                 for (k = 0; k < 8; k++) {
    140                         for (j = 0; j < height; j++) {
    141                                 *uncptr0++ = *uncptr1;
    142                                 uncptr1 += 8;
     143        const uint8 *srcPtr = uncbfrout;
     144        if (is32Colors) {
     145                for (i = 0; i < width / 16; ++i) {
     146                        for (j = 0; j < height; ++j) {
     147                                memcpy(dst + width * j + 16 * i, srcPtr, 16);
     148                                srcPtr += 16;
    143149                        }
    144                         uncptr2++;
    145                         uncptr1 = uncptr2;
    146150                }
    147                 uncptr3 += (height * 8);
    148                 uncptr2 = uncptr3;
    149                 uncptr1 = uncptr2;
    150         }
    151         length *= 8;
    152         cliplength = 0;
    153         while(1) {
    154                 if (length == 1) {
    155                         *clipoutptr++ = 0xFF; bufoutend++;
    156                         *clipoutptr++ = *uncbuffer; bufoutend++;
    157                         cliplength += 2;
    158                         break;
    159                 }
    160                 x = *uncbuffer++;
    161                 y = *uncbuffer++;
    162                 length -= 2;
    163                 if (x == y) {
    164                         n = 1;
    165                         y = *uncbuffer++;
    166                         if (length == 0) {
    167                                 *clipoutptr++ = n; bufoutend++;
    168                                 *clipoutptr++ = x; bufoutend++;
    169                                 cliplength += 2;
    170                                 break;
     151        } else {
     152                for (i = 0; i < width / 16; ++i) {
     153                        for (j = 0; j < height; ++j) {
     154                                memcpy(dst + width / 2 * j + 8 * i, srcPtr, 8);
     155                                srcPtr += 8;
    171156                        }
    172                         length--;
    173                         while (x == y)  {
    174                                 n++;
    175                                 y = *uncbuffer++;
    176                                 if (length == 0)
    177                                         break;
    178                                 length--;
    179                                 if(n == 127)
    180                                         break;
    181                         }
    182                         *clipoutptr++ = n; bufoutend++;
    183                         *clipoutptr++ = x; bufoutend++;
    184                         cliplength += 2;
    185                         uncbuffer--;
    186                         if (length == 0)
    187                                 break;
    188                         length++;
    189                 } else {
    190                         n =- 1;
    191                         uncptr0 = clipoutptr;
    192                         clipoutptr++;
    193                         bufoutend++;
    194                         *clipoutptr++ = x; bufoutend++;
    195                         cliplength += 2;
    196                         x = y;
    197                         y = *uncbuffer++;
    198                         if (length == 0) {
    199                                 *uncptr0 = n;
    200                                 break;
    201                         }
    202                         length--;
    203                         while (x != y) {
    204                                 if (n == -127)
    205                                         break;
    206                                 n--;
    207                                 *clipoutptr++ = x; bufoutend++;
    208                                 cliplength++;
    209                                 x = y;
    210                                 y = *uncbuffer++;
    211                                 if (length == 0)
    212                                         break;
    213                                 length--;
    214                         }
    215                         *uncptr0 = n;
    216                         if (length == 0)
    217                                 break;
    218                         uncbuffer -= 2;
    219                         length += 2;
    220157                }
    221158        }
    222         if (cliplength > (height * width / 2))
    223                 warning("Negative compression. Clip %d. %d bytes bigger.",clipnumber,(cliplength-(height*width/2)));
    224159        free(free_uncbuffer);
    225160        free(free_uncbfrout);
    226161}
    227162
    228 static void convertclip(uint32 offset, uint16 height, uint16 width) {
    229         debug(10, "convertclip: height %d width %d", height, width);
     163byte *AGOSEngine::convertclip(const byte *src, bool is32Colors, uint height, uint width, byte flags) {
     164        debug(0, "convertclip: is32Colors %d height %d width %d", is32Colors, height, width);
    230165
    231         uint32 length, i, j;
    232         uint16 word1, word2, word3, word4;
    233         byte outbyte, outbyte1;
    234         clipptr = offset + buffer;
    235         clipoutptr = bufoutend + bufferout;
    236         WRITE_BE_UINT32(bufptrout, bufoutend); bufptrout += 4;
    237         WRITE_BE_UINT16(bufptrout, height); bufptrout += 2;
    238         WRITE_BE_UINT16(bufptrout, width); bufptrout += 2;
    239         if (height > 32000) {
    240                 convertcompressedclip((uint16)(height - 32768), width);
     166        uint32 length, i;
     167        byte *dst = _videoBuf1;
     168
     169        if (flags & 0x80) {
     170                convertcompressedclip(src, dst, is32Colors, height, width);
    241171        } else {
    242                 width /= 16;
    243                 length = height * width;
     172                length = (width + 15) / 16 * height;
    244173                for (i = 0; i < length; i++) {
    245                         word1 = READ_BE_UINT16(clipptr); clipptr += 2;
    246                         word2 = READ_BE_UINT16(clipptr); clipptr += 2;
    247                         word3 = READ_BE_UINT16(clipptr); clipptr += 2;
    248                         word4 = READ_BE_UINT16(clipptr); clipptr += 2;
    249                         for (j = 0; j < 8; j++) {
    250                                 outbyte = ((word1 / 32768) + ((word2 / 32768) * 2) + ((word3 / 32768) * 4) + ((word4 / 32768) * 8));
    251                                 word1 <<= 1;
    252                                 word2 <<= 1;
    253                                 word3 <<= 1;
    254                                 word4 <<= 1;
    255                                 outbyte1 = ((word1 / 32768) + ((word2 / 32768) * 2) + ((word3 / 32768) * 4) + ((word4 / 32768) * 8));
    256                                 word1 <<= 1;
    257                                 word2 <<= 1;
    258                                 word3 <<= 1;
    259                                 word4 <<= 1;
    260                                 *clipoutptr++ = (outbyte * 16 + outbyte1); bufoutend++;
     174                        uint16 w[5];
     175                        w[0] = READ_BE_UINT16(src); src += 2;
     176                        w[1] = READ_BE_UINT16(src); src += 2;
     177                        w[2] = READ_BE_UINT16(src); src += 2;
     178                        w[3] = READ_BE_UINT16(src); src += 2;
     179                        if (is32Colors) {
     180                                w[4] = READ_BE_UINT16(src); src += 2;
     181                        } else {
     182                                w[4] = 0;
    261183                        }
     184                        decodeBitPlaneData(w, is32Colors, dst);
    262185                }
    263186        }
    264 }
    265187
    266 void AGOSEngine::convertAmiga(byte *srcBuf, int32 fileSize) {
    267         // TODO Better detection of full screen images
    268         if ((getGameType() == GType_WW && fileSize == 178624) ||
    269                 fileSize == 64800) {
    270                 byte *dstBuf = allocBlock (fileSize);
    271                 memcpy(dstBuf, srcBuf, fileSize);
    272                 return;
    273         }
    274 
    275         uint32 clipoffset, outlength;
    276         uint16 clipwidth, clipheight;
    277         byte *clipsend;
    278 
    279         debug(10, "convertAmiga: fizeSize %d", fileSize);
    280 
    281         buffer = (byte *)malloc((int32)fileSize);
    282         memcpy(buffer, srcBuf, fileSize);
    283         bufptr = buffer;
    284 
    285         bufferout = (byte *)malloc((int32)(fileSize * 2));
    286         bufptr = buffer;
    287         bufptrout = bufferout;
    288         clipnumber = 0;
    289         while(1) {
    290                 clipoffset = READ_BE_UINT32(bufptr); bufptr += 4;
    291                 clipheight = READ_BE_UINT16(bufptr); bufptr += 2;
    292                 clipwidth = READ_BE_UINT16(bufptr); bufptr += 2;
    293                 if (clipoffset != 0)
    294                         break;
    295                 WRITE_BE_UINT32(bufptrout, 0); bufptrout += 4;
    296                 WRITE_BE_UINT32(bufptrout, 0); bufptrout += 4;
    297                 clipnumber++;
    298         }
    299 
    300         clipsend = buffer + clipoffset;
    301         bufoutend = clipoffset;
    302         while (bufptr <= clipsend) {
    303                 if (clipoffset != 0) {
    304                         convertclip(clipoffset, clipheight, clipwidth);
    305                 } else {
    306                         WRITE_BE_UINT32(bufptrout, 0); bufptrout += 4;
    307                         WRITE_BE_UINT32(bufptrout, 0); bufptrout += 4;
    308                 }
    309                 clipoffset = READ_BE_UINT32(bufptr); bufptr += 4;
    310                 clipheight = READ_BE_UINT16(bufptr); bufptr += 2;
    311                 clipwidth = READ_BE_UINT16(bufptr); bufptr += 2;
    312                 clipnumber++;
    313         }
    314         outlength = bufoutend;
    315         debug(10, "convertAmiga: outlength %d",outlength);
    316 
    317         byte *dstBuf = allocBlock (outlength);
    318         memcpy(dstBuf, bufferout, outlength);
    319         free(buffer);
    320         free(bufferout);
     188        printf("Decode complete\n");
     189        return _videoBuf1;
    321190}
    322191
    323192} // End of namespace AGOS
  • engines/agos/agosgame.cpp

     
    1616
    1717                GType_ELVIRA1,
    1818                GID_ELVIRA1,
    19                 GF_OLD_BUNDLE | GF_CRUNCHED
     19                GF_OLD_BUNDLE | GF_CRUNCHED | GF_PLANAR
    2020        },
    2121
    2222        // Elvira 1 - English Amiga Demo
     
    3737
    3838                GType_ELVIRA1,
    3939                GID_ELVIRA1,
    40                 GF_OLD_BUNDLE | GF_CRUNCHED | GF_DEMO
     40                GF_OLD_BUNDLE | GF_CRUNCHED | GF_PLANAR | GF_DEMO
    4141        },
    4242
    4343        // Elvira 1 - English Atari ST Floppy
     
    5959
    6060                GType_ELVIRA1,
    6161                GID_ELVIRA1,
    62                 GF_OLD_BUNDLE | GF_CRUNCHED
     62                GF_OLD_BUNDLE | GF_CRUNCHED | GF_PLANAR
    6363        },
    6464
    6565        // Elvira 1 - French Atari ST Floppy
     
    8181
    8282                GType_ELVIRA1,
    8383                GID_ELVIRA1,
    84                 GF_OLD_BUNDLE | GF_CRUNCHED
     84                GF_OLD_BUNDLE | GF_CRUNCHED | GF_PLANAR
    8585        },
    8686
    8787        // Elvira 1 - English DOS Floppy
     
    171171
    172172                GType_ELVIRA2,
    173173                GID_ELVIRA2,
    174                 GF_OLD_BUNDLE | GF_CRUNCHED
     174                GF_OLD_BUNDLE | GF_CRUNCHED | GF_PLANAR
    175175        },
    176176
    177177        // Elvira 2 - English Atari ST Floppy
     
    195195
    196196                GType_ELVIRA2,
    197197                GID_ELVIRA2,
    198                 GF_OLD_BUNDLE | GF_CRUNCHED
     198                GF_OLD_BUNDLE | GF_CRUNCHED | GF_PLANAR
    199199        },
    200200
    201201        // Elvira 2 - French Atari ST Floppy
     
    219219
    220220                GType_ELVIRA2,
    221221                GID_ELVIRA2,
    222                 GF_OLD_BUNDLE | GF_CRUNCHED
     222                GF_OLD_BUNDLE | GF_CRUNCHED | GF_PLANAR
    223223        },
    224224
    225225
     
    365365
    366366                GType_WW,
    367367                GID_WAXWORKS,
    368                 GF_OLD_BUNDLE | GF_CRUNCHED | GF_CRUNCHED_GAMEPC
     368                GF_OLD_BUNDLE | GF_CRUNCHED | GF_CRUNCHED_GAMEPC | GF_PLANAR
    369369        },
    370370
    371371        // Waxworks - English DOS Floppy
     
    459459
    460460                GType_SIMON1,
    461461                GID_SIMON1AMIGA,
    462                 GF_32COLOR | GF_CRUNCHED | GF_OLD_BUNDLE
     462                GF_32COLOR | GF_CRUNCHED | GF_OLD_BUNDLE | GF_PLANAR
    463463        },
    464464
    465465        // Simon the Sorcerer 1 - English Amiga ECS Demo
     
    481481
    482482                GType_SIMON1,
    483483                GID_SIMON1AMIGA,
    484                 GF_32COLOR | GF_CRUNCHED | GF_CRUNCHED_GAMEPC | GF_OLD_BUNDLE | GF_DEMO
     484                GF_32COLOR | GF_CRUNCHED | GF_CRUNCHED_GAMEPC | GF_OLD_BUNDLE | GF_PLANAR | GF_DEMO
    485485        },
    486486
    487487        // Simon the Sorcerer 1 - English Amiga AGA Floppy
     
    503503
    504504                GType_SIMON1,
    505505                GID_SIMON1AMIGA,
    506                 GF_CRUNCHED | GF_OLD_BUNDLE
     506                GF_CRUNCHED | GF_OLD_BUNDLE | GF_PLANAR
    507507        },
    508508
    509509        // Simon the Sorcerer 1 - French Amiga AGA Floppy
     
    525525
    526526                GType_SIMON1,
    527527                GID_SIMON1AMIGA,
    528                 GF_CRUNCHED | GF_OLD_BUNDLE
     528                GF_CRUNCHED | GF_OLD_BUNDLE | GF_PLANAR
    529529        },
    530530
    531531        // Simon the Sorcerer 1 - German Amiga AGA Floppy
     
    547547
    548548                GType_SIMON1,
    549549                GID_SIMON1AMIGA,
    550                 GF_CRUNCHED | GF_OLD_BUNDLE
     550                GF_CRUNCHED | GF_OLD_BUNDLE | GF_PLANAR
    551551        },
    552552
    553553        // Simon the Sorcerer 1 - English Amiga CD32
     
    569569
    570570                GType_SIMON1,
    571571                GID_SIMON1CD32,
    572                 GF_TALKIE | GF_OLD_BUNDLE
     572                GF_TALKIE | GF_OLD_BUNDLE | GF_PLANAR
    573573        },
    574574
    575575        // Simon the Sorcerer 1 - English Amiga CD32 alternative?
     
    591591
    592592                GType_SIMON1,
    593593                GID_SIMON1CD32,
    594                 GF_TALKIE | GF_OLD_BUNDLE
     594                GF_TALKIE | GF_OLD_BUNDLE | GF_PLANAR
    595595        },
    596596
    597597        // Simon the Sorcerer 1 - English DOS Floppy Demo
  • engines/agos/gfx.cpp

     
    175175
    176176        if (getGameType() != GType_FF && getGameType() != GType_PP) {
    177177                state->draw_width = state->width * 2;
    178         } 
     178        }
    179179
    180180        cur = state->x;
    181181        if (cur < 0) {
     
    384384                        dst += _screenWidth;
    385385                        src += state->width;
    386386                } while (--state->draw_height);
    387         } 
     387        }
    388388}
    389389
    390390void AGOSEngine::drawImages_Simon(VC10_state *state) {
     
    408408        state->surf_addr += xoffs + yoffs * state->surf2_pitch;
    409409
    410410        if (state->flags & kDFMasked) {
     411                return;
     412
    411413                byte *mask, *src, *dst;
    412414                byte h;
    413415                uint w;
     
    529531                }
    530532
    531533                if (state->flags & kDFCompressed) {
     534
     535                        return;
     536
    532537                        uint w, h;
    533538                        byte *src, *dst, *dstPtr;
    534539
     
    589594        }
    590595}
    591596
     597void AGOSEngine::drawImages_SimonAmiga(VC10_state *state) {
     598        uint8 *dst;
     599        const byte *src;
     600        const uint16 *vlut = &_videoWindows[_windowNum * 4];
     601
     602        if (drawImages_clip(state) == 0)
     603                return;
     604
     605        uint xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
     606        uint yoffs = (vlut[1] - _videoWindows[17] + state->y);
     607
     608        state->surf2_addr += xoffs + yoffs * state->surf_pitch;
     609        state->surf_addr += xoffs + yoffs * state->surf2_pitch;
     610
     611        if (state->flags & kDFMasked) {
     612                warning("Unhandled kDFMasked");
     613        } else {
     614                src = state->depack_src + (state->width * state->y_skip * 16) + (state->x_skip * 8);
     615                dst = state->surf_addr;
     616
     617                state->draw_width *= 2;
     618
     619                uint h = state->draw_height;
     620                do {
     621                        for (uint i = 0; i != state->draw_width; i++)
     622                                if ((state->flags & kDFNonTrans) || src[i])
     623                                        dst[i] = src[i] | state->palette;
     624                        dst += _screenWidth;
     625                        src += state->width * 16;
     626                } while (--h);
     627        }
     628}
     629
    592630void AGOSEngine::drawImages(VC10_state *state) {
    593631        const uint16 *vlut = &_videoWindows[_windowNum * 4];
    594632