Mercurial > hg > dmlib
diff tools/lib64fmts.c @ 1860:01d7feb9f9ce
Some work on Pentel Paint sprite layer support. Does not work very well yet.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 24 Jun 2018 05:46:12 +0300 |
parents | 5d9dd663df8d |
children | 752893fa6412 |
line wrap: on
line diff
--- a/tools/lib64fmts.c Sun Jun 24 05:35:23 2018 +0300 +++ b/tools/lib64fmts.c Sun Jun 24 05:46:12 2018 +0300 @@ -851,10 +851,18 @@ const DMC64Image *img, const int bmoffs, const int scroffs, const int shift, const int bitmap, const int rasterX, const int rasterY) { - Uint8 color = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, 0, bitmap, 0); - (void) rasterX; - (void) rasterY; - return color; + const int ry = rasterY / C64_SPR_HEIGHT_PX; + const int yd = rasterY % C64_SPR_HEIGHT_PX; + const int rx = rasterX / C64_SPR_WIDTH_PX; + const int xd = rasterX % C64_SPR_WIDTH_PX; + const int offs = (ry * 8 + rx) * C64_SPR_SIZE + (yd * C64_SPR_WIDTH_UT) + (xd / 8); + const int mask = 1 << (7 - (rasterX & 7)); + + Uint8 color1 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, 0, bitmap, 0); + Uint8 color2 = img->extraData[0].data[offs] & mask ? 0x0f : 0; + Uint8 color3 = img->extraData[0].data[offs + C64_SPR_SIZE * 155] & mask ? img->d022 : 0; + + return color3 ? color3 : ( color2 ? color2 : color1 ); } @@ -1688,7 +1696,7 @@ }, { - "pen", "Pentel Paint (unpacked)", 0x4800, 19845, DM_FMT_RD, + "pen", "Pentel Paint (unpacked)", 0x4800, 19845, DM_FMT_RD | DM_FMT_BROKEN, NULL, NULL, NULL, { @@ -1699,8 +1707,11 @@ fmtGetPixelPentelPaint, { { DO_COPY , DS_BITMAP_RAM , 0x0000, 0, 0, 0, NULL, NULL }, - { DO_SET_OP , DS_SCREEN_RAM , 0x23 , 0, 0, 0, NULL, NULL }, + { DO_SET_OP , DS_SCREEN_RAM , 0x10 , 0, 0, 0, NULL, NULL }, { DO_SET_MEM_LO , DS_BGCOL , 0x9580 - 0x4800, 0, 0, 0, NULL, NULL }, + { DO_SET_MEM_LO , DS_D022 , 0x9581 - 0x4800, 0, 0, 0, NULL, NULL }, // Sprite color + { DO_SET_MEM , DS_COLOR_RAM , 0x9582 - 0x4800, 0, 0, 0, NULL, NULL }, + { DO_COPY , DS_EXTRA_DATA , 0x5ac0 - 0x4800, 0, C64_SPR_SIZE * 235, 0, NULL, NULL }, // Sprite data { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL }, } },