# HG changeset patch # User Matti Hamalainen # Date 1529696331 -10800 # Node ID e3d1f16be4ee4c3f63cbb8d4513e5d1b7831e6cf # Parent 88cef7758303777972ea3265c5a25b380c2fb31f Using the newly introduced data block offset feature, unify the handling of Fun Paint 2 and GunPaint formats somewhat. diff -r 88cef7758303 -r e3d1f16be4ee tools/lib64fmts.c --- a/tools/lib64fmts.c Fri Jun 22 22:31:52 2018 +0300 +++ b/tools/lib64fmts.c Fri Jun 22 22:38:51 2018 +0300 @@ -823,48 +823,12 @@ const int shift, const int bitmap, const int rasterX, const int rasterY) { const int vbank = (rasterY & 7) + (bitmap * 8); - int vr, vb; (void) rasterX; - if (rasterY < 100) - { - vb = 0; - vr = rasterY; - } - else - { - vb = 0; - vr = rasterY - 100; - } return dmC64GetGenericMCPixel( img, bmoffs, scroffs, shift, vbank, bitmap, 0, - img->extraData[vb].data[vr] & 15); -} - - -static Uint8 fmtGetPixelGunPaint( - const DMC64Image *img, const int bmoffs, const int scroffs, - const int shift, const int bitmap, const int rasterX, const int rasterY) -{ - const int vbank = (rasterY & 7) + (bitmap * 8); - int vr, vb; - (void) rasterX; - if (rasterY < 177) - { - vb = 0; - vr = rasterY; - } - else - { - vb = 0; - vr = rasterY - 177; - } - - return dmC64GetGenericMCPixel( - img, bmoffs, scroffs, shift, - vbank, bitmap, 0, - img->extraData[vb].data[vr] & 15); + img->extraData[0].data[rasterY] & 15); } @@ -1071,7 +1035,7 @@ { DO_COPY , DS_COLOR_RAM , 0x4000, 0, 0 , 0, NULL, NULL }, DEF_SCREEN_RAMS_8(0x43e8, 8, 0x400), { DO_COPY , DS_BITMAP_RAM , 0x63e8, 1, 0 , 0, NULL, NULL }, - { DO_COPY , DS_EXTRA_DATA , 0x8328, 1, 100, 0, NULL, NULL }, + { DO_COPY , DS_EXTRA_DATA , 0x8328, 0, 100, 100, NULL, NULL }, { DO_DEC_FUNC , 0 , 0x2742, 0, 1 , 0, fmtTruePaintGetLaceType, NULL }, { DO_LAST , 0 , 0 , 0, 0 , 0, NULL, NULL }, } @@ -1710,7 +1674,7 @@ C64_SCR_WIDTH, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, NULL, NULL, - fmtGetPixelGunPaint, + fmtGetPixelFunPaint2, // The format is essentially same as FP2 { DEF_SCREEN_RAMS_8(0x0000, 0, 0x400), { DO_COPY , DS_BITMAP_RAM , 0x2000, 0, 0 , 0, NULL, NULL }, @@ -1718,7 +1682,9 @@ { DO_COPY , DS_COLOR_RAM , 0x4000, 0, 0 , 0, NULL, NULL }, DEF_SCREEN_RAMS_8(0x4400, 8, 0x400), { DO_COPY , DS_BITMAP_RAM , 0x6400, 1, 0 , 0, NULL, NULL }, - { DO_COPY , DS_EXTRA_DATA , 0x47e8, 1, 20 , 0, NULL, NULL }, + // GunPaint does not store the last 3 d021 values .. so set them to black + // XXX TODO: According to some, the last 4 should be same .. + { DO_SET_MEM , DS_EXTRA_DATA , 0 , 0, 3 , 20+177, NULL, NULL }, { DO_DEC_FUNC , 0 , 0x2742, 0, 1 , 0, fmtTruePaintGetLaceType, NULL }, { DO_ENC_FUNC , 0 , fmtGunPaintMagicOffs, 0, fmtGunPaintMagicLen, 0, NULL, fmtEncodeGunPaint }, { DO_LAST , 0 , 0 , 0, 0 , 0, NULL, NULL },