comparison 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
comparison
equal deleted inserted replaced
1859:f382cde6bb58 1860:01d7feb9f9ce
849 849
850 static Uint8 fmtGetPixelPentelPaint( 850 static Uint8 fmtGetPixelPentelPaint(
851 const DMC64Image *img, const int bmoffs, const int scroffs, 851 const DMC64Image *img, const int bmoffs, const int scroffs,
852 const int shift, const int bitmap, const int rasterX, const int rasterY) 852 const int shift, const int bitmap, const int rasterX, const int rasterY)
853 { 853 {
854 Uint8 color = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, 0, bitmap, 0); 854 const int ry = rasterY / C64_SPR_HEIGHT_PX;
855 (void) rasterX; 855 const int yd = rasterY % C64_SPR_HEIGHT_PX;
856 (void) rasterY; 856 const int rx = rasterX / C64_SPR_WIDTH_PX;
857 return color; 857 const int xd = rasterX % C64_SPR_WIDTH_PX;
858 const int offs = (ry * 8 + rx) * C64_SPR_SIZE + (yd * C64_SPR_WIDTH_UT) + (xd / 8);
859 const int mask = 1 << (7 - (rasterX & 7));
860
861 Uint8 color1 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, 0, bitmap, 0);
862 Uint8 color2 = img->extraData[0].data[offs] & mask ? 0x0f : 0;
863 Uint8 color3 = img->extraData[0].data[offs + C64_SPR_SIZE * 155] & mask ? img->d022 : 0;
864
865 return color3 ? color3 : ( color2 ? color2 : color1 );
858 } 866 }
859 867
860 868
861 static Uint8 fmtGetPixelCrestHIFLIorCDHM( 869 static Uint8 fmtGetPixelCrestHIFLIorCDHM(
862 const DMC64Image *img, const int bmoffs, const int scroffs, 870 const DMC64Image *img, const int bmoffs, const int scroffs,
1686 }, 1694 },
1687 NULL 1695 NULL
1688 }, 1696 },
1689 1697
1690 { 1698 {
1691 "pen", "Pentel Paint (unpacked)", 0x4800, 19845, DM_FMT_RD, 1699 "pen", "Pentel Paint (unpacked)", 0x4800, 19845, DM_FMT_RD | DM_FMT_BROKEN,
1692 NULL, 1700 NULL,
1693 NULL, NULL, 1701 NULL, NULL,
1694 { 1702 {
1695 D64_FMT_HIRES | D64_FMT_FLI, 1703 D64_FMT_HIRES | D64_FMT_FLI,
1696 192, C64_SCR_HEIGHT, 1704 192, C64_SCR_HEIGHT,
1697 24, C64_SCR_CH_HEIGHT, 1705 24, C64_SCR_CH_HEIGHT,
1698 NULL, NULL, 1706 NULL, NULL,
1699 fmtGetPixelPentelPaint, 1707 fmtGetPixelPentelPaint,
1700 { 1708 {
1701 { DO_COPY , DS_BITMAP_RAM , 0x0000, 0, 0, 0, NULL, NULL }, 1709 { DO_COPY , DS_BITMAP_RAM , 0x0000, 0, 0, 0, NULL, NULL },
1702 { DO_SET_OP , DS_SCREEN_RAM , 0x23 , 0, 0, 0, NULL, NULL }, 1710 { DO_SET_OP , DS_SCREEN_RAM , 0x10 , 0, 0, 0, NULL, NULL },
1703 { DO_SET_MEM_LO , DS_BGCOL , 0x9580 - 0x4800, 0, 0, 0, NULL, NULL }, 1711 { DO_SET_MEM_LO , DS_BGCOL , 0x9580 - 0x4800, 0, 0, 0, NULL, NULL },
1712 { DO_SET_MEM_LO , DS_D022 , 0x9581 - 0x4800, 0, 0, 0, NULL, NULL }, // Sprite color
1713 { DO_SET_MEM , DS_COLOR_RAM , 0x9582 - 0x4800, 0, 0, 0, NULL, NULL },
1714 { DO_COPY , DS_EXTRA_DATA , 0x5ac0 - 0x4800, 0, C64_SPR_SIZE * 235, 0, NULL, NULL }, // Sprite data
1704 { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL }, 1715 { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL },
1705 } 1716 }
1706 }, 1717 },
1707 NULL 1718 NULL
1708 }, 1719 },