changeset 1847:e3d1f16be4ee

Using the newly introduced data block offset feature, unify the handling of Fun Paint 2 and GunPaint formats somewhat.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 22 Jun 2018 22:38:51 +0300
parents 88cef7758303
children 273e274f9ed6
files tools/lib64fmts.c
diffstat 1 files changed, 6 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- 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 },